PDA

View Full Version : Explode Leaders


thomas-p
2006-06-23, 07:18 PM
Does anyone have a lisp routine that can explode all leaders in a drawing and that would also keep the object color rather than changing to bylayer.

Thanks

psu15635
2006-06-25, 08:54 PM
I don't have a lisp routine but here is a thought about how I might do it. It is a rather low level approach that assumes you are familiar with entity list manipulation but here is a first draft rough algorithm:

Get a selection set filtered by ENTITY = LEADER
for first element in selection set
get the entity data list
get the layer name the entity is on
table search the LAYER table for the layer record
get the color from the layer record
explode the first selection set
new selection set = PREVIOUS
FOR EACH entity in the new selection set
ename <-- the current entity
entityDataList <-- get data of current ename
layer <--- field 8 in entity list
newLayerDef <-- change color in layer dotted pair to new layer color
replace layer with newLayerDef in entityDataList
update with the revised entityDataList

this assumes all leaders are on the same layer, otherwise you would need to do the layer table search in the main loop. we use these weird arc leaders are that were created as arced plines and the arrow head is a varied width pline. when you explode them, you lose the arrow head and have to go back and put an aligned triangular solid at the arrow head. hopefully you won't have to deal with this too

sorry I can't be of more help, I don't have AutoCAD at home.

gary

jwanstaett
2006-06-27, 10:43 PM
???? why are you exploding all leaders ????

kennet.sjoberg
2006-06-28, 12:20 AM
. . .rather than changing to bylayer. . .
How is your LEADER created ? as block ?

When I explode a LEADER ( color green ) on a red layer it remains green
When I explode a LEADER color red bylayer on a red layer it remains red

In my opinion exploding is to step back in time, and color by layer is power.
Anyway here is a line of code that explode all your leaders
(command "._explode" (ssget "_X" '((0 . "LEADER" ))) "" )

: ) Happy Computing !

kennet

rkmcswain
2006-06-28, 12:58 AM
Strange, it doesn't work here on 2006. I created 3 LEADER entities in an empty drawing and ran the code. It exploded one of the three. See below.


Command: ERASE

Select objects: ALL
1 found
1 was not in current space.

Select objects:

Command: LEADER
Specify leader start point:
Specify next point:
Specify next point or [Annotation/Format/Undo] <Annotation>:

Enter first line of annotation text or <options>:
Enter an annotation option [Tolerance/Copy/Block/None/Mtext] <Mtext>: N

Command: LEADER
Specify leader start point:
Specify next point:
Specify next point or [Annotation/Format/Undo] <Annotation>:

Enter first line of annotation text or <options>:
Enter an annotation option [Tolerance/Copy/Block/None/Mtext] <Mtext>: N

Command: LEADER
Specify leader start point:
Specify next point:
Specify next point or [Annotation/Format/Undo] <Annotation>:

Enter first line of annotation text or <options>:
Enter an annotation option [Tolerance/Copy/Block/None/Mtext] <Mtext>: N

Command: (command "._explode" (ssget "_X" '((0 . "LEADER" ))) "" )
._explode
Select object:
Command: LEADER
Specify leader start point: nil


Command: DBLIST

LEADER Layer: "C-BDRY-RWAY-NAME"
Space: Model space
Handle = 137f
associative: no
Normal: X= 0.0000 Y= 0.0000 Z= 1.0000
Horizontal direction: X= 1.0000 Y= 0.0000 Z= 0.0000
Vertex: X=5024.4168 Y=2882.7411 Z= 0.0000
Vertex: X=5326.9147 Y=3724.1478 Z= 0.0000
Hook Line: Off
Arrow: On
Path type: Straight
dimension style: "Standard"
dimension style overrides:
DIMSCALE 700.0000

LEADER Layer: "C-BDRY-RWAY-NAME"
Space: Model space
Handle = 1380
associative: no
Normal: X= 0.0000 Y= 0.0000 Z= 1.0000
Horizontal direction: X= 1.0000 Y= 0.0000 Z= 0.0000
Vertex: X=5629.4126 Y=2830.1532 Z= 0.0000
Vertex: X=5918.7583 Y=3684.7068 Z= 0.0000
Hook Line: Off
Arrow: On
Path type: Straight
dimension style: "Standard"
dimension style overrides:
DIMSCALE 700.0000

Press ENTER to continue:
SOLID Layer: "C-BDRY-RWAY-NAME"
Space: Model space
Handle = 1381
from point, X=4540.2940 Y=3161.6193 Z= 0.0000
and point, X=4472.0295 Y=3053.6519 Z= 0.0000
to point, X=4501.5875 Y=3177.9230 Z= 0.0000
and point, X=4501.5875 Y=3177.9230 Z= 0.0000

LWPOLYLINE Layer: "C-BDRY-RWAY-NAME"
Space: Model space
Handle = 1382
Open
Constant width 0.0000
area 0.0000
length 687.1432

at point X=4520.9408 Y=3169.7711 Z= 0.0000
at point X=4787.6794 Y=3803.0296 Z= 0.0000

rkmcswain
2006-06-28, 01:05 AM
I agree with kennet - if the LEADER has a color other than BYLAYER - it retains that color after exploding.

You might try this also.


(setq tmp (ssget "_X" '((0 . "LEADER" ))))
(sssetfirst tmp tmp)
(command "._explode")

miff
2006-06-28, 05:48 PM
Strange, it doesn't work here on 2006. I created 3 LEADER entities in an empty drawing and ran the code. It exploded one of the three. See below.<snip>

Explode is funny in lisp....try this:

(setvar "QAFLAGS" 1)
(command "explode" (ssget "x" '((0 . "LEADER"))) "")
(setvar "QAFLAGS" 0)

HTH,
Jeff

kennet.sjoberg
2006-06-29, 07:58 PM
If further questions LINK (http://forums.augi.com/showthread.php?t=11688#post6848)

: ) Happy Computing !

kennet