Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
msarqui
Posts: 139
Registered: ‎09-14-2010
Message 1 of 10 (1,581 Views)

Explode all blocks by lisp

1581 Views, 9 Replies
01-28-2013 05:26 PM

Could someone please confirm if what I want is impossible with lisp so I can stop looking and move on?
It's been a week that I'm looking for a routine to explode all blocks. So far I have not found one that do this with good results:

  1. Explode all blocks including normal blocks, nested blocks (until the last one), dynamic blocks (keeping the current visibility) and “non explodable” blocks in model and all paper space layouts without needing to select objects.
  2. Keep the text of the attributes, such as when I use the BURST command.
  3. Keep the draw order.
  4. Keep the layer, the color and the linetype as the same as it had when it was a block. Usually, when I explode a block made in layer 0 with color and linetype BYBLOCK, it reverses to layer 0 with color and linetype BYBLOCK and this is not good. (This last issue is not really important, but it will be nice).

I put a dwg file with some of my standard blocks in model space and also in paper space. I have cad 2012.

 

Thanks for help!

*Expert Elite*
pbejse
Posts: 2,530
Registered: ‎11-24-2009
Message 2 of 10 (1,568 Views)

Re: Explode all blocks by lisp

01-28-2013 09:59 PM in reply to: msarqui

msarqui wrote:

Could someone please confirm if what I want is impossible with lisp so I can stop looking and move on?
It's been a week that I'm looking for a routine to explode all blocks. So far I have not found one that do this with good results:

Thanks for help!


It is possible, Tell me why the need to explode the blocks? is this a prep for REVIT?


Explode all blocks including normal blocks, nested blocks (until the last one), dynamic blocks (keeping the current visibility) and “non explodable” blocks in model and all paper space layouts without needing to select objects.

Yes, but with DB you need to convert the block to Static Block then you can explode 


Keep the text of the attributes, such as when I use the BURST command.


Are these blocks with attributes also include nested blocks? 


Keep the layer, the color and the linetype as the same as it had when it was a block. Usually, when I explode a block made in layer 0 with color and linetype BYBLOCK, it reverses to layer 0 with color and linetype BYBLOCK and this is not good. (This last issue is not really important, but it will be nice).

 

Thanks for help!


Guess it can be done as well,

 

Mentor
marko_ribar
Posts: 190
Registered: ‎12-04-2011
Message 3 of 10 (1,557 Views)

Re: Explode all blocks by lisp

01-29-2013 03:16 AM in reply to: pbejse

Don't know ab Dynamic Blocks, but this will explode all blocks and all nested blocks within blocks and put entity layer to layer "0", but keep color...

 

Maybe this is what satisfies your needs at least for now...

 

http://www.cadtutor.net/forum/showthread.php?72503-Explode-but-keep-colours.&highlight=explode+neste...

 

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Distinguished Contributor
msarqui
Posts: 139
Registered: ‎09-14-2010
Message 4 of 10 (1,540 Views)

Re: Explode all blocks by lisp

01-29-2013 09:50 AM in reply to: pbejse

Hello pbejse


After I finish my projects I send the dwg file to my clients, but one of them always complain to me that he can’t open it correctly. I think he uses a software that is not AutoCAD and because the dynamic blocks he has these problems. Maybe It's because his computers are too old... So, he asked to me if I can explode all blocks.

 

There is no problem if the routine need to convert DB in normal blocks, because the project is already finished and also because of the reason that I explained earlier.

 

I have normal and DB with attributes but they don’t have nested blocks.

 

I do not know if it's true but during my research, I saw that the routines to explode blocks can have problems (endless loop) if the drawing contains xrefs. Perhaps it would be interesting to have a device in the routine to bypass xrefs. (just a tip) :smileyhappy:

 

Thanks,

Distinguished Contributor
msarqui
Posts: 139
Registered: ‎09-14-2010
Message 5 of 10 (1,536 Views)

Re: Explode all blocks by lisp

01-29-2013 10:01 AM in reply to: marko_ribar

Hi marko_ribar

 

I tried the routine with the file I attached but it creates an endless loop and stop my autocad.

Also it does not keep the texts in the attributes.

 

Anyway, thanks for the reply.

*Expert Elite*
3wood
Posts: 1,154
Registered: ‎03-25-2009
Message 6 of 10 (1,510 Views)

Re: Explode all blocks by lisp

01-31-2013 04:40 AM in reply to: msarqui

EXPLODEALL.vlx has been updated today. I have tested you sample file, except for 2 missing hatches, everything is perfect.

I hope the problem will be fixed in the next update.

Distinguished Contributor
msarqui
Posts: 139
Registered: ‎09-14-2010
Message 7 of 10 (1,493 Views)

Re: Explode all blocks by lisp

01-31-2013 04:59 PM in reply to: msarqui

Thanks 3wood, it's a great job, but I need in lisp to use with other routines. Feedback in your email.

Distinguished Contributor
msarqui
Posts: 139
Registered: ‎09-14-2010
Message 8 of 10 (1,444 Views)

Re: Explode all blocks by lisp

02-04-2013 09:48 AM in reply to: msarqui

it's just me or anyone else is seeing ghosts? When I use the command burst several times in my attached file, all visibilities appear. Even the visibilities of the blocks that were already exploded. Is this normal? This is driving me crazy.

Distinguished Contributor
msarqui
Posts: 139
Registered: ‎09-14-2010
Message 9 of 10 (1,414 Views)

Re: Explode all blocks by lisp

02-05-2013 05:05 PM in reply to: msarqui

I'm trying to do it by myself, but with no experience in AutoLISP is a bit difficult.

Why my routine does not ends?
When the routine explode all blocks, it keeps to ask me to select more blocks. What should I do?

 

(defun C:BurstAll (/ sset)
(while (setq sset (ssget "X" '((0 . "INSERT"))))
(sssetfirst nil sset)
(C:Burst)
)
(princ)
)

*Expert Elite*
3wood
Posts: 1,154
Registered: ‎03-25-2009
Message 10 of 10 (1,410 Views)

Re: Explode all blocks by lisp

02-05-2013 05:32 PM in reply to: msarqui

It is not a easy task. You have to consider more senarios.

BURST is a very basic command and has a lot of limits.

In your case, if there is any block not allow explosion, it will remain as it is because BURST can not explode such blocks. That why your 'while' loop never ends.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.