Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- card_x = 80
- card_y = 10
- card_z = 135
- card_margin = 10
- grid_x = 22
- grid_z = 5
- backplate_x = (card_x + card_margin) * grid_x + card_margin
- backplate_y = 30
- backplate_z = (card_z + card_margin) * grid_z + card_margin
- def draw_backplate():
- bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0), radius=1)
- bpy.ops.transform.resize(value=(backplate_x, backplate_y, backplate_z))
- return bpy.context.scene.objects.active
- def draw_cards():
- bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0), radius=1)
- bpy.ops.transform.resize(value=(card_x, card_y, card_z))
- cards = bpy.context.scene.objects.active
- cards_x_modifier = cards.modifiers.new(name="CardsXArray", type="ARRAY")
- cards_x_modifier.fit_type = "FIXED_COUNT"
- cards_x_modifier.count = grid_x
- cards_x_modifier.use_relative_offset = True
- cards_x_modifier.relative_offset_displace = ((card_x + card_margin) / card_x, 0, 0)
- cards_z_modifier = cards.modifiers.new(name="CardsZArray", type="ARRAY")
- cards_z_modifier.fit_type = "FIXED_COUNT"
- cards_z_modifier.count = grid_z
- cards_z_modifier.use_relative_offset = True
- cards_z_modifier.relative_offset_displace = (0, 0, (card_z + card_margin) / card_z)
- return cards
- def main():
- draw_backplate()
- draw_cards()
- main()
Advertisement
Add Comment
Please, Sign In to add comment