ssget : options

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

  1. andywatson

    andywatson Guest

    The ssget :N :E :S options are brand new to me. I've picked up some ideas regarding their uses from this group, but have some questions.

    Can I use ssget with any combination of options to return multiple subentities with a single window/crossing window?

    Thanks,
    Andrew
     
    andywatson, Jul 23, 2004
    #1
  2. There was many limits with it, and I think we found that we could NOT get
    multiple subentities with it. We ended up writting our own system for doing
    it. There is a C++ ARX sample in the ObjectARX kit that shows how to use it
    and what some of the limits are. I do not know if there is a lisp sample.
     
    Randy Sanders, Jul 23, 2004
    #2
  3. andywatson

    T.Willey Guest

    Reply From: Jürg Menzi
    Date: Jul/19/04 - 11:01 (PDT)

    Re: viewport from an object
    Hi mnash

    Welcome...¦-)
    From the AutoLISP help:
    :E Everything within the cursor's object selection pickbox.
    :S Allow single selection only.

    Cheers
    --
    Juerg Menzi
    MENZI ENGINEERING GmbH, Switzerland
    http://www.menziengineering.ch


    Hope this helps a little.
    Tim
     
    T.Willey, Jul 23, 2004
    #3
  4. andywatson

    andywatson Guest

    Thank T,

    I think I need to find some more information about the ":N" option.
    I know that when used in combination with ssnamex, it will return the subentity AND the owner entity in a selection set.
    For example, if you had a block with 5 attributes, all in a column, and you used (setq ss (ssget ":N")), you could pick each attribute individually and actually get the attribute subentities, in the same way nentsel works, but in a selection set.
    I wanted to know if there was a way to use ssget to retrieve those 5 attribute subentties AT ONCE, in one selection--using a crossing window.
    When I use (setq ss (ssget ":N")) and encompass all 5 attributes, I am only able to retrieve one of the attribute subentities, and of course the owner insert entity as well.
    Anyone have any ideas?
     
    andywatson, Jul 24, 2004
    #4
  5. andywatson

    T.Willey Guest

    From help.
    <snip>

    :E Everything within the cursor's object selection pickbox.

    :N Call ssnamex for additional information on container blocks and transformation matrices for any entities selected during the ssget operation. This additional information is available only for entities selected via graphical selection methods such as Window, Crossing, and point picks.

    Unlike the other object selection methods, :N may return multiple entities with the same entity name in the selection set. For example, if the user selects a subentity of a complex entity such as a BlockReference, PolygonMesh, or old style polyline, ssget looks at the subentity that is selected when determining if it has already been selected. However, ssget actually adds the main entity (BlockReference, PolygonMesh, an so on) to the selection set. The result could be multiple entries with the same entity name in the selection set (each will have different subentity information for ssnamex to report).

    :S Allow single selection only.

    <snip>

    Hope that helps.
    Tim
     
    T.Willey, Jul 24, 2004
    #5
  6. andywatson

    CAB2k Guest

    CAB2k, Jul 24, 2004
    #6
  7. andywatson

    James Allen Guest

    Hi Andrew,

    I also have yet to really figure those options out, but as to the more
    general question...

    Search for nssget. I posted this basic question a couple months ago and got
    some good help from Joe Burke. But also got the blanket statement from Tony
    that "Nested selection is not available to LISP." Personally, I haven't
    found a good general solution; only workarounds for particular applications.
     
    James Allen, Jul 26, 2004
    #7
  8. andywatson

    andywatson Guest

    Thanks James,

    Regarding the blanket statement "Nested selection is not available to LISP", well its not true. Just try "(setq ss (ssnamex (ssget ":N")))" and select any subentity of an insert by pick or crossing window and you'll see that it returns the nested subentity AND the owner entity as well.

    I am trying to return more than one subentity with a selection crossing window, but I'm fairly certain it isn't possible.
    Anyone interested in this issue can follow my other post where I try to clarify my intent:

    http://discussion.autodesk.com/thread.jspa?threadID=346588
     
    andywatson, Jul 26, 2004
    #8
  9. andywatson

    James Allen Guest

    Yeah, and there's nentsel and nentselp and even while... We can do nested
    picks all day long in LISP. But what I want (and you too I believe) is
    nested *selection*.

    I'm no expert here but from what I've seen so far it sure seems true that
    nested selection is not available to lisp. Doesn't mean we can't do it,
    just forces a little more creativity I guess. In any case, it sure would be
    nice if they would just give us access to functionality that is already
    built in. That said, it's also quite nice that they open as much to us as
    they do. I don't know of any other end-user software that is as open as
    theirs... FWIW

    I'll have a look at you other thread. May the force be with us.

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

    Jürg Menzi Guest

    Hi Andrew

    I played a little bit around with your problem. Fact is it's not easy.
    Until now I've found following (partial) solution:

    Code:
    (defun MePickBox ( / ExLoop RetVal)
    (princ "\nSelect object: ")
    (while (not ExLoop)
    (setq RetVal (vl-catch-all-apply 'grread '(T 12 2)))
    (cond
    ((vl-catch-all-error-p RetVal)		;Cancel
    (setq RetVal nil ExLoop T)			;return nil
    )
    ((or
    (and
    (= (car RetVal) 2)
    (vl-position (cadr RetVal) '(13 32))	;Enter/Space
    )						;or
    (= (car RetVal) 25)			;Left mouse button
    )
    (setq RetVal nil ExLoop T)			;return nil
    )
    ((= (car RetVal) 3)				;Pick
    (setq RetVal (cadr RetVal) ExLoop T)	;return pickpoint
    )
    )
    )
    RetVal
    )
    
    (defun MeSelectSingle (Ent Lst Acd / CurObj ObjLst)
    ;has to be completed
    (setq CurObj (vlax-ename->vla-object (car Ent))
    ObjLst Lst
    )
    (if (wcmatch (vla-get-ObjectName CurObj) "AcDb*Vertex") ;if vertex...
    (setq CurObj (vla-ObjectIDToObject Acd (vla-get-OwnerID CurObj))) ;get parent
    object
    )
    ;you can't highlight an object inside a block, alternative:
    ;;;     (vla-put-Layer CurObj "GreyOut")
    ;;;     (vla-put-Color CurObj acByLayer)
    ;;;     (vla-put-Linetype CurObj "ByLayer")
    ;;;     (if (not (eq (vla-get-ObjectName CurObj) "AcDbAttribute")) ;if not
    Attribute...
    ;;;      (vla-Update (vlax-ename->vla-object (car (last Ent)))) ;update block
    ;;;     )
    (if (not (vl-position CurObj ObjLst))
    (setq ObjLst (cons CurObj ObjLst))
    )
    ObjLst
    )
    
    (defun MeSelectCrossing (Fpt Npt Lst / ObjLst)
    ;has to be completed
    (setq ObjLst Lst)
    )
    
    (defun C:Test ( / AcaDoc CurEnt ExLoop NxtPnt ObjLst RetVal)
    (setq AcaDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
    (while (not ExLoop)
    (if (setq RetVal (MePickBox))
    (if (setq CurEnt (nentselp RetVal))		;Object selected
    (setq ObjLst (MeSelectSingle CurEnt ObjLst AcaDoc))
    (progn					;else... Point selected
    (initget 32)
    (setq NxtPnt (getcorner RetVal "\nOther corner: "))
    (if NxtPnt
    (setq ObjLst (MeSelectCrossing RetVal NxtPnt ObjLst))
    (setq ExLoop T)
    )
    )
    )
    (setq ExLoop T)
    )
    )
    (princ)
    )
    
    If I've more time, I will have a look to the rest, or maybe someone
    has a idea to complete or modify my code fragments.

    Cheers
     
    Jürg Menzi, Jul 27, 2004
    #10
  11. andywatson

    andywatson Guest

    Jürg,

    Thanks for the post. Nice work on the selection methods. The part I am most interested in would be the MeSelectCrossing function. I am not sure that it can be written in lisp. Imagine doing a crossing window over an xref. How would you determine exactly which subentities intersected the window, or how many are complete within the window? You might scan the xref, recreate all of its subentities, and THEN determine if those entities were crossing or whole within the window? I don't see a "clean" way of doing it, but that could be my lack of vision.
    It's a little frustrating to think about though, since that capability existed with the (ssget ":N:D") function in Acad versions < 2k. Recreating that function just doesn't seem very effective.

    Tony Tanzillo made reference to an undocumented ObjectARX command "acedSSGetNested". I need an excuse to delve into ObjectARX anyway...maybe its time?

    Jürg, if you find a way to solve this problem, I'd be interested in your results. Thanks again for the code. I'll think about it anyway.

    Andrew
     
    andywatson, Jul 28, 2004
    #11
  12. andywatson

    BTO Guest

    BTO, Aug 2, 2004
    #12
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.