Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Patchwork quilt to burst block by name

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
cbenner
794 Views, 8 Replies

Patchwork quilt to burst block by name

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"))))
(defun c:bu()
(c:burst)
)
(princ)
)
    (foreach item (mapcar 'cadr (ssnamex ss))
      (c:bu)
      )
    )
  (setq ss nil)
  (setvar "CMDECHO" old-echo)
  (princ)
)

8 REPLIES 8
Message 2 of 9
hmsilva
in reply to: cbenner

Chris,

 

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

HTH

Henrique

EESignature

Message 3 of 9
hmsilva
in reply to: cbenner

And change "Myblk" to your block name...

 

Henrique

 

 

EESignature

Message 4 of 9
cbenner
in reply to: cbenner

Message 5 of 9
Lee_Mac
in reply to: cbenner

Hi Chris,

 

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,

 

Lee

Message 6 of 9
hmsilva
in reply to: cbenner


@cbenner wrote:
Henrique,
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?

 

EDIT:

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

 

HTH

Henrique

EESignature

Message 7 of 9
cbenner
in reply to: hmsilva

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.

 

 

Message 8 of 9
hmsilva
in reply to: cbenner

You're welcome, Chris

Glad I could help

 

Henrique

EESignature

Message 9 of 9
Lee_Mac
in reply to: cbenner

You're welcome Chris! Smiley Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost