Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
My goal is to activate the lisp & have the block "BOM" burst so that it retains the information but can be purged, then have the blocks "BOM" & "LINDSAY" (nested in "BOM") purged. For the burst portion it makes no difference to me if it selects the "BOM" block in the program or if I have to highlight it. It should be noted that I am a beginner when it comes to lisp, I have some very basic things down which makes me think this can be done, but also could make me dangerous with it too.
This is code that I have written and it has me puzzled, it mimics other code in my Acaddoc.lsp file which is where I have located this as well;
;;;-----------------------------------------------
;;;BURST SHORTCUT
;;;-----------------------------------------------
(defun c:BU ()
(C:BURST)
)
(PRINC)
)
;;;-----------------------------------------------
;;;"BOM" PURGE
;;;-----------------------------------------------
(DEFUN C:BP ()
(COMMAND "-PURGE" "BLOCKS" "BOM" "no")
(princ)
)
;;;-----------------------------------------------
;;;"LINDSAY" PURGE
;;;-----------------------------------------------
(DEFUN C:LP ()
(COMMAND "-PURGE" "BLOCKS" "LINDSAY" "NO")
(princ)
)
;;;-----------------------------------------------
;;;BURST & PURGE
;;;-----------------------------------------------
(DEFUN C:BX ()
(C:BU)
(C:BP)
(C:LP)
(PRINC)
)
The burst shortcut works with no problem, however the "BOMPURGE" & "LINDSAYPURGE" are unknown commands per the command line. I have tried "purge", "_purge" also used the letters B for block & N for no instead of the words, tried the block name with & without the quotes all of which return the same result. From what I have seen in my search of this database my code should work as it appears to match what other have written, which makes me think its something very simple & I am overlooking it.
I also tried;
(DEFUN C:BP ()
(setq blockname "BOM")
(setq ss nil)
(setq ss (ssget "X" (list (cons 2 BOM))))
(if ss
(progn
(command "_BURST" ss "")
(command "_purge" "B" BOM "Y" "")
); progn
); if
which is code that I found on this board by EC-CAD for erasing a block & purging it, replaced the erase command with the burst to no avail. Any help on this would be greatly appreciated.
Solved! Go to Solution.
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
is the "LINDSAY" block contains attributes? do you want that block burst as well?
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
If it (LINDSAY) has attributes use this:
(Defun c:BBL (/ ss mn mn) (vl-load-com) (if (setq ss (ssget "_X" (list '(0 . "INSERT")'(66 . 1)'(2 . "BOM")(cons 410 (getvar 'CTAB))))) (progn (vla-getboundingbox (vlax-ename->vla-object (setq e (ssname ss 0))) 'mn 'mx ) (sssetfirst nil (ssadd e)) (c:burst) (if (sssetfirst nil (ssget "_W" (vlax-safearray->list mn) (vlax-safearray->list mx) '((0 . "INSERT") (66 . 1) (2 . "LINDSAY") ) ) ) (c:burst)) (command "_purge" "BLocks" "BOM,LINDSAY" "_N") )) (princ) )
If not
(Defun c:BBL (/ ss mn mn) (vl-load-com) (if (setq ss (ssget "_X" (list '(0 . "INSERT")'(66 . 1)'(2 . "BOM")(cons 410 (getvar 'CTAB))))) (progn (vla-getboundingbox (vlax-ename->vla-object (setq e (ssname ss 0))) 'mn 'mx ) (sssetfirst nil (ssadd e)) (c:burst) (if (setq ss (ssget "_W" (vlax-safearray->list mn) (vlax-safearray->list mx) '((0 . "INSERT") (66 . 1) (2 . "LINDSAY") ) ) ) (command "_explode" ss)) (command "_purge" "BLocks" "BOM,LINDSAY" "_N") )) (princ) )
Hope this helps
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you for the quick response. Yes the block named "Lindsay" does contain attributes. I tried both codes & neither seemed to do anything.
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
;;;---------------------------------------------------------------------------- ;;;BURST HOTKEY ;;;----------------------------------------------- ----------------------------- (defun c:BU () (C:BURST) ) (PRINC) ) ;;;----------------------------------------------- ----------------------------- ;;;"BOM" PURGE ;;;----------------------------------------------- ----------------------------- (DEFUN C:BOMPURGE () (COMMAND "_purge" "BLocks" "BOM" "_N") (princ) ) ;;;----------------------------------------------- ----------------------------- ;;;"LINDSAY" PURGE ;;;----------------------------------------------- ----------------------------- (DEFUN C:LINDSAYPURGE () (COMMAND "_purge" "BLocks" "LINDSAY" "_N") (princ) ) ;;;----------------------------------------------- ----------------------------- ;;;BURST PURGE ;;;----------------------------------------------- ----------------------------- (DEFUN C:BX () (C:BU) (C:BOMPURGE) (C:LINDSAYPURGE) (PRINC) )
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This is my code now, after re apploading I get BU, BOMPURGE & LINDSAYPURGE, to work seperatly & in the order, but my system still does not recognize the BX command
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reasons the code might not work or "neither seemed to do anything"
* (setq ss (ssget "_X" (list '(0 . "INSERT")'(66 . 1)
'(2 . "BOM")<-----Block "BOM" Not found, could be "anonymously named block" <"*U4">, in this case we may need to use '(2 . "`*U*,BOM") and
check each block effectivename
* Block explodable property is 0
* pickfirst is 0
(sssetfirst nil (ssadd e))<--- wont work at all
* (ssget "_W" <----- selection area must be visible on screen so (command "_zoom" "Object"...) would be invoke
(vlax-safearray->list mn)
(vlax-safearray->list mx)
'((0 . "INSERT")
(66 . 1)
(2 . "LINDSAY")
)
)
ossmo02 wrote:This is my code now, after re apploading I get BU, BOMPURGE & LINDSAYPURGE, to work seperatly & in the order, but my system still does not recognize the BX command
As for your code
(defun c:BU ()
(C:BURST)
(COMMAND "_purge" "BLocks" "BOM" "_N")
(COMMAND "_purge" "BLocks" "LINDSAY" "_N")
(PRINC)
)
Re: burst & purge blocks in a lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I am not sure why but when I type the code to match the corrections you made to mine it does not work, but if i copy & paste & changed the BU to BZ it works. Thank you for your assistance.

