CreateInterpolatedCurve() not found? Rhino Student needs help!

This is my code:

Rhino.Geometry.Curve curve = new Rhino.Geometry.Curve.CreateInterpolatedCurve(points, 3, CurveKnotStyle.Uniform);

Visual Studio gives me this error:
“The type name ‘CreateInterpolatedCurve’ does not exist in the type ‘Curve’”

How do I fix this?

Rhino.Geometry.Curve is a RhinoCommon class - something you’d use if you were writing a plug-in in .NET.

From your past posts, it appears that you are writing a plug-in in C++. Here is a sample of creating an interpolated NURBS curve in C++.

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleInterpCurve.cpp

My mistake - you might be using RhinoCommon, in which case CreateInterpolatedCurve is a static function on Rhino.Geometry.Curve. Make sure you project references RhinoCommon.

This statement is wrong:

Rhino.Geometry.Curve curve = new Rhino.Geometry.Curve.CreateInterpolatedCurve(points, 3, CurveKnotStyle.Uniform);

Because CreateInterpolatedCurve is a static function, you must call it like this (without the new operator):

Rhino.Geometry.Curve curve = Rhino.Geometry.Curve.CreateInterpolatedCurve(points, 3, CurveKnotStyle.Uniform);

1 Like

Good catch @menno. I completely missed the ‘new’…

Thank you all for your help, I was able to fix it.