mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
Accepting predefined type for windows/stairs/doors from type manager
Also assigned layout name property for windows/doors
This commit is contained in:
@@ -48,7 +48,9 @@ V = lambda *x: Vector([float(i) for i in x])
|
||||
def update_door_modifier_representation(context):
|
||||
obj = context.active_object
|
||||
props = obj.BIMDoorProperties
|
||||
ifc_element = tool.Ifc.get_entity(obj)
|
||||
ifc_file = tool.Ifc.get()
|
||||
|
||||
representation_data = {
|
||||
"operation_type": props.door_type,
|
||||
"overall_height": props.overall_height,
|
||||
@@ -99,6 +101,8 @@ def update_door_modifier_representation(context):
|
||||
model_representation = ifcopenshell.api.run("geometry.add_door_representation", ifc_file, **representation_data)
|
||||
replace_ifc_representation_for_object(ifc_file, ifc_context, obj, model_representation)
|
||||
|
||||
ifc_element.OperationType = props.door_type
|
||||
|
||||
|
||||
def create_bm_door_lining(bm, size: Vector, thickness: Vector, position:Vector=V(0,0,0).freeze()):
|
||||
"""`thickness` of the profile is defined as list in the following order: `(SIDE, TOP)`
|
||||
|
||||
@@ -248,6 +248,8 @@ class BIM_OT_add_clever_stair(Operator):
|
||||
should_add_representation=True,
|
||||
context=body_context,
|
||||
)
|
||||
element.PredefinedType = "STRAIGHT"
|
||||
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
bpy.context.view_layer.objects.active = None
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
@@ -296,7 +298,6 @@ class AddStair(bpy.types.Operator, tool.Ifc.Operator):
|
||||
update_stair_modifier(context)
|
||||
|
||||
# update IfcStairFlight properties
|
||||
element.PredefinedType = "STRAIGHT"
|
||||
if element.is_a("IfcStairFlight"):
|
||||
element.NumberOfRisers = props.number_of_treads + 1
|
||||
element.NumberOfTreads = props.number_of_treads
|
||||
|
||||
@@ -46,8 +46,10 @@ V = lambda *x: Vector([float(i) for i in x])
|
||||
|
||||
def update_window_modifier_representation(context):
|
||||
obj = context.active_object
|
||||
ifc_element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMWindowProperties
|
||||
ifc_file = tool.Ifc.get()
|
||||
|
||||
representation_data = {
|
||||
"partition_type": props.window_type,
|
||||
"overall_height": props.overall_height,
|
||||
@@ -82,12 +84,14 @@ def update_window_modifier_representation(context):
|
||||
"geometry.add_window_representation", ifc_file, **representation_data
|
||||
)
|
||||
replace_ifc_representation_for_object(ifc_file, ifc_context, obj, elevation_representation)
|
||||
|
||||
|
||||
# MODEL_VIEW representation
|
||||
ifc_context = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
|
||||
representation_data["context"] = ifc_context
|
||||
model_representation = ifcopenshell.api.run("geometry.add_window_representation", ifc_file, **representation_data)
|
||||
replace_ifc_representation_for_object(ifc_file, ifc_context, obj, model_representation)
|
||||
ifc_element.PartitioningType = props.window_type
|
||||
|
||||
|
||||
|
||||
def create_bm_window_frame(bm, size: Vector, thickness: Vector, position: Vector = V(0,0,0)):
|
||||
@@ -350,6 +354,8 @@ class BIM_OT_add_window(Operator):
|
||||
ifc_class="IfcWindow",
|
||||
should_add_representation=False
|
||||
)
|
||||
element.PredefinedType = "WINDOW"
|
||||
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
bpy.context.view_layer.objects.active = None
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
|
||||
@@ -283,7 +283,13 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
||||
mesh = bpy.data.meshes.new("IfcWindow")
|
||||
obj = bpy.data.objects.new("TYPEX", mesh)
|
||||
element = blenderbim.core.root.assign_class(
|
||||
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcWindowType", should_add_representation=False
|
||||
tool.Ifc,
|
||||
tool.Collector,
|
||||
tool.Root,
|
||||
obj=obj,
|
||||
predefined_type=predefined_type,
|
||||
ifc_class="IfcWindowType",
|
||||
should_add_representation=False
|
||||
)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
bpy.context.view_layer.objects.active = None
|
||||
@@ -298,6 +304,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
||||
tool.Collector,
|
||||
tool.Root,
|
||||
obj=obj,
|
||||
predefined_type=predefined_type,
|
||||
ifc_class="IfcDoorType",
|
||||
should_add_representation=False
|
||||
)
|
||||
@@ -315,6 +322,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
||||
tool.Collector,
|
||||
tool.Root,
|
||||
obj=obj,
|
||||
predefined_type=predefined_type,
|
||||
ifc_class="IfcStairFlightType",
|
||||
should_add_representation=True,
|
||||
context=body,
|
||||
|
||||
Reference in New Issue
Block a user