Declare new Curve into C# script component


I just faced a little issue trying to use the object Curve into C# script component.

I initialized a curve :

var tempCurve = new Curve();

and I get this error message:

1. Error (CS0122): ‘Rhino.Geometry.Curve.Curve(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)’ is inaccessible due to its protection level (line 62)

Now, I see that the Class is Protected; what does it change? how can it be used?

Thanks for your help!


Curve is just the base class providing framework and functionality. Depending on the type of curve you want to create, there are many options:

  • Call a derived curve classes constructor, i.e. new NurbsCurve(…,…);
  • Call a static construction method: Curve.CreateControlPointCurve(…,…);
  • Create the curve from a different object, i.e. by duplicating the boundary of a surface or brep
  • Transform another object to a curve, i.e. Line line = new Line(ptA, ptB); then line.ToNurbsCurve()


1 Like

Thanks for the answer.

What I needed was to get some Curve objects as input and modify them in a for loop; then create a new Curve object to output.

In the meantime I managed to do it creating a NurbsCurve object from the Curve using a cast.