mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Support for door/window/stair modifiers in ifc2x3
This commit is contained in:
@@ -128,7 +128,8 @@ def update_door_modifier_representation(context):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# type attributes
|
# type attributes
|
||||||
element.OperationType = props.door_type
|
if tool.Ifc.get_schema() != "IFC2X3":
|
||||||
|
element.OperationType = props.door_type
|
||||||
|
|
||||||
# occurences attributes
|
# occurences attributes
|
||||||
occurences = tool.Ifc.get_all_element_occurences(element)
|
occurences = tool.Ifc.get_all_element_occurences(element)
|
||||||
@@ -486,7 +487,8 @@ class BIM_OT_add_door(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcDoor", should_add_representation=False
|
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcDoor", should_add_representation=False
|
||||||
)
|
)
|
||||||
element.PredefinedType = "DOOR"
|
if tool.Ifc.get_schema() != "IFC2X3":
|
||||||
|
element.PredefinedType = "DOOR"
|
||||||
|
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
bpy.ops.object.select_all(action="DESELECT")
|
||||||
bpy.context.view_layer.objects.active = None
|
bpy.context.view_layer.objects.active = None
|
||||||
@@ -507,8 +509,8 @@ class AddDoor(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
props = obj.BIMDoorProperties
|
props = obj.BIMDoorProperties
|
||||||
|
|
||||||
if element.is_a() not in ("IfcDoor", "IfcDoorType"):
|
if element.is_a() not in ("IfcDoor", "IfcDoorType", "IfcDoorStyle"):
|
||||||
self.report({"ERROR"}, "Object has to be IfcDoor/IfcDoorType type to add a door.")
|
self.report({"ERROR"}, "Object has to be IfcDoor/IfcDoorType/IfcDoorStyle type to add a door.")
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
door_data = props.get_general_kwargs(convert_to_project_units=True)
|
door_data = props.get_general_kwargs(convert_to_project_units=True)
|
||||||
|
|||||||
@@ -232,9 +232,16 @@ class FilledOpeningGenerator:
|
|||||||
curve_3d = ifcopenshell.util.representation.resolve_representation(profile).Items[0]
|
curve_3d = ifcopenshell.util.representation.resolve_representation(profile).Items[0]
|
||||||
|
|
||||||
def get_curve_2d_from_3d(curve_3d):
|
def get_curve_2d_from_3d(curve_3d):
|
||||||
ifc_segments = [shape_builder.deep_copy(s) for s in curve_3d.Segments]
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
ifc_points = ifc_file.createIfcCartesianPointList2D([Vector(p).xz for p in curve_3d.Points.CoordList])
|
coords = [Vector(p).xz for p in shape_builder.get_polyline_coords(curve_3d)]
|
||||||
ifc_curve = ifc_file.createIfcIndexedPolyCurve(Points=ifc_points, Segments=ifc_segments)
|
ifc_curve = shape_builder.polyline(coords, closed=True)
|
||||||
|
else:
|
||||||
|
# using different algorithm to keep arc segments possible in the future
|
||||||
|
ifc_segments = [shape_builder.deep_copy(s) for s in curve_3d.Segments]
|
||||||
|
ifc_points = ifc_file.createIfcCartesianPointList2D(
|
||||||
|
[Vector(p).xz for p in curve_3d.Points.CoordList]
|
||||||
|
)
|
||||||
|
ifc_curve = ifc_file.createIfcIndexedPolyCurve(Points=ifc_points, Segments=ifc_segments)
|
||||||
return ifc_curve
|
return ifc_curve
|
||||||
|
|
||||||
extrusion = shape_builder.extrude(
|
extrusion = shape_builder.extrude(
|
||||||
|
|||||||
@@ -250,7 +250,8 @@ def update_ifc_stair_props(obj):
|
|||||||
props = obj.BIMStairProperties
|
props = obj.BIMStairProperties
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
|
|
||||||
element.PredefinedType = "STRAIGHT"
|
if tool.Ifc.get_schema() != "IFC2X3":
|
||||||
|
element.PredefinedType = "STRAIGHT"
|
||||||
number_of_risers = props.number_of_treads + 1
|
number_of_risers = props.number_of_treads + 1
|
||||||
# update IfcStairFlight properties (seems already deprecated but keep it for now)
|
# update IfcStairFlight properties (seems already deprecated but keep it for now)
|
||||||
# http://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcStairFlight.htm
|
# http://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcStairFlight.htm
|
||||||
@@ -260,7 +261,11 @@ def update_ifc_stair_props(obj):
|
|||||||
tread_length = props.tread_depth / si_conversion
|
tread_length = props.tread_depth / si_conversion
|
||||||
|
|
||||||
if element.is_a("IfcStairFlight"):
|
if element.is_a("IfcStairFlight"):
|
||||||
element.NumberOfRisers = number_of_risers
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
|
element.NumberOfRiser = number_of_risers
|
||||||
|
else:
|
||||||
|
element.NumberOfRisers = number_of_risers
|
||||||
|
|
||||||
element.NumberOfTreads = props.number_of_treads
|
element.NumberOfTreads = props.number_of_treads
|
||||||
element.RiserHeight = riser_height
|
element.RiserHeight = riser_height
|
||||||
element.TreadLength = tread_length
|
element.TreadLength = tread_length
|
||||||
@@ -330,7 +335,8 @@ class BIM_OT_add_clever_stair(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
should_add_representation=True,
|
should_add_representation=True,
|
||||||
context=body_context,
|
context=body_context,
|
||||||
)
|
)
|
||||||
element.PredefinedType = "STRAIGHT"
|
if tool.Ifc.get_schema() != "IFC2X3":
|
||||||
|
element.PredefinedType = "STRAIGHT"
|
||||||
|
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
bpy.ops.object.select_all(action="DESELECT")
|
||||||
bpy.context.view_layer.objects.active = None
|
bpy.context.view_layer.objects.active = None
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ def update_window_modifier_representation(context):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# type attributes
|
# type attributes
|
||||||
element.PartitioningType = props.window_type
|
if tool.Ifc.get_schema() != "IFC2X3":
|
||||||
|
element.PartitioningType = props.window_type
|
||||||
|
|
||||||
# occurences attributes
|
# occurences attributes
|
||||||
occurences = tool.Ifc.get_all_element_occurences(element)
|
occurences = tool.Ifc.get_all_element_occurences(element)
|
||||||
@@ -455,7 +456,8 @@ class BIM_OT_add_window(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcWindow", should_add_representation=False
|
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcWindow", should_add_representation=False
|
||||||
)
|
)
|
||||||
element.PredefinedType = "WINDOW"
|
if tool.Ifc.get_schema() != "IFC2X3":
|
||||||
|
element.PredefinedType = "WINDOW"
|
||||||
|
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
bpy.ops.object.select_all(action="DESELECT")
|
||||||
bpy.context.view_layer.objects.active = None
|
bpy.context.view_layer.objects.active = None
|
||||||
@@ -476,8 +478,8 @@ class AddWindow(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
props = obj.BIMWindowProperties
|
props = obj.BIMWindowProperties
|
||||||
|
|
||||||
if element.is_a() not in ("IfcWindow", "IfcWindowType"):
|
if element.is_a() not in ("IfcWindow", "IfcWindowType", "IfcWindowStyle"):
|
||||||
self.report({"ERROR"}, "Object has to be IfcWindow/IfcWindowType type to add a window.")
|
self.report({"ERROR"}, "Object has to be IfcWindow/IfcWindowType/IfcWindowStyle type to add a window.")
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
window_data = props.get_general_kwargs(convert_to_project_units=True)
|
window_data = props.get_general_kwargs(convert_to_project_units=True)
|
||||||
|
|||||||
@@ -329,8 +329,8 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Collector,
|
tool.Collector,
|
||||||
tool.Root,
|
tool.Root,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
predefined_type=predefined_type,
|
predefined_type=predefined_type if tool.Ifc.get_schema() != "IFC2X3" else None,
|
||||||
ifc_class="IfcWindowType",
|
ifc_class="IfcWindowType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcWindowStyle",
|
||||||
should_add_representation=False,
|
should_add_representation=False,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
bpy.ops.object.select_all(action="DESELECT")
|
||||||
@@ -347,8 +347,8 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
tool.Collector,
|
tool.Collector,
|
||||||
tool.Root,
|
tool.Root,
|
||||||
obj=obj,
|
obj=obj,
|
||||||
predefined_type=predefined_type,
|
predefined_type=predefined_type if tool.Ifc.get_schema() != "IFC2X3" else None,
|
||||||
ifc_class="IfcDoorType",
|
ifc_class="IfcDoorType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcDoorStyle",
|
||||||
should_add_representation=False,
|
should_add_representation=False,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
bpy.ops.object.select_all(action="DESELECT")
|
||||||
|
|||||||
Reference in New Issue
Block a user