home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / SUPPORT / TUTORIAL.LSP < prev    next >
Encoding:
Lisp/Scheme  |  1995-02-08  |  24.9 KB  |  1,040 lines

  1. ; Next available MSG number is    97
  2. ; MODULE_ID TUTORIAL_LSP_
  3. ;;;----------------------------------------------------------------------------
  4. ;;;   tutorial.lsp - LISP utilities for Learning AutoCAD Tutorials
  5. ;;;
  6. ;;;   (C) Copyright 1991-1994 by Autodesk, Inc.
  7. ;;;      
  8. ;;;   Permission to use, copy, modify, and distribute this software 
  9. ;;;   for any purpose and without fee is hereby granted, provided 
  10. ;;;   that the above copyright notice appears in all copies and that 
  11. ;;;   both that copyright notice and this permission notice appear in 
  12. ;;;   all supporting documentation.
  13. ;;;      
  14. ;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
  15. ;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
  16. ;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
  17. ;;;
  18. ;;;=========================================================================
  19.  
  20.  
  21. ;;;------------------------------------------------------------------------
  22.  
  23. (if (not tut_spd)(setq tut_spd 100))
  24.  
  25. (defun c:tutdemo ( / xxx )
  26.   (ac:erron 
  27.     (list 
  28.       ;|Msg0|;"coords" "snapmode" "blipmode" "limcheck" "globcheck"
  29.       ;|Msg0|;"cmdecho" "orthomode" "lunits" "pickbox"
  30.       ;|Msg0|;"dimasz" "dimexe" "dimexo" "dimtxt" "dimtfac"
  31.     )
  32.   )
  33.   (setvar ;|Msg0|;"globcheck" 0)
  34.   (setvar ;|Msg0|;"cmdecho" 0)
  35.   (initget ;|Msg0|;"01 02 03 04 05 06 07 08 09 10")
  36.   (setq xxx (getkword "\nEjecutar ejercicio: "))
  37.   (if (and xxx (tutundo 1))
  38.     (progn
  39.       (setq chk nil)
  40.       (setq nnn (strlen (getvar ;|Msg0|;"dwgprefix")))
  41.       (setq nam (strcase (substr (getvar ;|Msg0|;"dwgname") (1+ nnn))))
  42.       (if (tblsearch ;|Msg0|;"block" (strcat ;|Msg0|;"tut" xxx ;|Msg0|;"_do_not_delete_this_block"))
  43.         (if (= nam (strcat ;|Msg0|;"EX" xxx))
  44.           (alert "Para utilizar Demo debe guardar\nel dibujo con otro nombre.")
  45.           (progn
  46.             (repeat 3 (princ (nth 0 tut_strs)) )
  47.             (eval (read (strcat ;|Msg0|;"(tut" xxx ;|Msg0|;")" )))
  48.             (alert
  49.               (strcat
  50.                 "Demostraci≤n finalizada. \n \n"
  51.                 "Utilice el bot≤n Borrar para retroceder al "
  52.                 "estado original del dibujo. Cualquier cambio "
  53.                 "efectuado en el dibujo, desde ahora hasta el "
  54.                 "momento en que se pulse Borrar, se perderß."
  55.               )
  56.             )
  57.           )
  58.         )
  59.         (progn
  60.           (tutundo 0)
  61.           (alert
  62.             (strcat 
  63.               "Debe abrir el dibujo tutorial\n" 
  64.               ;|Msg0|;"EX" xxx 
  65.               " y guardarlo con otro nombre para\npoder utilizar Demo."
  66.             )
  67.           )
  68.         )
  69.       )
  70.     )
  71.     (alert 
  72.       (strcat 
  73.         "Debe pulsar el bot≤n Borrar\n"
  74.         "antes de ejecutar de nuevo\n"
  75.         "la demostraci≤n."
  76.       )
  77.     )
  78.   )
  79.   (ac:erroff)
  80.   (princ)
  81. )
  82.  
  83.  
  84. (defun c:tutclear ( / )
  85.   (if (tutundo 0)
  86.     (repeat 3 (princ (nth 0 tut_strs)) )
  87.     (alert "\nNo hay nada que borrar.")
  88.   )
  89.   (princ)
  90. )
  91.  
  92. (defun c:tutspd ( / xxx )
  93.   (setq xxx tut_spd)
  94.   (setq xxx (getint (strcat "\nRapidez: (a menor valor mayor rapidez)" (itoa xxx) ">: ")))
  95.   (if xxx (setq tut_spd xxx))
  96.   (princ)
  97. )
  98.  
  99. ;;;=== Keywords =============================================================
  100. ;;;
  101. ;;; First string in list is the internal keyword, the second string is the
  102. ;;; one that is displayed and passed to AutoCAD as the keyword.
  103.  
  104. (setq tut_kwds
  105.   (list
  106.     '(;|Msg0|;"tan" "tan")
  107.     '(;|Msg0|;"mid" "med")
  108.     '(;|Msg0|;"cen" "cen")
  109.     '(;|Msg0|;"per" "per")
  110.     '(;|Msg0|;"endp" "fin")
  111.     '(;|Msg0|;"int" "int")
  112.     '(;|Msg0|;"from" "desde")
  113.     '(;|Msg0|;"nea" "cer")
  114.     '(;|Msg0|;"all" "todo")         ; ZOOM
  115.     '(;|Msg0|;"attach" "e")        ; XREF Attach
  116.     '(;|Msg0|;"ca" "ct")           ; -MLEDIT CA (CutAll)
  117.     '(;|Msg0|;"crossing" "c")      ; STRETCH
  118.     '(;|Msg0|;"center" "c")          ; ARC Center
  119.     '(;|Msg0|;"close" "ce")        ; MLINE, PLINE Close
  120.     '(;|Msg0|;"color" "o")       ; LAYER Color
  121.     '(;|Msg0|;"distances" "d")     ; CHAMFER Distance
  122.     '(;|Msg0|;"freeze" "i")        ; VPLAYER Freeze
  123.     '(;|Msg0|;"vfreeze" "i")       ; VPLAYER, VPVISDFLT, pattern Freeze
  124.     '(;|Msg0|;"lfreeze" "i")       ; LAYER Freeze
  125.     '(;|Msg0|;"height" "a")        ; -MTEXT Height
  126.     '(;|Msg0|;"inscribed" "i")     ; POLYGON Inscribed
  127.     '(;|Msg0|;"invisible" "i")   ; ATTDEF Invisible
  128.     '(;|Msg0|;"last" "U")          ; MIRROR, ARRAY (Last selection)
  129.     '(;|Msg0|;"layer" "c")        ; CHPROP LAyer
  130.     '(;|Msg0|;"new" "crear")         ; LAYER New
  131.     '(;|Msg0|;"off" "des")         ; SNAP Off
  132.     '(;|Msg0|;"on" "act")           ; SNAP, ORTHO On
  133.     '(;|Msg0|;"previous" "p")      ; ZOOM Previous
  134.     '(;|Msg0|;"properties" "prop") ; -BHATCH Properties
  135.     '(;|Msg0|;"polar" "polar")     ; ARRAY Polar
  136.     '(;|Msg0|;"radius" "ra")        ; FILLET Radius
  137.     '(;|Msg0|;"set" "def")         ; LAYER Set
  138.     '(;|Msg0|;"scale" "escala")     ; MLINE Scale
  139.     '(;|Msg0|;"window" "v")        ; BLOCK, MIRROR, ZOOM (Window selection)
  140.     '(;|Msg0|;"vpvisdflt" "v")     ; VPLAYER Vpvisdflt
  141.   )
  142. )
  143.  
  144. ;;;=== Misc. strings ========================================================
  145.  
  146. (setq tut_strs
  147.   (list
  148.     "\nComando: "                      ; 0
  149.     "\nPrimera esquina: "                 ; 1
  150.     "\nEsquina opuesta: "                 ; 2
  151.     "RECTANG"                          ; 3
  152.     "No hay demo para el ejercicio"   ; 4
  153.   )
  154. )
  155.  
  156. ;;;=== Exercises ============================================================
  157. ;;;
  158. ;;;
  159. ;;;--- EXERCISE 01 -----------------------------------------------------------
  160.  
  161. (defun tut01 ()
  162.   (setvar "blipmode" 1)
  163.   (setvar "limcheck" 0)
  164.   (command "_zoom" "_w" "0,0" "12,9")
  165.   (slo_cmd "circle")
  166.   (slo_typ "3,4")
  167.   (slo_typ "2")
  168.   (slo_cmd "circle")
  169.   (slo_typ "7.5,4")
  170.   (slo_typ "1.2")
  171.   (slo_cmd "offset")
  172.   (slo_typ "1")
  173.   (slo_pik '(5 4))
  174.   (slo_xxx '(4.5 4))
  175.   (slo_typ "")
  176.   (slo_cmd "offset")
  177.   (slo_typ "0.6")
  178.   (slo_pik '(6.3 4))
  179.   (slo_xxx '(7 4))
  180.   (slo_typ "")
  181.   (slo_cmd "line")
  182.   (slo_kwd "tan")
  183.   (slo_xxx '(3 2))
  184.   (slo_kwd "tan")
  185.   (slo_xxx '(7.5 2.8))
  186.   (slo_typ "")
  187.   (slo_cmd "mirror")
  188.   (slo_kwd "last")
  189.   (slo_typ "")
  190.   (slo_kwd "cen")
  191.   (slo_xxx '(3 6))
  192.   (slo_kwd "cen")
  193.   (slo_xxx '(7.5 5.2))
  194.   (slo_typ "")
  195.   (slo_cmd "trim")
  196.   (slo_pik '(5.7989 2.4773))
  197.   (slo_pik '(5.5756 5.5671))
  198.   (slo_typ "")
  199.   (slo_xxx '(6.3 4))
  200.   (slo_typ "")
  201. ;  (slo_cmd "redraw")
  202. )
  203.  
  204. ;;;--- EXERCISE 02 ----------------------------------------
  205.  
  206. (defun tut02 ()
  207.   (setvar "blipmode" 1)
  208.   (setvar "lunits" 4)
  209.   (setvar "pickbox" 4)
  210.   (command "_zoom" "_w" "0,0" "12',15'")
  211.   (slo_cmd "layer")
  212.   (slo_kwd "new")
  213.   (slo_typ "TABIQUES") 
  214.   (slo_kwd "color")
  215.   (slo_typ "5")
  216.   (slo_typ "")
  217.   (slo_typ "")
  218.   (slo_cmd "mline")
  219.   (slo_kwd "scale")
  220.   (slo_typ "6")
  221.   (slo_typ "36,12")
  222.   (slo_typ "@96,0")
  223.   (slo_typ "@0,132")
  224.   (slo_typ "@-120,0")
  225.   (slo_typ "@0,-96")
  226.   (slo_kwd "close")
  227.   (slo_cmd "line")
  228.   (slo_kwd "from")
  229.   (slo_kwd "endp")
  230.   (slo_xxx '(132 12))
  231.   (slo_typ "@-6,0")
  232.   (slo_typ "@0,36")
  233.   (slo_typ "")
  234.   (slo_cmd "arc")
  235.   (slo_kwd "center")
  236.   (slo_kwd "endp")
  237.   (slo_xxx '(126 12))
  238.   (slo_kwd "endp")
  239.   (slo_xxx '(126 48))
  240.   (slo_kwd "nea")
  241.   (slo_xxx '(90 12))
  242.   (slo_cmd "-mledit")
  243.   (slo_kwd "ca")
  244.   (slo_kwd "endp")
  245.   (slo_xxx '(90 12))
  246.   (slo_kwd "endp")
  247.   (slo_xxx '(126 12))
  248.   (slo_typ "")
  249.   (slo_cmd "line")
  250.   (slo_kwd "endp")
  251.   (slo_xxx '(90 12))
  252.   (slo_kwd "endp")
  253.   (slo_xxx '(90 6))
  254.   (slo_typ "")
  255.   (slo_cmd "line")
  256.   (slo_kwd "endp")
  257.   (slo_xxx '(126 12))
  258.   (slo_kwd "endp")
  259.   (slo_xxx '(126.5 6))
  260.   (slo_typ "") 
  261. ;  (slo_cmd "redraw")  
  262. )
  263.  
  264.  
  265. ;;;--- EXERCISE 03 -----------------------------------------------------------
  266.  
  267. (defun tut03 ()
  268.   (setvar "blipmode" 1)
  269.   (setvar "limcheck" 0)
  270.   (command "_zoom" "_w" "0,0" "7,5")
  271.   (command "_layer" "_s" "0" "")
  272.   (slo_cmd "line")
  273.   (slo_typ "3,4")
  274.   (slo_typ "@0,-3")
  275.   (slo_typ "@-0.75,0")
  276.   (slo_typ "@0,0.75")
  277.   (slo_typ "@-0.75,0")
  278.   (slo_typ "@0,1.5")
  279.   (slo_typ "")
  280.   (slo_cmd "layer")
  281.   (slo_kwd "set")
  282.   (slo_typ "CENTRO")
  283.   (slo_typ "")
  284.   (slo_cmd "line")
  285.   (slo_kwd "mid")
  286.   (slo_xxx '(1.5 2.6))
  287.   (slo_kwd "per")
  288.   (slo_xxx '(3 2.6))
  289.   (slo_typ "")
  290.   (slo_cmd "line")
  291.   (slo_kwd "mid")
  292.   (slo_xxx '(2.26 1.5))
  293.   (slo_kwd "per")
  294.   (slo_xxx '(3 1.5))
  295.   (slo_typ "")
  296.   (slo_cmd "offset")
  297.   (slo_typ "0.125")
  298.   (slo_xxx '(2.64 1.37))
  299.   (slo_xxx '(2.64 1.2))
  300.   (slo_xxx '(2.64 1.37))
  301.   (slo_xxx '(2.64 1.5))
  302.   (slo_typ "")
  303.   (slo_cmd "offset")
  304.   (slo_typ "0.37")
  305.   (slo_xxx '(2.27 2.5))
  306.   (slo_xxx '(2.27 2.3))
  307.   (slo_typ "")
  308.   (slo_cmd "chprop")
  309.   (slo_pik '(2.63 1.25))
  310.   (slo_pik '(2.63 1.5))
  311.   (slo_pik '(2.27 2.13))
  312.   (slo_typ "")
  313.   (slo_kwd "layer")
  314.   (slo_typ "CONTORNO")
  315.   (slo_typ "")
  316.   (slo_cmd "offset")
  317.   (slo_typ "0.33")
  318.   (slo_xxx '(3 2.32))
  319.   (slo_xxx '(3.2 2.32))
  320.   (slo_xxx '(1.5 2.3))
  321.   (slo_xxx '(1.4 2.3))
  322.   (slo_xxx '(2.26 1.6))
  323.   (slo_xxx '(2.1 1.6))
  324.   (slo_typ "")
  325.   (slo_cmd "extend")
  326.   (slo_pik '(3.33 2.45))
  327.   (slo_pik '(1.17 2.45))
  328.   (slo_pik '(1.92 1.38))
  329.   (slo_typ "")
  330.   (slo_xxx '(1.69 2.5))
  331.   (slo_xxx '(2.86 2.5))
  332.   (slo_xxx '(2.39 1.37))
  333.   (slo_xxx '(2.88 1.37))
  334.   (slo_typ "")
  335.   (slo_cmd "erase")
  336.   (slo_pik '(3.33 2.9))
  337.   (slo_pik '(1.17 2.9))
  338.   (slo_pik '(1.92 1.5)) 
  339.   (slo_typ "")
  340.   (slo_cmd "ortho")
  341.   (slo_kwd "on")
  342.   (slo_cmd "mirror")
  343.   (slo_kwd "window")
  344.   (slo_xxx '(1.2 2.2))
  345.   (slo_xxx '(3.5 0.7))
  346.   (slo_typ "")
  347.   (slo_kwd "endp")
  348.   (slo_xxx '(1.17 2.5))
  349.   (slo_kwd "endp")
  350.   (slo_xxx '(3.33 2.5))
  351.   (slo_typ "")
  352.   (redraw)
  353.   (slo_cmd "fillet")
  354.   (slo_kwd "radius")
  355.   (slo_typ "0.17")
  356.   (slo_cmd "fillet")
  357.   (slo_xxx '(2.41 3.99))
  358.   (slo_xxx '(2.26 3.86))
  359.   (slo_cmd "fillet")
  360.   (slo_xxx '(1.68 3.25))
  361.   (slo_xxx '(1.5 3.11))
  362.   (slo_cmd "fillet")
  363.   (slo_xxx '(1.69 1.74))
  364.   (slo_xxx '(1.5 1.90))
  365.   (slo_cmd "fillet")
  366.   (slo_xxx '(2.41 1))
  367.   (slo_xxx '(2.26 1.14))
  368.   (slo_cmd "layer")
  369.   (slo_kwd "set")
  370.   (slo_typ "SOMBREADO")
  371.   (slo_typ "")
  372.   (slo_cmd "-bhatch")  
  373.   (slo_kwd "properties")
  374.   (slo_typ "ANSI31")
  375.   (slo_typ "1")
  376.   (slo_typ "0")
  377.   (slo_xxx '(2.6 3.9))
  378.   (slo_xxx '(2.6 3.1))
  379.   (slo_xxx '(2.6 1.9))
  380.   (slo_xxx '(2.6 1.1))
  381.   (slo_typ "")
  382. ;  (slo_cmd "redraw")
  383. )
  384.  
  385. ;;;--- EXERCISE 04 -----------------------------------------------------------
  386.  
  387. (defun tut04 ()
  388.   (setvar "blipmode" 1)
  389.   (command "_zoom" "_w" "0,-0.25" "2,2.5")
  390.   (command "_layer" "_s" "0" "")
  391.   (slo_cmd "pline")
  392.   (slo_typ "1,2")
  393.   (slo_typ "@1<270")
  394.   (slo_typ "@1<0")
  395.   (slo_typ "@1<270")
  396.   (slo_typ "@.35<0")
  397.   (slo_typ "@1.1<90")
  398.   (slo_typ "@0.1<180")
  399.   (slo_typ "@0.2<90")
  400.   (slo_typ "@0.5<180")
  401.   (slo_typ "@0.7<90")
  402.   (slo_kwd "close")
  403.   (slo_cmd "fillet")
  404.   (slo_kwd "radius")
  405.   (slo_typ "0.125")
  406.   (slo_cmd "fillet")
  407.   (slo_xxx '(2 0.16))
  408.   (slo_xxx '(2.13 0))
  409.   (slo_cmd "chamfer")
  410.   (slo_kwd "distances")
  411.   (slo_typ "0.125")
  412.   (slo_typ "")
  413.   (slo_cmd "chamfer")
  414.   (slo_xxx '(2.35 0.296))
  415.   (slo_xxx '(2.2 0))
  416.   (slo_cmd "revolve")
  417.   (slo_pik '(1.54 1))
  418.   (slo_typ "")
  419.   (slo_typ "1,2.5")
  420.   (slo_typ "2,2.5")
  421.   (slo_typ "225")
  422.   (slo_cmd "vpoint")
  423.   (slo_typ "3,-3,1")
  424. ;  (slo_cmd "hide")
  425. )
  426.  
  427. ;;;--- LESSON05 -----------------------------------------------------------
  428.  
  429. (defun tut05 ()
  430.   (setvar "blipmode" 1)
  431.   (setvar "pickbox" 1)
  432.   (command "_zoom" "_w" "-0.5,0" "6,5.25")
  433.   (slo_cmd "osnap")
  434.   (slo_kwd "int")
  435.   (slo_cmd "dimlinear")
  436.   (slo_xxx '(3 2.5))
  437.   (slo_xxx '(3 1.38))
  438.   (slo_xxx '(3.6 2))
  439.   (slo_cmd "dimcontinue")
  440.   (slo_xxx '(3 1))
  441.   (slo_typ "")
  442.   (slo_typ "")
  443.   (slo_cmd "osnap")
  444.   (slo_kwd "endp")
  445.   (slo_cmd "dimlinear")
  446.   (slo_xxx '(3 4))
  447.   (slo_xxx '(2.26 3.83))
  448.   (slo_xxx '(3 4.5))
  449.   (slo_cmd "dimbaseline")
  450.   (slo_xxx '(1.52 3.09))
  451.   (slo_typ "")
  452.   (slo_typ "")
  453.   (slo_cmd "dimlinear")
  454.   (slo_xxx '(2.43 4))
  455.   (slo_xxx '(1.69 3.26))
  456.   (slo_xxx '(0.45 3.6))
  457.   (slo_cmd "dimcontinue")
  458.   (slo_xxx '(1.69 1.74))
  459.   (slo_typ "")
  460.   (slo_typ "")
  461.   (slo_cmd "dimlinear")
  462.   (slo_xxx '(1.52 2.87))
  463.   (slo_xxx '(1.52 2.13))
  464.   (slo_xxx '(1 2.5))
  465.   (slo_cmd "dimradius")
  466.   (slo_xxx '(2.2982 1.0572))
  467.   (slo_xxx '(1.76 0.6))
  468. )
  469.  
  470. ;;;--- EXERCISE 06 -----------------------------------------------------------
  471.  
  472. (defun tut06 ()
  473.   (setvar "blipmode" 1)
  474.   (setvar "lunits" 2)
  475.   (command "_zoom" "_w" "-3.35,-5.20" "10,8")
  476.   (command "_layer" "_s" "TEXT" "")
  477.   (slo_cmd "style")
  478.   (slo_typ "NOTAS")
  479.   (slo_typ "simplex")
  480.   (slo_typ "0")
  481.   (slo_typ "1")
  482.   (slo_typ "0")
  483.   (slo_typ "")
  484.   (slo_typ "")
  485.   (slo_typ "")
  486.   (slo_cmd "-mtext")
  487.   (slo_kwd "height")
  488.   (slo_typ "0.25")
  489.   (slo_typ "-2,0")
  490.   (slo_typ "5,-5")
  491.   (slo_typ "{\\C6;NOTA:}")
  492.   (slo_typ "SOLUCION CORRECTA DE BORDILLO REBAJADO PARA ZONAS DE ")
  493.   (slo_typ "CARGA Y DESCARGA.")
  494.   (slo_typ "")
  495.   (slo_cmd "leader")
  496.   (slo_xxx '(0.37 4.91))
  497.   (slo_typ "@2<45")
  498.   (slo_typ "")
  499.   (slo_typ "2cm DE RADIO")
  500.   (slo_typ "")
  501.   (slo_cmd "leader")
  502.   (slo_xxx '(0.25 3.0))
  503.   (slo_typ "@2<45")
  504.   (slo_typ "")
  505.   (slo_typ "HORMIGON")
  506.   (slo_typ "")
  507.   (slo_cmd "leader")
  508.   (slo_xxx '(2.14 2.60))
  509.   (slo_typ "@1<45")
  510.   (slo_typ "")
  511.   (slo_typ "PAVIMENTO")
  512.   (slo_typ "")
  513.   (slo_cmd "leader")
  514.   (slo_xxx '(2.39 1.19))
  515.   (slo_typ "@1<-45")
  516.   (slo_typ "")
  517.   (slo_typ "LECHO DE GRAVILLA")
  518.   (slo_typ "")
  519.   (slo_cmd "text")
  520.   (slo_typ "-0.5,-3.4")
  521.   (slo_typ "0.4")
  522.   (slo_typ "0")
  523.   (slo_typ "SECCION BORDILLO")
  524. ;  (slo_cmd "redraw")
  525. )
  526.  
  527. ;;;--- EXERCISE 07 -----------------------------------------------------------
  528.  
  529. (defun tut07 ()
  530.   (setvar "blipmode" 1)
  531.   (setvar "lunits" 4)
  532.   (command "_zoom" "_w" "0,0" "198,192")
  533.   (command "_layer" "_s" "0" "")
  534.   (slo_cmd "line")
  535.   (slo_typ "12,186")
  536.   (slo_typ "1',13'")
  537.   (slo_typ "")
  538.   (slo_cmd "arc")
  539.   (slo_kwd "endp")
  540.   (slo_xxx '(12 156))
  541.   (slo_kwd "center")
  542.   (slo_kwd "endp")
  543.   (slo_xxx '(12 186))
  544.   (slo_xxx '(42 186))
  545.   (slo_cmd "ortho")
  546.   (slo_kwd "on")
  547.   (slo_cmd "mirror")
  548.   (slo_xxx '(12 170))
  549.   (slo_xxx '(36 168))
  550.   (slo_typ "")
  551.   (slo_kwd "endp")
  552.   (slo_xxx '(42 186))
  553.   (slo_xxx '(42 156))
  554.   (slo_typ "")
  555.   (slo_cmd "polygon")
  556.   (slo_typ "4")
  557.   (slo_xxx '(42 42))
  558.   (slo_kwd "inscribed")
  559.   (slo_typ "12")
  560.   (slo_cmd "snap")
  561.   (slo_kwd "off")
  562.   (slo_cmd "offset")
  563.   (slo_typ "1")
  564.   (slo_pik '(44 33.5))
  565.   (slo_xxx '(44 42))
  566.   (slo_typ "")
  567.   (slo_cmd "zoom")
  568.   (slo_xxx '(24 24))
  569.   (slo_xxx '(60 60))
  570.   (slo_cmd "fillet")
  571.   (slo_kwd "radius")
  572.   (slo_typ "2")
  573.   (slo_cmd "fillet")
  574.   (slo_xxx '(38.08 50.49))
  575.   (slo_xxx '(33.51 45.53))
  576.   (slo_cmd "fillet")
  577.   (slo_xxx '(33.51 36.53))
  578.   (slo_xxx '(36.65 33.51))
  579.   (slo_cmd "fillet")
  580.   (slo_xxx '(37.06 49.49))
  581.   (slo_xxx '(34.51 46.65))
  582.   (slo_cmd "fillet")
  583.   (slo_xxx '(34.51 37.14))
  584.   (slo_xxx '(37.16 34.51))
  585.   (slo_cmd "zoom")
  586.   (slo_kwd "previous")
  587.   (slo_cmd "block")
  588.   (slo_typ "SILLA")
  589.   (slo_kwd "mid")
  590.   (slo_xxx '(33.51 42.26))
  591.   (slo_kwd "window")
  592.   (slo_xxx '(24 24))
  593.   (slo_xxx '(60 60))
  594.   (slo_typ "")
  595.   (slo_cmd "snap")
  596.   (slo_kwd "on")
  597.   (slo_cmd "circle")
  598.   (slo_typ "48,48")
  599.   (slo_typ "27")
  600.   (slo_cmd "insert")
  601.   (slo_typ "SILLA")
  602.   (slo_typ "72,72")
  603.   (slo_typ "")
  604.   (slo_typ "")
  605.   (slo_typ "45")
  606.   (slo_cmd "array")
  607.   (slo_kwd "last")
  608.   (slo_typ "")
  609.   (slo_kwd "polar")
  610.   (slo_kwd "cen")
  611.   (slo_xxx '(74.93 46.10))
  612.   (slo_typ "4")
  613.   (slo_typ "")
  614.   (slo_typ "")
  615. ;  (slo_cmd "redraw")
  616. )
  617.  
  618. ;;;--- EXERCISE 08 -----------------------------------------------------------
  619.  
  620. (defun tut08 ()
  621.   (setvar "blipmode" 1)
  622.   (setvar "snapmode" 1)
  623.   (command "_zoom" "_w" "-108,-6" "480,810")
  624.   (command "_layer" "_s" "MOBILIARIO" "")
  625.   (slo_cmd "zoom")
  626.   (slo_kwd "window")
  627.   (slo_xxx '(-18 462))
  628.   (slo_xxx '(190 270))
  629.   (slo_princ (nth 3 tut_strs))
  630.   (princ (nth 1 tut_strs))
  631.   (slo_princ "114,390")
  632.   (princ (nth 2 tut_strs))
  633.   (slo_princ "174,360")
  634.   (setvar "cmdecho" 0)
  635.   (command "_.pline" "114,390" "174,390" "174,360" "114,360" "_c")
  636.   (setvar "cmdecho" 1)
  637.   (slo_cmd "attdef")
  638.   (slo_kwd "invisible")
  639.   (slo_typ "")
  640.   (slo_typ "FABR")
  641.   (slo_typ "Fabricante")
  642.   (slo_typ "")
  643.   (slo_typ "114,348")
  644.   (slo_typ "6")
  645.   (slo_typ "0")
  646.   (slo_cmd "attdef")
  647.   (slo_typ "")
  648.   (slo_typ "MODELO")
  649.   (slo_typ "Modelo")
  650.   (slo_typ "")
  651.   (slo_typ "")
  652.   (slo_cmd "attdef")
  653.   (slo_typ "")
  654.   (slo_typ "PRECIO")
  655.   (slo_typ "Precio")
  656.   (slo_typ "")
  657.   (slo_typ "")
  658.   (slo_cmd "attdef")
  659.   (slo_typ "")
  660.   (slo_typ "DEPARTAMENTO")
  661.   (slo_typ "Departamento")
  662.   (slo_typ "")
  663.   (slo_typ "")
  664.   (slo_cmd "block")
  665.   (slo_typ "MESA60")
  666.   (slo_kwd "mid")
  667.   (slo_xxx '(144 360))
  668.   (slo_kwd "window")
  669.   (slo_xxx '(108 394))
  670.   (slo_xxx '(185 287))
  671.   (slo_typ "")
  672.   (setvar "cmdecho" 0)
  673.   (command "_attdia")
  674.   (command "0")
  675.   (setvar "cmdecho" 1)
  676.   (slo_cmd "insert")
  677.   (slo_typ "MESA60")
  678.   (slo_typ "144,414")
  679.   (slo_typ "")
  680.   (slo_typ "")
  681.   (slo_typ "0")
  682.   (slo_typ "2227")               ;; Location
  683.   (slo_typ "Austria")            ;; Model
  684.   (slo_typ "Ecotresillos")   ;; Manufacturer
  685.   (slo_typ "126000")             ;; Cost
  686.   (setvar "cmdecho" 0)
  687.   (command "_attdia")
  688.   (command "1")
  689.   (setvar "cmdecho" 1)
  690.   (slo_cmd "zoom")
  691.   (slo_kwd "previous")
  692.   (slo_cmd "zoom")
  693.   (slo_kwd "window")
  694.   (slo_xxx '(-30 264))
  695.   (slo_xxx '(240 804))
  696.   (slo_cmd "erase")
  697.   (slo_xxx '(84 391.16))
  698.   (slo_xxx '(38 390.61))
  699.   (slo_xxx '(22.53 432.05))
  700.   (slo_xxx '(92.57 362))
  701.   (slo_xxx '(25.33 362))
  702.   (slo_typ "")
  703.   (slo_cmd "redraw")
  704.   (slo_cmd "snap")
  705.   (slo_kwd "off")
  706.   (slo_cmd "rotate")
  707.   (slo_xxx '(63.15 429.78))
  708.   (slo_typ "")
  709.   (slo_kwd "int")
  710.   (slo_xxx '(41.44 422.50))
  711.   (slo_typ "270")
  712.   (slo_cmd "move")
  713.   (slo_xxx '(49.14 422.5))
  714.   (slo_typ "")
  715.   (slo_kwd "mid")
  716.   (slo_xxx '(30.94 414.39))
  717.   (slo_xxx '(152.8 745 94))
  718.  
  719. ;; -- DDATTE portion not implemented in this demo since it is all
  720. ;;    dialog box access.
  721.  
  722.   (slo_cmd "zoom")
  723.   (slo_kwd "window")
  724.   (slo_xxx '(-18 264))
  725.   (slo_xxx '(129 466))
  726.   (slo_cmd "area")
  727.   (slo_xxx '(8.98 447.17))
  728.   (slo_xxx '(105.51 447.17))
  729.   (slo_xxx '(106 280))
  730.   (slo_xxx '(8.87 280))
  731.   (slo_typ "")
  732. ;  (slo_cmd "redraw")
  733. )
  734.  
  735. ;;;--- EXERCISE 09 -----------------------------------------------------------
  736.  
  737. (defun tut09 ()
  738.   (alert (strcat (nth 4 tut_strs) " 9."))
  739. )
  740.  
  741. ;;;--- EXERCISE 10 -----------------------------------------------------------
  742.  
  743. (defun tut10 ()
  744.   (if (and (setq elev1 (tutfind "elev1.dwg"))(setq elev2 (tutfind "elev2.dwg")))
  745.       (tut10a)
  746.       (alert (strcat "Error: Imposible localizar el archivo(s) ELEV1.DWG\n"
  747.                      "y/o ELEV2.DWG.\n\n"
  748.                      "Debe a±adir el directorio TUTORIAL al camino\n"
  749.                      "de soporte antes de ejecutar la desmostraci≤n\n"
  750.                      "del ejercicio 10." ))
  751.     )
  752.   
  753. )
  754.   
  755. (defun tut10a ()
  756.   (setvar "blipmode" 1)
  757.   (setvar "lunits" 4)
  758.   (command "_layer" "_s" "0" "")
  759.   (slo_typ "TILEMODE")
  760.   (slo_typ "0")
  761.   (slo_cmd "limits")
  762.   (slo_typ "0,0")
  763.   (slo_typ "42,30")
  764.   (slo_cmd "zoom")
  765.   (slo_kwd "all")
  766.   (slo_cmd "layer")
  767.   (slo_kwd "set")
  768.   (slo_typ "CONTORNO")
  769.   (slo_typ "")
  770.   (slo_princ (nth 3 tut_strs))
  771.   (princ (nth 1 tut_strs))
  772.   (slo_princ "0,0")
  773.   (princ (nth 2 tut_strs))
  774.   (slo_princ "42,30")
  775.   (setvar "cmdecho" 0)
  776.   (command "_.pline" "0,0" "42,0" "42,30" "0,30" "_c")
  777.   (setvar "cmdecho" 1)
  778.   (slo_cmd "layer")
  779.   (slo_kwd "set")
  780.   (slo_typ "VENTANA")
  781.   (slo_typ "")
  782.   (slo_cmd "mview")
  783.   (slo_typ "3,12")
  784.   (slo_typ "23,27")
  785.   (slo_cmd "mspace")
  786.   (setq vp_start (getvar "cvport")) ; get first viewport number
  787.   (slo_princ (getcname "_ZOOM"))
  788.   (slo_princ "1/96xp")
  789.   (setvar "cmdecho" 0)
  790.   (command "._view" "_r" "tut_v01")
  791.   (setvar "cmdecho" 1)
  792.   (slo_cmd "pspace")
  793.   (slo_cmd "stretch")
  794.   (slo_kwd "crossing")
  795.   (slo_xxx '(26 13))
  796.   (slo_xxx '(2 10))
  797.   (slo_typ "")
  798.   (slo_xxx '(26 13))
  799.   (slo_typ "@8.5<270")
  800.   (slo_cmd "mspace")
  801.   (slo_cmd "zoom")
  802.   (slo_typ "2x")
  803.   (slo_princ (getcname "_PAN"))
  804.   (setvar "cmdecho" 0)
  805.   (command "._view" "_r" "tut_v02")
  806.   (setvar "cmdecho" 1)
  807.   (slo_cmd "pspace")
  808.   (slo_cmd "vplayer")
  809.   (slo_kwd "vpvisdflt")
  810.   (slo_typ "Z*")
  811.   (slo_kwd "vfreeze")
  812.   (slo_typ "")
  813.   (slo_cmd "mview")
  814.   (slo_typ "24,17")
  815.   (slo_typ "40,27")
  816.   (slo_cmd "copy")
  817.   (slo_xxx '(32.35 17))
  818.   (slo_typ "")
  819.   (slo_typ "@")
  820.   (slo_typ "@11<270")
  821.   (slo_cmd "layer")
  822.   (slo_kwd "set")
  823.   (slo_typ "REFX1")
  824.   (slo_typ "")  
  825.   (slo_cmd "mspace")
  826.   (slo_typ "CVPORT")
  827.   (slo_typ (itoa (1+ vp_start)))
  828.   (slo_cmd "xref")
  829.   (slo_kwd "attach") 
  830.   (slo_typ elev1)
  831.   (slo_xxx '(320 240))
  832.   (slo_typ "")
  833.   (slo_typ "")
  834.   (slo_typ "")
  835.   (slo_cmd "setvar")
  836.   (slo_typ "CVPORT")
  837.   (slo_typ (itoa vp_start))
  838.   (slo_cmd "vplayer")
  839.   (slo_kwd "freeze")
  840.   (slo_typ "REFX1")
  841.   (slo_typ "")
  842.   (slo_typ "")
  843.   (slo_cmd "setvar")
  844.   (slo_typ "CVPORT")
  845.   (slo_typ (itoa (+ 2 vp_start)))
  846.   (slo_cmd "vplayer")
  847.   (slo_kwd "freeze")
  848.   (slo_typ "REFX1")
  849.   (slo_typ "")
  850.   (slo_typ "")
  851.   (slo_cmd "layer")
  852.   (slo_kwd "set")
  853.   (slo_typ "REFX2")
  854.   (slo_typ "")  
  855.   (slo_cmd "xref")
  856.   (slo_kwd "attach")
  857.   (slo_typ elev2)
  858.   (slo_xxx '(320 240))
  859.   (slo_typ "")
  860.   (slo_typ "")
  861.   (slo_typ "")
  862.   (slo_cmd "setvar")
  863.   (slo_typ "CVPORT")
  864.   (slo_typ (itoa vp_start))
  865.   (slo_cmd "vplayer")
  866.   (slo_kwd "freeze")
  867.   (slo_typ "REFX2")
  868.   (slo_typ "")
  869.   (slo_typ "")
  870.   (slo_cmd "setvar")
  871.   (slo_typ "CVPORT")
  872.   (slo_typ (itoa (1+ vp_start)))
  873.   (slo_cmd "vplayer")
  874.   (slo_kwd "freeze")
  875.   (slo_typ "REFX2")
  876.   (slo_typ "")
  877.   (slo_typ "")
  878.   (slo_cmd "pspace")
  879.   (slo_cmd "layer")
  880.   (slo_kwd "set")
  881.   (slo_typ "TITULO")
  882.   (slo_typ "")  
  883.   (slo_cmd "insert")
  884.   (slo_typ "TBLOCK")
  885.   (slo_typ "41,1")
  886.   (slo_typ "")
  887.   (slo_typ "")
  888.   (slo_typ "")
  889.   (slo_cmd "layer")
  890.   (slo_kwd "lfreeze")
  891.   (slo_typ "VENTANA,CONTORNO")
  892.   (slo_typ "")  
  893. ;  (slo_cmd "redrawall")
  894. )
  895.  
  896. ;;;=== End of Exercises ======================================================
  897.  
  898. ;;;=== Misc functions ========================================================
  899.  
  900. (defun tutfind ( fil /  )
  901.   (if (not (setq fff (findfile fil)))
  902.     (progn
  903.       (setq xxx (findfile "acis.dll"))
  904.       (setq pth (substr xxx 1 (- (strlen xxx) 8)))
  905.       (setq fff (findfile (strcat pth "\\tutorial\\" fil)))
  906.     )
  907.   )
  908.   fff
  909. )
  910.  
  911. (defun tutundo ( typ / xxx )  ;; typ=1 (UNDO mark), typ=0 (UNDO back)
  912.   (if (= typ 1)
  913.     (setq xxx "_mark")
  914.     (setq xxx "_back" typ 0)
  915.   )
  916.   (if (/= tutchk typ)
  917.     (progn
  918.       (setvar "cmdecho" 1)
  919.       (command "_.undo" xxx)
  920.       (setvar "cmdecho" 0)
  921.       (setq tutchk typ)
  922.     )
  923.     nil
  924.   )
  925. )
  926.  
  927.  
  928. (defun slo_princ ( str / ct )
  929.   (setq ct 1)
  930.   (repeat (strlen str)
  931.     (princ (substr str ct 1))
  932.     (setq ct (1+ ct))
  933.     (tut_wait tut_spd)
  934.   )
  935.   (princ (nth 0 tut_strs))
  936. )
  937.  
  938.  
  939. (defun slo_xxx ( xxx / )
  940.   (setvar "cmdecho" 1)
  941.   (command xxx)
  942.   (setvar "cmdecho" 1)
  943.   (tut_wait tut_spd)
  944. )
  945.  
  946. (defun slo_pik ( pt / ct ) 
  947.   (setq ename (car (nentselp pt))) 
  948.   (redraw ename 3)
  949.   (setvar "cmdecho" 0)
  950.   (command pt)
  951.   (setvar "cmdecho" 1)
  952.   (tut_wait tut_spd)
  953. )
  954.  
  955. (defun slo_typ ( str / ct )
  956.   (setq ct 1)
  957.   (repeat (strlen str)
  958.     (princ (substr str ct 1))
  959.     (setq ct (1+ ct))
  960.     (tut_wait tut_spd)
  961.   )
  962.   (repeat (1- ct)(princ "\010"))
  963.   (setvar "cmdecho" 1)
  964.   (command str)
  965. ;  (setvar "cmdecho" 0)
  966. )
  967.  
  968. (defun slo_kwd ( str / ct xxx)
  969.   (setq ct 1) 
  970.   (repeat (strlen str)
  971.     (princ (substr str ct 1))
  972.     (setq ct (1+ ct))
  973.     (tut_wait tut_spd)
  974.   )
  975.   (repeat (1- ct)(princ "\010"))
  976.   (setvar "cmdecho" 1)
  977.   (if (setq xxx (cadr (assoc str tut_kwds)))
  978.     (command xxx)                   ;; if str is in keyword list, use that
  979.     (command (strcat "_" str))      ;; else, keyword gets underscored and used as-is
  980.   )
  981. ;  (setvar "cmdecho" 0)
  982. )
  983.  
  984. (defun slo_cmd ( str / ct )
  985.   (setq ct 1)
  986.   (setq cname (getcname (strcat "_" str)))
  987.   (repeat (strlen cname)
  988.     (princ (substr cname ct 1))
  989.     (setq ct (1+ ct))
  990.     (tut_wait tut_spd)
  991.   )
  992.   (repeat (1- ct)(princ "\010"))
  993.   (setvar "cmdecho" 1)
  994.   (command cname)
  995. ;  (setvar "cmdecho" 0)
  996. )
  997.  
  998. ;;; (tut_wait) waits <ttt> milliseconds
  999.  
  1000. (defun tut_wait ( ttt / xxx ) 
  1001.   (setq xxx (+ (getvar "cdate") (* ttt 0.000000001 )))
  1002.   (while (> xxx (getvar "cdate")) )
  1003. )
  1004.  
  1005. ;;;=========================================================================
  1006. ;;; Error handling program
  1007.  
  1008. (defun ac:erron ( varlst / )
  1009.   (setvar "cmdecho" 0)
  1010.   (setq acerr *error*)
  1011.   (setq ac=mods nil)
  1012.   (if varlst 
  1013.     (foreach n varlst 
  1014.       (setq ac=mods (append ac=mods (list (list n (getvar n)))))
  1015.     )
  1016.   )
  1017.   (defun *error* (msg) 
  1018.     (if ac_errprg (ac_errprg))
  1019.     (if ac=mods (foreach n ac=mods (setvar (car n) (cadr n))) )
  1020.     (setq *error* acerr)
  1021.     (princ (strcat "Error: " msg ))
  1022.     (if (and ac_errmsg (/= ac_errmsg ""))
  1023.       (princ (strcat "\n  >> " ac_errmsg " <<"))
  1024.     )
  1025.     (setq ac_errmsg nil)
  1026.     (princ)
  1027.   )
  1028.   (defun ac:erroff ()
  1029.     (if ac=mods (foreach n ac=mods (setvar (car n) (cadr n))) )
  1030.     (setq ac_errprg nil)
  1031.     (setq *error* acerr)
  1032.     (princ)
  1033.   )
  1034. )
  1035.  
  1036. ;;;===========================================================================
  1037.  
  1038. (princ)
  1039.  
  1040.