Fixed error on canceling editing railing/roof

Since we do not update representation for railing / roofs and just mark them wtih `tool.Ifc.edit(obj)` their previous representation may still be incorrect. So we restore the previous representation just using bmesh update method.

For example if create a new roof, enter editing roof properties mode and then cancel editing, then it would result in "Failed to process a shape" because roof still had just empty Body/PointCloud representation.
This commit is contained in:
Andrej730
2023-07-13 14:32:09 +05:00
parent 7896d5b6e5
commit 38f7c044a3
2 changed files with 5 additions and 23 deletions
@@ -369,20 +369,11 @@ class CancelEditingRailing(bpy.types.Operator, tool.Ifc.Operator):
element = tool.Ifc.get_entity(obj)
data = json.loads(ifcopenshell.util.element.get_pset(element, "BBIM_Railing", "Data"))
props = obj.BIMRailingProperties
# restore previous settings since editing was canceled
props.set_props_kwargs_from_ifc_data(data)
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
blenderbim.core.geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
representation=body,
should_reload=True,
is_global=True,
should_sync_changes_first=False,
)
update_railing_modifier_bmesh(context)
props.is_editing = False
return {"FINISHED"}
@@ -611,19 +611,10 @@ class CancelEditingRoof(bpy.types.Operator, tool.Ifc.Operator):
element = tool.Ifc.get_entity(obj)
data = json.loads(ifcopenshell.util.element.get_pset(element, "BBIM_Roof", "Data"))
props = obj.BIMRoofProperties
# restore previous settings since editing was canceled
props.set_props_kwargs_from_ifc_data(data)
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
blenderbim.core.geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
representation=body,
should_reload=True,
is_global=True,
should_sync_changes_first=False,
)
update_roof_modifier_bmesh(context)
props.is_editing = False
return {"FINISHED"}