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

Explode all

6 REPLIES 6
Reply
Message 1 of 7
msarqui
5339 Views, 6 Replies

Explode all

Hey everybody!

 

I think I have a good challenge. I have been searching in all known forums a routine to explode all blocks and hatches (those hatches that allow this). This must to be done both in model and paper space with some particular issues. The routine must:

 

  1. Turn the layer 0 current.
  2. Unlock all locked layers.
  3. In the layer Tx-Travail I have my grid and I want to erase it. So, the routine must erase the layer Tx-Travail, even if it contains some objects drawn on it. These objects will be erased with the layer.
  4. I have some FIELDS that link texts and attributes between different layouts or between different blocks. So, if I explode the block, the FIELD will show those typical ##### and I do not want this. I think that here, the routine need to convert all FIELDS in normal text (or mtext, not matter which) before to do the step 5.
  5. Explode all blocks including normal blocks, nested blocks, dynamic blocks and “non explodable” blocks.
  6. Avoid the “endless loop” because some blocks are “non explodable”. I think that here it will be nice to convert all “non explodable” blocks in “explodable” (if appropriate). If is too hard to do this, I can use the routine as many times as necessary until all the blocks are exploded.
  7. 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 I do not want this. I want to keep the layer, the color and the linetype as the same as it had when it was a block.
  8. Keep the text of the attributes, such as when I use the BURST command.
  9. Explode anonymous blocks (those that the name starts with *).
  10. Do not explode polylines because some of them have width and I want to keep it.
  11. Do not explode wipeouts.
  12. Bring all texts to front to prevent them from getting hidden by the wipeouts.
  13. At the end, do the PURGE command, to clean the drawing for the unused things (if it’s possible, purge the empty/nul lines, Text, Mtext & Blocks.

During my research, I found some useful informations here and there, if someone need.

http://www.cadtutor.net/forum/showthread.php?50859-unlock-all-layers (unlock all layers)

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Convert-Field-to-Text/td-p/1722015/pa... (convert FIELD to text/mtext)

http://www.draftsperson.net/index.php?title=Anonymous_Blocks_in_AutoCAD (convert anonymous blocks with a *U prefix to normal autocad blocks)

http://forums.cadalyst.com/showthread.php?t=5628 (some discussions about explode all blocks)

http://forums.augi.com/showthread.php?129530-Non-Exploding-Blocks (how to convert non explodable in explodable blocks)

http://www.lee-mac.com/upgradedburst.html (pretty good one)

http://forums.augi.com/archive/index.php/t-66776.html (purge null lines, text, mtext & blocks)

 

Thanks for any help!

Tags (1)
6 REPLIES 6
Message 2 of 7
3wood
in reply to: msarqui

Have you tried EXPLODEALL.vlx?

It has almost all you need except Step1, Step 4, & Step 13 which you can do with separate routines.

Message 3 of 7
msarqui
in reply to: 3wood

Thanks for the reply 3wood.

 

I did not know that EXPLODEALL.vlx existed. I did the install and the registration.

 

My feedback, if you allow me Smiley Wink

 

-       When I started to use the routine, something was not working. So I realized that my QAFLAGS was set to 0, because yesterday I tested several routines and one of these routines had changed my QAFLAGS without my knowing. So, I suggest to you add to your routine, a "device" that makes this variable set to 1 before executing the routine.

 

-       I realized that every time I restart the AutoCAD or in each new project I open the routine resets its settings. I would like to suggest that the routine record the last configuration chosen by the user. I think it would be more practical.

 

-       In Model space when I get the prompt "Select objects" and I write ALL, the routine does not affect the objects in Paper space. Likewise, when I am in a Paper space and I write ALL, the command does not affect the Model space objects or even the objects in other Model spaces layouts. I suggest here a "device" so the user can choose the entire drawing, or the current space/layout location (such as in the FIND command).

 

Now, about my issues: Smiley Embarassed

 

Sorry, but Step 4 is really important, because I have thousands of fields in each project.

 

I asked the Step 12, because all my blocks have wipeouts and solid hatches with texts. When I do the “as built” project, I erase the solid hatch and I keep only the wipeout to hide the objects below. Sometimes, the solid is not erased because the constructor did not make his job as it was supposed. So, using your routine made me realize that my problem is not the wipeout, but the solid. After exploding the block, is the solid that hides all my texts. I know there are routines to send all hatches to back but, if I do that, the solids will go to the back of the wipeouts and I do not want this. This is the reason to bring all texts to front.

 

I can do Steps 1, 3, 4 and 13 manually but, you must agree with me that it is to avoid making manual work that routines exist. 🙂

 

I appreciate your reply and I hope that I may have contributed to improving your routine.

 

Message 4 of 7
3wood
in reply to: msarqui

Thank you very much for the great suggestions.

I just tested it and acturally field values are remained as they are.

To incorparate more functions in one go, I guess the best way is to provied a command-line-only function of EXPLODEALL once the initial setting is saved in the system. So you can use it combined with other fuctions in a script file / new lsp / Startup.

 

Message 5 of 7
braudpat
in reply to: 3wood

 

Hello from France

 

2 nice routines coming from a french forum www.cadxp.com [ Author: (gille) / Gilles ] 

that I am using often ... Maybe it can help you !?

 

KHatch_Block & KWipeout_Block : Kill Hatch & Wipeout inside Blocks

 

Bye, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 6 of 7
braudpat
in reply to: braudpat

 

Hello

 

An other routine (I am using sometimes) which explodes

ALL Blocks (and Blocks inside Blocks) in the current DWG

From www.cadxp.com - Author: Bred & Patrick_35

 

Bye, Patrice

 

 

;; Explode ALL Blocks even Block inside Block 
;; From Bred & Patrick_35 
;; Routine: EXPBS 
;; ATTENTION : no error management, so ... 

(defun c:expbs (/ N NB X)  
(vl-load-com) 
  (while (setq n (ssget "_X" '((0 . "INSERT"))))    
      (setq x 0
            nb 0)
      (repeat (sslength n)
        (vla-explode (vlax-ename->vla-object (ssname n x)))
        (vla-delete (vlax-ename->vla-object (ssname n x)))
        (setq nb (+ (sslength n) nb))
        (setq x (+ x 1)))
      )
  (if nb
    (princ (strcat "\n" (rtos nb) "Bloc(s) explosé(s) dans le DWG "))
    (princ "\n pas de Blocs dans le DWG "))
  (princ)
)

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 7 of 7
msarqui
in reply to: braudpat

Bonjour Patrice, comment ça va?

 

Thanks for the reply.

 

The routines kill hatchs and kill wipeouts are realy good. They are so fast! 

Unfortunately that's not what I'm looking for. I do not want to erase the hatchs and the wipeouts. I actually want to keep them, especially without changing the draw order. I'm trying very hard to find a routine that explodes the blocks without changing the draw order. By the way, your routine to explode all blocks it’s also good and fast but that does not respect the Step 7 I asked. Secondly, it does not keep the draw order. In my blocks I have: wipeouts underhacths under lines. I would not to change this draw order sequence because otherwise hatches will be in front of the lines, or the wipeouts will be in front of hatches and that is not good. So, keep the draw order is important.

 

Anyway, thanks for the help. I'll keep trying to find routines and unite them in the sequence I need.

 

Merci beaucoup et bonne journée! Thanks and have a nice day!

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

Post to forums  

Autodesk Design & Make Report

”Boost