def test_from_circle(radius): circle = factory.new('CIRCLE', dxfattribs={ 'center': (1, 0, 0), 'radius': radius, }) path = make_path(circle) assert path.start == (2, 0) assert path.end == (2, 0) assert path.is_closed is True
def test_polyine_with_bulges(): from ezdxf.entities import Polyline pline = Polyline() pline.close(True) pline.append_formatted_vertices(POINTS, format='xyb') path = make_path(pline) assert path.start == (0, 0) assert path.end == (0, 0) # closed assert any(cmd.type == Command.CURVE4_TO for cmd in path)
def test_from_quadrilateral_with_3_points(dxftype): entity = factory.new(dxftype) entity.dxf.vtx0 = (0, 0, 0) entity.dxf.vtx1 = (1, 0, 0) entity.dxf.vtx2 = (1, 1, 0) entity.dxf.vtx3 = (1, 1, 0) # last two points are equal path = make_path(entity) assert path.is_closed is True assert len(list(path.approximate())) == 4
def test_from_arc(): arc = factory.new('ARC', dxfattribs={ 'center': (1, 0, 0), 'radius': 1, 'start_angle': 0, 'end_angle': 180, }) path = make_path(arc) assert path.start == (2, 0) assert path.end == (0, 0)
def test_from_ellipse(): ellipse = factory.new('ELLIPSE', dxfattribs={ 'center': (3, 0), 'major_axis': (1, 0), 'ratio': 0.5, 'start_param': 0, 'end_param': math.pi }) path = make_path(ellipse) assert path.start == (4, 0) assert path.end == (2, 0)
def test_from_spline(): spline = factory.new('SPLINE') spline.fit_points = [(2, 0), (4, 1), (6, -1), (8, 0)] path = make_path(spline) assert path.start == (2, 0) assert path.end == (8, 0)