I've pieced this code together from about 4 different sources here in this forum, but I know I don't have it together quite right yet. It's close... when I load it, however, instead of finding the block by name, it gives me "Select objects". As soon as I pick the block it executes the burst. But I can do that much without a program. Can you gurus help me see what I am missing.
(I've got some books on the way to help me learn this stuff... I swear!)
(defun c:burev (/ ss old-echo item)
(setq old-echo (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(if (setq ss (ssget "_x" '((0 . "INSERT")(2 . "E-REVTABLE"))))
(foreach item (mapcar 'cadr (ssnamex ss))
(setq ss nil)
(setvar "CMDECHO" old-echo)
Solved! Go to Solution.
one simpler way
(defun c:burev (/ ss) (if (setq ss (ssget "_x" '((0 . "INSERT")(2 . "MyBlk")))) (progn (sssetfirst nil ss) (c:burst) );; progn ) (princ) );; burev
I believe you will only be able to supply the BURST command with an implied selection if PICKFIRST=1 on your system, else the ssget function is expecting a selection to be made following function evaluation and does not accept implied selections.
With PICKFIRST=1, the following will burst all standard (non-dynamic) blocks with block name equal to 'Ben' residing in the current layout (much the same as that which Henrique has posted earlier):
(defun c:burev ( / s ) (if (setq s (ssget "_X" '((0 . "INSERT") (2 . "Ben")))) (progn (sssetfirst nil s) (c:burst) ) ) (princ) )
If you were instead looking to burst references of this attributed block in all layouts, whilst also ignoring invisible attributes and using a much faster program, you might be interested in my Burst Upgraded program, which you could call with the following code (again, providing that PICKFIRST=1):
(defun c:burev ( / s ) (if (setq s (ssget "_X" '((0 . "INSERT") (2 . "Ben")))) (progn (sssetfirst nil s) (c:iburst) ) ) (princ) )
I hope this helps,
Thanks for this, I've tried it out with my block Ben, but it still takes me to a "select objects" prompt instead of just acting on the named block.
You're welcome, Chris
The code shouldn't ask to select objects, should only select the blocks with the name "???", and if the if the blocks exist
they are selected and gripped, then just run the burst routine...
Is it possible to share with us a sample dwg with your block?
And as Lee already said, ensures that PICKFIRST is 1 or
(defun c:burev (/ pfst ss) (if (setq ss (ssget "_x" '((0 . "INSERT")(2 . "MyBlk")))) (progn (setq pfst (getvar 'PICKFIRST)) (setvar 'PICKFIRST 1) (sssetfirst nil ss) (c:burst) (setvar 'PICKFIRST pfst) );; progn ) (princ) );; burev
Henrique and Lee,
Thank you both. The "pickfirst" was the culprit. You can tell I don't do much Acad these days.
Anyway this works nicely now. Thank you both.