Select subentities with one selection window

Discussion in 'AutoCAD' started by andywatson, Jul 26, 2004.

  1. andywatson

    andywatson Guest

    This post is a clarification of my "ssget : options" post a week ago. I have done an extensive search through the help files regarding ssget and the :N :S :E options, and also through other newsgroups.

    I am trying to create a routine that would implement a selection method similar to AutoCAD's native attribute edit routine as shown in the following example:

    1. Create & insert a block that has, say, 5 attributes stacked in a column.
    2. At the command line: "-ATE", "Yes", "*", "*", "*"
    3. You are now prompted to select the attributes, use a single window to select only the top 2 attributes.

    This proves it is possible to select multiple subentities of an insert with a single window. The example above filters the selection for attribute subentities. I want tohave control over the filter.

    I initially thought I would be able to achieve this using (setq ss (ssnamex (ssget ":N"))) and a selection window; HOWEVER, a single selection window over multiple subentities only returns ONE subentity per selection window.

    Any ideas?
    Andrew
     
    andywatson, Jul 26, 2004
    #1
  2. andywatson

    CAB2k Guest

  3. andywatson

    andywatson Guest

    Thanks CAB2k.

    It still does not answer the question.
    One of those posts, however, shows that using (ssget ":N:D") in versions 2000 and earlier USED to return all the subentities within the selection window. It appears that all versions after 2k will only return a single subentity for every selection window.

    Is anyone familiar with that change, and still the question is, *is there a way to return multiple subentities with one selection window* ?
     
    andywatson, Jul 26, 2004
    #3
  4. andywatson

    Jim Claypool Guest

    Can you be more specific about what you want to do with the attributes once
    you get them?

    2000 and earlier USED to return all the subentities within the selection
    window. It appears that all versions after 2k will only return a single
    subentity for every selection window.
    a way to return multiple subentities with one selection window* ?
     
    Jim Claypool, Jul 26, 2004
    #4
  5. andywatson

    andywatson Guest

    Jim,
    I was only using the "-ATE" command as a proof that there *is* a method to select multiple subentities of an INSERT entity in a single crossing window.
    What I want: To select multiple subentities within an INSERT entity using a single (one) crossing window (as in the "-ATE" example, but not filtered only for attributes)
    Andrew
     
    andywatson, Jul 26, 2004
    #5
  6. andywatson

    Jim Claypool Guest

    In order to get the objects other than attributes in a block, you will have
    to first get the block, then use (tblsearch "Block" blockname) to get the
    entire block definition
    and step through that using entnext until you come to the end of the block
    def.

    (setq ss (ssget ":S" '((0 . "INSERT"))))
    (if ss
    (progn
    (setq
    ename (ssname ss 0)
    blkname (cdr (assoc 2 (entget ename)))
    e (cdr (assoc -2 (tblsearch "block" blkname)))
    elist (list e ename)
    )
    (while (setq e (entnext e))
    (setq elist (cons e elist))
    )
    (setq elist (reverse elist))
    )
    )

    The first element in elist is the block, everything else is what's in the
    block.
    If you want the attribute values in the selected block, you will need to
    step through the selected block.
    Or if you are using AutoCAD 2000 or later you can use

    (defun GetAtts (Obj)
    (setq obj (vlax-ename->vla-object obj))
    (mapcar
    '(lambda (Att)
    (cons (vla-get-TagString Att) (vla-get-TextString Att))
    )
    (vlax-invoke Obj "GetAttributes")
    )
    )

    Where (getatts ename) will return a list of attribute values.

    Hope this helps.

    Jim


    select multiple subentities of an INSERT entity in a single crossing window.
    a single (one) crossing window (as in the "-ATE" example, but not filtered
    only for attributes)
     
    Jim Claypool, Jul 26, 2004
    #6
  7. andywatson

    andywatson Guest

    Thanks everyone for your posts.
    I'm obviously not making my intent very clear.
    I don't want attributes, I was just hoping someone would go through steps 1-2-3 as shown in the first post, SIMPLY to show that it is possible to select multiple subentities from an owner entity using a single (1) crossing window. The "-ATE" command clearly shows that this is possible.
    WITH THAT IN MIND...I would like to know how to retrieve one selection set of multiple subentities (attributes, lines, whatever) from EITHER a block reference OR an xref with a SINGLE crossing window.

    Evidently, this was possible in AutoCAD 2000 and previous versions, where issuing the command (setq ss (ssnamex (ssget ":N:D"))) would retrieve multiple subentities with only a single crossing window. However, in later versions, only one subentity per selection is returned.
     
    andywatson, Jul 27, 2004
    #7
  8. andywatson

    CAB2k Guest

    Andy,
    I think that the (setq ss (ssnamex (ssget ":N:D"))) does not work on
    able to work around by getting the crossing window coordinates via
    the (getcorner pt [msg]) the find intersection points of objects
    that intersect the crossing window, loop through each intersection
    and nentsel that object.
    Just a guess at what might be possible.

    CAB
     
    CAB2k, Jul 27, 2004
    #8
  9. andywatson

    andywatson Guest

    Thanks CAB,
    It really is too bad. There was a lot of potential, for me at least, with that capability.
     
    andywatson, Jul 27, 2004
    #9
  10. andywatson

    James Allen Guest

    Andrew, I think trim & extend also illustrate quite well that this is
    possible.
    http://discussion.autodesk.com/thread.jspa?messageID=2507400

    As mentioned, you could cycle through intersection points using nentselp,
    but then what about overlapped ents?

    I wholeheartedly agree there is a LOT of potential with that capability.

    James
     
    James Allen, Jul 27, 2004
    #10
  11. andywatson

    andywatson Guest

    Thanks James,
    What I find interesting is that Autodesk changed the behavior of (ssget ":N:D") after 2k. In the post for which you provided a link, Tony mentioned nested selection is not possible. I'm assuming he means that it is not possible with a single selection, because it is possible to get multiple subentities if you use the pick method with (ssget ":N:D"). He makes reference to an ObjectARX function. I wonder if one might be able to create a DLL, utilizing that function, that could then be accessed by lisp?
     
    andywatson, Jul 27, 2004
    #11
  12. andywatson

    andywatson Guest

    Here's something interesting.
    If you are in a drawing that contains an xref containing two entities and you zoom out enough so that both are within the apeture box, using the (ssget ":N:E") options (nested entities & everything in apeture), it will highlight both subentities.
    Yet it doesn't work anymore for a crossing window...
     
    andywatson, Jul 28, 2004
    #12
  13. andywatson

    James Allen Guest

    I like the DLL suggestion, but I sure wouldn't know how to do it. I am
    limited to the built-in API's here (vlisp & vba). Sure would be nice if
    someone did it though. :),

    James
     
    James Allen, Jul 28, 2004
    #13
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.