How can i join objects per collection

I want to join objects per collection.

Is it possible to do that with a script?

I have 50 collections, which means if every object will be joined per collection, I would have 50 objects at all (1 object per collection).

2 Likes

Try this:

import bpy

def final():
        bpy.ops.object.select_all(action='DESELECT')

        for Coll in bpy.data.collections:
            for obj in Coll.objects:
                if obj.type == 'MESH':
                   obj.select_set(True)
            #bpy.context.view_layer.objects.active = bpy.data.objects["Cube"]
            bpy.ops.object.join()

final()

I made some small changes to the script below, should work

https://blender.stackexchange.com/questions/268027/bpy-scripting-join-objects-in-a-collection

1 Like