See #2820. Fix issue where some hatches weren't merged when an object had multiple SVG paths.

This commit is contained in:
Dion Moult
2023-03-01 22:25:12 +11:00
parent 67d33001d5
commit d5ecb9b8ea
@@ -529,10 +529,12 @@ class CreateDrawing(bpy.types.Operator):
classes.add(el.attrib["{http://www.ifcopenshell.org/ns}guid"])
is_closed_polygon = False
for path in el.findall("{http://www.w3.org/2000/svg}path"):
coords = [[round(float(o), 1) for o in co[1:].split(",")] for co in path.attrib["d"].split()]
if coords[0] == coords[-1]:
is_closed_polygon = True
polygons.append(shapely.Polygon(coords))
for subpath in path.attrib["d"].split("M")[1:]:
subpath = "M" + subpath.strip()
coords = [[round(float(o), 1) for o in co[1:].split(",")] for co in subpath.split()]
if coords[0] == coords[-1]:
is_closed_polygon = True
polygons.append(shapely.Polygon(coords))
if is_closed_polygon:
el.getparent().remove(el)