From 2d6744008537c69ea1681086126d58ae196d0699 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 1 Jun 2025 09:22:40 +0200 Subject: [PATCH] Draw.py don't assert just only take outer boundary in arrangement --- src/ifcopenshell-python/ifcopenshell/draw.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/draw.py b/src/ifcopenshell-python/ifcopenshell/draw.py index 55fac81626..502c7f5abf 100644 --- a/src/ifcopenshell-python/ifcopenshell/draw.py +++ b/src/ifcopenshell-python/ifcopenshell/draw.py @@ -441,8 +441,16 @@ def main( for p in yield_groups(svg1, "path") if "IfcSpace" in p.parentNode.getAttribute("class") ] - assert all(s.count("M") == 1 for s in polies) - polies = [[[*map(float, s[1:].split(","))] for s in d.split(" ")[:-1]] for d in polies] + + def break_at_second(char, s, offset=1): + i = s.find(char, offset) + if i == -1: + return s + else: + warnings.warn('Polygons with holes are not supported') + return s[0:i] + + polies = [[[*map(float, s[1:].split(","))] for s in break_at_second('M', d).split(" ")[:-1]] for d in polies] def create_poly(b): p = ifcopenshell.ifcopenshell_wrapper.polygon_2()