How do you get the parent geometry when subobject selecting?

A bit stuck here, but I would assume there’s probably an easy way to do this I don’t know of in Rhinocommon.

When I Ctrl+Shift select a segment of a curve. How do I get the whole curve to which that segment belongs to?

Ok some more context now that I have a bit more time:
I’m trying to split a curve such that I end up with a list with all selected sub curves and a list with all subcurves that were not selected.

var go = new GetObject();
go.SetCommandPrompt("Select subcurve (select while pressing Ctrl+Shift)");
go.GetMultiple(1, 0);

List<Curve> selectedcurves = new List<Curve>();

foreach (var obj_ref in go.Objects())
                {
                    var ci = obj_ref.GeometryComponentIndex;
                    var subobj = obj_ref.Object().GetSubObjects();
                    selectedcurves.Add(subobj[ci.Index].Geometry as Curve);
                }

I’m a bit stuck on how to get the remaining curvesegments. Does anybody have any suggestions on how to go about this?

Hi @siemen, see if this works for you, it works for sub selections (pre- or postpick) of multiple curves:

SelectedSubCurveIndices.py (1.8 KB)

Hm, i got the count of all subobjects and created a number range. If a number (a sub-curve index) is not in the list of selected sub curve indices, i added this to a list of unselected sub-curve indices.

_
c.

2 Likes

@clement Thanks, I’ll look into it!

Thanks again, took me some time to translate it into C# but got it working now thanks to your example.