def test_to_lwpolylines(self, path): polylines = list(to_lwpolylines(path)) assert len(polylines) == 1 p0 = polylines[0] assert p0.dxftype() == 'LWPOLYLINE' assert p0[0] == (0, 0, 0, 0, 0) # x, y, swidth, ewidth, bulge assert p0[-1] == (0, 0, 0, 0, 0)
def test_to_lwpolylines_with_ocs(self, path1): m = Matrix44.x_rotate(math.pi / 4) path = path1.transform(m) extrusion = m.transform((0, 0, 1)) polylines = list(to_lwpolylines(path, extrusion=extrusion)) p0 = polylines[0] assert p0.dxf.elevation == pytest.approx(1) assert p0.dxf.extrusion.isclose(extrusion) assert p0[0] == (0, 0, 0, 0, 0) assert p0[-1] == (4, 0, 0, 0, 0)
def test_to_lwpolylines_with_wcs_elevation(self, path1): polylines = list(to_lwpolylines(path1)) p0 = polylines[0] assert p0.dxf.elevation == 1
def test_empty_to_lwpolyline(self): assert list(to_lwpolylines([])) == []