LISP explode doesn't work

Discussion in 'AutoCAD' started by CLS, Jul 21, 2004.

  1. CLS

    CLS Guest

    Hi All,

    I need to explode everything in my drawing. The problem is that our blocks
    are not that great. We have blocks inside blocks.

    When my LISP routine executes the explode it explodes all the selected
    items. But there are still some blocks that exist. So I doubled the
    explode command, but it doesn't find the new blocks. If I type in explode
    then all, it still doesn't work. I have to use the mouse and select all the
    items by a window and then type explode.

    How can I do this in my LISP routine?

    Chad

    --

    ________________________________
    Cameron Land Surveying Ltd.
    #203-6333 148 Street
    Surrey, BC V3S 1C1

    (o) (604) 597-3777
    (f) (603) 597-3783

    All E-Mail Scanned with Norton Anti-Virus
     
    CLS, Jul 21, 2004
    #1
  2. CLS

    ECCAD Guest

    (repeat 5 ; 3 or more..
    (setq ss (ssget "ALL"))
    (command "_explode" ss "")
    ); end repeat
     
    ECCAD, Jul 21, 2004
    #2
  3. Or

    (while (setq SS (ssget "ALL"))
    (command "_explode" SS "")
    )
     
    Alan Henderson @ A'cad Solutions, Jul 21, 2004
    #3
  4. That creates a infinite loop. You'd be better off
    specifying the types of entities that can be exploded
    or using the QAFLAGS variable as a work around.
     
    Jason Piercey, Jul 21, 2004
    #4
  5. CLS

    Jürg Menzi Guest

    Cool, endless loop...:cool:

    Cheers
     
    Jürg Menzi, Jul 21, 2004
    #5
  6. CLS

    Doug Broad Guest

    Do you want to explode only blocks or also
    polylines and mtext? If you only want to explode
    only block references, then something like this might
    be better. The filter list could be expanded.

    ;;Explode all inserts
    (defun c:xpall () ;;D. C. Broad 2004
    (setvar "qaflags" 1)
    (while (setq ss (ssget "x" (list (cons 0 "insert"))))
    (command "explode" ss ""))
    (setvar "qaflags" 0)
    (princ)
    )
     
    Doug Broad, Jul 21, 2004
    #6
  7. CLS

    ECCAD Guest

    Why not,
    (while (setq SS (ssget "ALL"))
    (command "_explode" SS "")
    (command "_regen")
    )

    Makes the loop even longer...
    :)
    Bob
     
    ECCAD, Jul 21, 2004
    #7
  8. CLS

    CLS Guest

    Thanks
    I tried your idea, but it still doesn't work. It says the object is not
    able to be exploded. It is a simple block. If I click on it and type
    explode, it works, but everything I try is Lisp doesn't

    Chad
     
    CLS, Jul 21, 2004
    #8
  9. CLS

    CLS Guest

    Hang on,

    I tried it again, and it worked. So I tried it a couple of times, and it
    randomly works.

    ???
    Chad
     
    CLS, Jul 21, 2004
    #9
  10. CLS

    ECCAD Guest

    You said 'everything' .. see Doug's program - will work just fine.

    Bob
     
    ECCAD, Jul 21, 2004
    #10
  11. CLS

    ECCAD Guest

    It will error when it finds an item that cannot be exploded..and just exits the loop. Would appear to be random. I like Doug's approach..try that..

    Bob
     
    ECCAD, Jul 21, 2004
    #11
  12. CLS

    Doug Broad Guest

    Sigh... Sometimes posting seems to be a waste of time
    when the person being helped doesn't even notice.
    Thanks Bob.
     
    Doug Broad, Jul 21, 2004
    #12
  13. CLS

    ECCAD Guest

    Doug,
    Yes, I know what you mean. :)
    Bob
     
    ECCAD, Jul 21, 2004
    #13
  14. CLS

    CLS Guest

    OK Doug,

    I tried your. It appears to do nothing. This is what is displayed on the
    prompt:
    C:XPALL

    all blocks are still blocks.

    Now what?
    Chad

    PS: I did try yours. How do I expand the filter list to include everything?
     
    CLS, Jul 21, 2004
    #14
  15. CLS

    Doug Barr Guest

    Layers locked?

     
    Doug Barr, Jul 21, 2004
    #15
  16. CLS

    Doug Broad Guest

    Chad,
    You just loaded it. It creates a command called XPALL.
    Enter the command at the keyboard.
     
    Doug Broad, Jul 21, 2004
    #16
  17. CLS

    CLS Guest

    Here is the complete scenario. We use a different program for our drafting.
    We have to submit the drawings to the city. They have an exact set of
    rules. When we export the file to dxf, linetypes, colours, & blocks are
    messed up.

    I have done the layer assignments already & the colours, except, that the
    blocks have lines from other layers, so I have to explode the block so I can
    change the layers of the lines inside the block. Not everything on the
    drawing is blocks, I have text, mtext, plines, lines, etc.

    If I highlight everything and type explode, it will say 10 items found 5
    items could not be exploded. So I do it again, then it might say 20 items
    found, 15 could not be exploded. So I do it again, and it might say 100
    items found 100 items could not be exploded.

    Now I know all items are exploded, and I can select everything and change it
    so that the colour, linetype are 'bylayer'.

    I want to be able to do this with a lisp command.

    Chad

    ECCAD: your way works occasionally. From what I understand, if it comes
    across a line it stops the lisp routine because it cannot be exploded.

    Doug: your did nothing.
     
    CLS, Jul 21, 2004
    #17
  18. CLS

    CLS Guest

    That was quick, let me try again. XPALL
     
    CLS, Jul 21, 2004
    #18
  19. CLS

    Tom Smith Guest

    He might need to try hitting ALT+F4 a few times...
     
    Tom Smith, Jul 21, 2004
    #19
  20. CLS

    CLS Guest

    Doug,

    That works perfectly.

    Thanks everyone.

    Chad
     
    CLS, Jul 21, 2004
    #20
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.