Ellipse

The ELLIPSE (DXF Reference) entity is a 3D curve defined by the dxf.center, the dxf.major_axis vector and the dxf.extrusion vector.

The dxf.ratio attribute is the ratio of minor axis to major axis and has to be smaller or equal 1. The dxf.start_param and dxf.end_param attributes defines the starting- and the end point of the ellipse, a full ellipse goes from 0 to 2*pi. The curve always goes from start- to end param in counter clockwise orientation.

The dxf.extrusion vector defines the normal vector of the ellipse plan. The minor axis direction is calculated by dxf.extrusion cross dxf.major_axis. The default extrusion vector (0, 0, 1) defines an ellipse plane parallel to xy-plane of the WCS.

All coordinates and vectors in WCS.

Subclass of

ezdxf.entities.DXFGraphic

DXF type

'ELLIPSE'

factory function

add_ellipse()

Inherited DXF attributes

Common graphical DXF attributes

Required DXF version

DXF R2000 ('AC1015')

class ezdxf.entities.Ellipse
dxf.center

Center point of circle (2D/3D Point in WCS)

dxf.major_axis

Endpoint of major axis, relative to the dxf.center (Vec3), default value is (1, 0, 0).

dxf.ratio

Ratio of minor axis to major axis (float), has to be in range from 0.000001 to 1.0, default value is 1.

dxf.start_param

Start parameter (float), default value is 0.

dxf.end_param

End parameter (float), default value is 2*pi.

start_point

Returns the start point of the ellipse in WCS.

end_point

Returns the end point of the ellipse in WCS.

minor_axis

Returns the minor axis of the ellipse as Vec3 in WCS.

construction_tool() ConstructionEllipse

Returns construction tool ezdxf.math.ConstructionEllipse.

apply_construction_tool(e: ConstructionEllipse) Ellipse

Set ELLIPSE data from construction tool ezdxf.math.ConstructionEllipse.

vertices(params: Iterable[float]) Iterable[Vec3]

Yields vertices on ellipse for iterable params in WCS.

Parameters

params – param values in the range from 0 to 2*pi in radians, param goes counter-clockwise around the extrusion vector, major_axis = local x-axis = 0 rad.

flattening(distance: float, segments: int = 8) Iterable[Vec3]

Adaptive recursive flattening. The argument segments is the minimum count of approximation segments, if the distance from the center of the approximation segment to the curve is bigger than distance the segment will be subdivided. Returns a closed polygon for a full ellipse: start vertex == end vertex.

Parameters
  • distance – maximum distance from the projected curve point onto the segment chord.

  • segments – minimum segment count

params(num: int) Iterable[float]

Returns num params from start- to end param in counter-clockwise order.

All params are normalized in the range from [0, 2*pi).

transform(m: Matrix44) Ellipse

Transform the ELLIPSE entity by transformation matrix m inplace.

translate(dx: float, dy: float, dz: float) Ellipse

Optimized ELLIPSE translation about dx in x-axis, dy in y-axis and dz in z-axis, returns self (floating interface).

to_spline(replace=True) Spline

Convert ELLIPSE to a Spline entity.

Adds the new SPLINE entity to the entity database and to the same layout as the source entity.

Parameters

replace – replace (delete) source entity by SPLINE entity if True

classmethod from_arc(entity: DXFGraphic) Ellipse

Create a new ELLIPSE entity from ARC or CIRCLE entity.

The new SPLINE entity has no owner, no handle, is not stored in the entity database nor assigned to any layout!