NurbSpline Creation Error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on a Revit plugin that in part accepts closed curves from Rhino that can be used to create a floor in Revit. In trying to accomodate all of the different Rhino curves that could be used I'm translating splines. The closest way to generate the spline with minimal deviation from the original has been to use NurbSpline.Create to generate the spline. I'm feeding it the control points, weights, knots, and degree from the Rhino curve and it so far works fine when the degree is set to 3 (and all other requirements met), but I've been running into an odd problem when the degree is set to 5.
The documentation says:
Degree must be 3 or greater. If rational, the control points and weights array must be the same size. There must be at least degree+1 control points. The size of knots must equal the sum of degree, the size of the controlPoints array and 1. The first degree+1 knots should be identical, as should the last degree+1 knots. The knots in the middle of the sequence must be non-decreasing.
If I feed it degree, control point, weight, and knot information such that the degree is 5 and the control point size is equal to degree + 1, the minimum 6 control points then the NurbSpline.Create method works fine. If I try to use a curve with more than degree+1 (6) control points it throws the ArgumentsInconsistentException. Reviewing all of the information shows that the size of the knots array is equal to the degree + control point size + 1, the first degree +1 knots are the same value as are the last degre +1 knots, and all of the other knot values are always non-decreasing. I've tried it on a couple of dozen splines and it looks pretty consistent.
The file has two splines that I tried to create just in a macro to test. The first spline should fail and the second spline should go through and create itself.