import bpy

COUNT = 5
SPACING = 2.4
SIZE = 1.6

collection = bpy.data.collections.new("Practice_Blocks")
bpy.context.scene.collection.children.link(collection)

for index in range(COUNT):
    bpy.ops.mesh.primitive_cube_add(
        size=SIZE,
        location=(index * SPACING, 0, SIZE / 2)
    )
    obj = bpy.context.object
    obj.name = f"Block_{index + 1:02d}"
    # 将新对象从当前集合移入专用练习集合
    for old_collection in list(obj.users_collection):
        old_collection.objects.unlink(obj)
    collection.objects.link(obj)
    bevel = obj.modifiers.new("Soft_Edges", "BEVEL")
    bevel.width = 0.06
    bevel.segments = 3

print("Created", COUNT, "practice blocks")
