Ellipse¶
Type: Composite Entity
Ellipse curves are approximated by a POLYLINE.
For an explanation of ellipse curves see Wikipedia:
http://en.wikipedia.org/wiki/Ellipse
-
DXFEngine.
ellipse
(center, rx, ry, startangle=0., endangle=360., rotation=0., segments=100, **kwargs)¶ Parameters: - center – center point (xy- or xyz-tuple), z-axis is 0 by default
- rx (float) – radius in x-axis
- ry (float) – radius in y-axis
- startangle (float) – in degree
- endangle (float) – in degree
- rotation (float) – angle between x-axis and ellipse-main-axis in degree
- segments (int) – count of line segments for polyline approximation
- linetype (str) – linetype name, if not defined = BYLAYER
- layer (str) – layer name
- color (int) – range [1..255], 0 = BYBLOCK, 256 = BYLAYER
Example¶
import dxfwrite
from dxfwrite import DXFEngine as dxf
name = 'ellipse.dxf'
dwg = dxf.drawing(name)
for axis in [0.5, 0.75, 1., 1.5, 2., 3.]:
dwg.add(dxf.ellipse((0,0), 5., axis, segments=200))
dwg.add(dxf.line((-7, 0), (+7, 0), color=1, linetype='DASHDOT'))
dwg.add(dxf.line((0, -5), (0, +5), color=2, linetype='DASHDOT'))
for rotation in [0, 30, 45, 60, 90]:
dwg.add(dxf.ellipse((20,0), 5., 2., rotation=rotation, segments=100))
for startangle in [0, 30, 45, 60, 90]:
dwg.add(dxf.ellipse((40,0), 5., 2., startangle=startangle, endangle=startangle+90,
rotation=startangle, segments=90))
dwg.add(dxf.ellipse((40,0), 5., 2., startangle=startangle+180, endangle=startangle+270,
rotation=startangle, segments=90))
dwg.save()


