algorithmic modeling for Rhino
Any wizards out there able to help me with this? It may very well be a stupid question but my brain isn't working so well at the moment.
I'm trying to write some code that checks which type of curve is coming into a component. (arc, linecurve, nurbscurve, etc)
Here's what I have:
public Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Curve> _curveTree;
//loop through branches
for (int i = 0; i < _curveTree.Branches.Count; i++)
{
//The path
Grasshopper.Kernel.Data.GH_Path path = _curveTree.Paths[i];
//loop through list
for (int j = 0; j < _curveTree.Branches[i].Count; j++)
{
GH_Curve gCurve = _curveTree[path][j];
//check for curve type here - HOW?
}
}
Any help appreciated, thanks!
Tags:
gCurve will have a Value property that returns a Rhino.Geometry.Curve, you can then query this instance for it's shape or type (i.e. NurbsCurve, ArcCurve, LineCurve, PolylineCurve, Polycurve).
If you want it easy, you can use the converter functions in Grasshopper.Kernel.GH_Convert. The methods ToLine, ToArc, ToCircle etc. will give you lines, arcs and circles even if the curve is merely 'arc-shaped'.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Great thanks David!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by