Jump to content

EXPLODE ALL BLOCKS EXCEPT IN THIS SPECIFIC LAYER


williamferenal

Recommended Posts

Hi. I am a newbie with Lisps. But was just wondering if there is an existing lisp out there to explode all blocks (both model space and paper space) except for blocks in this layer "A3_TT"?

 

I am trying to look for a routine cause I need to apply it to almost thousands of drawings.

 

Any help would be much appreciated.

 

Best regards,

 

William

Link to comment
Share on other sites

For us around a while explode all blocks except some in a 1000 dwg's rings alarm bells, can you please explain more why you need to do just that, there may be a better way. 

 

Doing the explode part is like 2 lines of code, a ssget with exclude layer, then explode selection set.

(setq ss (ssget "x" ...............

(command "explode" ss "")

 

In mean time do a bit of googling about accoreconsole that will process the 1000 dwgs.

Edited by BIGAL
Link to comment
Share on other sites

Hi Bigal,

 

Thanks for the reply. I am actually just applying it to 80 to 90 drawings at a time. But we have multiple packages of the same number of drawings hence I mentioned around 1000's.

Link to comment
Share on other sites

Can you explain the need to explode the blocks, I typed the 2 lines of code directly to command line and exploded all the blocks I had so that is easy part, I am just not good at ssget and -4 not. Some on will provide.

 

method 1 use a script open dwg and run the explode, disadvantage a bit slow but if dwgs are small suprisingly fast. I ran 100+ did mslide it flashed and buzzed around 15 minutes.

 

method 2 use OBDX and change other dwgs with out opening. OBDX is not the simplest to code. Its lisp.

 

method 3 use accoreconsole this changes dwg's without opening them runs in background, very fast, you can make a BAT file that will do complete directories just looks for .dwg.

 

Hint I use old fashioned Dos to get dwg list of names then put in Notepad++ or word and make a script if doing 50 may be very fast

 

this may not be quite right just a example of a script

Open dwg1 (setq ss (ssget "x" ....) explode !ss ; close Y

Open dwg2 (setq ss (ssget "x" ....) explode !ss ; close Y

 

Link to comment
Share on other sites

This will explode all block in the drawing in model or paper space that is not on layer A3_TT with a simple ~. 

 

(defun C:blkExp (/ SS)
  (if (setq SS (ssget "_X" '((0 . "INSERT") (8 . "~A3_TT")))) ;the ~ = all layers not A3_TT
    (foreach ent (mapcar 'cadr (ssnamex SS))
      (vla-explode (setq blk (vlax-ename->vla-object ent))) ;works on blocks on other tabs
      (vla-delete blk)
    )
  )
)
Edited by mhupp
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Guys, apologies for the late reply...had a bit of health issues...anyway mhupp thank you very much for the reply, it worked like a charm...

  • Like 1
Link to comment
Share on other sites

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...