I am unable to recreate a new nurbcurve with arches in C#
I couldn’t match the NurbsKnotsList of the new nurbscurve to the old one, resulting a pinched kink in the newly created curve on the right.
The output shows the two curves have different NurbsCurveKnotList
Below is my code:
private NurbsCurve CreateNurbsFromGrevillePoints(IEnumerable<Point3d> grevillePoints, int degree, double knots)
var curve = new NurbsCurve(degree, grevillePoints.Count());
for (int i = 0; i < grevillePoints.Count(); i++)
curve.Points[i] = new ControlPoint(0, i, 0);
curve.Knots.CreatePeriodicKnots(0.5 * Math.PI);
I think you’re trying to re-create a periodic nurbs curve, which does not have clamped knots. So, if you remove the second to last line which clamps the knots, would it work any better?
If not, please attach the gh file, so others can take a look.
@menno Thanks so much!!
I have attached the .gh file.
All I am trying to do is to manipulate the greville points and rebuild it back using those data.
But I found out that if the curve is closed, I cannot rebuild it as it was.
I suspect it has something to do with how the knots are arranged.
How do I manipulate the NurbsCurveKnotList?
There doesn’t seem to be any relevant exposed method for me to create an new array from scratch.
manipulateGrevillePoints.gh (9.6 KB)
How about this?
test_setgrevillepoints.gh (4.1 KB)
But I actually want to have more of a control of the knotlist.
The above example is just a demonstration of how the NurbsCurveKnotList is hard to be manipulated.
for instance sometimes I would like to add a kink when t=0.2
or i would like to convert the kink when t=0.2 back to an ordinary edit point.
How can I go about that with C#?