home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / cad / jul93.zip / BLINE.LSP < prev    next >
Lisp/Scheme  |  1993-06-21  |  3KB  |  102 lines

  1. ; *********************************************************
  2. ; BLINE.LSP
  3. ; Copyright Barry R. Bowen 1993
  4. ; ---------------------------------------------------------
  5. ; Variables:
  6. ; ANG   = Angle in radians from PT1 to PT2
  7. ; BPT   = Beginning point for first line segment
  8. ; DIST  = Line segement length
  9. ; EL    = Last entity
  10. ; HT    = Text height
  11. ; HTX   = Half the text height
  12. ; PT1   = First line segement start point
  13. ; PT2   = First line segement end point
  14. ; TX    = Text added to line segement
  15. ; TLGTH = String length of text for break distance
  16. ; ---------------------------------------------------------
  17.  
  18. (defun C:BLINE (/ ANG BPT DIST PT1 PT2 EL HT HTX TX TLGTH)
  19.   (V3)
  20.   (setq PT1 (getpoint "\nStart Point: ")
  21.         BPT PT1
  22.         PT2 (getpoint PT1 "\nEnd Point: ")
  23.         ANG (angle PT1 PT2))
  24.   (command "line" PT1 PT2 "")
  25.   (setq EL (entlast)
  26.         DIST (getdist PT1 "\nSegement Length: "))
  27.   (if (= HT nil) (setq TXHT 0.2) (setq TXHT HT))
  28.   (setq HT (getreal (strcat "\nText Height<" (rtos TXHT 2 2) ">: ")))
  29.   (if (= HT nil) (setq HT TXHT))
  30.   (setq HTX (/ HT 2.0)
  31.         TX (getstring "\nText Added To Line: ")
  32.         TLGTH (strlen TX)
  33.         HTX (* HTX TLGTH))
  34.   (doline)
  35.   (while PT2 (cntline))
  36.   (V4)
  37. )
  38.  
  39. ; ----------------------- DOLINE----------------------------
  40. (defun doline (/ IN EN ELIST PT PTA PTB)
  41.   (command "measure" PT1 DIST)
  42.   (S3 EL)
  43.   (if (= ANG pi) (setq ANG 0))
  44.   (if (= ANG (D270)) (setq ANG (D90)))
  45.   (setq IN 0 EN (ssname SS1 IN))
  46.   (while EN
  47.     (setq ELIST (entget EN)
  48.           PT (cdr (assoc 10 ELIST))
  49.           PTA (polar PT (+ ANG pi) HTX)
  50.           PTB (polar PT ANG HTX))
  51.     (entdel EN)
  52.     (command "break" PT "f" PTA PTB)
  53.     (command "text" "m" PT HT (angtos ANG) TX)
  54.     (setq IN (1+ IN) EN (ssname SS1 IN))
  55.   )
  56. )
  57.  
  58. ; ----------------------- CUTLINE---------------------------
  59. (defun CNTLINE (/ ANG EL)
  60.   (setq PT1 PT2 PT2 (getpoint PT1 "\nNext Point: "))
  61.   (if (/= PT2 nil)
  62.    (progn
  63.     (command "line" PT1 PT2 "")
  64.     (setq ANG (angle PT1 PT2)
  65.           EL (entlast))
  66.     (doline)
  67.   ))
  68. )
  69.  
  70. (defun D90 () (* pi 0.5))
  71.  
  72. (defun D270 () (* pi 1.5))
  73.  
  74. ; ------------------------- S3 -----------------------------
  75. (defun S3 (EVAR1)
  76.   (setq SS1 (ssadd) EN1 (entnext EVAR1))
  77.   (while EN1
  78.     (setq SS1 (ssadd EN1 SS1)
  79.           EN1 (entnext EN1))
  80.   )
  81. )
  82.  
  83. ; ------------------------ V3.LSP --------------------------
  84. (defun V3 ()
  85.   (setq BM (getvar "blipmode"))
  86.   (setvar "blipmode" 0)
  87.   (setvar "cmdecho" 0)
  88.   (command "undo" "group")
  89. )
  90.  
  91. ; ------------------------ V4.LSP --------------------------
  92. (defun V4 (/ BA)
  93.   (setvar "blipmode" BM)
  94.   (command "undo" "end")
  95.   (prompt "\n")
  96.   (setq BA "Program Completed. . . . .")
  97. )
  98.  
  99. (prompt "\nBLINE loaded!")
  100. (princ)
  101.  
  102.