import bpy
from math import radians
radius = 2
zion_number = 15
vertices = 60
create_single_disk = True
if create_single_disk:
disk_locations = [(30.0, 0.0, 0.0)]
object_names = ['cylinder']
rotation_enabled = {'z': False, 'y': False}
else:
disk_locations = [
(30.0, 0.0, 0.0),
(30.0, 0.0, zion_number),
(30.0, 0.0, -zion_number),
(30.0, -zion_number, 0.0),
(30.0, zion_number, 0.0)
]
object_names = ['cylinder1', 'cylinder2', 'cylinder3', 'cylinder4', 'cylinder5']
z_rotation_enabled = {'cylinder1': True, 'cylinder2': True, 'cylinder3': True, 'cylinder4': True, 'cylinder5': True}
y_rotation_enabled = {'cylinder1': False, 'cylinder2': False, 'cylinder3': False, 'cylinder4': False, 'cylinder5': False}
for i, location in enumerate(disk_locations):
x, y, z = location
bpy.ops.mesh.primitive_cylinder_add(radius=radius, depth=0, vertices=vertices, enter_editmode=False, align='WORLD', location=(x, y, z))
cylinder = bpy.context.object
cylinder.name = object_names[i]
cylinder.rotation_euler = (radians(90), radians(0), radians(0))
if not create_single_disk:
if z_rotation_enabled[object_names[i]]:
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.rotate(value=radians(90), orient_axis='Z', orient_type='GLOBAL')
bpy.ops.object.mode_set(mode='OBJECT')
cylinder.rotation_euler.y = radians(90) if y_rotation_enabled[object_names[i]] else radians(0)
import bpy
from math import radians
radius = 2
zion_number = 15
vertices = 60
create_single_disk = True
if create_single_disk:
disk_locations = [(30.0, 0.0, 0.0)]
object_names = ['cylinder']
rotation_enabled = {'z': False, 'y': False}
else:
disk_locations = [
(30.0, 0.0, 0.0),
(30.0, 0.0, zion_number),
(30.0, 0.0, -zion_number),
(30.0, -zion_number, 0.0),
(30.0, zion_number, 0.0)
]
object_names = ['cylinder1', 'cylinder2', 'cylinder3', 'cylinder4', 'cylinder5']
z_rotation_enabled = {'cylinder1': True, 'cylinder2': True, 'cylinder3': True, 'cylinder4': True, 'cylinder5': True}
y_rotation_enabled = {'cylinder1': False, 'cylinder2': False, 'cylinder3': False, 'cylinder4': False, 'cylinder5': False}
for i, location in enumerate(disk_locations):
x, y, z = location
bpy.ops.mesh.primitive_cylinder_add(radius=radius, depth=0, vertices=vertices, enter_editmode=False, align='WORLD', location=(x, y, z))
cylinder = bpy.context.object
cylinder.name = object_names[i]
cylinder.rotation_euler = (radians(90), radians(0), radians(0))
if not create_single_disk:
if z_rotation_enabled[object_names[i]]:
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.rotate(value=radians(90), orient_axis='Z', orient_type='GLOBAL')
bpy.ops.object.mode_set(mode='OBJECT')
cylinder.rotation_euler.y = radians(90) if y_rotation_enabled[object_names[i]] else radians(0)
bbb