Bubble Trouble

Bubble Trouble

Anonymous
Not applicable
352 Views
24 Replies
Message 1 of 25

Bubble Trouble

Anonymous
Not applicable
I want to create a menu button that calls qleader and applies a bubble to
the end. My Qleader settings are set to block referance, I have created a
circle with an attribute (called bubble) and setr up a button on my menu
bar. The command lilne is:
^C^CQleader;\\\bubble;@7<0;;;
Works great except... I can only insert the bubble at 0 degrees from the
last point. (or any other set angle that I choose.
I can retrieve the lastangle variable:
(setq lsta (getvar "LASTANGLE")
But I cannot sem to apply it to the end of my line. (the bubble is 14" in
diameter, inserted in model space, it scales down) hence the 7.
What I would like is to insert the bubble block @7
I'm missing something
Help?

Michael Hager
Stainless Incorporated
0 Likes
353 Views
24 Replies
Replies (24)
Message 2 of 25

Anonymous
Not applicable
Michael,

Try the following:

^C^C^PQleader;\\\bubble;(polar (getvar "lastpoint") (getvar "lastangle")
7.0);;
--
Dave D
(remove '-' for Email)

Michael Hager wrote in article
<7vverl$fhl31@adesknews2.autodesk.com>...
> I want to create a menu button that calls qleader and applies a bubble to
> the end. My Qleader settings are set to block referance, I have created
a
> circle with an attribute (called bubble) and setr up a button on my menu
> bar. The command lilne is:
> ^C^CQleader;\\\bubble;@7<0;;;
> Works great except... I can only insert the bubble at 0 degrees from the
> last point. (or any other set angle that I choose.
> I can retrieve the lastangle variable:
> (setq lsta (getvar "LASTANGLE")
> But I cannot sem to apply it to the end of my line. (the bubble is 14"
in
> diameter, inserted in model space, it scales down) hence the 7.
> What I would like is to insert the bubble block @7
> I'm missing something
> Help?
>
> Michael Hager
> Stainless Incorporated
>
>
>
>
0 Likes
Message 3 of 25

Anonymous
Not applicable
Doesn't work for me...
It still sets the bubble at 0 degrees from the last point. I want to set
the center of the bubble 7 inches from the last point at the same angle as
the last line.
???

Michael Hager

David Doane wrote in message
news:01bf2806$28051600$4cb400d0@lms-1...
> Michael,
>
> Try the following:
>
> ^C^C^PQleader;\\\bubble;(polar (getvar "lastpoint") (getvar "lastangle")
> 7.0);;
> --
> Dave D
> (remove '-' for Email)
>
> Michael Hager wrote in article
> <7vverl$fhl31@adesknews2.autodesk.com>...
> > I want to create a menu button that calls qleader and applies a bubble
to
> > the end. My Qleader settings are set to block referance, I have created
> a
> > circle with an attribute (called bubble) and setr up a button on my menu
> > bar. The command lilne is:
> > ^C^CQleader;\\\bubble;@7<0;;;
> > Works great except... I can only insert the bubble at 0 degrees from the
> > last point. (or any other set angle that I choose.
> > I can retrieve the lastangle variable:
> > (setq lsta (getvar "LASTANGLE")
> > But I cannot sem to apply it to the end of my line. (the bubble is 14"
> in
> > diameter, inserted in model space, it scales down) hence the 7.
> > What I would like is to insert the bubble block @7
> > I'm missing something
> > Help?
> >
> > Michael Hager
> > Stainless Incorporated
> >
> >
> >
> >
0 Likes
Message 4 of 25

Anonymous
Not applicable
Michael,

It must have something to do with Qleader and Leader. Although it works
fine for Line, I could not get anything to work for the leaders.

I have a substitute autolisp program for leaders that I can modify for you
if you like. With it, you can draw as many segments as you wish, and it
will draw a continuous polyline complete with arrowhead. The arrowhead
size is currently based on a factor of textsize, I think, but I can change
that to dimasz.

The only problem is that while the arrowhead is part of the polyline, if
you swing (stretch) the polyline, the arrowhead does not swing with it.
Then again, neither would the bubble.

Another solution I just thought of. Perhaps you could utilize the leader
command with no annotation, then insert the bubble block as a continued
command utilizing the (polar (getvar "lastpoint") (getvar "lastangle")
7.0).

I must get on to other things at the moment, but let me know and I will try
to do something tonight.
--
Dave D
(remove '-' for Email)

Michael Hager wrote in article
<8017um$k491@adesknews2.autodesk.com>...
> Doesn't work for me...
> It still sets the bubble at 0 degrees from the last point. I want to set
> the center of the bubble 7 inches from the last point at the same angle
as
> the last line.
> ???
>
> Michael Hager
>
> David Doane wrote in message
> news:01bf2806$28051600$4cb400d0@lms-1...
> > Michael,
> >
> > Try the following:
> >
> > ^C^C^PQleader;\\\bubble;(polar (getvar "lastpoint") (getvar
"lastangle")
> > 7.0);;
> > --
> > Dave D
> > (remove '-' for Email)
> >
> > Michael Hager wrote in article
> > <7vverl$fhl31@adesknews2.autodesk.com>...
> > > I want to create a menu button that calls qleader and applies a
bubble
> to
> > > the end. My Qleader settings are set to block referance, I have
created
> > a
> > > circle with an attribute (called bubble) and setr up a button on my
menu
> > > bar. The command lilne is:
> > > ^C^CQleader;\\\bubble;@7<0;;;
> > > Works great except... I can only insert the bubble at 0 degrees from
the
> > > last point. (or any other set angle that I choose.
> > > I can retrieve the lastangle variable:
> > > (setq lsta (getvar "LASTANGLE")
> > > But I cannot sem to apply it to the end of my line. (the bubble is
14"
> > in
> > > diameter, inserted in model space, it scales down) hence the 7.
> > > What I would like is to insert the bubble block @7
> > > I'm missing something
> > > Help?
> > >
> > > Michael Hager
> > > Stainless Incorporated
> > >
> > >
> > >
> > >
>
>
>
0 Likes
Message 5 of 25

Anonymous
Not applicable
I will try the seperate command suggestion... have to get home right now,
but I'll give it a shot on Monday morning. Thanks for the suggestions, I'll
get it right sooner or later.

Michael Hager

David Doane wrote in message
news:01bf286d$256cd920$4256d2d0@lms-1...
> Michael,
>
> It must have something to do with Qleader and Leader. Although it works
> fine for Line, I could not get anything to work for the leaders.
>
> I have a substitute autolisp program for leaders that I can modify for you
> if you like. With it, you can draw as many segments as you wish, and it
> will draw a continuous polyline complete with arrowhead. The arrowhead
> size is currently based on a factor of textsize, I think, but I can change
> that to dimasz.
>
> The only problem is that while the arrowhead is part of the polyline, if
> you swing (stretch) the polyline, the arrowhead does not swing with it.
> Then again, neither would the bubble.
>
> Another solution I just thought of. Perhaps you could utilize the leader
> command with no annotation, then insert the bubble block as a continued
> command utilizing the (polar (getvar "lastpoint") (getvar "lastangle")
> 7.0).
>
> I must get on to other things at the moment, but let me know and I will
try
> to do something tonight.
> --
> Dave D
> (remove '-' for Email)
>
> Michael Hager wrote in article
> <8017um$k491@adesknews2.autodesk.com>...
> > Doesn't work for me...
> > It still sets the bubble at 0 degrees from the last point. I want to
set
> > the center of the bubble 7 inches from the last point at the same angle
> as
> > the last line.
> > ???
> >
> > Michael Hager
> >
> > David Doane wrote in message
> > news:01bf2806$28051600$4cb400d0@lms-1...
> > > Michael,
> > >
> > > Try the following:
> > >
> > > ^C^C^PQleader;\\\bubble;(polar (getvar "lastpoint") (getvar
> "lastangle")
> > > 7.0);;
> > > --
> > > Dave D
> > > (remove '-' for Email)
> > >
> > > Michael Hager wrote in article
> > > <7vverl$fhl31@adesknews2.autodesk.com>...
> > > > I want to create a menu button that calls qleader and applies a
> bubble
> > to
> > > > the end. My Qleader settings are set to block referance, I have
> created
> > > a
> > > > circle with an attribute (called bubble) and setr up a button on my
> menu
> > > > bar. The command lilne is:
> > > > ^C^CQleader;\\\bubble;@7<0;;;
> > > > Works great except... I can only insert the bubble at 0 degrees from
> the
> > > > last point. (or any other set angle that I choose.
> > > > I can retrieve the lastangle variable:
> > > > (setq lsta (getvar "LASTANGLE")
> > > > But I cannot sem to apply it to the end of my line. (the bubble is
> 14"
> > > in
> > > > diameter, inserted in model space, it scales down) hence the 7.
> > > > What I would like is to insert the bubble block @7
> > > > I'm missing something
> > > > Help?
> > > >
> > > > Michael Hager
> > > > Stainless Incorporated
> > > >
> > > >
> > > >
> > > >
> >
> >
> >
0 Likes
Message 6 of 25

Anonymous
Not applicable
David,

> utilizing the (polar (getvar "lastpoint") (getvar "lastangle")
>

That won't work (at least in R14), because creating a LEADER object
doesn't modify LASTANGLE (although LWPLINES do, which is what the
LEADER explodes into).

So, I think if you use LEADER or QLEADER to create the leader, you will
have to extract the list of vertices and calculate the angle between
the last two vertices.

Matt Stachoni recently posted an elegant function to extract pline
vertices, which can be used for leaders as well:

;; Code after Matt Stachoni 11/99
;; Return lwpolyline vertices
(defun GetVerts (e)
(apply 'append
(mapcar
'(lambda (x)
(if (= 10 (car x))
(list (cdr x))
)
)
e
)
)
)

so, you could (getverts(entget(entlast))) on the leader, and calculate
the angle between the last two members of the list.

Example:

Command: (entget(entlast))
((-1 . ) (0 . "LEADER") (5 . "E0") (100 .
"AcDbEntity")
(67 . 0) (8 . "ANNOBJ") (100 . "AcDbLeader") (3 . "STANDARD$7") (71 .
1) (72 .
0) (73 . 3) (74 . 1) (75 . 0) (40 . 0.0) (41 . 0.0) (76 . 3) (10
15.0917
4.34551 0.0) (10 15.2204 4.67876 0.0) (10 15.4048 4.49752 0.0) (77 .
256) (340
) (211 1.0 0.0 0.0) (210 0.0 0.0 1.0) (212 0.0 0.0
0.0) (213
0.0 0.0 0.0))

Command: (getverts(entget(entlast)))
((15.0917 4.34551 0.0) (15.2204 4.67876 0.0) (15.4048 4.49752 0.0))

Actually, I would prefer to modify Matt's function to work with any
instance of multiple group codes:

;; Build a list of multiple assoc codes
;; Based on code by Matt Stachoni 11/99.
(defun GetMultAssoc (n e)
(apply 'append
(mapcar
'(lambda (x)
(if (= n (car x))
(list (cdr x))
)
)
e
)
)
)

As you have stated, a leader created with an "associated" block will
not have the block re-oriented to the last leader segment if the
block/leader gets stretched (maybe some brave soul knows how to do this
with reactors - not I :). So, there seems to be little benefit to
"associating" the block to the leader..

hm
0 Likes
Message 7 of 25

Anonymous
Not applicable
Herman,

NOW you tell me! After I spent an hour finding that out the hard way.
For a last leader angle of 90, lastangle reports 9, and (getvar
"lastangle") the radial equivalent.

I finally had to give up and just create the points first, then apply
leader/qleader to them.

Matt's program (and your variation) would work great. Only one problem for
me. A string or selection set I can handle, but I know next to nothing
about finding the length of a list, and how to manipulate nth. Might be an
interesting project and an excellent way to learn when I get time.

Meanwhile, I will post to Michael what I came up with. Perhaps you could
come up with something along the lines of your thinking. Ideally, running
the leader utilizing cmdactive would allow as many segments as desired.
However, I never could end that sucker correctly.

Thanks for the info.
--
Dave D
(remove '-' for Email)

Herman Mayfarth wrote in article
...
> David,
>
> > utilizing the (polar (getvar "lastpoint") (getvar "lastangle")
> >
>
> That won't work (at least in R14), because creating a LEADER object
> doesn't modify LASTANGLE (although LWPLINES do, which is what the
> LEADER explodes into).
>
> So, I think if you use LEADER or QLEADER to create the leader, you will
> have to extract the list of vertices and calculate the angle between
> the last two vertices.
>
> Matt Stachoni recently posted an elegant function to extract pline
> vertices, which can be used for leaders as well:
>
> ;; Code after Matt Stachoni 11/99
> ;; Return lwpolyline vertices
> (defun GetVerts (e)
> (apply 'append
> (mapcar
> '(lambda (x)
> (if (= 10 (car x))
> (list (cdr x))
> )
> )
> e
> )
> )
> )
>
> so, you could (getverts(entget(entlast))) on the leader, and calculate
> the angle between the last two members of the list.
>
> Example:
>
> Command: (entget(entlast))
> ((-1 . ) (0 . "LEADER") (5 . "E0") (100 .
> "AcDbEntity")
> (67 . 0) (8 . "ANNOBJ") (100 . "AcDbLeader") (3 . "STANDARD$7") (71 .
> 1) (72 .
> 0) (73 . 3) (74 . 1) (75 . 0) (40 . 0.0) (41 . 0.0) (76 . 3) (10
> 15.0917
> 4.34551 0.0) (10 15.2204 4.67876 0.0) (10 15.4048 4.49752 0.0) (77 .
> 256) (340
> ) (211 1.0 0.0 0.0) (210 0.0 0.0 1.0) (212 0.0 0.0
> 0.0) (213
> 0.0 0.0 0.0))
>
> Command: (getverts(entget(entlast)))
> ((15.0917 4.34551 0.0) (15.2204 4.67876 0.0) (15.4048 4.49752 0.0))
>
> Actually, I would prefer to modify Matt's function to work with any
> instance of multiple group codes:
>
> ;; Build a list of multiple assoc codes
> ;; Based on code by Matt Stachoni 11/99.
> (defun GetMultAssoc (n e)
> (apply 'append
> (mapcar
> '(lambda (x)
> (if (= n (car x))
> (list (cdr x))
> )
> )
> e
> )
> )
> )
>
> As you have stated, a leader created with an "associated" block will
> not have the block re-oriented to the last leader segment if the
> block/leader gets stretched (maybe some brave soul knows how to do this
> with reactors - not I :). So, there seems to be little benefit to
> "associating" the block to the leader..
>
>
> hm
>
>
>
0 Likes
Message 8 of 25

Anonymous
Not applicable
Michael,

It seems that leader and qleader are weird suckers, and they don't produce
a 'lastangle' like other stuff does. So far, the best I could come up with
is as follows, and that is an AutoLISP program. You may have to modify the
'insert' ending to handle your attribute, as I was simply inserting a
blocked circle.

(defun C:BUBBLE (/ pnt1 pnt2 pnt3 pnt4 ang1)
(setq pnt1 (getpoint "\nStart point for arrow: ")
pnt2 (getpoint pnt1 "\nNext point: ")
pnt3 (getpoint pnt2 "\nNext point: ")
ang1 (angle pnt2 pnt3)
pnt4 (polar pnt3 ang1 7.0) ) ;setq
(command ".leader" pnt1 pnt2 pnt3 "" "" "n")
(if (= "15" (substr (getvar "acadver") 1 2))
(command ".-insert" "bubble" pnt4 "" "" "") ;for A2K
(command ".insert" "bubble" pnt4 "" "" "") ;for R14
) ;if
(princ)
)

--
Dave D
(remove '-' for Email)

Michael Hager wrote in article
<801ugi$k5p8@adesknews2.autodesk.com>...
> I will try the seperate command suggestion... have to get home right now,
> but I'll give it a shot on Monday morning. Thanks for the suggestions,
I'll
> get it right sooner or later.
>
> Michael Hager
0 Likes
Message 9 of 25

Anonymous
Not applicable
David,

> Ideally, running
> the leader utilizing cmdactive would allow as many segments as desired.

Well, I really don't like calling (command), so I wrote a function to
entmake leaders, without annotation or hooklines (relax, I didn't do that
this afternoon:). Using that function and one which applies a suitable
scaling factor to blocks, etc., here is what I came up with:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Bubble.LSP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Created: Nov 1998
;;; Current file: 6 Nov. 1999
;;; Version: 1.0
;;; Author: Herman Mayfarth (c) 1999
;;; Purpose: Creates callout bubbles with leaders
;;;
;;; Provided as is. Permission granted to freely use & redistribute
;;; without fee provided this notice remains intact.
;;; Notice also applies to external functions.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Function C:BUBBLE
; Purpose: draws leader with callout bubble
; Needs: user input of points
; External functions: tktn_ldr,tktn_setscl
; Block definition: mk_bubl0 (that's a zero)
; with a circle of radius 0.17, somewhere on your search path
; Returns: nil
; Autoscales the block insert, based on sf set by tktn_setscl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:BUBBLE ( /
;;local functions
*lerror*
extbbl
;;local symbols
bblrad
olderr
pathtype
larwlayer
ldrtyp
rtlist
lastpt
sf
inspt
)
;;local error handler
(defun *lerror*(msg)
(extbbl)
(command "_.UNDO" "GROUP")
(command "_.REDRAW")
(if
(or
(= msg "Function cancelled")
(= msg "quit / exit abort")
)
(princ)
(princ (strcat "\nError: " msg))
);end if
(princ)
);end *lerror*
;; exit function
(defun extbbl ()
(command "_.UNDO" "END")
(setq *error* olderr)
(princ)
); end extbbl
(command "_.UNDO" "BEGIN")
(setq olderr *error*
*error* *lerror*)
(setq bblrad 0.170);this may change if using an alternate block
(setq larwlayer (getvar "CLAYER"));use current layer
(initget "Spline STraight")
(setq pathtype (getkword "\nLeader Pathtype: Spline "))
(cond ((equal pathtype "Spline" )(setq pathtype 1))
(T (setq pathtype 0))
);cond

(setq rtlist (tktn_ldr pathtype larwlayer nil)
sf (tktn_setscl)
lastpt (cadr rtlist)
inspt (polar lastpt (angle (car rtlist) lastpt) (* bblrad sf))
)
(setvar "TEXTEVAL" 1)
(command "_.INSERT" "MK_BUBL0" inspt sf sf 0.0 pause)
(setvar "TEXTEVAL" 0)
(extbbl)
(princ)
);end C:BUBBLE
;; Prompt at load time
(prompt " \nBubble Copyright(c) 1999 by Herman Mayfarth.")
(prompt " \nType BUBBLE to run.")
(princ)

;;here are the external functions:

;;;---------------------tktn_ldr-------------------------------
;;; function to entmake leaders, forward or backward
;;; Uses: pthtyp: 0 = straight, 1 = splined
;;; arwlayer: string specifies layer
;;; ldrtyp: nil = forward, non-nil = backward
;;; Returns: rtlist: list containing last 2 points selected
;;;-------------------------------------------------------------
(defun tktn_ldr (pthtyp arwlayer ldrtyp / p1 p2 |p1 |p2 dimsty nvert
ptlist rtlist elist)
(setq dimsty (getvar "DIMSTYLE"))
(if (tblsearch "DIMSTYLE" (strcat (getvar "DIMSTYLE") "$7"))
(setq dimsty (strcat dimsty "$7"));defaults to parent style
); ;if no leader child exists
(setq elist (list'(0 . "LEADER")
'(100 . "AcDbEntity") ;required!
'(100 . "AcDbLeader") ;what it is
(cons 3 dimsty) ;dimension style
(cons 8 arwlayer) ;layer
(cons 71 1) ;arrow flag
(cons 72 pthtyp) ;path type
)
);setq
(setq |p1 (getpoint "\nEnd of Leader:")
p1 (trans |p1 1 0)
ptlist (list (cons 10 p1))
)
(while (setq |p2 (getpoint |p1 "\n Next Point:"))
(progn
(setq p2 (trans |p2 1 0))
(grdraw |p1 |p2 -1)
(setq ptlist (cons (cons 10 p2) ptlist)
|p1 |p2)
);progn
);while
(if (< 1 (length ptlist))
(progn
(setq nvert (length ptlist)
rtlist (list (cdadr ptlist)
(cdar ptlist))
)
(if (null ldrtyp) (setq ptlist (reverse ptlist)));T draws ldr
backward
(setq elist (append elist (list(cons 76 nvert)) ptlist
(list(cons 77 256))))
(entmake elist)
(command "_.REDRAW")
);progn
(princ "\nNot enough points!\n")
);if
rtlist;last two points selected
);end tktn_ldr

;;--------------------- tktn_setscl--------------------------------------
;; Purpose: calculate scale factor
;; Uses: nothing
;; Returns: sf
;; local symbols
;; curvpt: current viewport (integer - not saved by drawing)
;;-----------------------------------------------------------------
(defun tktn_setscl( / curvpt )
(setq curvpt (getvar "CVPORT"))
(cond ((= 1 (getvar "TILEMODE")) (setq sf (getvar "DIMSCALE")));tiled
space
((= 1 curvpt) (setq sf 1.0));in paper space
;; in a viewport
(T
(setq sf (last (trans '(0 0 1.0) 3 2)));calc scale factor
)
);cond
);end tktn_setscl

Now all you need is a bubble block.
You can use my radius value of 0.170 and block name "mk_bubl0"
or change those to suit your own purposes.

>finding the length of a list

Nothing to it:

Command: (setq l1 (list '("foo" "bar" 1.0)))
(("foo" "bar" 1.0))

Command: (length l1)
1

Command: (setq l2 (list "foo" "bar" 0.0))
("foo" "bar" 0.0)

Command: (length l2)
3

Only thing to remember about (nth) is that the index starts with 0:

Command: (nth 1 l2)
"bar"

Criticisms welcome:).

hm
0 Likes
Message 10 of 25

Anonymous
Not applicable
Oops - forgot to (trans) the inspt.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Bubble.LSP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Created: Nov 1998
;;; Current file: 6 Nov. 1999
;;; Version: 1.1
;;; Author: Herman Mayfarth
;;; Purpose: Creates callout bubbles with leaders
;;;----------------------------------------------------------
;;; Added trans of (inspt) & changed *lerror* UNDO
;;; 11/6/99
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; function C:BUBBLE
; Purpose: draws leader with callout bubble
; Needs: user input of points
; External functions: tktn_ldr,tktn_setscl
; Block definition: mk_bubl0 (that's a zero)
; with a circle of radius 0.17, somewhere on your search path
; Returns: nil
; Autoscales the block insert, based on sf set by tktn_setscl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:BUBBLE ( /
;;local functions
*lerror*
extbbl
;;local symbols
bblrad
olderr
pathtype
larwlayer
ldrtyp
rtlist
lastpt
sf
inspt
)
;;local error handler
(defun *lerror*(msg)
(extbbl)
(command "_.UNDO" "")
(redraw)
(if
(or
(= msg "Function cancelled")
(= msg "quit / exit abort")
)
(princ)
(princ (strcat "\nError: " msg))
);end if
(princ)
);end *lerror*
;; exit function
(defun extbbl ()
(command "_.UNDO" "END")
(setq *error* olderr)
(princ)
); end extbbl
(command "_.UNDO" "BEGIN")
(setq olderr *error*
*error* *lerror*)
(setq bblrad 0.170);this may change if using an alternate block
(setq larwlayer (getvar "CLAYER"));use current layer
(initget "Spline STraight")
(setq pathtype (getkword "\nLeader Pathtype: Spline "))
(cond ((equal pathtype "Spline" )(setq pathtype 1))
(T (setq pathtype 0))
);cond

(setq rtlist (tktn_ldr pathtype larwlayer nil)
sf (tktn_setscl)
lastpt (cadr rtlist)
inspt (polar lastpt (angle (car rtlist) lastpt) (* bblrad sf))
inspt (trans inspt 0 1)
)
(setvar "TEXTEVAL" 1)
(command "_.INSERT" "MK_BUBL0" inspt sf sf 0.0 pause)
(setvar "TEXTEVAL" 0)
(extbbl)
(princ)
);end C:BUBBLE
;; Prompt at load time
(prompt " \nBubble Copyright(c) 1999 by Herman Mayfarth.")
(prompt " \nType BUBBLE to run.")
(princ)

hm
0 Likes
Message 11 of 25

Anonymous
Not applicable
A wee little Tweek...

Speaking for myself, I don't like the enter required to get past spline or straight each
time,
It should allow point selection, or Spline or Straight right from the get go. I would
also
work in a rolling default - set it to spline and thats the new default.

That's not the tweek though...
I tried it and my leader arrow heads didn't resize based on dimscale?
The tweek adds xdata to the leader so the arrow size is correct
(I think so anyway - might need more tweeking) I didn't use your
scale factor value in the Xdata - and I just skimmed the function so far.

I would also see if the first two point picks, could be used to put in a fake
leader entity just for visual consistency (the two point leader is then erased
just before the entmake'd leader).

I've never tried to entmake a leader entity before so I thought I'd check this out.
(I did write my own leader command, but I just used (command "leader" etc...))

Nice routine.

P.Farrell
0 Likes
Message 12 of 25

Anonymous
Not applicable
Michael,

What ever happened to that simple menu macro??

I believe the reason the block as part of leader/qleader will always insert
at zero is that 'leader' and 'qleader' treat it like text, which is usually
placed horizontal.

Here are three ideas, for whatever they may be worth. These seem to work
in R14 and A2K. Unless I wanted to be bound by a set number of segments
(two, in this case), I would use the last one, "Bubble". Since the whole
thing is not associative, I see no reason to utilize leader or qleader.

; Two segment leader with bubble insert
(defun c:BUBB (/ pnt1 pnt2 pnt3 pnt4 ang1)
(setq pnt1 (getpoint "\nSpecify leader start point: ")
pnt2 (getpoint pnt1 "\nSpecify next point: "))
(grdraw pnt1 pnt2 -1)
(setq pnt3 (getpoint pnt2 "\nSpecify next point: ")
ang1 (angle pnt2 pnt3)
pnt4 (polar pnt3 ang1 7.0) ) ;setq
(command "redraw" ".leader" pnt1 pnt2 pnt3 "" "" "n")
(if (= "15" (substr (getvar "acadver") 1 2))
(command ".-insert" "bubble" pnt4 "" "" "")
(command ".insert" "bubble" pnt4 "" "" "")
) ;if
(princ)
) BUBB
; ********
; Two segment leader with bubble insert
(defun C:BUBBL (/ llst plst pnt1 pnt2 pnt3 ang1)
(prompt "\nSpecify leader points: ")
(command ".leader" pause pause pause "" "" "n")
(setq plst (getverts (entget (entlast))))
(setq llst (length plst))
(setq pnt1 (nth (- llst 2) plst))
(setq pnt2 (nth (- llst 1) plst))
(setq ang1 (angle pnt1 pnt2))
(setq pnt3 (polar pnt2 ang1 7.0))
(if (= "15" (substr (getvar "acadver") 1 2))
(command ".-insert" "bubble" pnt3 "" "" "")
(command ".insert" "bubble" pnt3 "" "" "")
) ;if
(princ)
) ;BUBBL

;; Code after Matt Stachoni 11/99
;; Return lwpolyline vertices
(defun GetVerts (e)
(apply 'append
(mapcar
'(lambda (x)
(if (= 10 (car x))
(list (cdr x))
)
)
e
)
)
) ;GetVerts
; ********
; Multi-segment polyline leader with bubble insert
(defun C:BUBBLE (/ asiz awid pnt1 pnt2 pnt3 pnt4 ang1)
(if (setq pnt1 (getpoint ".\nSpecify leader start point: \n")) (progn
(setq asiz (* (getvar "dimasz") (getvar "dimscale"))
awid (* 0.33 asiz) ) ;setq
(while (setq pnt3 (getpoint pnt1 ".\nSpecify next point: \n"))
(setq ang1 (angle pnt1 pnt3))
(if (not pnt2) (progn ;first segment?
(setq pnt2 (polar pnt1 ang1 asiz))
(command ".pline" pnt1 "w" 0.0 awid pnt2 "w" 0.0 0.0 pnt3) ) )
;progn, if
(command (setq pnt1 pnt3)) ;set point
(princ "\nPress Return for Bubble, or ..")
) ;while pnt3
(command "") ;end pline
(setq pnt4 (polar pnt1 ang1 7.0))
(if (= "15" (substr (getvar "acadver") 1 2))
(command ".-insert" "bubble" pnt4 "" "" "")
(command ".insert" "bubble" pnt4 "" "" "")
) ;if acadver
) );progn, if (pnt1)
(princ)
) ;BUBBLE
--
Dave D
(remove '-' for Email)

David Doane wrote in article
<01bf28cc$2d2c9880$e956d2d0@lms-1>...
> Michael,
>
> It seems that leader and qleader are weird suckers, and they don't
produce
> a 'lastangle' like other stuff does. So far, the best I could come up
with
> is as follows, and that is an AutoLISP program. You may have to modify
the
> 'insert' ending to handle your attribute, as I was simply inserting a
> blocked circle.
0 Likes
Message 13 of 25

Anonymous
Not applicable
Peter,

> Speaking for myself, I don't like the enter required to get past spline or straight each
> time,

Neither do I.

> It should allow point selection, or Spline or Straight right from the get go

Agreed. But I think this requires some work with grread (?) to distinguish between a
keypress (for options) and a pointing device pick to enter points. On my list...

>work in a rolling default - set it to spline and thats the new default.

OK - easy enough. Not doing that today, though.

>I tried it and my leader arrow heads didn't resize based on dimscale?

Correct. The function as posted just picks up the current dimstyle.

>The tweek adds xdata to the leader so the arrow size is correct

I think you are working too hard to do this . I tried manually adjusting the arrow
size, using DDMODIFY (R14). The only xdata I see added is group 40:

* Registered Application Name: ACAD
* Code 1000, ASCII string: DSTYLE
* Code 1002, Starting or ending brace: {
* Code 1070, 16-bit integer: 40
* Code 1040, Real number: 8.0000
* Code 1002, Starting or ending brace: }

So, here is my kludgy way of doing this.
This is a kludge because it doesn't need to happen in certain
circumstances, which you can easily figure out, so you get
xdata whether you need it or not, but it does work.
I don't have time to do it correctly, right now.:)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; *unconditionally* adds xdata to scale the leader arrow size,
;; based on the value returned by tktn_setscl,
;; based on a suggestion by Peter Farrell 11/7/99
(setq elist (append elist (list (list
'-3
(list
"ACAD"
'(1000 . "DSTYLE")
'(1002 . "{")
'(1070 . 40)
(cons 1040 (tktn_setscl))
'(1002 . "}")
)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

The value returned by tktn_setscl is the following:

;; dimscale <-TILEMODE=1
;; 1 <-in paper space
;; viewport scale <-in a viewport

So, the above code will rescale the arrows in paper space, as well as
in a viewport, or if a dimscale override is set.

>I would also see if the first two point picks, could be used to put in a fake
>leader entity just for visual consistency

I think if you go to that trouble, you might as well call (command)
I wrote my leader entmake function to allow me to draw leaders backwards as well,
so I would not want to change my function, for that reason...but you might have other
ideas.:)

Thanks for your criticism!

I am attaching the updated file, V1.2.
There is an added (if) for the call to "INSERT", based on what David Doane posted in
message #34812. I do not have A2K to check this. Someone who does may wish to verify it.
Thanks.

hm
0 Likes
Message 14 of 25

Anonymous
Not applicable
Well, I figured out the length of a list, and how to use nth, easily
enough. but with a continuing command, cmdactive ain't worth sthpipth!

I couldn't get your (corrected) program to run just right, even after
making some adjustments to fit. I did discover that the bubble radius must
be set to the actual bubble radius, or you don't get a bubble. Never did
get the arrow head size to work. Seems like a lot of code for a simple
little leader, though.

I posted the three versions that I came up with for Michael, for whatever
they are worth. Maybe he can use one of them.

Thanks for the info and insight.
--
Dave D
(remove '-' for Email)

Herman Mayfarth wrote in article
...
> David,
>
> > Ideally, running
> > the leader utilizing cmdactive would allow as many segments as desired.
>
> Well, I really don't like calling (command), so I wrote a function to
> entmake leaders, without annotation or hooklines (relax, I didn't do that

> this afternoon:). Using that function and one which applies a suitable
> scaling factor to blocks, etc., here is what I came up with:
0 Likes
Message 15 of 25

Anonymous
Not applicable
Herman,

Using version 1.2:

After adjusting the bubble radius to fit my insert and the bubble name, It
works thusly:

The arrow size and bubble size scale according to the dimscale setting
correctly.

In R14 when the command is finished, I do not get a command prompt returned
until I pick a point. Then I just get the command prompt. If I just press
enter, sometimes I get just the command prompt, and sometimes this message:
Unknown command "BUBBLE". Press F1 for help.

In A2K when the command ends, I get a command prompt OK, but if then pick a
point, I get the following message:

Command: Specify opposite corner: _.UNDO
Invalid window specification.

Command: Specify opposite corner: _.UNDO
Invalid window specification.
; error: An error has occurred inside the *error* functionFunction
cancelled
Command: Specify opposite corner:

If I enter a command after running bubble, I get this message:

Command: bubble
Unknown command "BUBBLE". Press F1 for help.

Command: _.UNDO Enter the number of operations to undo or
[Auto/Control/BEgin/End/Mark/Back] <1>: END
Command:

Perhaps I will get a chance to look a the error code a little later. In
case you are wondering, it is not my generic *error* function as I
purposely spelled 'canceled' as such.
--
Dave D
(remove '-' for Email)

Herman Mayfarth wrote in article
...
> Peter,
>
> > Speaking for myself, I don't like the enter required to get past spline
or straight each
> > time,
>
> Neither do I.
>
> > It should allow point selection, or Spline or Straight right from the
get go
>
> Agreed. But I think this requires some work with grread (?) to
distinguish between a
> keypress (for options) and a pointing device pick to enter points. On my
list...
0 Likes
Message 16 of 25

Anonymous
Not applicable
David:

>I posted the three versions that I came up with for Michael, for whatever
>they are worth. Maybe he can use one of them.

FWIW, I have a bubble-leader function on my freebies page
(http://www.manusoft.com/freebies.htm). Perhaps it will help your cause. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
0 Likes
Message 17 of 25

Anonymous
Not applicable
Herman,

I found the problem. I wondered before why you had ended the insert
command with a 'pause', but it wasn't the focus of my attention. Removing
it allows a clean flawless operation in R13, R14, and A2K.

Now why do you need 'texteval'? It works OK with or without it.
--
Dave D
(remove '-' for Email)

David Doane wrote in article
<01bf295d$bf87ab20$3155d2d0@lms-1>...
> Herman,
>
> Using version 1.2:
>
> After adjusting the bubble radius to fit my insert and the bubble name,
It
> works thusly:
>
> The arrow size and bubble size scale according to the dimscale setting
> correctly.
>
> In R14 when the command is finished, I do not get a command prompt
returned
> until I pick a point. Then I just get the command prompt. If I just
press
> enter, sometimes I get just the command prompt, and sometimes this
message:
> Unknown command "BUBBLE". Press F1 for help.
>
> In A2K when the command ends, I get a command prompt OK, but if then pick
a
> point, I get the following message:
>
> Command: Specify opposite corner: _.UNDO
> Invalid window specification.
>
> Command: Specify opposite corner: _.UNDO
> Invalid window specification.
> ; error: An error has occurred inside the *error* functionFunction
> cancelled
> Command: Specify opposite corner:
>
> If I enter a command after running bubble, I get this message:
>
> Command: bubble
> Unknown command "BUBBLE". Press F1 for help.
>
> Command: _.UNDO Enter the number of operations to undo or
> [Auto/Control/BEgin/End/Mark/Back] <1>: END
> Command:
>
> Perhaps I will get a chance to look a the error code a little later. In
> case you are wondering, it is not my generic *error* function as I
> purposely spelled 'canceled' as such.
> --
> Dave D
> (remove '-' for Email)
>
> Herman Mayfarth wrote in article
> ...
> > Peter,
> >
> > > Speaking for myself, I don't like the enter required to get past
spline
> or straight each
> > > time,
> >
> > Neither do I.
> >
> > > It should allow point selection, or Spline or Straight right from the
> get go
> >
> > Agreed. But I think this requires some work with grread (?) to
> distinguish between a
> > keypress (for options) and a pointing device pick to enter points. On
my
> list...
>
>
>
0 Likes
Message 18 of 25

Anonymous
Not applicable
Hey! You've got some neat stuff there. I gotta come visit you more often.


I snatched the balloon program and I'll give it a shot.

How often have we re-invented the wheel? 😞 Of course this time it
evolved from a simple menu macro.

Thanks.
--
Dave D
(remove '-' for Email)

Owen Wengerd wrote in article
<804qvv$p0l13@adesknews2.autodesk.com>...
> David:
>
> >I posted the three versions that I came up with for Michael, for
whatever
> >they are worth. Maybe he can use one of them.
>
> FWIW, I have a bubble-leader function on my freebies page
> (http://www.manusoft.com/freebies.htm). Perhaps it will help your cause.
:)
> --
> Owen Wengerd
> President, ManuSoft ==> http://www.manusoft.com
> VP Americas, CADLock, Inc. ==> http://www.cadlock.com
>
>
>
0 Likes
Message 19 of 25

Anonymous
Not applicable
David,

> In R14 when the command is finished, I do not get a command prompt returned
> until I pick a point. Then I just get the command prompt. If I just press
> enter, sometimes I get just the command prompt, and sometimes this message:
> Unknown command "BUBBLE".
>

I dunno.?? Does your block have more than one attribute? V1.2 "assumes"
(yeah, I know) one attribute, so it will fail if your block has >1. I just
fixed that, so V1.3 should work with any number of attributes.
Maybe CMDECHO got turned off accidentally by something else? In that case you
would not see the attribute prompt(s).?

Here is the command line output I get, in R14, using V1.3, attached, and a
block with two attributes:

Loading L:\WRAP\ADESKNEW\Bubble3.lsp ...
Bubble V1.3 Copyright(c) 1999 by Herman Mayfarth.
Type BUBBLE to run.

Command: bubble
_.UNDO Auto/Control/BEgin/End/Mark/Back/: BEGIN
Command:
Leader Pathtype: Spline

End of Leader:
Next Point:
Next Point:
Next Point:
Next Point:
_.INSERT Block name (or ?): MK_BUBL0 Insertion point: X scale factor <1> /
Corner / XYZ: 1.000000000000000 Y scale factor (default=X):
1.000000000000000
Rotation angle <0>: 0.000000000000000
Enter attribute values
MARK1: a
MARK2: d

Command: _.UNDO Auto/Control/BEgin/End/Mark/Back/: END
Command:

Attached zip contains the dwg file named mk_bubl0.dwg with two attributes,
which I used for the above.

Sorry, I can't be of any use w.r.t. A2K, as I do not license that product.

Tnanks for taking the time to test the program.

hm
0 Likes
Message 20 of 25

Anonymous
Not applicable
David,

> why you had ended the insert
> command with a 'pause', but it wasn't the focus of my attention. Removing
> it allows a clean flawless operation in R13, R14, and A2K.

As Mr. Turvill is so fond of pointing out, "that only works because the open
"COMMAND" is the last statement in the function.":) The single pause allows
only one attribute value to be entered (sloppy coding), so V1.3 does this:

(if (> (distof (getvar "acadver") 2) 14.1)
(command "_.-INSERT" "MK_BUBL0" inspt sf sf 0.0);R15(?)
(command "_.INSERT" "MK_BUBL0" inspt sf sf 0.0);R14 & R13
)
(while (=(logand(getvar "CMDACTIVE")1)1)
(command pause))

>Now why do you need 'texteval'? It works OK with or without it.

Doesn't for me. Changing the first instance to:

(setvar "TEXTEVAL" 0) causes the program to charge right through the
attribute prompts, inserting the block with blank attributes:

_.INSERT Block name (or ?) : MK_BUBL0 Insertion point: X scale
factor <1> / Corner / XYZ: 1.000000000000000 Y scale factor (default=X):
1.000000000000000 Rotation angle <0>: 0.000000000000000
Enter attribute values
MARK1: \ MARK2: \<---gets interpreted as an
Command: _.UNDO Auto/Control/BEgin/End/Mark/Back/: END

Thanks for testing it with other releases.:)

hm
0 Likes