Explode Command

Discussion in 'AutoCAD' started by sashk, Jun 25, 2004.

  1. sashk

    sashk Guest

    Barr-

    I added a list of blocks that I do not want to be exploded, but it still explodes them. Also, when an item does explode, like a polyline, it will explode it (good) but it also returns an "unknown command" as well. I attached the file that I added to. Any ideas?? Thanks
     
    sashk, Jun 28, 2004
    #21
  2. sashk

    sashk Guest

    thats okay. I will tell them to type in .explode to do that. Can you check the previous post that I just added. It explodes blocks that I have added to the list. Thanks
     
    sashk, Jun 28, 2004
    #22
  3. sashk

    Barr Guest

    Hi Sashk -
    I looked at your list.

    The reason it's not working for you is that you're combining 2 categories in the
    same filter...
    "DIMENSION" "HATCH" are entity type (assoc 0)
    "QASECBUB-ATT2" "QACDEBUB-ATT" are names of blocks or hatch types (assoc 2).

    You'll need to determine what you want to filter for. If you're really
    interested in protecting just some specific blocknames or hatchnames, you need
    to change from

    (setq safelist (list "DIMENSION" "HATCH"))
    to
    (setq safelist (list "QASECBUB-ATT2" "QACDEBUB-ATT" ...etc))
    and change
    (setq c (assoc 0 b))
    to
    (setq c (assoc 2 b))

    If you want to filter out ALL dimensions and hatches, and
    SOME blocks, it could be a two-step process...

    (defun C:EXPLODE ( / sset ssl n a b c d safelist)
    (setq safetypes (list "DIMENSION" "HATCH"))
    (setq safenames (list "TICK1" "QADETBUB-ATT" "QADETBUBLDR-ATT"
    "QAGRDBUB-ATT" "QANOTBUB-ATT" "QASECBUB-ATT"
    "QASECBUB-ATT2" "QACDEBUB-ATT" "QAHEADJAMB-ATT"
    "QADORTAG-ATT" "QADORTAG2-ATT" "QARMTAG-ATT"
    "QAWINTAG-ATT" "DIAMOND-ATT" "SQTAG-ATT"
    "DELTATAG-ATT" "ELLIPSETAG-ATT" "QAELEVBUB-ATT"
    "QAKEYTITLE-ATT" "QK-NORTH-ATT"))
    (princ "\nSelect entities to explode - some entities are protected:")
    (setq sset (ssget))
    (setq ssl (sslength sset))
    (setq n ssl)
    (setq counter 0)
    (repeat ssl
    (setq n (1- n))
    (setq a (ssname sset n))
    (setq b (entget a))
    (setq c (assoc 0 b))
    (setq d (cdr c))
    (setq e (assoc 2 b))
    (setq f (cdr e))
    (if (not (or (member d safetypes)(member f safenames)))
    (progn
    (setq counter (1+ counter))
    (command ".explode" a "")
    )
    )
    )
    (setq protected (- ssl counter))
    (princ counter)
    (princ " entities exploded, ")
    (princ protected)
    (princ " entities protected.")
    (princ)
    )

    I hope you can see what's happening here.
    -doug

    previous post that I just added. It explodes blocks that I have added to the
    list. Thanks
     
    Barr, Jun 28, 2004
    #23
  4. sashk

    Barr Guest

    It does return 'unknown command', apparently after it explodes the entity,
    possibly when it hits the "" following the entity name to be exploded. That ""
    is to close the selection set and continue with the explode command. But if the
    "" is deleted, the explode command does not execute.

    It appears to be simply a report. Setting cmdecho=0 does not make it go away.
    However, the good news is that the report doesn't stop the explode command.
    Maybe someone else can tell us why this happens.
    -doug
     
    Barr, Jun 28, 2004
    #24
  5. sashk

    sashk Guest

    Thanks Doug. It works. I'll work on the unknown thing.
     
    sashk, Jun 28, 2004
    #25
  6. sashk

    sashk Guest

    I noticed one more thing that I tried to get to work....

    When I select things like lines, circles, arcs, etc., it still says that they exploded them. I tried to make it filter those things out like how the normal explode command would do, but I messed up. Is there a way when those types of objects are selected, it will filter them out???

    Thanks so much for all of your help. This routine is great. It helps to prevent accidental mistakes
     
    sashk, Jun 28, 2004
    #26
  7. sashk

    Barr Guest

    Hi sashk -
    Lines, circles and arcs cannot be exploded, as you know. You're right -- unless
    those entities are filtered out, they will be 'added to the count' of entities
    to be exploded (even though they cannot be exploded).

    So simply add them to the list of entity types to filter out:
    (setq safetypes (list "DIMENSION" "HATCH" "LINE" "CIRCLE" "ARC"))
    and they won't be counted among the entities to be exploded. Same results,
    different count.

    -doug
    by the way, when I call you sashk, I somehow don't
    think that's your name... care to enlighten me?


    exploded them. I tried to make it filter those things out like how the normal
    explode command would do, but I messed up. Is there a way when those types of
    objects are selected, it will filter them out???
    prevent accidental mistakes
     
    Barr, Jun 29, 2004
    #27
  8. sashk

    sashk Guest

    Doug,

    People call me Sash because my name (real name) is difficult to pronounce. I was calling you Barr at the beginning, but it took me a few posts to figure out that your name was Doug.

    BTW, because my knowledge of lisp is really limited, where do I find a good listing of the associations. The routine looks somewhat simple, but assoc and counters are something that I do not know. Thanks again for all of your help. It has been truly great!
     
    sashk, Jun 29, 2004
    #28
  9. sashk

    Barr Guest

    BTW, because my knowledge of lisp is really limited, where do I find a good
    listing of the associations. The routine looks somewhat simple, but assoc and
    counters are something that I do not know. Thanks again for all of your help. It
    has been truly great!


    I've searched high & low for a listing of the asoc values in Acad Help files. A
    few are noted, but there's no complete listing. Some assoc values are specific
    to the entity type, and mean something different when the entity is a block
    rather than a circle, for example.

    I know that a complete listing of all assoc values, specific to their entity
    type, is listed in the Lisp Customization Manual which was included in Acad 12's
    set of books. I have that at home.

    Perhaps someone here knows where to find that listing.
    -doug
     
    Barr, Jun 29, 2004
    #29
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.