Author Topic: vla-explode objects  (Read 5992 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
vla-explode objects
« on: April 10, 2011, 08:56:15 AM »
Hello.

I guess objects must be arrays to variant which I do not have any idea about it , so would someone help me with it ?

Code: [Select]
(vl-load-com)
(if (setq ssets (ssget "_x" '((0 . "*LEADER"))))
  (repeat
    (setq n (sslength ssets))
       (setq ents (ssname ssets (setq n (1- n))))
        (vla-explode (vlax-ename->vla-object ents) [color=red].........[/color])
 ))

Thanks
« Last Edit: April 10, 2011, 09:07:14 AM by coder »

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: vla-explode objects
« Reply #1 on: April 10, 2011, 09:11:54 AM »
The Explode method only requires a single argument - the VLA-Object to be exploded:

Quote from: AutoCAD Developer Help
Explode Method

Explodes the compound object into subentities.

Object

3DPolyline , BlockRef, ExternalReference, LightweightPolyline, MInsertBlock, Polygonmesh, Polyline, Region
The objects this method applies to.

Return Value

Variant (array of objects)
The array of exploded objects.

i.e.

Code: [Select]
(vla-Explode <VLA-Object>)
Which returns an array of the exploded objects.

The correct code would hence be:

Code: [Select]
(repeat (setq n (sslength ss))
  (setq ent (ssname ss (setq n (1- n))))
  (vla-explode (vlax-ename->vla-object ent))
)

Note however, that this will only explode those objects listed, which doesn't include any forms of Leader.

Coder

  • Swamp Rat
  • Posts: 827
Re: vla-explode objects
« Reply #2 on: April 10, 2011, 09:19:44 AM »
Thanks Lee.

Yes That's right, the *leaders are not obtained with the "vla-explode" function to deal with . :-)

So is there any other function which could explode Leader out of explode command ?

Appreciated


Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: vla-explode objects
« Reply #3 on: April 10, 2011, 09:22:53 AM »
Without reconstructing the Leaders using MText and Polylines I believe the Explode command is your only option:

Code: [Select]
(defun c:test ( / qa ss )

  (setq qa (getvar 'QAFLAGS))
  (setvar 'QAFLAGS 1)

  (if (setq ss (ssget "_X" '((0 . "*LEADER"))))
    (command "_.explode" ss "")
  )
  (setvar 'QAFLAGS qa)
  (princ)
)

Coder

  • Swamp Rat
  • Posts: 827
Re: vla-explode objects
« Reply #4 on: April 10, 2011, 09:27:15 AM »
This is what I am trying to avoid , because if I have many Leaders to explode in a dwg , that should make me waiting for it .

Is not it possible with Vlisp or ActiveX codes instead of command call ?

Thanks

Coder

  • Swamp Rat
  • Posts: 827
Re: vla-explode objects
« Reply #5 on: April 10, 2011, 10:47:00 AM »
OKi ,

The system variable (getvar 'QAFLAGS) does a very good job by pushing the Explode command to go faster .

So without it the routine would take a longer time and sometimes being boring .

Thank you Lee.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: vla-explode objects
« Reply #6 on: April 10, 2011, 12:39:51 PM »
This may also improve speed if you have leaders in other layouts:
Code: [Select]
(defun c:test ( / qa ss )

  (setq qa (getvar 'QAFLAGS))
  (setvar 'QAFLAGS 1)

  (if (setq ss (ssget "_X" (LIST '(0 . "*LEADER")(cons 410 (getvar "ctab")))))
    (command "_.explode" ss "")
  )
  (setvar 'QAFLAGS qa)
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

kruuger

  • Swamp Rat
  • Posts: 637
Re: vla-explode objects
« Reply #7 on: April 10, 2011, 01:38:51 PM »
Hello.

I guess objects must be arrays to variant which I do not have any idea about it , so would someone help me with it ?

Code: [Select]
(vl-load-com)
(if (setq ssets (ssget "_x" '((0 . "*LEADER"))))
  (repeat
    (setq n (sslength ssets))
       (setq ents (ssname ssets (setq n (1- n))))
        (vla-explode (vlax-ename->vla-object ents) [color=red].........[/color])
 ))

Thanks
i'm corious why are you exploding leader and making mess in drawing ?
kruuger

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: vla-explode objects
« Reply #8 on: April 10, 2011, 09:47:18 PM »
Hello.

I guess objects must be arrays to variant which I do not have any idea about it , so would someone help me with it ?

Code: [Select]
(vl-load-com)
(if (setq ssets (ssget "_x" '((0 . "*LEADER"))))
  (repeat
    (setq n (sslength ssets))
       (setq ents (ssname ssets (setq n (1- n))))
        (vla-explode (vlax-ename->vla-object ents) [color=red].........[/color])
 ))

Thanks
i'm corious why are you exploding leader and making mess in drawing ?
kruuger
Ditto.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Coder

  • Swamp Rat
  • Posts: 827
Re: vla-explode objects
« Reply #9 on: April 11, 2011, 12:44:17 AM »
Thank you CAB .

Hello.

I guess objects must be arrays to variant which I do not have any idea about it , so would someone help me with it ?

Code: [Select]
(vl-load-com)
(if (setq ssets (ssget "_x" '((0 . "*LEADER"))))
  (repeat
    (setq n (sslength ssets))
       (setq ents (ssname ssets (setq n (1- n))))
        (vla-explode (vlax-ename->vla-object ents) [color=red].........[/color])
 ))

Thanks
i'm corious why are you exploding leader and making mess in drawing ?
kruuger
Ditto.

Actually I do agree with both of you , but sometimes I have to do that to be able to purge the dim. styles that are related to Leaders .

Thanks

kruuger

  • Swamp Rat
  • Posts: 637
Re: vla-explode objects
« Reply #10 on: April 11, 2011, 01:49:04 AM »
Thank you CAB .

Hello.

I guess objects must be arrays to variant which I do not have any idea about it , so would someone help me with it ?

Code: [Select]
(vl-load-com)
(if (setq ssets (ssget "_x" '((0 . "*LEADER"))))
  (repeat
    (setq n (sslength ssets))
       (setq ents (ssname ssets (setq n (1- n))))
        (vla-explode (vlax-ename->vla-object ents) [color=red].........[/color])
 ))

Thanks
i'm corious why are you exploding leader and making mess in drawing ?
kruuger
Ditto.

Actually I do agree with both of you , but sometimes I have to do that to be able to purge the dim. styles that are related to Leaders .

Thanks
hmm. if you got leaders you got the dim style. why are you need to purge them ?
maybe there will be another solution.

kruuger
« Last Edit: April 11, 2011, 01:56:17 AM by kruuger »

Coder

  • Swamp Rat
  • Posts: 827
Re: vla-explode objects
« Reply #11 on: April 11, 2011, 03:59:46 AM »
We are using purge to reduce the overload of entities in a dwg , so that's why, me and the others do it that way .

So what is your solution regarding the issue ?

Thanks

kruuger

  • Swamp Rat
  • Posts: 637
Re: vla-explode objects
« Reply #12 on: April 11, 2011, 04:33:53 AM »
We are using purge to reduce the overload of entities in a dwg , so that's why, me and the others do it that way .

So what is your solution regarding the issue ?

Thanks
OMG. My solution is leave your leader as is  :-)
When you explode leader you are not reduce but increase entittes. Also drainwg became bigger. try to make file with 25000 leader with text and then make second file with exploded object. Which is lighter.
No offense but when i see exploded leader i always want to use my tool (on draftsmen hands) ;-)

kruuger

Coder

  • Swamp Rat
  • Posts: 827
Re: vla-explode objects
« Reply #13 on: April 11, 2011, 04:48:14 AM »
Right .

Thanks a lot , now it is clear .

Appreciated