Table of Contents

Method SetNurbsData

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

SetNurbsData(int, bool, bool, bool, IEnumerable<GeoPoint3>, IEnumerable<double>, IEnumerable<double>)

Gives the spline its whole NURBS data at once, as setting AutoCAD's NurbsData does: degree, flags, control points, knots and weights, checked together and written in one go, its fit data (fit points and end tangents) taken out, as the spline is given by its control points from then on. A cubic of 4 points from (0, 0, 0) to (4, 0, 0) takes the knots 0, 0, 0, 0, 1, 1, 1, 1. A curve whose ends meet (within 1E-3) is written closed, the flag 1 of group 70, and where it runs on across its seam in the one direction (within 1E-12 of a radian, whatever its size), with the flag 2 as well, whatever closed and periodic say, as AutoCAD 2021 writes one: its closed cubic of 70 11 given its own data back not periodic, or not closed, was saved 70 11 and read closed (its 17-k), and with its seam turned by a hundred-millionth of a degree saved 70 9 (17-x); the flags 32 and 1024 of fit data go with the fit data, its periodic cubic of 70 3115 given its own data back being saved 70 2059.

public void SetNurbsData(int degree, bool rational, bool closed, bool periodic, IEnumerable<GeoPoint3> controlPoints, IEnumerable<double> knots, IEnumerable<double> weights)

Parameters

degree int

The degree, 1 or more.

rational bool

Whether the weights are written (flag 4 of group 70).

closed bool

Whether it is closed (flag 1); a curve whose ends meet is closed whatever this says.

periodic bool

Whether it is periodic as the DXF reference has it (flag 2), which a curve closed round a smooth seam is whatever this says; where it is not, AutoCAD's flag 2048 of a periodic spline (IsPeriodic) is taken off too, and kept as it was where it is.

controlPoints IEnumerable<GeoPoint3>

The control points, in the world, the degree and one at least.

knots IEnumerable<double>

The knots, as many as the points and the degree and one, none going down.

weights IEnumerable<double>

The weights, one to each point above nought where the spline is rational; not read, and may be null, where it is not.

Exceptions

ArgumentNullException

Thrown when the points or the knots are null, or the weights of a rational spline.

ArgumentOutOfRangeException

Thrown when the degree is below 1, or a knot or weight is not finite, or a weight not above nought.

ArgumentException

Thrown when a point is not finite, or the counts do not make a spline.

InvalidOperationException

Thrown when the spline is erased.