Creating ON_NurbsCurve from control points and knot vector

Hi,

How do I create ON_NurbsCurve from control points and knot vector? Constructor takes dimension, rationalbool, order and nControl points as args. How do I get control point array and knot vector array?

Sorry …How do I SET control point array and knot vector array?

I think you may find this example useful

More example code can be found on
http://wiki.mcneel.com/developer/sdksamples/knowledgebasecpp

I am using C++ opennurbs toolkit.

The example should also work in OpenNURBS I think.

Thanks for help. I could create ON_NurbsCurve. I have another problem now. I am parsing SPLINE from DXF file. Degree is 3, control point count is 5 and knot vector count is 9. Either degree has to be 5 or knot vector count has to be 7. So Curve->IsValid() returns falls and so I can’t evaluate nurbs curve. Any help is appreciated.

The DXF format uses an extra duplicated knot at the beginning and end of the knot vector (this value is not required and is used in many “old” formats). You must discard the first and last knot in the DXF knot vector when you go to Rhino. From Rhino to DXF, you must duplicate the first and last knot.

1 Like

Thanks for the help. But I do not get complete spline if I omit first and last knot. Also in one another case the spline is shifted in WCS by some distance. I am certainly doing something wrong. How can I attach images here for audience to see the problem?

You can use the “cloud-with-arrow” icon to attach files to your post.