RC - subobject selection routine problems

Trying to be able to select some subobjects via RhinoCommon and have them remain selected once the Get() operation is finished. So far, all I figured out how to do is have the whole object selected.

The second problem is (with the snippet below) that despite the fact that both surface edges and faces are enabled, I can only get the faces - If I zoom in close and try to pick an edge, the multi-selection box only indicates faces, no edges in the list.

import Rhino

def TestSO(prompt):
    go = Rhino.Input.Custom.GetObject()
    filt=Rhino.DocObjects.ObjectType.Curve | Rhino.DocObjects.ObjectType.Surface
    if go.CommandResult()!=Rhino.Commands.Result.Success:
        return go.CommandResult()
    objrefs = go.Objects()
    if not objrefs: return Rhino.Commands.Result.Nothing
    for objref in objrefs:
        indices=[item.Index for item in objref.Object().GetSelectedSubObjects()]
        #objref.Object().Select(True)  <-- selects the whole base object
    return rc

result=TestSO("Select sub objects")


What am I missing here?

TIA, --Mitch

You can use RhinoObject.SelectSubObject Method like this:

for objref in objrefs:
        for i in objref.Object().GetSelectedSubObjects():
            objref.Object().SelectSubObject(i, True, True, True)

SubObjectsSelection.py (647 Bytes)

1 Like

Ah, OK, thanks! I was looking in the various GetObject classes because I thought it should be there, didn’t think to look elsewhere. :confounded:

Still do not know why I can’t select concurrent surface edges though. If I have only one selection type - edges or faces - it works, but not both.

Edit - Ah, found it…

1 Like