def test_closed_ellipse(self): ellipse = Ellipse(center=(0., 0.), rx=5.0, ry=3.0, startangle=0., endangle=360., rotation=30., segments=16, color=3, layer='0', linetype='SOLID') flags = 0 for tag in ( t for t in ellipse.__dxftags__() if isinstance(t, DXFInt) ): if tag.group_code == 70: flags = tag.value break self.assertTrue(flags & POLYLINE_CLOSED)
def test_closed_ellipse(self): ellipse = Ellipse(center=(0., 0.), rx=5.0, ry=3.0, startangle=0., endangle=360., rotation=30., segments=16, color=3, layer='0', linetype='SOLID') flags = 0 for tag in (t for t in ellipse.__dxftags__() if isinstance(t, DXFInt)): if tag.group_code == 70: flags = tag.value break self.assertTrue(flags & POLYLINE_CLOSED)
def test_api(self): ellipse = Ellipse(center=(0., 0.), rx=5.0, ry=3.0, startangle=0., endangle=360., rotation=30., segments=100, color=3, layer='0', linetype='SOLID') self.assertNotEqual(ellipse, None)
def test_implementation(self): ellipse = Ellipse(center=(0., 0.), rx=5.0, ry=3.0, startangle=0., endangle=90., rotation=30., segments=16, color=3, layer='0', linetype='SOLID') result = dxfstr(ellipse) self.assertSequenceEqual(normalize_dxf_chunk(result), normalize_dxf_chunk(expected))
def ellipse(center, rx, ry, startangle=0., endangle=360., rotation=0., segments=100, color=256, layer='0', linetype=None): """ Create a new ellipse-entity, consisting of an approximation with a polyline. :param center: center point (xy- or xyz-tuple), z-axis is 0 by default :param float rx: radius in x-axis :param float ry: radius in y-axis :param float startangle: in degree :param float endangle: in degree :param float rotation: angle between x-axis and ellipse-main-axis in degree :param int segments: count of line segments for polyline approximation :param str linetype: linetype name, if not defined = **BYLAYER** :param str layer: layer name :param int color: range [1..255], 0 = **BYBLOCK**, 256 = **BYLAYER** """ return Ellipse(center, rx, ry, startangle, endangle, rotation, segments, color, layer, linetype)