mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
See #2820. Ensure only closed polygons are merged in drawings.
This commit is contained in:
@@ -527,10 +527,14 @@ class CreateDrawing(bpy.types.Operator):
|
|||||||
for el in els:
|
for el in els:
|
||||||
classes.update(el.attrib["class"].split())
|
classes.update(el.attrib["class"].split())
|
||||||
classes.add(el.attrib["{http://www.ifcopenshell.org/ns}guid"])
|
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"):
|
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()]
|
coords = [[round(float(o), 1) for o in co[1:].split(",")] for co in path.attrib["d"].split()]
|
||||||
polygons.append(shapely.Polygon(coords))
|
if coords[0] == coords[-1]:
|
||||||
el.getparent().remove(el)
|
is_closed_polygon = True
|
||||||
|
polygons.append(shapely.Polygon(coords))
|
||||||
|
if is_closed_polygon:
|
||||||
|
el.getparent().remove(el)
|
||||||
|
|
||||||
merged_polygons = shapely.ops.unary_union(polygons)
|
merged_polygons = shapely.ops.unary_union(polygons)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user