home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / GRAFX / ALLY30.ZIP / BUB.LSP < prev    next >
Lisp/Scheme  |  1994-03-24  |  1KB  |  55 lines

  1. ;; BUB.LSP   Copyright (c) 1992, 1994 Steve Waskow
  2. ;; Draws item # bubble, leader, and numbers bubble
  3. ;; Example program to illustrate Analyzer features
  4.  
  5. (defun leader (/ i pt2 drawln)
  6. ;draws pline arrowhead and line leader
  7.  
  8.   (defun drawln ()
  9.   ;draws one or more leader line segments
  10.     (if (> (distance pt pt2) (* 0.1875 dimsc))
  11.       (command ".line" pt pt2 "")
  12.       (setq pt2 pt pt i i (prompt "\nToo short!"))
  13.     )
  14.     ;ask for another line segment
  15.     (if (setq i pt pt pt2
  16.           pt2 (getpoint pt "\nTo point: ")
  17.         )
  18.       (drawln) ;recursively draw next line segment
  19.     )
  20.   )
  21.  
  22.   (setq dimsc (getvar "dimscale") ;use for scale
  23.     pt  (getpoint "\nPoint of arrowhead: ")
  24.     pt2 (getpoint pt "\nLeader to point: ")
  25.   )
  26.   ;draw proportioned arrowhead
  27.   (command ".pline" pt "W" 0 (* 0.0416 dimsc)
  28.     (setq
  29.       pt (polar pt (angle pt pt2) (* 0.125 dimsc))
  30.     )
  31.     ""
  32.   )
  33.   (drawln) ;draw first line segment
  34. )
  35.  
  36. (defun bubble ()
  37. ;draws bubble centered on last point and item #
  38.   (command ".circle" pt (* 0.1875 dimsc)
  39.     ".trim" (entlast) "" pt ""
  40.     ".text" "M" pt (* 0.125 dimsc) 0 item
  41.   )
  42. )
  43.  
  44. (defun C:BUB (/ i pt s dimsc)
  45. ;auto-incremented item bubble with arrow leader.
  46. ;press <enter> at point prompt to place bubble.
  47.   (setq s (itoa (setq item (if item (1+ item) 1))))
  48.   (if (setq i (getint (strcat "\nItem <" s ">: ")))
  49.     (setq item i)
  50.   )
  51.   (leader)
  52.   (bubble)
  53.   (princ) ;exit with no echo
  54. )
  55.