Select a sub object

Loft.3DM (33.9 KB)

For the attached model, using the Selection Filter, one can select the sub object. However, the following code does not work for sub-object selection. How to fix the problem? Also, when specifying CRhinoGetObject::curve_object|CRhinoGetObject::edge_object for a box model, would Rhino selects a curve or edge from the model?

	CRhinoGetObject go;
	go.SetCommandPrompt(L"Select curve");
	go.EnableSubObjectSelect(TRUE, TRUE);
	unsigned int iGeometryTypeFilter = 0;
	iGeometryTypeFilter |= CRhinoGetObject::point_object;
	iGeometryTypeFilter |= CRhinoGetObject::curve_object;
	iGeometryTypeFilter |= CRhinoGetObject::edge_object;
	iGeometryTypeFilter |= CRhinoGetObject::brepvertex_filter;

	CRhinoGet::result res = go.GetObjects(1, 0);

Hi @XNurbs,

This should be all you need:

const unsigned int filter = ON::curve_object | 
                            ON::point_object | 
CRhinoGetObject go;
go.SetCommandPrompt(L"Select curves and points");
go.GetObjects(1, 0);
if (go.CommandResult() == CRhinoCommand::success)
  // todo...

– Dale

1 Like

The code above dose not work. As you can see, it selects the whole object. How could we select a sub object?

Hi @XNurbs,

To select subcurve of a polycurve, press Ctrl+Shift and click with the mouse. This is standard subobject picking behavior in Rhino.

The ability to select subcurves of a polycurve without the use of the keyboard combination is unique to pre-selecting objects with the Selection Filter window open and the Sub-object and Curves/Edges options enabled.

– Dale