def test_to_hatches_with_ocs(self, path1): m = Matrix44.x_rotate(math.pi / 4) path = path1.transform(m) extrusion = m.transform((0, 0, 1)) hatches = list(to_hatches(path, extrusion=extrusion)) h0 = hatches[0] assert h0.dxf.elevation == (0, 0, 1) assert h0.dxf.extrusion.isclose(extrusion) polypath0 = h0.paths[0] assert polypath0.vertices[0] == (0, 0, 0) # x, y, bulge assert polypath0.vertices[-1] == (0, 0, 0), "should be closed automatically"
def test_to_edge_path_hatches(self, path): hatches = list(to_hatches(path, edge_path=True)) assert len(hatches) == 1 h0 = hatches[0] assert h0.dxftype() == 'HATCH' assert len(h0.paths) == 1 edge_path = h0.paths[0] assert edge_path.PATH_TYPE == 'EdgePath' line, spline = edge_path.edges assert line.EDGE_TYPE == 'LineEdge' assert line.start == (0, 0) assert line.end == (4, 0) assert spline.EDGE_TYPE == 'SplineEdge' assert spline.control_points[0] == (4, 0) assert spline.control_points[1] == (3, 1) # 2D OCS entity assert spline.control_points[2] == (1, 1) # 2D OCS entity assert spline.control_points[3] == (0, 0)
def test_to_poly_path_hatches_with_wcs_elevation(self, path1): hatches = list(to_hatches(path1, edge_path=False)) ho = hatches[0] assert ho.dxf.elevation == (0, 0, 1)
def test_to_poly_path_hatches(self, path): hatches = list(to_hatches(path, edge_path=False)) assert len(hatches) == 1 h0 = hatches[0] assert h0.dxftype() == 'HATCH' assert len(h0.paths) == 1
def test_empty_to_hatches(self): assert list(to_hatches([])) == []
def test_to_hatches_with_wcs_elevation(self, path1): hatches = list(to_hatches(path1)) ho = hatches[0] assert ho.dxf.elevation == (0, 0, 1)
def test_to_hatches(self, path): hatches = list(to_hatches(path)) assert len(hatches) == 1 h0 = hatches[0] assert h0.dxftype() == 'HATCH' assert len(h0.paths) == 1