Spline¶
SPLINE curve (DXF Reference), all coordinates have to be 3D coordinates even the spline is only a 2D planar curve.
The spline curve is defined by control points, knot values and weights. The control points establish the spline, the various types of knot vector determines the shape of the curve and the weights of rational splines define how strong a control point influences the shape.
To create a Spline
curve you just need a bunch of fit points  knot
values and weights are optional (tested with AutoCAD 2010). If you add
additional data, be sure that you know what you do.
New in version 0.16: The function ezdxf.math.fit_points_to_cad_cv()
calculates control
vertices from given fit points. This control vertices define a cubic
Bspline which matches visually the SPLINE entities created by BricsCAD and
AutoCAD from fit points.
See also
 Wikipedia article about B_splines
 Department of Computer Science and Technology at the Cambridge University
 Tutorial for Spline
Subclass of  ezdxf.entities.DXFGraphic 
DXF type  'SPLINE' 
Factory function  see table below 
Inherited DXF attributes  Common graphical DXF attributes 
Required DXF version  DXF R2000 ('AC1015' ) 
Factory Functions¶
Basic spline entity  add_spline() 
Spline control frame from fit points  add_spline_control_frame() 
Open uniform spline  add_open_spline() 
Closed uniform spline  add_closed_spline() 
Open rational uniform spline  add_rational_spline() 
Closed rational uniform spline  add_closed_rational_spline() 

class
ezdxf.entities.
Spline
¶ All points in WCS as (x, y, z) tuples

dxf.
degree
¶ Degree of the spline curve (int).

dxf.
flags
¶ Bit coded option flags, constants defined in
ezdxf.lldxf.const
:dxf.flags Value Description CLOSED_SPLINE 1 Spline is closed PERIODIC_SPLINE 2 RATIONAL_SPLINE 4 PLANAR_SPLINE 8 LINEAR_SPLINE 16 planar bit is also set

dxf.
n_knots
¶ Count of knot values (int), automatically set by ezdxf (read only)

dxf.
n_fit_points
¶ Count of fit points (int), automatically set by ezdxf (read only)

dxf.
n_control_points
¶ Count of control points (int), automatically set by ezdxf (read only)

dxf.
knot_tolerance
¶ Knot tolerance (float); default =
1e10

dxf.
fit_tolerance
¶ Fit tolerance (float); default =
1e10

dxf.
control_point_tolerance
¶ Control point tolerance (float); default =
1e10

closed
¶ True
if spline is closed. A closed spline has a connection from the last control point to the first control point. (read/write)

control_points
¶ VertexArray
of control points in WCS.

fit_points
¶ VertexArray
of fit points in WCS.

knots
¶ Knot values as
array.array('d')
.

weights
¶ Control point weights as
array.array('d')
.

control_point_count
() → int¶ Count of control points.

fit_point_count
() → int¶ Count of fit points.

knot_count
() → int¶ Count of knot values.

construction_tool
() → BSpline¶ Returns the construction tool
ezdxf.math.BSpline
.

apply_construction_tool
(s: BSpline) → Spline¶ Apply SPLINE data from a
BSpline
construction tool or from ageomdl.BSpline.Curve
object.

flattening
(distance: float, segments: int = 4) → Iterable[Vec3]¶ Adaptive recursive flattening. The argument segments is the minimum count of approximation segments between two knots, if the distance from the center of the approximation segment to the curve is bigger than distance the segment will be subdivided.
Parameters:  distance – maximum distance from the projected curve point onto the segment chord.
 segments – minimum segment count between two knots
New in version 0.15.

set_open_uniform
(control_points: Sequence[Vertex], degree: int = 3) → None¶ Open Bspline with uniform knot vector, start and end at your first and last control points.

set_uniform
(control_points: Sequence[Vertex], degree: int = 3) → None¶ Bspline with uniform knot vector, does NOT start and end at your first and last control points.

set_closed
(control_points: Sequence[Vertex], degree=3) → None¶ Closed Bspline with uniform knot vector, start and end at your first control point.

set_open_rational
(control_points: Sequence[Vertex], weights: Sequence[float], degree: int = 3) → None¶ Open rational Bspline with uniform knot vector, start and end at your first and last control points, and has additional control possibilities by weighting each control point.

set_uniform_rational
(control_points: Sequence[Vertex], weights: Sequence[float], degree: int = 3) → None¶ Rational Bspline with uniform knot vector, does NOT start and end at your first and last control points, and has additional control possibilities by weighting each control point.

set_closed_rational
(control_points: Sequence[Vertex], weights: Sequence[float], degree: int = 3) → None¶ Closed rational Bspline with uniform knot vector, start and end at your first control point, and has additional control possibilities by weighting each control point.

transform
(m: Matrix44) → Spline¶ Transform the SPLINE entity by transformation matrix m inplace.

classmethod
from_arc
(entity: DXFGraphic) → Spline¶ Create a new SPLINE entity from a CIRCLE, ARC or ELLIPSE entity.
The new SPLINE entity has no owner, no handle, is not stored in the entity database nor assigned to any layout!
