Xplode a specific block

Discussion in 'AutoCAD' started by T.Willey, Aug 9, 2004.

  1. T.Willey

    T.Willey Guest

    Yes you can. Look at the ssget stuff to filter for certain things. Example:

    (setq ss (ssget "x" ; this gets all items in the drawing
    '((0 . "INSERT")(2 . "BLOCKNAME")) ; here is your filter
    ) ; this just ends the setq ss, which is the selection set of what you want.

    Hope this helps,
    Tim
     
    T.Willey, Aug 9, 2004
    #1
  2. This will filter your selection set down to a specific block name "blkname".

    (ssget (list (cons 2 blkname)))
     
    Allen Johnson, Aug 9, 2004
    #2
  3. Is there a way that I can explode a specific block in a drawing without
    exploding all of them.
    I have 1 block that is used over a 100 times in my drawing and I don't want
    to select each
    one individually. Can I select by block name or something?
     
    Leonard Johnson, Aug 9, 2004
    #3
  4. T.Willey

    T.Willey Guest

    (setq tm1 (ssget "x" '((0 . "INSERT")(2 . "CIR-NOTE"))))
    This worked for me, where "cir-note" is the block name. Post your code so we can see what you are doing.

    Tim
     
    T.Willey, Aug 9, 2004
    #4
  5. Have you tried qselect?
     
    John Michalik, Aug 9, 2004
    #5
  6. T.Willey

    Jeff Mishler Guest

    Give this a try:
    (setq flags (getvar "qaflags"))
    (setvar "qaflags" 5)
    (setq tm1 (ssget "x" '((0 . "INSERT")(2 . "phacap"))))
    (command "explode" tm1 "")
    (setvar "qaflags" flags)
     
    Jeff Mishler, Aug 9, 2004
    #6
  7. qselect
     
    John Michalik, Aug 9, 2004
    #7
  8. T.Willey

    T.Willey Guest

    Just go:
    (command "_.explote" (setq tm1 (ssget "x" '((0 . "INSERT")(2 . "phacap")))))

    But this may not work if the block exist in another space than the active one. Example if the block was inserted in model space and you are in paper space. You might want to try something like this:

    (setq bset (ssget "x" '((0 . "INSERT")(2 . "phacap"))))
    (setq cnt1 0 cnt2 (sslength bset))
    (while (/= cnt1 cnt2)
    (setq obj1 (vlax-ename->vla-object (ssname bset cnt1)))
    (vlax-invoke-method obj1 'Explode)
    (setq cnt1 (1+ cnt1))
    )

    This should work if you in a version 2000 or later.

    Tim
     
    T.Willey, Aug 9, 2004
    #8
  9. Leonard, I just checked it out to be sure, you can type qselect, or pick
    the option from the properties flyout (looks like a funnel) tell it to
    select all blocks with name equal to whatever the name is, it will select
    them with blue grips, you should be able to explode them then.
     
    John Michalik, Aug 9, 2004
    #9
  10. oh, this just downloaded. Doesn't seem to be command line driven. Sorry.
     
    John Michalik, Aug 9, 2004
    #10
  11. I get his error message

    explode ; error: malformed list on input

    Select objects: *Cancel*

    None found.
     
    Leonard Johnson, Aug 9, 2004
    #11
  12. how do I access from the command line?

     
    Leonard Johnson, Aug 9, 2004
    #12
  13. (command "explode")
    (command (setq tm1 (ssget "x" '((0 . "INSERT")(2 . "phacap"))))
     
    Leonard Johnson, Aug 9, 2004
    #13
  14. T.Willey

    Jeff Mishler Guest

    If you decide to use the ActiveX approach, be warned that the block insert
    will remain with the newly exploded entities on top of it. To emulate the
    Explode command, invoke the Delete method on the insert after exploding
    (vla-delete obj1)
    --
    Jeff
    check out www.cadvault.com

    one. Example if the block was inserted in model space and you are in paper
    space. You might want to try something like this:
     
    Jeff Mishler, Aug 9, 2004
    #14
  15. I don't want the dialog box, I want to be able to run it through a script.
     
    Leonard Johnson, Aug 9, 2004
    #15
  16. T.Willey

    Jeff Mishler Guest

    Not sure, as I've not used any. Most of my learning has come from the people
    in this group and other forums, such as the ones at Cadvault, and the Help
    files. There is an electronic (pdf) book entitled "The Viusal Lisp
    Developer's Bible" that was recently posted in the customer-files area that
    is very informative.
     
    Jeff Mishler, Aug 9, 2004
    #16
  17. T.Willey

    T.Willey Guest

    Jeff,

    Thanks for the info. Didn't know that one. Will watch out how I use it next time.

    Tim
     
    T.Willey, Aug 9, 2004
    #17
  18. T.Willey

    jonesr Guest

    If you want to do this from Command prompt use the SSX command.
     
    jonesr, Aug 9, 2004
    #18
  19. thanks, where cam I get a good book to learn lisp?
     
    Leonard Johnson, Aug 9, 2004
    #19
  20. T.Willey

    BTO Guest

    hi, alternative method without lisp :

    ssx command to select
    then explode with previous selection.

    Bruno Toniutti
     
    BTO, Aug 11, 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.