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

Explode Blocks set to "Allow Exploding = NO"

15 REPLIES 15
Reply
Message 1 of 16
Anonymous
2951 Views, 15 Replies

Explode Blocks set to "Allow Exploding = NO"

I have a simple routeen that finds all instances of an INSERT (block) and explodes them...

My problem is that i have a drawing (from architect) where there are LOTS of blocks that are set to NOT allow exploding...

How can i progamactally set ALL blocks to allow exploding before i use my exploding routeen...

My routeen as fallows:

(defun C:expbl( / selset len i )
(setq selset (ssget))
(setq len (sslength selset))
(setq i 0)
(while (<= i (- len 1))
(if (equal (assoc 0 (entget (ssname selset i))) (cons 0 "INSERT") )
(command "explode" (ssname selset i))
)

(setq i (+ i 1))
)
(princ)
)
15 REPLIES 15
Message 2 of 16
Anonymous
in reply to: Anonymous

A search here would have turned up this routine, which supposedly came from the AUGI forum, and others:

(DEFUN C:EB ()
(VLAX-MAP-COLLECTION
(VLA-GET-BLOCKS
(VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
'(LAMBDA (X)
(AND
(VLAX-PROPERTY-AVAILABLE-P X 'EXPLODABLE)
(EQ (VLAX-GET-PROPERTY X 'EXPLODABLE) :VLAX-TRUE)
(NOT (VLAX-PUT-PROPERTY X 'EXPLODABLE :VLAX-FALSE))))))


You can process large numbers of things much, much faster if you take advantage of ssget filters in the intial selection instead of testing each object in the selection. You also don;t need to exploe them one by one:

(defun C:expbl( / selset)
(setq selset (ssget '((0 . "INSERT"))))
(setvar "qaflags" 1)
(command "explode" selset "")
(setvar "qaflags" 0)
(princ))
Message 3 of 16
Anonymous
in reply to: Anonymous

Tom:

Thanks for the pointers on my explode lisp...

I did do a search for "allow explode" what search terms did you use...

And lastly the EB function does not seem to change any elements to explodable from non explodable...

I ran the EB command with and without selected objects and just got "#" returned in the command line... ??
Message 4 of 16
Anonymous
in reply to: Anonymous

not much experience with vlisp so not sure how to fix this code to work... ??
Message 5 of 16
Anonymous
in reply to: Anonymous

From what i read about the other function it makes ALL blocks NOT EXPLODABLE but again i am unfamiliar with vlisp and activex...

but this one does work...

Reply From: gile
Date: Nov/01/07 - 23:21 (GMT)

Re: how to make unexplodable blocks explodable?
Hi,

Here's a little routine to put explodable all blocks in the drawing

(defun c:expl-p ()
(vl-load-com)
(vlax-for b (vla-get-Blocks
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(or (wcmatch (vla-get-Name b) "`**_Space*")
(vla-put-explodable b :vlax-true)
)
)
(princ)
)
Message 6 of 16
Anonymous
in reply to: Anonymous

I found that routine by searching "allow explode." Sorry, I didn't test it.

Here's one I found by searching "explodable" which does seem to work. It makes all blocks in the drawing explodable

(defun c:expl-p ()
(vl-load-com)
(vlax-for b (vla-get-Blocks
(vla-get-ActiveDocument (vlax-get-acad-object)))
(or (wcmatch (vla-get-Name b) "`**_Space*")
(vla-put-explodable b :vlax-true)))
(princ))
Message 7 of 16
Anonymous
in reply to: Anonymous

See below.
Message 8 of 16
Anonymous
in reply to: Anonymous

I'm curious. Why in the world would you want to explode all the blocks? You end up with
significantly less functionality.


wrote in message news:5929859@discussion.autodesk.com...
I have a simple routeen that finds all instances of an INSERT (block) and explodes them...

My problem is that i have a drawing (from architect) where there are LOTS of blocks that
are set to NOT allow exploding...

How can i progamactally set ALL blocks to allow exploding before i use my exploding
routeen...

My routeen as fallows:

(defun C:expbl( / selset len i )
(setq selset (ssget))
(setq len (sslength selset))
(setq i 0)
(while (<= i (- len 1))
(if (equal (assoc 0 (entget (ssname selset i))) (cons 0 "INSERT") )
(command "explode" (ssname selset i))
)

(setq i (+ i 1))
)
(princ)
)
Message 9 of 16
Anonymous
in reply to: Anonymous

Doug, I would guess it's the age-old embedded layers/colors "problem" which usually provokes consultants to blow everything up. Perhaps one of the make-everything-bylayer routines which have been posted would be a better solution.
Message 10 of 16
Anonymous
in reply to: Anonymous

Or the SetBylayer command (in 2008)

wrote in message news:5930682@discussion.autodesk.com...
> Perhaps one of the make-everything-bylayer routines
> which have been posted would be a better solution.
Message 11 of 16
Anonymous
in reply to: Anonymous

Doug,

I'm working on a set of Facilities Management drawings. The renovation source
drawing, which come to me on a regular basis, are from six different architectural
firms. I convert these drawings to FM CAD standards and then folded into the FM set.

If I don't explode all blocks in the source drawings, I run the risk of block name
conflicts when the files are folded into the existing FM set.

The final FM drawings are better without blocks, where they would typically be used.

Joe Burke

"Doug Broad" wrote in message
news:5930594@discussion.autodesk.com...
I'm curious. Why in the world would you want to explode all the blocks? You end up
with
significantly less functionality.
Message 12 of 16
Anonymous
in reply to: Anonymous

Interesting. Thanks for the post. I would have thought that there could have been
another way to manage the conflict such as xreffing the drawings and then binding them
rather than inserting them and exploding everthing to avoid problems with block
variations.

"Joe Burke" wrote in message
news:5934554@discussion.autodesk.com...
Doug,

I'm working on a set of Facilities Management drawings. The renovation source
drawing, which come to me on a regular basis, are from six different architectural
firms. I convert these drawings to FM CAD standards and then folded into the FM set.

If I don't explode all blocks in the source drawings, I run the risk of block name
conflicts when the files are folded into the existing FM set.

The final FM drawings are better without blocks, where they would typically be used.

Joe Burke

"Doug Broad" wrote in message
news:5930594@discussion.autodesk.com...
I'm curious. Why in the world would you want to explode all the blocks? You end up
with
significantly less functionality.
Message 13 of 16
Mike_Y2
in reply to: Anonymous

How would you change this code to the opposite i.e.  stop allowing blocks from being exploded

 

this code ALLOWS Exploding...

(defun c:Witlof_Allow_Block_Explode ()
(vl-load-com)
(vlax-for b (vla-get-Blocks
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(or (wcmatch (vla-get-Name b) "`**_Space*")
(vla-put-explodable b :vlax-true)
)
)
(princ)
)

 

I tried changing it to the below but this didn't work...

(defun c:Witlof_Allow_Block_Explode ()
(vl-load-com)
(vlax-for b (vla-get-Blocks
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(or (wcmatch (vla-get-Name b) "`**_Space*")
(vla-put-explodable b :vlax-false)
)
)
(princ)
)

Message 14 of 16
Moshe-A
in reply to: Mike_Y2

@Mike_Y2 hey,

 

watchout 😀

the blocks record contains all blocks and that include the model_space + all layouts + xrefs dependent blocks, you should filter them out.

 

Moshe

 

Message 15 of 16
Mike_Y2
in reply to: Moshe-A

@Moshe-A 

how do i filter them out? I am new to using lisp

Thanks for pointing out the impact of using this code

Message 16 of 16
Moshe-A
in reply to: Mike_Y2

@Mike_Y2 

 

Something like this - Untested 😀

 

Moshe

 

 

(vl-load-com)

(defun c:Witlof_Allow_Block_Explode (/ AcDbBlkRefRec bname)
 (vlax-for AcDbBlkTablRec (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq bname (vla-get-name AcDbBlkTablRec))

  (if (and
	(not (eq (vla-get-islayout AcDbBlkTablRec) :vlax-true))
	(not (eq (vla-get-isXref   AcDbBlkTablRec) :vlax-true))
	(not (wcmatch bname "`*Model_Space,`*Paper_Space,`*Paper_Space0"))
      )	
   (vla-put-explodable AcDbBlkTablRec :vlax-false) ; disable explode
  ); if
   
  (vlax-release-object AcDbBlkTblRec) 
 ); vlax-for
  
 (princ)
)

 

 

 

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

Post to forums  

Autodesk Design & Make Report

”Boost