Disable edit mode on non mesh-like representations as well to prevent risk of invalid geometry.

This commit is contained in:
Dion Moult
2023-04-01 21:25:36 +11:00
parent e9074e3b3f
commit 9fba57d5db
@@ -742,23 +742,30 @@ class OverrideModeSetEdit(bpy.types.Operator):
obj.select_set(False) obj.select_set(False)
continue continue
if obj.data.BIMMeshProperties.ifc_definition_id: representation = tool.Geometry.get_active_representation(obj)
representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id) if not representation:
if representation.RepresentationType in ("Tessellation", "Brep"): obj.select_set(False)
if element.HasOpenings: continue
# Mesh elements with openings must disable openings
# so that you can edit the original topology. if representation.RepresentationType in ("Tessellation", "Brep"):
core.switch_representation( if element.HasOpenings:
tool.Ifc, # Mesh elements with openings must disable openings
tool.Geometry, # so that you can edit the original topology.
obj=obj, core.switch_representation(
representation=representation, tool.Ifc,
should_reload=True, tool.Geometry,
is_global=True, obj=obj,
should_sync_changes_first=False, representation=representation,
apply_openings=False, should_reload=True,
) is_global=True,
obj.data.BIMMeshProperties.mesh_checksum = tool.Geometry.get_mesh_checksum(obj.data) should_sync_changes_first=False,
apply_openings=False,
)
obj.data.BIMMeshProperties.mesh_checksum = tool.Geometry.get_mesh_checksum(obj.data)
else:
obj.select_set(False)
continue
if not context.selected_objects: if not context.selected_objects:
return {"FINISHED"} return {"FINISHED"}
bpy.ops.object.mode_set(mode="EDIT", toggle=True) bpy.ops.object.mode_set(mode="EDIT", toggle=True)