diff --git a/src/bonsai/bonsai/bim/module/attribute/operator.py b/src/bonsai/bonsai/bim/module/attribute/operator.py index 330bf1b2bb..e439e2b7ab 100644 --- a/src/bonsai/bonsai/bim/module/attribute/operator.py +++ b/src/bonsai/bonsai/bim/module/attribute/operator.py @@ -202,5 +202,9 @@ class CopyAttributeToSelection(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): value = context.active_object.BIMAttributeProperties.attributes.get(self.name).get_value() + i = 0 for obj in tool.Blender.get_selected_objects(): - core.copy_attribute_to_selection(tool.Ifc, name=self.name, value=value, obj=obj) + success = core.copy_attribute_to_selection(tool.Ifc, name=self.name, value=value, obj=obj) + if success: + i += 1 + self.report({"INFO"}, f"Attribute was successfully copied to {i} elements.") diff --git a/src/bonsai/bonsai/core/attribute.py b/src/bonsai/bonsai/core/attribute.py index 6084a57502..b6f713f486 100644 --- a/src/bonsai/bonsai/core/attribute.py +++ b/src/bonsai/bonsai/core/attribute.py @@ -25,10 +25,12 @@ if TYPE_CHECKING: import bonsai.tool as tool -def copy_attribute_to_selection(ifc: tool.Ifc, name: str, value: Union[str, None], obj: bpy.types.Object) -> None: +def copy_attribute_to_selection(ifc: tool.Ifc, name: str, value: Union[str, None], obj: bpy.types.Object) -> bool: element = ifc.get_entity(obj) if element: try: ifc.run("attribute.edit_attributes", product=element, attributes={name: value}) + return True except: pass + return False