Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:sdksamples:pickfaceedge [2015/09/14] (current)
Line 1: Line 1:
 +====== Picking Brep Components ======
 +> **Developer:​** //​[[developer:​cplusplusplugins|C++]]//​
 +> **Summary:​** //Discusses picking components of a Brep.//
 +
 +===== Question =====
 +
 +I would like to pick a brep component (e.g. face or edge) and then take action depending on what was picked. If I write an object picker as such:
 +
 +<code c++>
 +CRhinoGetObject go;
 +go.SetCommandPrompt( L"​Select face or edge" );
 +go.SetGeometryFilter( CRhinoGetObject::​surface_object |
 +CRhinoGetObject::​edge_object );
 +go.EnableSubObjectSelect( true );
 +go.GetObjects( 1, 1 );
 +</​code>​
 +
 +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. Any way of doing this?
 +
 +===== Answer =====
 +You need to enable "​choose one question"​ to get multiple subobject types on one brep to work. So, this should work:
 +
 +<code c++>
 +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 );
 +</​code>​
 +
 +\\
 +
 +{{tag>​Developer cplusplus}}
  
developer/sdksamples/pickfaceedge.txt · Last modified: 2015/09/14 (external edit)