Alternative for Curve.GetSubCurves

What are some alternatives to Curve.GetSubCurves? This call ties my plugin to version 8.13 while I would prefer it to be available for earlier versions as well. I am using it to ubiquitously convert curves even if they are polycurves.

from the documentation:

The results will be similar to what is produced by Rhino's **Explode** command. 

That’s great but this method exists in the PolyCurve class while I would like to use it for the general Curve class. Would it be sufficient to create this extension method myself or can there be corner cases where any kind of curve that consists of >1 segments would not be handled?

public static Curve[] getSubCurves(this Curve curve) {
    if (curve is PolyCurve polyCurve) {
        return polyCurve.Explode();
    }
    else return new Curve[] { curve };
}

Hi @Christos_Tsaridis,

This method is available in all versions of Rhino 8.

Does this help?

– Dale

Hi @dale ,

This is also what the documentation claims, however if I reference any version of RhinoCommon before 8.08, I get an error message. So I am looking for an alternative.

image
image

Hi @Christos_Tsaridis,

Yes, I can see that. There is the original issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-81979

So why would you want support versions older than 8.8? If you find a user with an older version, they should be encouraged to update.

– Dale