diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index 3e78a2dcbb..0c6dd2b90e 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -290,6 +290,7 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator): should_sync_changes_first=False, ) else: + # TODO: replace empty geometry meshes with empties. element = core.assign_class( tool.Ifc, tool.Collector, @@ -301,6 +302,17 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator): context=ifc_context, ifc_representation_class=self.ifc_representation_class, ) + tool.Geometry.reload_representation(obj) + + # TODO: reload representation might lead to the object being replaced by object of the other type. + # We probably should track it somehow and keep the original selection. + + # Validation selection. + new_selected_objects = list(filter(tool.Blender.is_valid_data_block, current_selection[2])) + active_object = current_selection[1] + if active_object and not tool.Blender.is_valid_data_block(active_object): + active_object = None + current_selection = (current_selection[0], active_object, new_selected_objects) tool.Blender.set_objects_selection(*current_selection)