Converting Curves into multiple arcs


#1

I see that there is a convert option that does this job, but I can’t find any functions in the Rhinocommon SDK that can do the same thing in one step. Does anyone know how to convert a freeform curve into arcs? Is there a way to see the algorithm behind the convert feature?


(David Rutten) #2

Convert option where? Grasshopper only provides ways to convert curves to polylines. Perhaps you’re using a plug-in component?


#3

It’s in Rhino: Curve->Convert->Curve To Arcs


(David Rutten) #4

I was confused because you posted this in the Grasshopper Developer forum, whereas this concerns Rhino commands and Rhino SDK. The ConvertCurveToArc logic uses bi-arcs as I recall which are not exposed in the SDK. Grasshopper also has a bi-arc algorithm (but that code is part of the CurveComponents.gha project, not Grasshopper.dll).

I copied my C# bi-arc fitter into a GH C# component. The attached file contains a script component which creates a collection of tangent bi-arcs that approximate a curve.

biarcfitter.gh (3.9 KB)


#5

Thanks!


#6

There are two problems with the code.

1- the last or the first arc part is missing.

2- if there is a kink on the curve, the code doesn’t work well.

here is screenshot


(David Rutten) #7

Try the adjusted script attached. It can create very short biarcs near kinks, if the original curve division yielded a point nearby. This can be handled but would require additional code.

biarcfitter.gh (6.9 KB)


#8

Thanks, that works. And also thanks for the really fast reply.