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

Explode all blocks by lisp

10 REPLIES 10
Reply
Message 1 of 11
msarqui
15797 Views, 10 Replies

Explode all blocks by lisp

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!

10 REPLIES 10
Message 2 of 11
pbejse
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,

 

Message 3 of 11
marko_ribar
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)
Message 4 of 11
msarqui
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) 🙂

 

Thanks,

Message 5 of 11
msarqui
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.

Message 6 of 11
3wood
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.

Message 7 of 11
msarqui
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.

Message 8 of 11
msarqui
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.

Message 9 of 11
msarqui
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)
)

Message 10 of 11
3wood
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.

 

Message 11 of 11
engzahrarhm
in reply to: marko_ribar

This link does not open!

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

Post to forums  

Autodesk Design & Make Report

”Boost