From 99f2a0c1e8dc61cc584d4ed4039c705ff5e7d008 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Thu, 16 Jul 2026 13:13:54 +0300 Subject: [PATCH] bonsai(drawing): join mitred wall/slab linework by actual layer materials, not LayerSetName (#6274) The default drawing join criteria compared IfcMaterialLayerSetUsage via "material.Name", which for layered walls resolves to the optional IfcMaterialLayerSet.LayerSetName attribute. Two walls with an identical layer composition (same materials, same thicknesses) can still have a different or unset LayerSetName depending on how the material was assigned (direct instance override vs wall type), which made the 2D cut linework merge fail and left a spurious seam line at mitred or butt joins even though the walls share the same material. Switch to "materials.Name", which resolves the actual list of constituent material names via ifcopenshell.util.element.get_materials, so two elements are only treated as different when their real material composition differs. The redundant "Material.Name" entry is removed, since it never resolved to anything (get_element_value only recognizes the lowercase "material"/"materials" keys), so it was silently matching None for every element. Verified live in headless Blender 5.2 against the reporter's attached Wall joins & visualisation.ifc: before the fix, the mitred wall pair (GUIDs 1KtMvpwxL5PwkIhx8XA6Ro and 1EzeyHDj98PhTMAOhx02Zi, both a brick+concrete layered wall) rendered as two separate SVG groups with a visible internal seam. After the fix they merge into a single group with no seam, and unrelated walls that only coincidentally shared an unset LayerSetName no longer get incorrectly merged together either. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/drawing/operator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index b1c4c69c3b..6391be9474 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -1443,13 +1443,17 @@ class CreateDrawing(bpy.types.Operator): join_criteria = join_criteria.split(",") else: # Drawing convention states that same objects classes with the same material are merged when cut. + # We compare the resolved list of constituent material names ("materials.Name") rather than + # "material.Name", because for layered walls/slabs the latter resolves to the optional + # IfcMaterialLayerSet.LayerSetName, which is frequently left unset (or set inconsistently) even when + # two elements share the exact same layer composition. That caused mitred/butt-joined walls with + # identical materials to keep a spurious visible seam in the 2D linework. See #6274. join_criteria = [ "class", - "material.Name", + "materials.Name", "/Pset_.*Common/.Status", "EPset_Status.Status", "EPset_Status.UserDefinedStatus", - "Material.Name", ] group = root.find("{http://www.w3.org/2000/svg}g")