after exploding a polycurve:
Curve[ ] segments = polycurve.DuplicateSegments();
I want to:
-test if the segment is a line (I can do that: segment.IsLinear() )
-test if the segment is an arc (I can do that too: segment.TryGetArc(out arc) )
-test if the segment is a nurbs curve (but not an arc nor a line) to decompose it with the method Curve.ToPolyline, each segment from this polyline will be treated as a line. Here, I can’t find the trick to do it…
Help me please
diff-arch
(diff-arch)
March 12, 2023, 6:12pm
2
Have you tried isinstance(your_curve_segment, Rhino.Geometry.NurbsCurve)
?
See that
If you must know…
If (data Is Nothing) Then Return String.Format("Null {0}", name)
If (Not data.IsValid()) Then Return String.Format("Invalid {0}", name)
If (data.IsArc()) Then
If (data.IsClosed()) Then Return String.Format("{0}Circular {1}", prefix, name)
Return String.Format("{0}Arc-like {1}", prefix, name)
End If
If (data.IsEllipse()) Then
Return String.Format("{0}Elliptical {1}", prefix, name)
End If
If (data.IsLinear()) Then
Dim pts As Polyline = Nothing
If (data.TryGetPolyl…
For SVG plugin I have done that
public XmlNode WriteSVGCurve(XmlDocument xmlDoc, Curve curve, Rhino.DocObjects.RhinoObject rhobj)
{
//if (testIfCurveVisibleInView(curve, DirectionOfProjection, doc.ModelAngleToleranceRadians, doc.ModelAbsoluteTolerance))
//{
if (curve.IsLinear())
{
return WriteSVGLine(xmlDoc, curve, rhobj);
}//End if linear
else
{
Polyline polyline;
if (curve.TryGetPolyline(out polyline))
{
return WriteSVGPolyline(xmlDoc, polyline, rhobj);
}//End if polyline
else
{
Circle circle;
if (curve.TryGetCircle(out circle))
{
if (Vector3d.Multiply(circle.Normal, DirectionOfProjection) < 0.9999) return WriteSVGBezier(xmlDoc, curve, rhobj);
else return WriteSVGCircle(xmlDoc, circle, rhobj);
}
else
{
return WriteSVGBezier(xmlDoc, curve, rhobj);
}
}
}
//}
//else return null;
}
Thank you very much for your answers, I will come back to you when I can do the tests.