mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Merge pull request #7619 from falken10vdl/MEP-Segment-tool-add-rectangular-hollow-profile
MEP-Segment-tool-add-rectangular-hollow-and-U-shape-profile
This commit is contained in:
@@ -134,23 +134,55 @@ class IfcClassData:
|
|||||||
return [("FACE", "Face", "A planar face surface")]
|
return [("FACE", "Face", "A planar face surface")]
|
||||||
templates = [
|
templates = [
|
||||||
("EMPTY", "No Geometry", "Start with an empty object"),
|
("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 in ("IfcWindowType", "IfcWindowStyle", "IfcWindow"):
|
||||||
|
templates.extend([None, ("WINDOW", "Window", "Parametric window")])
|
||||||
|
elif ifc_class in ("IfcDoorType", "IfcDoorStyle", "IfcDoor"):
|
||||||
|
templates.extend([None, ("DOOR", "Door", "Parametric door")])
|
||||||
|
elif ifc_class in ("IfcStairType", "IfcStairFlightType", "IfcStair", "IfcStairFlight"):
|
||||||
|
templates.extend([None, ("STAIR", "Stair", "Parametric stair")])
|
||||||
|
elif ifc_class in ("IfcRailingType", "IfcRailing"):
|
||||||
|
templates.extend([None, ("RAILING", "Railing", "Parametric railing")])
|
||||||
|
elif ifc_class in ("IfcRoofType", "IfcRoof", "IfcSlabType", "IfcSlab", "IfcCovering", "IfcCoveringType"):
|
||||||
|
templates.extend([None, ("ROOF", "Roof", "Parametric roof with a constant pitch")])
|
||||||
|
elif ifc_class and "Segment" in ifc_class:
|
||||||
|
templates.extend(
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
(
|
||||||
|
"FLOW_SEGMENT_RECTANGULAR",
|
||||||
|
"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",
|
||||||
|
"Works similarly to Profile, has distribution ports",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"FLOW_SEGMENT_CIRCULAR_HOLLOW",
|
||||||
|
"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",
|
||||||
|
"Uses IfcUShapeProfileDef, has distribution ports",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if ifc_class.endswith("Type") or ifc_class.endswith("Style"):
|
if ifc_class.endswith("Type") or ifc_class.endswith("Style"):
|
||||||
templates.extend(
|
templates.extend(
|
||||||
[
|
[
|
||||||
@@ -172,38 +204,26 @@ class IfcClassData:
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if ifc_class in ("IfcWindowType", "IfcWindowStyle", "IfcWindow"):
|
templates.extend(
|
||||||
templates.extend([None, ("WINDOW", "Window", "Parametric window")])
|
[
|
||||||
elif ifc_class in ("IfcDoorType", "IfcDoorStyle", "IfcDoor"):
|
None,
|
||||||
templates.extend([None, ("DOOR", "Door", "Parametric door")])
|
|
||||||
elif ifc_class in ("IfcStairType", "IfcStairFlightType", "IfcStair", "IfcStairFlight"):
|
|
||||||
templates.extend([None, ("STAIR", "Stair", "Parametric stair")])
|
|
||||||
elif ifc_class in ("IfcRailingType", "IfcRailing"):
|
|
||||||
templates.extend([None, ("RAILING", "Railing", "Parametric railing")])
|
|
||||||
elif ifc_class in ("IfcRoofType", "IfcRoof", "IfcSlabType", "IfcSlab", "IfcCovering", "IfcCoveringType"):
|
|
||||||
templates.extend([None, ("ROOF", "Roof", "Parametric roof with a constant pitch")])
|
|
||||||
elif ifc_class and "Segment" in ifc_class:
|
|
||||||
templates.extend(
|
|
||||||
(
|
(
|
||||||
None,
|
"OBJ",
|
||||||
(
|
"Tessellation From Object",
|
||||||
"FLOW_SEGMENT_RECTANGULAR",
|
"Use an object as a template to create a new tessellation",
|
||||||
"Rectangular Distribution Segment",
|
),
|
||||||
"Works similarly to Profile, has distribution ports",
|
(
|
||||||
),
|
"MESH",
|
||||||
(
|
"Custom Tessellation",
|
||||||
"FLOW_SEGMENT_CIRCULAR",
|
"Create a basic tessellated or faceted cube",
|
||||||
"Circular Distribution Segment",
|
),
|
||||||
"Works similarly to Profile, has distribution ports",
|
(
|
||||||
),
|
"EXTRUSION",
|
||||||
(
|
"Custom Extruded Solid",
|
||||||
"FLOW_SEGMENT_CIRCULAR_HOLLOW",
|
"An extrusion from an arbitrary profile",
|
||||||
"Circular Hollow Distribution Segment",
|
),
|
||||||
"Works similarly to Profile, has distribution ports",
|
]
|
||||||
),
|
)
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return templates
|
return templates
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -697,6 +697,24 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
XDim=default_x_dim / unit_scale,
|
XDim=default_x_dim / unit_scale,
|
||||||
YDim=default_y_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":
|
elif representation_template == "FLOW_SEGMENT_CIRCULAR":
|
||||||
default_diameter = 0.1
|
default_diameter = 0.1
|
||||||
profile_name = f"{props.ifc_class}-{default_diameter*1000}"
|
profile_name = f"{props.ifc_class}-{default_diameter*1000}"
|
||||||
@@ -717,6 +735,21 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
Radius=(default_diameter / 2) / unit_scale,
|
Radius=(default_diameter / 2) / unit_scale,
|
||||||
WallThickness=default_thickness,
|
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(
|
rel = ifcopenshell.api.material.assign_material(
|
||||||
tool.Ifc.get(), products=[element], type="IfcMaterialProfileSet"
|
tool.Ifc.get(), products=[element], type="IfcMaterialProfileSet"
|
||||||
|
|||||||
Reference in New Issue
Block a user