Jump to content

balloons


rookie37

Recommended Posts

Posted

how do I draw a balloon? (circle with text in it and a leader with an arrow head pointing to the part)

 

I'm sure there is an easier way than the way I'm doing it.

 

I'm still doing it the same as I did it in Autocad 9

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Biscuits

    4

  • El Jefe '36

    4

  • Strix

    3

  • rookie37

    3

Posted

with the LEADER command in dimensions?

 

there is a variable you can set to make your leader come out in different formats, but I'm afraid I've forgotten what that variable is and I can't go look on this computer

Guest Alan Cullen
Posted

Strix......you gotta do something about being cadless at home.......

Posted

I'm not cadless at home - I'm just cadless on my new laptop

 

I've got LT98 on the PC and I think it's 2002 on the old laptop - but it's slow and cranky

Posted
....but it's slow and cranky

 

sounds a bit like someone i know

Guest Alan Cullen
Posted
sounds a bit like someone i know

 

Yeah.....Strix........or are talking about ME, Blue......?????? :lol: :lol:

Posted
Yeah.....Strix........or are talking about ME, Blue......?????? :lol: :lol:

 

Was thinking more about myself, certainly the latter part of the sentence.

 

C'mon Strix, make your 500th post a good 'un

Posted

so here's me sat here wondering whether I should suggest I'd read your 'somebody I know' post as being you but you beat me to it Norts :roll:

 

do I have to start a new thread for my 500th?

Guest Alan Cullen
Posted

yeah.....in the chat area.....in the appropriate thread.....

Posted
do I have to start a new thread for my 500th?

 

I would say the answer is a 'yep, sure do' providing you want a fanfare and all the trimmings

Posted

Iv'e had a look at the leader command.

 

I couldn't find how to set is as a balloon.

Posted

First you have to create a block containing the circle and whatever attributes you want to use for your callout. Then start the LEADER command.

 

The first time you initiate the LEADER command, type S for Settings. This will open the "Leader Settings" dialog. Click on the "Annotation" tab and select "Block Reference" from the "Annotation Type" section. Hit "OK" to exit the dialog and get back into the Leader command.

 

Now draw out your leader. Once you place your 3rd point, you will be asked to specify the name of the block you want to use as your callout. Type in the name of the block you just created and hit enter. You can now place the block at the end of the leader by selecting the "Basepoint" option from the command line. Using your Quadrant & Endpt Osnaps, click on a quadrant of the circle and then click on the endpoint of the leader to set the block. Accept the defaults for scale and rotation and the block will then be attached to the leader. So now if you move the block, the leader will stretch and stay attached to the block.

 

Hope that helps. :)

Posted

Biscuits

 

I'd be very interested in the balloon lisp routine.

 

Thank you

 

Is the email address correct?

Posted

I'll sent them tomorrow when I get to work

Posted

:huh: So you're not going to share with the rest of us? :roll:

If you've got a good lisp routine, post it up. It may be useful to others.

Posted
:huh: So you're not going to share with the rest of us? :roll:

If you've got a good lisp routine, post it up. It may be useful to others.

I'll share a VBA routine with you then. :D Its a long time since I used it so it may not work though. :shock:

 

Paste this lot into your VBA editor as a new module

Option Explicit

Public Sub Arw(Optional LType As Integer)
Dim P1 As Variant, P3 As Variant
Dim Pa(0 To  As Double, Pd(0 To 11) As Double
Dim myArrow As AcadLeader
Dim annotationObject As AcadObject
Dim myCircle As AcadCircle
Dim myDonut As AcadLWPolyline
Dim myText As AcadText
Dim myLayer As AcadLayer
Dim LayEx1 As Boolean, LayEx2 As Boolean
Dim txtItem As String, txtQuan As String
Dim myScale, CircleRad, Prompt$
Dim defItemLayer As String, defQLayer As String
Dim LeaderDir As Integer, i As Integer, CurrentQ As Integer
On Error Resume Next
defItemLayer = "ItemNo"
defQLayer = "ItemQ"
myScale = ThisDrawing.GetVariable("DIMSCALE")
CircleRad = 5 * myScale
CurrentQ = ThisDrawing.GetVariable("USERI5") + 1
For i = 0 To ThisDrawing.Layers.Count - 1
   If ThisDrawing.Layers.Item(i).Name = defItemLayer Then LayEx1 = True
   If ThisDrawing.Layers.Item(i).Name = defQLayer Then LayEx2 = True
   Next
If Not LayEx1 Then
   ThisDrawing.Layers.Add (defItemLayer)
   ThisDrawing.Layers.Item(defItemLayer).color = acGreen
   End If
   
If Not LayEx2 Then
   ThisDrawing.Layers.Add (defQLayer)
   ThisDrawing.Layers.Item(defQLayer).color = acMagenta
   End If
Set annotationObject = Nothing
P1 = ThisDrawing.Utility.GetPoint(, "Leader start")
If Err <> 0 Then Exit Sub
P3 = ThisDrawing.Utility.GetPoint(P1, "item centre ")
If P1(0) < P3(0) Then LeaderDir = 1 Else LeaderDir = -1
Pa(0) = P1(0): Pa(1) = P1(1): Pa(2) = P1(2)
Pa(3) = P3(0) - 1.5 * CircleRad * LeaderDir: Pa(4) = P3(1): Pa(5) = P3(2)
Pa(6) = P3(0) - CircleRad * LeaderDir: Pa(7) = Pa(4): Pa( = Pa(5)
Prompt$ = "Item no. <" & Trim(CurrentQ) & "> "
txtItem = ThisDrawing.Utility.GetString(False, Prompt$)
If txtItem = "" Then txtItem = Trim(CurrentQ)
CurrentQ = txtItem
ThisDrawing.SetVariable "USERI5", CurrentQ
txtQuan = ThisDrawing.Utility.GetString(False, "No off ")
'force LType to withArrow until donut sorted
'LType = 2
If LType = 0 Then
   Pd(0) = Pa(0) - 0.25 * myScale
   Pd(1) = Pa(1)
   Pd(2) = Pa(0) + 0.25 * myScale
   Pd(3) = Pa(1)
   Pd(4) = Pd(0)
   Pd(5) = Pd(1)
   Pd(6) = Pa(0)
   Pd(7) = Pa(1)
   Pd( = Pa(3)
   Pd(9) = Pa(4)
   Pd(10) = Pa(6)
   Pd(11) = Pa(7)
   
   Set myDonut = ThisDrawing.ModelSpace.AddLightWeightPolyline(Pd)
   myDonut.SetBulge 0, 1
   myDonut.SetBulge 1, 1
   myDonut.ConstantWidth = 0
   myDonut.SetWidth 0, myScale / 2, myScale / 2
   myDonut.SetWidth 1, myScale / 2, myScale / 2
   Else
   Set myArrow = ThisDrawing.ModelSpace.AddLeader(Pa, annotationObject, LType)
   End If
   
Set myCircle = ThisDrawing.ModelSpace.AddCircle(P3, CircleRad)
Set myText = ThisDrawing.ModelSpace.AddText(txtItem, P3, 3.5 * myScale)
myText.Alignment = acAlignmentMiddle
myText.TextAlignmentPoint = P3
myText.Layer = "ItemNo"
myText.ScaleFactor = 0.8
myCircle.color = acCyan
If txtQuan <> "" Then
   'ADD 2nd text line here
   P3(0) = P3(0) + CircleRad
   P3(1) = P3(1) + 0.5 * CircleRad
   Set myText = ThisDrawing.ModelSpace.AddText(txtQuan, P3, 2.5 * myScale)
   myText.Layer = "ItemQ"
   myText.ScaleFactor = 0.8
   End If
   
End Sub
Public Sub ItemArrow()
Call Arw(2)
End Sub
Public Sub ItemBlob()
Call Arw(0)
End Sub

 

and start with

^C^Cvbastmt;arw(2); 

Posted

Here is one I use :

 

;; by paulmcz


(defun incr ()
 (princ "\n Increment part numbers? <Y>:")
 (setq ans (getstring))
 (if (or (= ans "n")(= ans "N"))()
 (if (= ans "")(progn (setq inn2 (atoi inn))
	    (setq inn3 (1+ inn2))
	    (setq inn (itoa inn3)))(setq inn ans)
 ))
 (setq sl (strlen inn))
 (if (or (= ans "n")(= ans "N"))()
 (cond
   ((= sl 1)(setq inn (strcat "00" inn)))
   ((= sl 2)(setq inn (strcat "0" inn)))
   (T nil)
 ))
)

(defun c:bn (/ in is)
 
 (setq	cmd (getvar "cmdecho")
osm (getvar "osmode")
 )
 (setvar "cmdecho" 0)
 (setq is (getpoint "\n Arrow point: "))
 (setq cc (getpoint is "\n Center point of balloon: "))
 (if inn
   ()
   (setq inn "000")
 )
 (incr)
 (princ "\n Part number < ")
 (princ inn)
 (princ " >? :")
 (setq in (getstring))
 (if (= in "")
   (setq in inn)
 )
 (setq inn in)
 (if imm () (setq imm "000"))
 (princ "\n Sheet number < ")
 (princ imm)
 (princ " >? :")
 (setq im (getstring))
 (if (= im "")(setq im imm))
 (setq imm im)
 (setq ds (getvar "dimscale"))
 (if (and (> ds 0)(/= ds nil)) ()(setq ds 1.0))
 (setq th (getvar "dimtxt"))
 (setq cd (* th 4.0))
 (setq dia (* cd ds))
 (setq txt (* th ds))
 (setq rad (/ dia 2))
 (setq ptl1 (list (- (car cc) rad) (cadr cc)))
 (setq ptl2 (list (+ (car cc) rad) (cadr cc)))
 (setq ptt1 (list (car cc) (+ (cadr cc) (* 0.8 txt))))
 (setq ptt2 (list (car cc) (- (cadr cc) (* 0.8 txt))))
 (setvar "osmode" 0)
 (command "circle" cc rad)
 (command ".line" ptl1 ptl2 "")
 (entmake (list (cons 0 "TEXT")	
	 (cons 10 ptt1)	
	 (cons 11 ptt1)		
	 (cons 1 in)	
	 (cons 7 (getvar "TEXTSTYLE"))
	 (cons 40 (* txt 0.)
	 (cons 72 4)
   )
 )
 (entmake (list (cons 0 "TEXT")
	 (cons 10 ptt2)		
	 (cons 11 ptt2)		
	 (cons 1 im)		
	 (cons 7 (getvar "TEXTSTYLE"))
	 (cons 40 (* txt 0.)
	 (cons 72 4)
   )
 )
 (command "leader"
   is
   (polar is
	  (angle is cc)
	  (- (distance is cc) rad)
   )
   ""
   ""
   "n"
   ^c^c
 )
 (setvar "cmdecho" cmd)
 (setvar "osmode" osm)
 (princ)
)
(prompt "\ntype < bn > to start Split Balloon with Leader")

;; Original version by Mr Randy

Posted

Here are the (2) lisp routines I promised to create balloons using plain text.

 

I do have another one (if anyone is interested) that will create attributes rather than plain text.

 

Feel free to use and modify as you wish.

 

The first one uses arrowheads that snap (nearest) and the second one uses a dot without any osnaps used.

 

The leader, balloon, and text size are created based on current dimscale.

 

They work on all versions of autocad since 2002, they are a bit old, and could probably have been done a little cleaner. But they work great for me. Let me know if I can be of further help.

 

 

 

 

 

 
(defun c:bln-a (/ cc in is)
(prompt "Balloon")
       (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)
 (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" "" "" "" "" "" "" "")
 (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)
 (princ)
)

 

 

(defun c:bln-b (/ cc in is)
(prompt "Balloon")
      (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)

    (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" "" "" "" "" "" "" "") 
  (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)
) 

  • 1 month later...
Posted

Any lisp routines to create balloons using Mtext? We don't use leaders on our ballons, instead we have a solid object from the box pointing to the object. We have a lisp routine for this to only work with plain text, but we would love one to work with Mtext.

 

I can supply the plain text lisp routine if it can help create one to work with Mtext. Let me know. Thanks!

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...