How can I join all objects in a collection? This is what i have so far:
def final():
Coll=bpy.data.collections['low']
#finalColl=bpy.data.collections['final']
for obj in Coll.objects:
if obj.type=='MESH':
ob.join
You have to make sure you have selected all the objects you want to join using obj.select_set(True)
in the for loop and make sure one of the objects is active (yellow outline). Then you can join them using bpy.ops.object.join()
after the loop has finished.
import bpy
def final():
bpy.ops.object.select_all(action='DESELECT')
Coll = bpy.data.collections['low']
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()