時空図の 斜め軌跡の 球体半径 0.2 と トーラス円周 コレクション
import bpy
import math
def create_sphere_at_position(position, color, name):
# 半径を設定
radius = 0.15
# 球を作成(指定した座標に)
bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=position)
sphere = bpy.context.active_object
# マテリアルを作成
material = bpy.data.materials.new(name="Material_" + name)
sphere.data.materials.append(material)
# マテリアルの設定
material.use_nodes = False
material.diffuse_color = color
# オブジェクトの名前を設定
sphere.name = name
# 球体の作成する線分の両端の位置を指定
start_position = (-1, 0, -1)
end_position = (0, 0, 0)
num_spheres = 5
# 球体を等間隔で作成
for i in range(num_spheres):
t = i / (num_spheres - 1) # 0から1の範囲で等間隔になるように計算
x_position = start_position[0] + t * (end_position[0] - start_position[0])
y_position = start_position[1] + t * (end_position[1] - start_position[1])
z_position = start_position[2] + t * (end_position[2] - start_position[2])
color = (1.0, 0, 1.0, 1.0) # ピンクの色 (R:1.0, G:0, B:1.0, A:1.0)
name = f"point({x_position:.2f}, {y_position:.2f}, {z_position:.2f})"
create_sphere_at_position((x_position, y_position, z_position), color, name)
import bpy
import math
# オブジェクトを作成
bpy.ops.mesh.primitive_torus_add(
align='WORLD',
location=(0, 0, 0),
rotation=(0, 0, 0),
major_radius=1,
minor_radius=0.06,
major_segments=48,
minor_segments=12
)
# オブジェクトを選択
obj = bpy.context.active_object
# オブジェクト名を変更
obj.name = "MyTorus"
# コレクションを作る 重複の場合 作らない
import bpy
# List of collection names
collection_names = [
"事象情報",
"地図位置",
"torus 円周",
"時空 斜線",
"写真 正方形",
"光時計",
"xyz 軸",
"abcdefg"
]
# Function to create a new collection if it doesn't exist
def create_collection_if_not_exists(name):
if name not in bpy.data.collections:
collection = bpy.data.collections.new(name)
bpy.context.scene.collection.children.link(collection)
# Create collections
for name in collection_names:
create_collection_if_not_exists(name)