From 2b7bcb1b4026c3edee2356c57f450a628278103f Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sun, 12 Apr 2026 08:09:12 -0500 Subject: [PATCH] Add opt-in toggle to join coplanar surface boundaries in drawings Introduces a "Join Coplanar Surfaces" boolean property (default off) nested under the "Generate Material Layers" option in BIM_PT_camera. When enabled, remove_coplanar_boundary_lines runs after linework generation to suppress shared boundary lines between adjacent coplanar elements of the same material. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/drawing/operator.py | 6 ++++-- src/bonsai/bonsai/bim/module/drawing/prop.py | 5 +++++ src/bonsai/bonsai/bim/module/drawing/ui.py | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index d190734290..c4c44b107d 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -1005,14 +1005,16 @@ class CreateDrawing(bpy.types.Operator): if self.cprops.generate_material_layers: self.generate_material_layers(context, root) self.merge_linework_and_add_metadata(root) - self.remove_coplanar_boundary_lines(root) + if self.cprops.generate_material_layers and self.cprops.join_coplanar_surfaces: + self.remove_coplanar_boundary_lines(root) self.move_elements_to_top(root) elif self.cprops.cut_mode == "OPENCASCADE": self.move_projection_to_bottom(root) if self.cprops.generate_material_layers: self.generate_material_layers(context, root) self.merge_linework_and_add_metadata(root) - self.remove_coplanar_boundary_lines(root) + if self.cprops.generate_material_layers and self.cprops.join_coplanar_surfaces: + self.remove_coplanar_boundary_lines(root) self.move_elements_to_top(root) if self.cprops.fill_mode == "SHAPELY": diff --git a/src/bonsai/bonsai/bim/module/drawing/prop.py b/src/bonsai/bonsai/bim/module/drawing/prop.py index 57c182c02e..235b3047c9 100644 --- a/src/bonsai/bonsai/bim/module/drawing/prop.py +++ b/src/bonsai/bonsai/bim/module/drawing/prop.py @@ -500,6 +500,11 @@ class BIMCameraProperties(PropertyGroup): generate_material_layers: bpy.props.BoolProperty( name="Generate Material Layers", description="Generate material layer linework in drawings", default=True ) + join_coplanar_surfaces: bpy.props.BoolProperty( + name="Join Coplanar Surfaces", + description="Remove shared boundary lines between adjacent coplanar elements of the same material", + default=False, + ) fill_mode: EnumProperty( items=[ ("NONE", "None", "Disable filling areas seen in projection"), diff --git a/src/bonsai/bonsai/bim/module/drawing/ui.py b/src/bonsai/bonsai/bim/module/drawing/ui.py index c1809995a0..d8e9645b1c 100644 --- a/src/bonsai/bonsai/bim/module/drawing/ui.py +++ b/src/bonsai/bonsai/bim/module/drawing/ui.py @@ -104,6 +104,10 @@ class BIM_PT_camera(Panel): row.prop(props, "linework_mode") row = self.layout.row() row.prop(props, "generate_material_layers") + if props.generate_material_layers: + row = self.layout.row() + row.separator(factor=1.0) + row.prop(props, "join_coplanar_surfaces") if props.linework_mode == "OPENCASCADE": row = self.layout.row() row.prop(props, "fill_mode")