Python - How to implement custom input of objects similar to Rhino

How do I implement Rhino.Input.Custom.GetObject to allow the user select multiple surfaces and/or polysurfaces. They need to be allowed to select groups and also allowed to select individual surfaces from a polysurface object.

Rhino (Windows) allows the user to select all of the following objects at once:

  • A surface
  • A polysurface (holding the Shift key)
  • A surface from a polysurface (Ctrl-Shift)
  • A group of surfaces (Shift)
  • A single surface from a group of surfaces (Ctrl-Shift)

How can I get Rhino.Input.Custom.GetObject to act the same way?

Hi MIke - does this do what you need?

    go = Rhino.Input.Custom.GetObject()

    go.GroupSelect = True

    go.GeometryFilter = Rhino.DocObjects.ObjectType.Brep

    rc = go.GetMultiple(1,0)

    objs = [go.Object(n) for n in range (go.ObjectCount)]
    
    print (len(objs))

-Pascal

1 Like

Just to reiterate the requirements for better understanding…

The object selection needs to allow for the following objects:

  • single surface selection
  • entire group of surfaces
  • single surface within a group of surfaces
  • entire polysurface
  • single surface within a polysurface

Furthermore, rs.GetObjects does not allow for individual surface selection within a polysurface.

See this file for further explanation and testing:
Test.3dm (95.0 KB)

Hi Pascal…yes thank you! The key was GroupSelect.