Skip to content

Commit 13f03b7

Browse files
authored
Merge pull request #7619 from falken10vdl/MEP-Segment-tool-add-rectangular-hollow-profile
MEP-Segment-tool-add-rectangular-hollow-and-U-shape-profile
2 parents c6257a4 + 2727bec commit 13f03b7

2 files changed

Lines changed: 91 additions & 38 deletions

File tree

src/bonsai/bonsai/bim/module/root/data.py

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -134,44 +134,8 @@ def representation_template(cls):
134134
return [("FACE", "Face", "A planar face surface")]
135135
templates = [
136136
("EMPTY", "No Geometry", "Start with an empty object"),
137-
None,
138-
(
139-
"OBJ",
140-
"Tessellation From Object",
141-
"Use an object as a template to create a new tessellation",
142-
),
143-
(
144-
"MESH",
145-
"Custom Tessellation",
146-
"Create a basic tessellated or faceted cube",
147-
),
148-
(
149-
"EXTRUSION",
150-
"Custom Extruded Solid",
151-
"An extrusion from an arbitrary profile",
152-
),
153137
]
154-
if ifc_class.endswith("Type") or ifc_class.endswith("Style"):
155-
templates.extend(
156-
[
157-
None,
158-
(
159-
"LAYERSET_AXIS2",
160-
"Vertical Layers",
161-
"For objects similar to walls, will automatically add IfcMaterialLayerSet",
162-
),
163-
(
164-
"LAYERSET_AXIS3",
165-
"Horizontal Layers",
166-
"For objects similar to slabs, will automatically add IfcMaterialLayerSet",
167-
),
168-
(
169-
"PROFILESET",
170-
"Extruded Profile",
171-
"Create profile type object, automatically defines IfcMaterialProfileSet with the first profile from library",
172-
),
173-
]
174-
)
138+
175139
if ifc_class in ("IfcWindowType", "IfcWindowStyle", "IfcWindow"):
176140
templates.extend([None, ("WINDOW", "Window", "Parametric window")])
177141
elif ifc_class in ("IfcDoorType", "IfcDoorStyle", "IfcDoor"):
@@ -191,6 +155,11 @@ def representation_template(cls):
191155
"Rectangular Distribution Segment",
192156
"Works similarly to Profile, has distribution ports",
193157
),
158+
(
159+
"FLOW_SEGMENT_RECTANGULAR_HOLLOW",
160+
"Rectangular Hollow Distribution Segment",
161+
"Works similarly to Profile, has distribution ports",
162+
),
194163
(
195164
"FLOW_SEGMENT_CIRCULAR",
196165
"Circular Distribution Segment",
@@ -203,7 +172,58 @@ def representation_template(cls):
203172
),
204173
)
205174
)
206-
175+
if (ifc_class and "IfcCableCarrierSegment" in ifc_class):
176+
templates.extend(
177+
(
178+
(
179+
"FLOW_SEGMENT_U_SHAPE",
180+
"U-Shape Distribution Segment",
181+
"Uses IfcUShapeProfileDef, has distribution ports",
182+
),
183+
)
184+
)
185+
186+
if ifc_class.endswith("Type") or ifc_class.endswith("Style"):
187+
templates.extend(
188+
[
189+
None,
190+
(
191+
"LAYERSET_AXIS2",
192+
"Vertical Layers",
193+
"For objects similar to walls, will automatically add IfcMaterialLayerSet",
194+
),
195+
(
196+
"LAYERSET_AXIS3",
197+
"Horizontal Layers",
198+
"For objects similar to slabs, will automatically add IfcMaterialLayerSet",
199+
),
200+
(
201+
"PROFILESET",
202+
"Extruded Profile",
203+
"Create profile type object, automatically defines IfcMaterialProfileSet with the first profile from library",
204+
),
205+
]
206+
)
207+
templates.extend(
208+
[
209+
None,
210+
(
211+
"OBJ",
212+
"Tessellation From Object",
213+
"Use an object as a template to create a new tessellation",
214+
),
215+
(
216+
"MESH",
217+
"Custom Tessellation",
218+
"Create a basic tessellated or faceted cube",
219+
),
220+
(
221+
"EXTRUSION",
222+
"Custom Extruded Solid",
223+
"An extrusion from an arbitrary profile",
224+
),
225+
]
226+
)
207227
return templates
208228

209229
@classmethod

src/bonsai/bonsai/bim/module/root/operator.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,24 @@ def _execute(self, context):
697697
XDim=default_x_dim / unit_scale,
698698
YDim=default_y_dim / unit_scale,
699699
)
700+
elif representation_template == "FLOW_SEGMENT_RECTANGULAR_HOLLOW":
701+
default_x_dim = 0.4
702+
default_y_dim = 0.2
703+
default_thickness = 0.005
704+
default_inner_fillet_radius = 0.005
705+
default_outer_fillet_radius = 0.005
706+
profile_name = f"{props.ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}x{default_thickness*1000}"
707+
profile = tool.Ifc.get().create_entity(
708+
"IfcRectangleHollowProfileDef",
709+
ProfileName=profile_name,
710+
ProfileType="AREA",
711+
XDim=default_x_dim / unit_scale,
712+
YDim=default_y_dim / unit_scale,
713+
WallThickness=default_thickness / unit_scale,
714+
InnerFilletRadius=default_inner_fillet_radius / unit_scale,
715+
OuterFilletRadius=default_outer_fillet_radius / unit_scale,
716+
)
717+
700718
elif representation_template == "FLOW_SEGMENT_CIRCULAR":
701719
default_diameter = 0.1
702720
profile_name = f"{props.ifc_class}-{default_diameter*1000}"
@@ -717,6 +735,21 @@ def _execute(self, context):
717735
Radius=(default_diameter / 2) / unit_scale,
718736
WallThickness=default_thickness,
719737
)
738+
elif representation_template == "FLOW_SEGMENT_U_SHAPE":
739+
default_depth = 0.4
740+
default_flange_width = 0.2
741+
default_web_thickness = 0.005
742+
default_flange_thickness = 0.005
743+
profile_name = f"{props.ifc_class}-{default_depth*1000}x{default_flange_width*1000}x{default_web_thickness*1000}x{default_flange_thickness*1000}"
744+
profile = tool.Ifc.get().create_entity(
745+
"IfcUShapeProfileDef",
746+
ProfileName=profile_name,
747+
ProfileType="AREA",
748+
Depth=default_depth / unit_scale,
749+
FlangeWidth=default_flange_width / unit_scale,
750+
WebThickness=default_web_thickness / unit_scale,
751+
FlangeThickness=default_flange_thickness / unit_scale,
752+
)
720753

721754
rel = ifcopenshell.api.material.assign_material(
722755
tool.Ifc.get(), products=[element], type="IfcMaterialProfileSet"

0 commit comments

Comments
 (0)