import bpy
cubeblanc= bpy.data.objects["CubeBlanc"]
cubenoir= bpy.data.objects["CubeNoir"]
for i in range(0,10):
for j in range(0,10):
blanc = bpy.data.objects.new('blanc', cubeblanc.data)
blanc.location.x = 4*i
blanc.location.y= 4*j
blanc.scale.z=0.1
bpy.data.collections["damier"].objects.link(blanc)
blanc.select_set(True)
noir = bpy.data.objects.new('noir', cubenoir.data)
noir.location.x = 4*i+2
noir.location.y= 4*j
noir.scale.z=0.1
bpy.data.collections["damier"].objects.link(noir)
noir.select_set(True)
blanc = bpy.data.objects.new('blanc', cubeblanc.data)
blanc.location.x = 4*i+2
blanc.location.y= 4*j+2
blanc.scale.z=0.1
bpy.data.collections["damier"].objects.link(blanc)
blanc.select_set(True)
noir = bpy.data.objects.new('noir', cubenoir.data)
noir.location.x = 4*i
noir.location.y= 4*j+2
noir.scale.z=0.1
bpy.data.collections["damier"].objects.link(noir)
noir.select_set(True)
for ob in bpy.context.scene.objects:
if ob.type == 'MESH':
ob.select = True
bpy.context.scene.objects.active = ob
else:
ob.select = False
bpy.ops.object.join()
import bpy
cubeblanc= bpy.data.objects["CubeBlanc"]
cubenoir= bpy.data.objects["CubeNoir"]
for i in range(0,10):
for j in range(0,10):
blanc = bpy.data.objects.new('blanc', cubeblanc.data)
blanc.location.x = 4*i
blanc.location.y= 4*j
blanc.scale.z=0.1
bpy.data.collections["damier"].objects.link(blanc)
blanc.select_set(True)
noir = bpy.data.objects.new('noir', cubenoir.data)
noir.location.x = 4*i+2
noir.location.y= 4*j
noir.scale.z=0.1
bpy.data.collections["damier"].objects.link(noir)
noir.select_set(True)
blanc = bpy.data.objects.new('blanc', cubeblanc.data)
blanc.location.x = 4*i+2
blanc.location.y= 4*j+2
blanc.scale.z=0.1
bpy.data.collections["damier"].objects.link(blanc)
blanc.select_set(True)
noir = bpy.data.objects.new('noir', cubenoir.data)
noir.location.x = 4*i
noir.location.y= 4*j+2
noir.scale.z=0.1
bpy.data.collections["damier"].objects.link(noir)
noir.select_set(True)
for ob in bpy.context.scene.objects:
if ob.type == 'MESH':
ob.select = True
bpy.context.scene.objects.active = ob
else:
ob.select = False
bpy.ops.object.join()
Cette contribution était de : http://blenderclan.tuxfamily.org/html/newbb/viewtopic.php?forum=2&topic_id=50351&post_id=586709