Skip to content

Commit 8acc238

Browse files
committed
Fix select_ifc_class clipboard query output
Previously the clipboard was set inside the class loop, overwriting on each iteration and reporting multiple times. Now all classes are joined with " + " and the clipboard is set once after selection completes. Generated with the assistance of an AI coding tool.
1 parent 88daa83 commit 8acc238

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/bonsai/bonsai/bim/module/search/operator.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,6 @@ def execute(self, context):
12851285
if element := tool.Ifc.get_entity(obj):
12861286
classes.add(element.is_a())
12871287
predefined_types.add(ifcopenshell.util.element.get_predefined_type(element))
1288-
result = ""
12891288
for cls in classes:
12901289
for element in tool.Ifc.get().by_type(cls):
12911290
if (
@@ -1299,13 +1298,10 @@ def execute(self, context):
12991298
obj.hide_set(False)
13001299
tool.Blender.select_object(obj)
13011300

1302-
# copy selection query to clipboard
1303-
if not result:
1304-
result = f"{cls}"
1305-
else:
1306-
result += f", {cls}"
1307-
bpy.context.window_manager.clipboard = result
1308-
self.report({"INFO"}, f"({result}) was copied to the clipboard.")
1301+
# copy selection query to clipboard
1302+
result = " + ".join(classes)
1303+
bpy.context.window_manager.clipboard = result
1304+
self.report({"INFO"}, f"({result}) was copied to the clipboard.")
13091305

13101306
return {"FINISHED"}
13111307

0 commit comments

Comments
 (0)