Picking Brep Components
Windows only
Problem
You would like to pick a brep component (e.g. face or edge) and then take action depending on what was picked. If you write an object picker as such:
CRhinoGetObject go;
go.SetCommandPrompt( L"Select face or edge" );
go.SetGeometryFilter( CRhinoGetObject::surface_object |
CRhinoGetObject::edge_object );
go.EnableSubObjectSelect( true );
go.GetObjects( 1, 1 );
and then use it to try to pick the edge of a box, for example, only the faces show up on the “choose one object” menu.
Solution
You need to enable “choose one question” to get multiple subobject types on one brep to work. So, this should work:
CRhinoGetObject go;
go.SetCommandPrompt( L"Select face or edge" );
go.SetGeometryFilter( CRhinoGetObject::surface_object |
CRhinoGetObject::edge_object );
go.EnableSubObjectSelect( true );
go.EnableChooseOneQuestion( true ); // ADD THIS...
go.GetObjects( 1, 1 );