home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / GR / GR505.ZIP / LSP.EXE / DENT.LSP < prev    next >
Lisp/Scheme  |  1989-09-06  |  3KB  |  117 lines

  1. ;Function CPROP
  2. ;
  3. ;Called with a required argument, which must be a valid
  4. ;entity association list.
  5. ;
  6. ;Changes current LAYER, LINETYPE, THICKNESS, and COLOR settings
  7. ;to those contained within the entity association list
  8. ;supplied as an argument.
  9.  
  10. (defun cprop (elist)
  11.   (command "LAYER" "S" (cdr (assoc 8 elist)) "")
  12.   (if
  13.     (assoc 6 elist)
  14.     (command "LINETYPE" "S" (cdr (assoc 6 elist)) "")
  15.     (command "LINETYPE" "S" "bylayer" "")
  16.   )
  17.   (if
  18.     (assoc 39 elist)
  19.     (command "ELEV" 0 (cdr (assoc 39 elist)))
  20.     (command "ELEV" 0 0)
  21.   )
  22.   (cond                          ;added test for color byblock
  23.     ((not (assoc 62 elist))
  24.      (command "COLOR" "bylayer")
  25.     )
  26.     ((= 0 (cdr (assoc 62 elist)))
  27.      (command "COLOR" "byblock")
  28.     )
  29.     (t (command "COLOR" (cdr (assoc 62 elist))))
  30.   )
  31. )
  32.  
  33. ;Function C:DENT  Draw ENTity
  34. ;
  35. ;For AutoCAD Release 10
  36. ;
  37. ;DENT prompts user to select an entity, and passes the
  38. ;entity association list of the selected entity to the
  39. ;function CPROP.  Upon return from CPROP, DENT issues
  40. ;an AutoCAD command to draw the same type of entity as
  41. ;the one selected.
  42. ;
  43. ;This function is not fully de-bugged, and I expect you to
  44. ;encounter some situations where you will want to implement
  45. ;changes to this code.  Please be my guest and modify this
  46. ;to your heart's content.  I refuse to honor any requests for
  47. ;feature changes or bug fixes to this code; you're on
  48. ;your own.  Have fun!
  49. ;
  50. ;Written by Brad Zehring
  51. ;Tuesday  March 21, 1989  7:45 pm  Sausalito, California
  52. ;Modified 6/13/89
  53. ;
  54. ;Based on an idea from Creighton Hoke
  55.  
  56. (defun C:DENT (/ old_cmdecho ename elist etype)
  57.   (setq old_cmdecho (getvar "CMDECHO"))
  58.   (setvar "CMDECHO" 0)
  59.   (if
  60.     (setq ename (entsel))
  61.     (progn
  62.       (setq ename (car ename)
  63.             elist (entget ename)
  64.             etype (cdr (assoc 0 elist))
  65.       )
  66.       (cprop elist)
  67.       (setvar "CMDECHO" 1)
  68.       (cond
  69.         ((eq "TEXT" etype)
  70.          (menucmd "S=X")    ;added ACAD.MNU screen menu calls
  71.          (menucmd "S=TEXT")
  72.          (if                ;style height non-zero?
  73.            (/= 0 
  74.              (cdr 
  75.                (assoc 40 
  76.                  (tblsearch "STYLE" (cdr (assoc 7 elist)))
  77.                )
  78.              )
  79.            )
  80.            (command "DTEXT" "Style" (cdr (assoc 7 elist))
  81.                             pause
  82.                             (/ (* 180 (cdr (assoc 50 elist))) pi)
  83.            )
  84.            (command "DTEXT" "Style" (cdr (assoc 7 elist))
  85.                             pause
  86.                             (cdr (assoc 40 elist))
  87.                             (/ (* 180 (cdr (assoc 50 elist))) pi)
  88.            )
  89.          )
  90.         )
  91.         ((eq "POLYLINE" etype)
  92.          (menucmd "S=X")
  93.          (menucmd "S=PLINE")
  94.          (command "PLINE")
  95.         )
  96.         ((eq "INSERT" etype)
  97.          (menucmd "S=X")
  98.          (menucmd "S=INSERT")
  99.          (command "INSERT" (cdr (assoc 2 elist)))
  100.         )
  101.         ((eq "DIMENSION" etype)
  102.          (menucmd "S=X")
  103.          (menucmd "S=DIM")
  104.          (command "DIM1")
  105.         )
  106.         (t 
  107.          (menucmd "S=X")
  108.          (menucmd (strcat "S=" etype))
  109.          (command etype)
  110.         )
  111.       )
  112.     )
  113.   )
  114.   (setvar "CMDECHO" old_cmdecho)
  115.   (prin1)
  116. )
  117.