multilple select and erase in one command

Discussion in 'AutoCAD' started by rjdrw, May 17, 2004.

  1. rjdrw

    rjdrw Guest

    What I am trying to do is the following:
    Command: ssx-select a block (choose a block and ssx command selects all occurences of this block in the drawing). Then, command: erase, select previous. This will erase all the objects that ssx has found. It is tedious typing ssx then entering then e enter p enter to erase. Trying to get this into one command.
     
    rjdrw, May 17, 2004
    #1
  2. rjdrw

    ECCAD Guest

    I don't know the 'ssx' function you have, but if it is a 'command' e.g. C:SSX, then a button macro would do it:
    [Select Block, Erase All]^c^c(c:ssx);(command "_erase" "P" "");
     
    ECCAD, May 17, 2004
    #2
  3. SSX is basically just user interface for ssget filtering.
     
    Jason Piercey, May 17, 2004
    #3
  4. rjdrw

    David Kozina Guest

    Jason,

    I bet Anne almost huskied that message. ;)
     
    David Kozina, May 17, 2004
    #4
  5. At a quick glance, I bet that is possible :)
     
    Jason Piercey, May 17, 2004
    #5
  6. rjdrw

    rjdrw Guest

    Then does anyone know how to erase 44 or 1000 blocks that are scattered across the drawing without having to select every block?
     
    rjdrw, May 17, 2004
    #6
  7. rjdrw

    Anne Brown Guest

    Had to read it a few times <G>

    Anne
     
    Anne Brown, May 17, 2004
    #7
  8. rjdrw

    rjdrw Guest

    Out of all this, does anyone know how to erase multiple instances of a block w/o having to select every block?
    and if possible, when a block is attributed.
     
    rjdrw, May 17, 2004
    #8
  9. See my post (to you) previous to this one
     
    Jason Piercey, May 17, 2004
    #9
  10. SSX is an Express Tool (in A2K at least, I don't know about earlier), for
    making a selection set of things just like the thing you select at its first
    prompt. I fiddled with it a little, and it takes some getting used to. If
    you use it "straight," in this situation looking for all occurrences of a
    block, it will find all insertions of the same block name on the SAME layer,
    with the same linetype, etc. If you remove the Layer filter, it finds them
    on all layers. I tried inserting some with the current linetype and color
    set to something other than bylayer, thinking you'd have to remove those
    filters, too, but it seems if you remove the Layer filter, it does find the
    ones that are inserted with other linetypes and colors, even though you
    haven't removed those filters -- go figure.

    You don't need to make the selection set and then erase P. You CAN use ssx
    as a command to make a selection set to do it that way, but you can also use
    (ssx) [with the parentheses] in response to the erase command's object
    selection prompt, so you build your selection set inside the erase command.
    The \ is to pick a block, the LA is to play with the Layer filter, and the
    first enter (semicolon) after it is to turn it off (instead of, for example,
    feeding in another Layer name) so all insertions on all Layers will be
    found. The next semicolon completes the ssx operation, and the next
    completes the erase command. I've tested this, and it works (in ADT2K4, at
    least):

    [Erase All of a Block]^C^Cerase (ssx) \LA ;;;

    If you happened to pick a Line instead of a Block, this would erase all the
    Lines in the drawing, so you might want to think about controls to prevent
    that kind of thing. (Maybe it should be called "Erase all of an Entity
    Type" or something.) I thought of trying something like this:

    [Erase All of a Block]^C^Cerase
    <however-you-get-into-'filter-without-dialog-box>
    <however-you-specify-Block-name-as-the-Filter>
    <pick-a-block-and-extract-its-block-name>
    <however-you-say-Add-that-to-the-filter-list>
    <however-you-say-Apply-the-filter-list> ALL ;;

    but I couldn't find a way to get into filtering without the dialog box. Any
    ideas?

    Kent Cooper, AIA


    C:SSX, then a button macro would do it:
     
    Kent Cooper, AIA, May 17, 2004
    #10
  11. rjdrw

    rjdrw Guest

    I have been using acad for about 6 years but have little customization skills. I am learning but I have no clue what you want me to do w/ the text that you replied w/.
     
    rjdrw, May 17, 2004
    #11
  12. Is this something that you will be using time and
    time again? or is this simply a "one-shot" deal?

    If the latter, you can simply cut/paste the code
    to the command line (it'll look messy, but it will
    work)

    If the former, then some other things could be
    done to allow you to use this whenever the need
    arises.

    --

    Autodesk Discussion Group Facilitator


    learning but I have no clue what you want me to do w/ the text that you replied w/.
     
    Jason Piercey, May 17, 2004
    #12
  13. Refinement:
    The "Erase All of a Block" line below (like Jason's version using ssget "x")
    does NOT do instances in different layouts, or in ANY layouts if you use it
    in model space, or in model space if you're in any layout. But at least it
    tells you there were some not in the current space. And it gets the block
    name from a block you select with each invoking of it, whereas it looks like
    Jason's would require you to extract the block name somehow first so you can
    put it into the "YourBlockName" variable to be used in there.

    Kent Cooper, AIA


     
    Kent Cooper, AIA, May 17, 2004
    #13
  14. rjdrw

    rjdrw Guest

    This is what I was looking for. If you figure out how to get rid of the "all line erase" please post it here so I can change this.

    Thanks again.
     
    rjdrw, May 17, 2004
    #14
  15. rjdrw

    rjdrw Guest

    This command worked in the current drawing that I had created the toolbar in. Problem was when I tried using it in another drawing. This is the error that I got:

    Command: erase
    Select objects: (ssx)
    Error: no function definition: SSX; error: An error has occurred inside the
    *error* functionAutoCAD variable setting rejected: "CLAYER" nil
     
    rjdrw, May 17, 2004
    #15
  16. I renamed that function to SEX a long time ago... what's more natural than
    selecting objects by their sex?! ;^)
     
    R. Robert Bell, May 17, 2004
    #16
  17. Well, let's think about this....

    (cdr (assoc 2 (entget (car (entsel))))) \
    returns the block name.

    (cdr (assoc 0 (entget (car (entsel))))) \
    returns the entity type, which should be "INSERT" if it's a block, so you
    want to do the routine only if that's what you get.

    Maybe the best way would be to extract those pieces of information, and then
    do an "if" thing to save the block name into a variable (here called
    "YourBlockName" to fit into Jason's routine) and do the erasing, ONLY if
    what you pick is a block. On experimentation, I find not every entity type
    HAS an "assoc 2" value (Lines don't, for example). So you need to test for
    its being a block before you can save the block name.

    ....
    (setq pickeditem (entget (car (entsel "Select Block to Erase All Insertions
    of: ")))) \+
    (if (= (cdr (assoc 0 pickeditem)) "INSERT") +
    (progn (setq YourBlockName (cdr (assoc 2 pickeditem))) +
    (...<something like Jason's routine>...)) +
    (...<tell you the thing you picked wasn't a block>...))
    ....

    [formatted, like your original, as a pull-down or screen or tablet menu
    macro -- add appropriate header for pull-down or screen, or adjust as
    appropriate for a "defun" or whatever, with whatever other stuff like error
    handling and so on....]

    It doesn't use ssx, but it may be the simpler way to do it if you want to
    first test for the selected item being a block insertion. But it might be
    doable by saving the entity itself to feed back into ssx, in addition to
    extracting the assoc information from it.

    Kent Cooper, AIA


    "all line erase" please post it here so I can change this.
     
    Kent Cooper, AIA, May 17, 2004
    #17
  18. First thing I'd check would be to make sure Express Tools are loaded in the
    other drawing.

    Kent Cooper, AIA

    in. Problem was when I tried using it in another drawing. This is the
    error that I got:
     
    Kent Cooper, AIA, May 17, 2004
    #18
  19. rjdrw

    rjdrw Guest

    I changed my settings to load the acad.lisp w/ every drawing and the express tools are loaded. This has not changed the problem w/ having to type ssx before trying this command.
     
    rjdrw, May 18, 2004
    #19
  20. rjdrw

    rjdrw Guest

    I looked at the ssx command after it was put into the erase command. There is no LAYER filter available at start. this is allowed after ssx was run by itself in the begining.
    Any help?
     
    rjdrw, May 20, 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.