import bpy
from math import radians
# トーラスを作成する
bpy.ops.mesh.primitive_torus_add(major_radius=30, minor_radius=1)
# 回転させる軸を選択する
zion_xyz = 'zana'
if zion_xyz == 'xana':
# 軸を中心に90度回転させる
bpy.context.object.rotation_euler[0] = radians(0)
bpy.context.object.rotation_euler[1] = radians(90)
bpy.context.object.rotation_euler[2] = radians(0)
# X軸方向に伸ばす
bpy.context.object.scale[0] = 1
bpy.context.object.scale[1] = 1
bpy.context.object.scale[2] = 1
elif zion_xyz == 'yana':
# 軸を中心に90度回転させる
bpy.context.object.rotation_euler[0] = radians(90)
bpy.context.object.rotation_euler[1] = radians(0)
bpy.context.object.rotation_euler[2] = radians(0)
# Y軸方向に伸ばす
bpy.context.object.scale[0] = 3
bpy.context.object.scale[1] = 3
bpy.context.object.scale[2] = 3
elif zion_xyz == 'zana':
# Z軸を中心に90度回転させる
bpy.context.object.rotation_euler[0] = radians(0)
bpy.context.object.rotation_euler[1] = radians(0)
bpy.context.object.rotation_euler[2] = radians(0)
# Z軸方向に伸ばす
bpy.context.object.scale[0] = 1
bpy.context.object.scale[1] = 1
bpy.context.object.scale[2] = 10
else:
print('Invalid rotation axis selected.')
# トーラスを選択する
bpy.context.view_layer.objects.active = bpy.context.selected_objects[0]
bbb