def test_polyine_lines(): from ezdxf.entities import Polyline pline = Polyline() pline.append_formatted_vertices([(1, 1), (2, 1), (2, 2)], format='xy') path = Path.from_polyline(pline) assert path.start == (1, 1) assert path.end == (2, 2) assert len(path) == 2 pline.dxf.elevation = (0, 0, 1) path = Path.from_polyline(pline) assert path.start == (1, 1, 1) assert path.end == (2, 2, 1)
def test_3d_polyine(): from ezdxf.entities import Polyline pline = Polyline.new(dxfattribs={'flags': Polyline.POLYLINE_3D}) pline.append_vertices([(1, 1, 1), (2, 1, 3), (2, 2, 2)]) path = Path.from_polyline(pline) assert path.start == (1, 1, 1) assert path.end == (2, 2, 2) assert len(path) == 2
def test_polyine_with_bulges(): from ezdxf.entities import Polyline pline = Polyline() pline.close(True) pline.append_formatted_vertices(POINTS, format='xyb') path = Path.from_polyline(pline) assert path.start == (0, 0) assert path.end == (0, 0) # closed assert any(cmd.type == Command.CURVE_TO for cmd in path)