mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +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
|
||||
element.OperationType = props.door_type
|
||||
if tool.Ifc.get_schema() != "IFC2X3":
|
||||
element.OperationType = props.door_type
|
||||
|
||||
# occurences attributes
|
||||
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(
|
||||
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.context.view_layer.objects.active = None
|
||||
@@ -507,8 +509,8 @@ class AddDoor(bpy.types.Operator, tool.Ifc.Operator):
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMDoorProperties
|
||||
|
||||
if element.is_a() not in ("IfcDoor", "IfcDoorType"):
|
||||
self.report({"ERROR"}, "Object has to be IfcDoor/IfcDoorType type to add a door.")
|
||||
if element.is_a() not in ("IfcDoor", "IfcDoorType", "IfcDoorStyle"):
|
||||
self.report({"ERROR"}, "Object has to be IfcDoor/IfcDoorType/IfcDoorStyle type to add a door.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
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]
|
||||
|
||||
def get_curve_2d_from_3d(curve_3d):
|
||||
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)
|
||||
if tool.Ifc.get_schema() == "IFC2X3":
|
||||
coords = [Vector(p).xz for p in shape_builder.get_polyline_coords(curve_3d)]
|
||||
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
|
||||
|
||||
extrusion = shape_builder.extrude(
|
||||
|
||||
@@ -250,7 +250,8 @@ def update_ifc_stair_props(obj):
|
||||
props = obj.BIMStairProperties
|
||||
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
|
||||
# update IfcStairFlight properties (seems already deprecated but keep it for now)
|
||||
# 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
|
||||
|
||||
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.RiserHeight = riser_height
|
||||
element.TreadLength = tread_length
|
||||
@@ -330,7 +335,8 @@ class BIM_OT_add_clever_stair(bpy.types.Operator, tool.Ifc.Operator):
|
||||
should_add_representation=True,
|
||||
context=body_context,
|
||||
)
|
||||
element.PredefinedType = "STRAIGHT"
|
||||
if tool.Ifc.get_schema() != "IFC2X3":
|
||||
element.PredefinedType = "STRAIGHT"
|
||||
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
bpy.context.view_layer.objects.active = None
|
||||
|
||||
@@ -167,7 +167,8 @@ def update_window_modifier_representation(context):
|
||||
)
|
||||
|
||||
# type attributes
|
||||
element.PartitioningType = props.window_type
|
||||
if tool.Ifc.get_schema() != "IFC2X3":
|
||||
element.PartitioningType = props.window_type
|
||||
|
||||
# occurences attributes
|
||||
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(
|
||||
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.context.view_layer.objects.active = None
|
||||
@@ -476,8 +478,8 @@ class AddWindow(bpy.types.Operator, tool.Ifc.Operator):
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMWindowProperties
|
||||
|
||||
if element.is_a() not in ("IfcWindow", "IfcWindowType"):
|
||||
self.report({"ERROR"}, "Object has to be IfcWindow/IfcWindowType type to add a window.")
|
||||
if element.is_a() not in ("IfcWindow", "IfcWindowType", "IfcWindowStyle"):
|
||||
self.report({"ERROR"}, "Object has to be IfcWindow/IfcWindowType/IfcWindowStyle type to add a window.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
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.Root,
|
||||
obj=obj,
|
||||
predefined_type=predefined_type,
|
||||
ifc_class="IfcWindowType",
|
||||
predefined_type=predefined_type if tool.Ifc.get_schema() != "IFC2X3" else None,
|
||||
ifc_class="IfcWindowType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcWindowStyle",
|
||||
should_add_representation=False,
|
||||
)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
@@ -347,8 +347,8 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
||||
tool.Collector,
|
||||
tool.Root,
|
||||
obj=obj,
|
||||
predefined_type=predefined_type,
|
||||
ifc_class="IfcDoorType",
|
||||
predefined_type=predefined_type if tool.Ifc.get_schema() != "IFC2X3" else None,
|
||||
ifc_class="IfcDoorType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcDoorStyle",
|
||||
should_add_representation=False,
|
||||
)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
|
||||
Reference in New Issue
Block a user