Polyline, PolyCurve, Nurbs -> To PolyCurve

I am dealing with complex curves, most times PolyCurves that serve as machine pathes.
I store additional information in the Userdata - currently on the top level Curve - currently i do not use the Userdata of the Segemetcurve / Sub-Objekct (which might be an alternative approach).
I am a bit stuck as for some special cases the curve could be a line, a nurbs curve with degree 1 or a polyline. Without converting, this would generate some ugly special cases.
(see also here: PolylineCurve to Polyline )

For me the easiest would be a “To PolyCurve” Function - even if the Polycurve only has one segment.
Do I miss something ?
or do i really have to write a / deal with a “to Polycurve” Function for those rare / special cases myself?
Or is there any reason why there is a TryGetPolyline, ToNurbs… but no equivalent for “ToPolyCurve” ?
(or i just did not find it ?)

thanks

crvs_.3dm (53.6 KB)

Hi @Tom_P,

In general, a PolyCurve should not have a single curve segment, as the whole point of a PolyCurve is to hold a sequence of contiguous Curve segments.

A LineCurve inherits from Curve, just like PolyCurve. So I don’t understand the problem.

– Dale

Dear @dale thanks for having a look at it. My Problem is not on the geometrical side, but regarding additional data: I store additional information per segment, like tool, speed, acceleration to later output g-code. It would be nice to handle only one sub-type of Curves.
The workarround would be to “duplicate Segments” of a Curve each time i handle the geometry - or to do separate cases for each curve type