import bpy
from math import radians
# Create a cylinder
bpy.ops.mesh.primitive_cylinder_add(radius=1, depth=2)
# Create an inner cylinder
bpy.ops.mesh.primitive_cylinder_add(radius=0.8, depth=2)
# Select the inner cylinder
inner_cylinder = bpy.context.object
# Move the inner cylinder to the center of the outer cylinder
inner_cylinder.location = (0, 0, 1)
# Add a boolean modifier to the outer cylinder
modifier = outer_cylinder.modifiers.new(name="Boolean", type="BOOLEAN")
modifier.object = inner_cylinder
modifier.operation = 'DIFFERENCE'
# Apply the modifier to make the outer cylinder hollow
bpy.ops.object.modifier_apply(modifier='Boolean')
# Select rotation axis
zion_xyz = 'zana'
if zion_xyz == 'xana':
# Rotate 90 degrees around X-axis
bpy.context.object.rotation_euler[0] = radians(90)
bpy.context.object.rotation_euler[1] = radians(0)
bpy.context.object.rotation_euler[2] = radians(0)
# Scale along X-axis
bpy.context.object.scale[0] = 3
bpy.context.object.scale[1] = 1
bpy.context.object.scale[2] = 1
elif zion_xyz == 'yana':
# Rotate 90 degrees around Y-axis
bpy.context.object.rotation_euler[0] = radians(0)
bpy.context.object.rotation_euler[1] = radians(90)
bpy.context.object.rotation_euler[2] = radians(0)
# Scale along Y-axis
bpy.context.object.scale[0] = 1
bpy.context.object.scale[1] = 3
bpy.context.object.scale[2] = 1
elif zion_xyz == 'zana':
# Rotate 90 degrees around Z-axis
bpy.context.object.rotation_euler[0] = radians(0)
bpy.context.object.rotation_euler[1] = radians(0)
bpy.context.object.rotation_euler[2] = radians(90)
# Scale along Z-axis
bpy.context.object.scale[0] = 1
bpy.context.object.scale[1] = 1
bpy.context.object.scale[2] = 10
else:
print('Invalid rotation axis selected.')
# Select the outer cylinder
bpy.context.view_layer.objects.active = bpy.context.selected_objects[0]
import bpy
from math import radians
# Create outer cylinder
bpy.ops.mesh.primitive_cylinder_add(radius=2, depth=4)
# Create inner cylinder
bpy.ops.mesh.primitive_cylinder_add(radius=1, depth=4)
# Select the inner cylinder
inner_cylinder = bpy.context.object
# Move the inner cylinder to the center of the outer cylinder
inner_cylinder.location = (0, 0, 0)
# Add boolean modifier to the outer cylinder
modifier = bpy.context.object.modifiers.new(name="Boolean", type="BOOLEAN")
modifier.object = inner_cylinder
modifier.operation = 'DIFFERENCE'
# Apply the modifier to make the outer cylinder hollow
bpy.ops.object.modifier_apply(modifier='Boolean')
# Select rotation axis
zion_xyz = 'zana'
if zion_xyz == 'xana':
# Rotate 90 degrees around X-axis
bpy.context.object.rotation_euler[0] = radians(90)
bpy.context.object.rotation_euler[1] = radians(0)
bpy.context.object.rotation_euler[2] = radians(0)
# Scale along X-axis
bpy.context.object.scale[0] = 3
bpy.context.object.scale[1] = 1
bpy.context.object.scale[2] = 1
elif zion_xyz == 'yana':
# Rotate 90 degrees around Y-axis
bpy.context.object.rotation_euler[0] = radians(0)
bpy.context.object.rotation_euler[1] = radians(90)
bpy.context.object.rotation_euler[2] = radians(0)
# Scale along Y-axis
bpy.context.object.scale[0] = 1
bpy.context.object.scale[1] = 3
bpy.context.object.scale[2] = 1
elif zion_xyz == 'zana':
# Rotate 90 degrees around Z-axis
bpy.context.object.rotation_euler[0] = radians(0)
bpy.context.object.rotation_euler[1] = radians(0)
bpy.context.object.rotation_euler[2] = radians(90)
# Scale along Z-axis
bpy.context.object.scale[0] = 1
bpy.context.object.scale[1] = 1
bpy.context.object.scale[2] = 10
else:
print('Invalid rotation axis selected.')
# Select the outer cylinder
bpy.context.view_layer.objects.active = bpy.context.selected_objects[0]
bbb