Loop through all Dynamic blocks and set the Block property “Allow exploding” to “Yes”

Loop through all Dynamic blocks and set the Block property “Allow exploding” to “Yes”

Mike_Y2
Advocate Advocate
715 Views
5 Replies
Message 1 of 6

Loop through all Dynamic blocks and set the Block property “Allow exploding” to “Yes”

Mike_Y2
Advocate
Advocate

Hi,

I regularly receive drawings from a client that contain a dozen or so Dynamic blocks. Each of the Dynamic blocks has the Block property “Allow exploding” set to “No”.

 

I was wondering if anyone has (or can write) a macro / Lisp that will loop through all Dynamic blocks in the current drawing and set the Block property “Allow exploding” to “Yes”?

 

Any help would be greatly appreciated

0 Likes
Accepted solutions (2)
716 Views
5 Replies
Replies (5)
Message 2 of 6

h_s_walker
Mentor
Mentor
Accepted solution

I found this thread Explode Blocks set to "Allow Exploding = NO" - Autodesk Community - AutoCAD which might help you

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 3 of 6

Libbya
Mentor
Mentor

The Dynamic Blocks forum does not really deal with custom code and isn't where coding experts typically hang out.  If you want help with a LISP, then post to the LISP forum. 

0 Likes
Message 4 of 6

Mike_Y2
Advocate
Advocate

Thanks for the reply. I haven't used Lisp before and I am clearly doing something wrong...

 

  1. I copied the code from the post you sent me (also shown below) and pasted it into Notepad
  2. Then saved the file as "Test.lsp"
  3. In AutoCAD I went to the "Manage" tab and clicked on "Load Application"
  4. I selected the "Test.lsp" file and clicked on the "Load" button
  5. AutoCAD says it successfully loaded

I am not sure how to run the command / if the steps I did (listed above) are correct???

 

Can anyone help???

 

(defun c:expl-p ()
(vl-load-com)
(vlax-for b (vla-get-Blocks
(vla-get-ActiveDocument (vlax-get-acad-object)))
(or (wcmatch (vla-get-Name b) "`**_Space*")
(vla-put-explodable b :vlax-true)))
(princ))

0 Likes
Message 5 of 6

h_s_walker
Mentor
Mentor
Accepted solution

@Mike_Y2 I have never used Lisp (I'm only on LT), however I do believe the line below defines the command

(defun c:expl-p ()

So at the command line after loading the lisp you need to type EXPL-P

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 6 of 6

Mike_Y2
Advocate
Advocate

thanks @h_s_walker 

0 Likes