From a6e2a97b6df31b5c87e1fef62591c1fc7545592d Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Mon, 20 Jul 2026 13:24:38 +0300 Subject: [PATCH] Bonsai: stop merged cut linework leaking classes onto disjoint pieces In merge_linework_and_add_metadata every closed subpath of an element group was queued with a reference to the same class set, so when one subpath was unioned with a neighbouring element the in-place polygon_classes.update() also rewrote the classes of that element's other, geometrically unrelated subpaths. A wall split by an opening could therefore emit a piece carrying a neighbour's GlobalId, status and metadata classes, styling it from the wrong CSS rules. Queue a copy of the class set per polygon so each merged polygon owns its own classes. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/drawing/operator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 35d93db7d2..84c2be95c7 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -1708,7 +1708,7 @@ class CreateDrawing(bpy.types.Operator): coords.append(coords[0]) if len(coords) > 2 and coords[0] == coords[-1]: is_closed_polygon = True - queue.append((shapely.Polygon(coords), classes)) + queue.append((shapely.Polygon(coords), set(classes))) if is_closed_polygon: el.getparent().remove(el)