From 966751a928aa77163b8829029463f98774d33754 Mon Sep 17 00:00:00 2001 From: falken10vdl Date: Thu, 29 Jan 2026 13:10:54 +0100 Subject: [PATCH 1/4] Add support for FLOW_SEGMENT_RECTANGULAR_HOLLOW in profile creation in the MEP Segment Tool --- src/bonsai/bonsai/bim/module/root/data.py | 5 +++++ src/bonsai/bonsai/bim/module/root/operator.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/root/data.py b/src/bonsai/bonsai/bim/module/root/data.py index 66412e7d483..d2516559b49 100644 --- a/src/bonsai/bonsai/bim/module/root/data.py +++ b/src/bonsai/bonsai/bim/module/root/data.py @@ -191,6 +191,11 @@ def representation_template(cls): "Rectangular Distribution Segment", "Works similarly to Profile, has distribution ports", ), + ( + "FLOW_SEGMENT_RECTANGULAR_HOLLOW", + "Rectangular Hollow Distribution Segment", + "Works similarly to Profile, has distribution ports", + ), ( "FLOW_SEGMENT_CIRCULAR", "Circular Distribution Segment", diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index a2ac73f2005..dc1d74f0279 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -697,6 +697,24 @@ def _execute(self, context): XDim=default_x_dim / unit_scale, YDim=default_y_dim / unit_scale, ) + elif representation_template == "FLOW_SEGMENT_RECTANGULAR_HOLLOW": + default_x_dim = 0.4 + default_y_dim = 0.2 + default_thickness = 0.005 + default_inner_fillet_radius = 0.005 + default_outer_fillet_radius = 0.005 + profile_name = f"{props.ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}" + profile = tool.Ifc.get().create_entity( + "IfcRectangleHollowProfileDef", + ProfileName=profile_name, + ProfileType="AREA", + XDim=default_x_dim / unit_scale, + YDim=default_y_dim / unit_scale, + WallThickness=default_thickness / unit_scale, + InnerFilletRadius=default_inner_fillet_radius / unit_scale, + OuterFilletRadius=default_outer_fillet_radius / unit_scale, + ) + elif representation_template == "FLOW_SEGMENT_CIRCULAR": default_diameter = 0.1 profile_name = f"{props.ifc_class}-{default_diameter*1000}" From d06f5a6cb9fb279d9ec758a1b99e82dcc3ee6ea6 Mon Sep 17 00:00:00 2001 From: falken10vdl Date: Thu, 29 Jan 2026 13:12:47 +0100 Subject: [PATCH 2/4] Add thickness dimension to profile name --- src/bonsai/bonsai/bim/module/root/operator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index dc1d74f0279..73f23deb9ee 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -703,7 +703,7 @@ def _execute(self, context): default_thickness = 0.005 default_inner_fillet_radius = 0.005 default_outer_fillet_radius = 0.005 - profile_name = f"{props.ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}" + profile_name = f"{props.ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}x{default_thickness*1000}" profile = tool.Ifc.get().create_entity( "IfcRectangleHollowProfileDef", ProfileName=profile_name, From e47694458f210b092126b748830cbef0cecc7899 Mon Sep 17 00:00:00 2001 From: falken10vdl Date: Thu, 29 Jan 2026 23:21:14 +0100 Subject: [PATCH 3/4] Add support for FLOW_SEGMENT_U_SHAPE in the AddElement operator --- src/bonsai/bonsai/bim/module/root/data.py | 5 +++++ src/bonsai/bonsai/bim/module/root/operator.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/root/data.py b/src/bonsai/bonsai/bim/module/root/data.py index d2516559b49..c23ea49e33c 100644 --- a/src/bonsai/bonsai/bim/module/root/data.py +++ b/src/bonsai/bonsai/bim/module/root/data.py @@ -206,6 +206,11 @@ def representation_template(cls): "Circular Hollow Distribution Segment", "Works similarly to Profile, has distribution ports", ), + ( + "FLOW_SEGMENT_U_SHAPE", + "U-Shape Distribution Segment", + "Uses IfcUShapeProfileDef, has distribution ports", + ), ) ) diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index 73f23deb9ee..983429d3110 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -735,6 +735,21 @@ def _execute(self, context): Radius=(default_diameter / 2) / unit_scale, WallThickness=default_thickness, ) + elif representation_template == "FLOW_SEGMENT_U_SHAPE": + default_depth = 0.4 + default_flange_width = 0.2 + default_web_thickness = 0.005 + default_flange_thickness = 0.005 + profile_name = f"{props.ifc_class}-{default_depth*1000}x{default_flange_width*1000}x{default_web_thickness*1000}x{default_flange_thickness*1000}" + profile = tool.Ifc.get().create_entity( + "IfcUShapeProfileDef", + ProfileName=profile_name, + ProfileType="AREA", + Depth=default_depth / unit_scale, + FlangeWidth=default_flange_width / unit_scale, + WebThickness=default_web_thickness / unit_scale, + FlangeThickness=default_flange_thickness / unit_scale, + ) rel = ifcopenshell.api.material.assign_material( tool.Ifc.get(), products=[element], type="IfcMaterialProfileSet" From 2727bec929bbf8565c9ba93aea991d821c84ceb4 Mon Sep 17 00:00:00 2001 From: falken10vdl Date: Fri, 30 Jan 2026 10:24:53 +0100 Subject: [PATCH 4/4] Reorder representation_template to improve clarity and organization as per user feedback --- src/bonsai/bonsai/bim/module/root/data.py | 86 +++++++++++++---------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/root/data.py b/src/bonsai/bonsai/bim/module/root/data.py index c23ea49e33c..50f3248d8fc 100644 --- a/src/bonsai/bonsai/bim/module/root/data.py +++ b/src/bonsai/bonsai/bim/module/root/data.py @@ -134,44 +134,8 @@ def representation_template(cls): return [("FACE", "Face", "A planar face surface")] templates = [ ("EMPTY", "No Geometry", "Start with an empty object"), - None, - ( - "OBJ", - "Tessellation From Object", - "Use an object as a template to create a new tessellation", - ), - ( - "MESH", - "Custom Tessellation", - "Create a basic tessellated or faceted cube", - ), - ( - "EXTRUSION", - "Custom Extruded Solid", - "An extrusion from an arbitrary profile", - ), ] - if ifc_class.endswith("Type") or ifc_class.endswith("Style"): - templates.extend( - [ - None, - ( - "LAYERSET_AXIS2", - "Vertical Layers", - "For objects similar to walls, will automatically add IfcMaterialLayerSet", - ), - ( - "LAYERSET_AXIS3", - "Horizontal Layers", - "For objects similar to slabs, will automatically add IfcMaterialLayerSet", - ), - ( - "PROFILESET", - "Extruded Profile", - "Create profile type object, automatically defines IfcMaterialProfileSet with the first profile from library", - ), - ] - ) + if ifc_class in ("IfcWindowType", "IfcWindowStyle", "IfcWindow"): templates.extend([None, ("WINDOW", "Window", "Parametric window")]) elif ifc_class in ("IfcDoorType", "IfcDoorStyle", "IfcDoor"): @@ -206,6 +170,11 @@ def representation_template(cls): "Circular Hollow Distribution Segment", "Works similarly to Profile, has distribution ports", ), + ) + ) + if (ifc_class and "IfcCableCarrierSegment" in ifc_class): + templates.extend( + ( ( "FLOW_SEGMENT_U_SHAPE", "U-Shape Distribution Segment", @@ -213,7 +182,48 @@ def representation_template(cls): ), ) ) - + + if ifc_class.endswith("Type") or ifc_class.endswith("Style"): + templates.extend( + [ + None, + ( + "LAYERSET_AXIS2", + "Vertical Layers", + "For objects similar to walls, will automatically add IfcMaterialLayerSet", + ), + ( + "LAYERSET_AXIS3", + "Horizontal Layers", + "For objects similar to slabs, will automatically add IfcMaterialLayerSet", + ), + ( + "PROFILESET", + "Extruded Profile", + "Create profile type object, automatically defines IfcMaterialProfileSet with the first profile from library", + ), + ] + ) + templates.extend( + [ + None, + ( + "OBJ", + "Tessellation From Object", + "Use an object as a template to create a new tessellation", + ), + ( + "MESH", + "Custom Tessellation", + "Create a basic tessellated or faceted cube", + ), + ( + "EXTRUSION", + "Custom Extruded Solid", + "An extrusion from an arbitrary profile", + ), + ] + ) return templates @classmethod