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.
See also
Since ezdxf v0.8.9 Spline
stores fit- and control points, knots and weights as packed data
(array.array
).
Subclass of |
|
DXF type |
|
Factory function |
see table below |
Inherited DXF attributes |
|
Required DXF version |
DXF R2000 ( |
Factory Functions¶
Basic spline entity |
|
Spline control frame from fit points |
|
Open uniform spline |
|
Closed uniform spline |
|
Open rational uniform spline |
|
Closed rational uniform 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 =
1e-10
-
dxf.
fit_tolerance
¶ Fit tolerance (float); default =
1e-10
-
dxf.
control_point_tolerance
¶ Control point tolerance (float); default =
1e-10
-
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 construction tool
ezdxf.math.BSpline
.New in version 0.13.
-
apply_construction_tool
(s: BSpline) → Spline¶ Set SPLINE data from construction tool
ezdxf.math.BSpline
or from ageomdl.BSpline.Curve
object.New in version 0.13.
-
set_open_uniform
(control_points: Sequence[Vertex], degree: int = 3) → None¶ Open B-spline with uniform knot vector, start and end at your first and last control points.
-
set_uniform
(control_points: Sequence[Vertex], degree: int = 3) → None¶ B-spline 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 B-spline 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 B-spline 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 B-spline with uniform knot vector, deos 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 B-spline 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 SPLINE entity by transformation matrix m inplace.
New in version 0.13.
-
classmethod
from_arc
(entity: DXFGraphic) → Spline¶ Create a new SPLINE entity from 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!
New in version 0.13.
-