# Select a sub object

**URL:** <https://discourse.mcneel.com/t/select-a-sub-object/76446>\
**Category:** Rhino Developer\
**Created:** [December 18, 2018, 1:09pm UTC](https://discourse.mcneel.com/t/select-a-sub-object/76446 "2018-12-18T13:09:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![XNurbs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/xnurbs/32/356173_2.png) [@XNurbs](https://discourse.mcneel.com/u/XNurbs)\
**Post date:** [December 18, 2018, 1:09pm UTC](https://discourse.mcneel.com/t/select-a-sub-object/76446/1 "2018-12-18T13:09:18Z")

</div>

[Loft.3DM](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/c/8/c84683ab539abbfa969a770dad1273b94c80128b.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;
	go.SetGeometryFilter(iGeometryTypeFilter);

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

```

 ![image](https://global.discourse-cdn.com/mcneel/original/3X/9/7/971fe6d00d7ebf2316eb6bcea9ea2e5ac2d312b7.png)

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [December 18, 2018, 9:47pm UTC](https://discourse.mcneel.com/t/select-a-sub-object/76446/2 "2018-12-18T21:47:24Z")

</div>

Hi @XNurbs,

This should be all you need:

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

```

– Dale

---

<div class="post-metadata">

**Author:** ![XNurbs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/xnurbs/32/356173_2.png) [@XNurbs](https://discourse.mcneel.com/u/XNurbs)\
**Post date:** [December 19, 2018, 2:12am UTC](https://discourse.mcneel.com/t/select-a-sub-object/76446/3 "2018-12-19T02:12:55Z")

</div>

The code above dose not work. As you can see, it selects the whole object. How could we select a sub object?  
 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/c/0/c05c1a6adce507638b8d8873bb8432734392adcd.png)

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [December 19, 2018, 4:07am UTC](https://discourse.mcneel.com/t/select-a-sub-object/76446/4 "2018-12-19T04:07:35Z")

</div>

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
