diff --git a/src/bonsai/bonsai/bim/module/root/data.py b/src/bonsai/bonsai/bim/module/root/data.py index 66412e7d483..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"): @@ -191,6 +155,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", @@ -203,7 +172,58 @@ def representation_template(cls): ), ) ) - + if (ifc_class and "IfcCableCarrierSegment" in ifc_class): + templates.extend( + ( + ( + "FLOW_SEGMENT_U_SHAPE", + "U-Shape Distribution Segment", + "Uses IfcUShapeProfileDef, has distribution ports", + ), + ) + ) + + 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 diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index a2ac73f2005..983429d3110 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}x{default_thickness*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}" @@ -717,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"