Jump to content

Help with 1987 Balloon LISP


ryanmorris1995

Recommended Posts

I have a LISP that creates balloons simply for me, the problem is the LISP only makes balloons with a dot on the end. I have been playing about with it trying to make it have the option to put an arrow head on the end but can't work it out after trying for quite a while.

 

The draughtsmen here have been using it since they started so I'm not sure if LISPs will be written the same way now as they were in '87!

 

Any help would be great.

 

Cheers.

 

Here is the code;

 

;---------- BALLOON.LSP    Simon Jones   24-8-87

; Macro to simplify the construction of item-number labels.

; The size of the dot, text and balloon are based on the dimensioning
; variables. If DIMASZ is set to zero the dot is not drawn. If the
; current text style has a fixed height then that height is used to
; scale the balloon and its text.

; A null response to the first prompt ("From point: ") will terminate
; the command.

; Numeric text is incremented to aid itemising components of a drawing

(defun C:BALLOON (/ a b c d h l r txt)

 ; a : Leader start
 ; b : Balloon centre
 ; c : Leader end point

 ; d : Dot diameter
 ; h : Text height
 ; r : Balloon radius

 ; Store and set system variables
 (setq ce (getvar "CMDECHO"))
 (setq bm (getvar "BLIPMODE"))
 (setvar "CMDECHO" 0)
 (setvar "BLIPMODE" 0)

 ; Set dot diameter to tenth of arrow head size
 (setq d (* (getvar "DIMSCALE") (getvar "DIMASZ") 0.3))

 ; Check whether the current text style has a fixed height
 (setq ts (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE")))))
 (if (zerop ts)
     ; Set balloon radius based on dimension text height
     (setq r (* (getvar "DIMSCALE") (getvar "DIMTXT") 1.85)
           h (* (getvar "DIMSCALE") (getvar "DIMTXT") 1.3)
     )
     ; Set balloon radius based on current style text height
     (setq r (* ts 1.85))
 )

 ; Get start point (a null response will terminate function)
 (setq a (getpoint "\nFrom point: "))
 (if a
     (progn
      ; Get balloon cntre disallowing null responses
      (initget 1)
      (setq b (getpoint a "\nBalloon centre: "))
      (if (null oldtxt) (setq oldtxt "1"))
      (prompt (strcat "\nText <" oldtxt ">: "))
      (setq txt (getstring))
      (if (= txt "") (setq txt oldtxt))
      (setvar "BLIPMODE" 0)

      ; Draw dot if DIMASZ is set
      (if (> d 0) (command "DONUT" "0" d a ""))

      ; Calculate point where leader crosses balloon
      (setq c (polar a
                     (angle a b)
                     (- (distance a b) r)
              )
      )

      ; Draw leader
      (command "LINE" a c "")

      ; Draw balloon
      (command "CIRCLE" b r)

      ; Draw text (checking against fixed text height)
      (if (zerop ts)
          (command "TEXT" "M" b h "0" txt)
          (command "TEXT" "M" b "0" txt)
      )
      (setq oldtxt (itoa (1+ (atoi txt))))
     )
 )
 ; Reset system variables
 (setvar "BLIPMODE" bm)
 (setvar "CMDECHO" ce)
 (princ)
)

Edited by ryanmorris1995
Adding help to title
Link to comment
Share on other sites

Try this one. Load "bubble.lsp".

Run "bubble" for an arrowhead.

Run "bubbledot" to use a dot instead.

 

Also creates layer dim with red colors assigned.

Sets osmode (onsaps) to 47

 

 

;BUBBLE.LSP

; This routine uses "Arrowhead" and "Dot" style of item indicators

 

;;;;;;;;;;;;;;;;;;;;;;Bubble Arrowhead Section;;;;;;;;;;;;;;;;

;;(if (not BUBBLE.LSP) (LOAD "BUBBLE.LSP")) BUBBLE

(defun c:Bubble (/ cc in is)

(VL-LOAD-COM)

(vl-cmdf ".undo" "BEGIN")

(terpri)(setq *ortm* (getvar "orthomode"))

(command "dimasz" ".09375")

(command "._-LAYER" "_NEW" "DIM" "_COLOR" 1 "DIM" "" "")

(command "LAYER" "SET" "DIM" "")

(command "dimldrblk" ".")

 

(setq cmd (getvar "cmdecho"))

(setvar "osmode" 512)

(setvar "cmdecho" 0)

(setvar "orthomode" 0)

 

(terpri)(setq is (getpoint "Start point of Leader:"))

(terpri)(setq cc (getpoint is "Center of Balloon:"))

(terpri)(setq ds (getvar "dimscale"))

(terpri)(setq th (getvar "dimtxt"))

(terpri)(setq cd (getvar "dimdli"))

(terpri)(setq rad (* th 3))

(terpri)(setq txt (* th ds))

(terpri)(setq dia (* rad ds))

(command ".circle" "_non" cc "d" dia)

(command "-STYLE" "STANDARD" "" "" "" "" "" "" "")

(setvar "orthomode" *ortm*)

(command "Qleader" "_non" is "_non" (polar is (angle is cc)

(- (distance is cc) (/ dia 2))) c^c^)

(terpri)(setq in (getstring "Text in Balloon:"))

(command ".text" "m" "_non" cc txt 0 in)

(setvar "cmdecho" cmd)

(setvar "osmode" 47)

;;;;;;

(vl-cmdf ".undo" "END")

;;;;;

(princ)

)

;;;;;;;;;;;;;;;;;;;;;;Bubble Dot Section;;;;;;;;;;;;;;;;

;;(if (not BUBBLE.LSP) (LOAD "BUBBLE.LSP")) BUBBLEDOT

(defun c:BubbleDot (/ cc in is)

(terpri)(setq *ortm* (getvar "orthomode"))

(command "dimasz" ".06")

(command "._-LAYER" "_NEW" "DIM" "_COLOR" 1 "DIM" "" "")

(command "LAYER" "SET" "DIM" "")

(command "dimldrblk" "dot")

 

(setq cmd (getvar "cmdecho"))

(setvar "osmode" 0)

(setvar "cmdecho" 0)

(setvar "orthomode" 0)

 

(terpri)(setq is (getpoint "Start point of Leader:"))

(terpri)(setq cc (getpoint is "Center of Balloon:"))

 

(terpri)(setq ds (getvar "dimscale"))

(terpri)(setq th (getvar "dimtxt"))

(terpri)(setq cd (getvar "dimdli"))

(terpri)(setq rad (* th 3))

(terpri)(setq txt (* th ds))

(terpri)(setq dia (* rad ds))

(command ".circle" cc "d" dia)

(COMMAND "-STYLE" "STANDARD" "" "" "" "" "" "" "")

(setvar "orthomode" *ortm*)

(command "Qleader" is (polar is (angle is cc)

(-(distance is cc)(/ dia 2))) c^c^)

(terpri)(setq in (getstring "Text in Balloon:"))

(command ".text" "m" cc txt 0 in)

(setvar "cmdecho" cmd)

(setvar "osmode" 47)

(command "dimldrblk" ".")

(command "dimasz" ".09375")

 

(princ)

)

 

Link to comment
Share on other sites

Are you doing this just for the AutoLISP exercise? I had similar routines back in '87. But, for me, MLeader is the way to go now. It's like a dynamic block with attributes; a much more versatile way to do it, especially if you need to move any part of the balloon pointer.

Link to comment
Share on other sites

Thanks for the replies. I will try that asap Biscuits.

Neo I get frustrated with mleaders having to adjust the size and wondered how the other draughties did it and they showed me this. I like it as it automatically sets the balloon and text size. I think I'll have to get with the times and use MLeaders at some point though :lol: !

Link to comment
Share on other sites

Yeah, I can understand the need to have the size right. Note that with MLeaders, you can simply copy and then manipulate with grips, so, you only have to size the first one. After that, it is simple editing. I suppose it depends on how you work. I like to be able to quickly change the location of the balloon, which I cannot do with the old style. I've got an old drawing right now where someone did change it, but left it a mess; nothing lines up. It is also much easier to de-select as a single item. Etc....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...