mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Stair, roof, railing - auto updating representation when creating one or update it
So basically there should be no need to manually update representation after you created one of the objects from ifc modifiers.
This commit is contained in:
@@ -54,6 +54,9 @@ def bm_split_edge_at_offset(edge, offset):
|
||||
|
||||
|
||||
def update_railing_modifier_ifc_data(context):
|
||||
"""should be called after new geometry settled
|
||||
since it's going to update ifc representation
|
||||
"""
|
||||
obj = context.active_object
|
||||
props = obj.BIMRailingProperties
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
@@ -79,6 +82,7 @@ def update_railing_modifier_ifc_data(context):
|
||||
"Height": props.height,
|
||||
},
|
||||
)
|
||||
tool.Ifc.edit(obj)
|
||||
|
||||
|
||||
def update_bbim_railing_pset(element, railing_data):
|
||||
@@ -262,8 +266,8 @@ class AddRailing(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
update_bbim_railing_pset(element, railing_data)
|
||||
refresh()
|
||||
update_railing_modifier_ifc_data(context)
|
||||
update_railing_modifier_bmesh(context)
|
||||
update_railing_modifier_ifc_data(context)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -403,6 +407,7 @@ class FinishEditingRailingPath(bpy.types.Operator, tool.Ifc.Operator):
|
||||
update_railing_modifier_bmesh(context)
|
||||
if bpy.context.object.mode == "EDIT":
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
update_railing_modifier_ifc_data(context)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -139,6 +139,9 @@ def bm_get_indices(sequence):
|
||||
|
||||
|
||||
def update_roof_modifier_ifc_data(context):
|
||||
"""should be called after new geometry settled
|
||||
since it's going to update ifc representation
|
||||
"""
|
||||
obj = context.active_object
|
||||
props = obj.BIMRoofProperties
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
@@ -151,6 +154,8 @@ def update_roof_modifier_ifc_data(context):
|
||||
# TODO: add Qto_RoofBaseQuantities, need to calculate GrossArea, NetArea, ProjectedArea
|
||||
# https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/Qto_RoofBaseQuantities.htm
|
||||
|
||||
tool.Ifc.edit(obj)
|
||||
|
||||
|
||||
def update_bbim_roof_pset(element, roof_data):
|
||||
pset = tool.Pset.get_element_pset(element, "BBIM_Roof")
|
||||
@@ -295,9 +300,9 @@ class AddRoof(bpy.types.Operator, tool.Ifc.Operator):
|
||||
roof_data["path_data"] = path_data
|
||||
|
||||
update_bbim_roof_pset(element, roof_data)
|
||||
update_roof_modifier_ifc_data(context)
|
||||
refresh()
|
||||
update_roof_modifier_bmesh(context)
|
||||
update_roof_modifier_ifc_data(context)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -437,6 +442,7 @@ class FinishEditingRoofPath(bpy.types.Operator, tool.Ifc.Operator):
|
||||
update_roof_modifier_bmesh(context)
|
||||
if bpy.context.object.mode == "EDIT":
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
update_roof_modifier_ifc_data(context)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -252,10 +252,14 @@ def update_stair_modifier(context):
|
||||
|
||||
|
||||
def update_ifc_stair_props(obj):
|
||||
"""should be called after new geometry settled
|
||||
since it's going to update ifc representation
|
||||
"""
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
props = obj.BIMStairProperties
|
||||
ifc_file = tool.Ifc.get()
|
||||
|
||||
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
|
||||
@@ -281,6 +285,7 @@ def update_ifc_stair_props(obj):
|
||||
"TreadLength": props.tread_depth,
|
||||
},
|
||||
)
|
||||
tool.Ifc.edit(obj)
|
||||
|
||||
|
||||
class BIM_OT_add_clever_stair(bpy.types.Operator, tool.Ifc.Operator):
|
||||
@@ -400,7 +405,6 @@ class FinishEditingStair(bpy.types.Operator, tool.Ifc.Operator):
|
||||
ifcopenshell.api.run("pset.edit_pset", tool.Ifc.get(), pset=pset, properties={"Data": data})
|
||||
|
||||
# update IfcStairFlight properties
|
||||
element.PredefinedType = "STRAIGHT"
|
||||
update_ifc_stair_props(obj)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user