def test_to_polylines2d(self, path): polylines = list(to_polylines2d(path)) assert len(polylines) == 1 p0 = polylines[0] assert p0.dxftype() == 'POLYLINE' assert p0.is_2d_polyline is True assert p0[0].dxf.location == (0, 0, 0) assert p0[-1].dxf.location == (0, 0, 0)
def test_to_polylines2d_with_ocs(self, path1): m = Matrix44.x_rotate(math.pi / 4) path = path1.transform(m) extrusion = m.transform((0, 0, 1)) polylines = list(to_polylines2d(path, extrusion=extrusion)) p0 = polylines[0] assert p0.dxf.elevation == (0, 0, 1) assert p0.dxf.extrusion.isclose(extrusion) assert p0[0].dxf.location == (0, 0, 1) assert p0[-1].dxf.location == (4, 0, 1)
def test_to_polylines2d_with_wcs_elevation(self, path1): polylines = list(to_polylines2d(path1)) p0 = polylines[0] assert p0.dxf.elevation == (0, 0, 1)
def test_empty_to_polylines2d(self): assert list(to_polylines2d([])) == []