I have many collections in the scene. There are many models with the same prefix in the collection. I try to merge objects with the same prefix in each collection.
My idea is:
- Select a collection to hide other collections
for i in bpy.data.collections:
i.hide_viewport = True
2.Select objects according to prefix. Prefix example 'Assembled','Basic'
for i in bpy.data.collections:
i.hide_viewport = False
bpy.ops.object.select_pattern(pattern='Assembled'+"*")
bpy.ops.object.join() #Warning: Active object is not a selected mesh
bpy.ops.object.select_all(action='DESELECT')
My question is:How do I turn one of the selected objects into an active object
In addition, I feel there is something wrong with my thinking. Can I have a simpler solution
