Hi,
I’m trying to pick lines from the doc, and some of them can be part a polylines/polycurves. (For exemple two sides of a rectangle) Is there a way to do this properly with rhinocommon?
The only idea I thought of is to explode/replace the polylines, but it’s kind off messy and implies to modify the geometry which is not the purpose of my code.
var go = new GetObject();
go.SetCommandPrompt("Select curves");
go.GeometryFilter = ObjectType.Curve;
go.SubObjectSelect = true;
go.GetMultiple(1, 0);
if (go.CommandResult() == Result.Success)
{
foreach (var obj_ref in go.Objects())
{
var ci = obj_ref.GeometryComponentIndex;
// TODO...
}
}
Hi @dale,
Any way to force sub-object selection? (without the need of CTRL+SHIFT)
Also, I’ve tried to HighLight selected subobjects with no success:
'Select curve(s)
Dim curves As New List(Of CurveObject)
Dim GO As New Rhino.Input.Custom.GetObject()
Dim GO_Result As Rhino.Input.GetResult
GO.GeometryFilter = ObjectType.Curve
GO.SubObjectSelect = True
GO.AcceptUndo(True)
GO.AcceptNothing(True)
GO.EnableClearObjectsOnEntry(True)
GO.EnableUnselectObjectsOnExit(False)
GO.DeselectAllBeforePostSelect = False
If IsOutline Then
GO.SetCommandPrompt("Select outlines")
Else
GO.SetCommandPrompt("Select lines")
End If
While True
GO.SetDefaultString("Enter")
'Get Options or objects
GO_Result = GO.GetMultiple(1, 0)
GO.EnablePreSelect(False, True)
If GO.CommandResult <> Result.Success Then Return Result.Failure
If GO_Result = GetResult.Object Then
For Each Obj_ref In GO.Objects()
If Not curves.Contains(Obj_ref.Object) Then
Dim CI As ComponentIndex = Obj_ref.GeometryComponentIndex
If CI.Index = -1 Then
curves.Add(TryCast(Obj_ref.Object, CurveObject))
Else
Obj_ref.Object.Highlight(False)
Obj_ref.Object.HighlightSubObject(CI, True)
curves.Add(TryCast(Obj_ref.Object.GetSubObjects(CI.Index), CurveObject))
End If
End If
Next
Continue While
End If
Exit While
End While