How to Explode Blocks without generating a Copy

How to Explode Blocks without generating a Copy

mmP3TWV
Participant Participant
284 Views
2 Replies
Message 1 of 3

How to Explode Blocks without generating a Copy

mmP3TWV
Participant
Participant

Hi, I am aware that again i am asking a very basic question.

This is my Code

 

(defun FPSpreng_t (/ ss i ent data)

(ss-foreach(ssget "X" '((0 . "INSERT")))
'(lambda(ent / )
(vl-catch-all-apply 'vla-explode (list (vlax-ename->vla-object ent)))
)
)

)

 

 

I use a simple Loop to explode All Blocks in my Drawing. But my Lisp does not "kill" the Block but explodes a copy of it so I end up with two Geometries one Block and One Set of Circles and Lines

mmP3TWV_1-1702975668374.png

mmP3TWV_0-1702975566148.png

When I explode the Block manually with the Command _explode I end up with only the lines and no block.

mmP3TWV_2-1702975764040.png

How can I avoid that copy when using 'vla-explode, script the _explode-Command OR Delete all Blocks remaining in my Drawing after having used 'vla-explode? Eather way should work for me.

 

The Circles and lines inside the Block are drawn on Layer 0.

 

 

0 Likes
Accepted solutions (1)
285 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant
Accepted solution

One way or another

 

(defun c:test ()
  (setq blk (vlax-ename->vla-object (car (entsel))))
  (vl-catch-all-apply 'vla-explode (list blk))
  (vl-catch-all-apply 'vla-delete (list blk))
  )

(defun c:test2 ()
  (setq s (ssget '((0 . "INSERT"))))
  (initcommandversion)
  (command "_.explode" s "")
  )

 

0 Likes
Message 3 of 3

mmP3TWV
Participant
Participant

Thank you. Tried with 'vla-delete before but didn't see that i can just add it to the allready existing selection. 

That's all I needed :-).

 

0 Likes