diff --git a/src/bonsai/bonsai/bim/module/material/operator.py b/src/bonsai/bonsai/bim/module/material/operator.py index ce07822348..714d2ad91b 100644 --- a/src/bonsai/bonsai/bim/module/material/operator.py +++ b/src/bonsai/bonsai/bim/module/material/operator.py @@ -61,7 +61,15 @@ class SelectByMaterial(bpy.types.Operator): material: bpy.props.IntProperty() def execute(self, context): - core.select_by_material(tool.Material, tool.Spatial, material=tool.Ifc.get().by_id(self.material)) + material=tool.Ifc.get().by_id(self.material) + core.select_by_material(tool.Material, tool.Spatial, material=material) + + # copy selection query to clipboard + material_name = material.Name + result = f'material="{material_name}"' + bpy.context.window_manager.clipboard = result + self.report({"INFO"}, f"({result}) was copied to the clipboard.") + return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/search/operator.py b/src/bonsai/bonsai/bim/module/search/operator.py index f2223e7ad9..3fb3055d09 100644 --- a/src/bonsai/bonsai/bim/module/search/operator.py +++ b/src/bonsai/bonsai/bim/module/search/operator.py @@ -518,6 +518,7 @@ class SelectIfcClass(Operator): if element := tool.Ifc.get_entity(obj): classes.add(element.is_a()) predefined_types.add(ifcopenshell.util.element.get_predefined_type(element)) + result = '' for cls in classes: for element in tool.Ifc.get().by_type(cls): if ( @@ -527,6 +528,15 @@ class SelectIfcClass(Operator): continue if obj := tool.Ifc.get_object(element): tool.Blender.select_object(obj) + + # copy selection query to clipboard + if not result: + result = f"{cls}" + else: + result += f", {cls}" + bpy.context.window_manager.clipboard = result + self.report({"INFO"}, f"({result}) was copied to the clipboard.") + return {"FINISHED"} @@ -748,3 +758,25 @@ class SelectSimilar(Operator, tool.Ifc.Operator): ) else: self.report({"INFO"}, f"Selected all objects that share the same ({key}) value") + + + # copy selection query to clipboard + if not self.calculate_sum: + result = '' + if value == True: + value = "TRUE" + if value == False: + value = "FALSE" + if key == "predefined_type": + key = "PredefinedType" + if isinstance(value, list) and value: + for item in value: + sub_result = f'{key} = "{item}"' + if not result: + result = sub_result + else: + result += f", {sub_result}" + else: + result = f'{key} = "{value}"' + bpy.context.window_manager.clipboard = result + self.report({"INFO"}, f"({result}) was copied to the clipboard.") diff --git a/src/bonsai/bonsai/bim/module/type/operator.py b/src/bonsai/bonsai/bim/module/type/operator.py index 0ce7d85058..36808a68ce 100644 --- a/src/bonsai/bonsai/bim/module/type/operator.py +++ b/src/bonsai/bonsai/bim/module/type/operator.py @@ -198,12 +198,26 @@ class SelectSimilarType(bpy.types.Operator): continue relating_types.add(relating_type) + result = '' for relating_type in relating_types: related_objects = ifcopenshell.util.element.get_types(relating_type) + for element in related_objects: obj = tool.Ifc.get_object(element) if obj and obj in context.visible_objects: obj.select_set(True) + + # copy selection query to clipboard + related_objects_class = related_objects[0].is_a() + relating_type_name = relating_type.Name + if not result: + result = f"{related_objects_class}, type=\"{relating_type_name}\"" + else: + result += f" + {related_objects_class}, type=\"{relating_type_name}\"" + bpy.context.window_manager.clipboard = result + self.report({"INFO"}, f"({result}) was copied to the clipboard.") + + return {"FINISHED"}