def _boundaries_to_polygons(boundaries, ocs, elevation): paths = (Path.from_hatch_boundary_path(boundary, ocs, elevation) for boundary in boundaries) for polygon in nesting.fast_bbox_detection(paths): exterior = polygon[0] # only take exterior path of level 1 holes, nested holes are ignored yield exterior, [hole[0] for hole in polygon[1:]]
def _hatch_primitives( hatch: 'Hatch', max_flattening_distance=None) -> Iterable[AbstractPrimitive]: """ Yield all HATCH boundary paths as separated Path() objects. """ ocs = hatch.ocs() elevation = hatch.dxf.elevation.z for boundary in hatch.paths: yield PathPrimitive( Path.from_hatch_boundary_path(boundary, ocs, elevation), hatch, max_flattening_distance)
def boundary_to_vertices(boundary) -> List[Vector]: path = Path.from_hatch_boundary_path(boundary, ocs, elevation) return path_to_vertices(path)
def to_path(p): path = Path.from_hatch_boundary_path(p, ocs, elevation) path.close() return path