Jump to content

lisp to find convert all unexplodable blocks within a file to explodable blocks


Recommended Posts

Posted

Hi. Is there any lisp to  to find convert all unexplodable blocks within a file to explodable blocks? You can set a block as  explodable or unexplodable while creating a block or change this property later, but block by block. What I want is a lisp to convert all unexplodable blocks to explodable blocks.

 

Thanks in advance.

Posted

Here's a quick one:

(defun c:foo nil
  ;; RJP » 2021-08-05
  (vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (if	(= 0 (vlax-get b 'islayout) (vlax-get b 'isxref))
      (vlax-put b 'explodable -1)
    )
  )
  (princ)
)

 

  • Like 2
Posted
On 8/5/2021 at 3:22 PM, ronjonp said:

Here's a quick one:


(defun c:foo nil
  ;; RJP » 2021-08-05
  (vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (if	(= 0 (vlax-get b 'islayout) (vlax-get b 'isxref))
      (vlax-put b 'explodable -1)
    )
  )
  (princ)
)

 

I like your other way (from my link) better

Posted
11 minutes ago, Steven P said:

I like your other way (from my link) better

Why? This one does all block definitions.

Posted (edited)
On 8/5/2021 at 7:12 AM, Steven P said:

Google is your friend, I like google.... 1st result:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-unexplodable-blocks-explodable/td-p/2107647 

2nd page and a LISP by RonJon (just stealing his thunder, no doubt he will be along later with the same link)

ronjonp posted 3 different codes you should have linked to the one you liked and why to be clearer.

Normally I'd always go with a coders recent post which he posted here yesterday but I did like the added option in his third post. It was on the second page.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-unexplodable-blocks-explodable/m-p/9314254#M395882

I use a lot of ronjonp's code on a daily basis like https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/publish-to-pdf-default-location/m-p/9831049#M406719

and snippets like

  (defun Trim0s (xb) ; Thank ronjonp
	(if (= (type xb) 'real); Trim 0's from end of string conversion, then trim . if it's at the end afterwards.
	  (vl-string-right-trim "." (vl-string-right-trim "0" (vl-princ-to-string xb)))
	  (itoa xb); if integer convert to string without trimming 0's from end.
	)
  )

in code like: http://forums.augi.com/showthread.php?171064-Linetypes-and-Text-readability&p=1333199&viewfull=1#post1333199

that keeps my workflow running smooth. Thanks ronjonp!

Edited by tombu
Posted (edited)
46 minutes ago, tombu said:

ronjonp posted 3 different codes you should have linked to the one you liked and why to be clearer.

Normally I'd always go with a coders recent post which he posted here yesterday but I did like the added option in his third post. It was on the second page.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-unexplodable-blocks-explodable/m-p/9314254#M395882

I use a lot of ronjonp's code on a daily basis like https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/publish-to-pdf-default-location/m-p/9831049#M406719

and snippets like



  (defun Trim0s (xb) ; Thank ronjonp
	(if (= (type xb) 'real); Trim 0's from end of string conversion, then trim . if it's at the end afterwards.
	  (vl-string-right-trim "." (vl-string-right-trim "0" (vl-princ-to-string xb)))
	  (itoa xb); if integer convert to string without trimming 0's from end.
	)
  )

in code like: http://forums.augi.com/showthread.php?171064-Linetypes-and-Text-readability&p=1333199&viewfull=1#post1333199

that keeps my workflow running smooth. Thanks ronjonp!

I do like that that snippet better :)

 

Glad you can make use of the code I provide! 🍻 That current path code with the reactor saves me sooooo much time browsing around our network.

Edited by ronjonp
  • Thanks 1
Posted (edited)

Yup, same one I was meaning, the one on the second page, 3rd post

 

 

 

("2nd page and a LISP by RonJon "... only saying.....)

Edited by Steven P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...