Elektrik Posted August 5, 2021 Posted August 5, 2021 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. Quote
Steven P Posted August 5, 2021 Posted August 5, 2021 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) 1 Quote
ronjonp Posted August 5, 2021 Posted August 5, 2021 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) ) 2 Quote
Steven P Posted August 6, 2021 Posted August 6, 2021 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 Quote
ronjonp Posted August 6, 2021 Posted August 6, 2021 11 minutes ago, Steven P said: I like your other way (from my link) better Why? This one does all block definitions. Quote
tombu Posted August 6, 2021 Posted August 6, 2021 (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 August 6, 2021 by tombu Quote
ronjonp Posted August 6, 2021 Posted August 6, 2021 (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 August 6, 2021 by ronjonp 1 Quote
Steven P Posted August 6, 2021 Posted August 6, 2021 (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 August 6, 2021 by Steven P Quote
Recommended Posts
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.