2023年10月16日月曜日

20231019 mon Tの字




コレクションを作る


名前

線路rail
視線方向 

import bpy

# 新しいコレクションの名前を指定
collection_names = ["線路rail", "視線方向"]

# 重複を避けるためにコレクション名をセットに保持
existing_collection_names = set(bpy.data.collections.keys())

# コレクションを作成
for collection_name in collection_names:
    if collection_name not in existing_collection_names:
        new_collection = bpy.data.collections.new(collection_name)
        bpy.context.scene.collection.children.link(new_collection)
        existing_collection_names.add(collection_name)  # 作成済みのコレクション名をセットに追加









-2,0,0から
0、1,0へ
角度を シータで






blender python



球体を作る
半径 0.01
名前は point 


(-2,0,0)から (2,,0,0)

0.1 間隔で 作る



import bpy

# 球体の半径を指定
radius = 0.03

# 球体を作成する範囲を指定
start_x = -2
end_x = 2
interval = 0.1

# 球体を作成するループ
for x in range(int(start_x * 10), int(end_x * 10) + 1, int(interval * 10)):
    # 球体の中心座標を計算
    current_x = x / 10.0
    location = (current_x, 0, 0)
    
    # 球体を作成
    bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=location, segments=32, ring_count=16)
    
    # 作成した球体の名前を設定
    sphere = bpy.context.active_object
    sphere.name = f"point_{current_x}"

# シーンを更新
bpy.context.view_layer.update()





-2,0,0から
0、1,0 方向へ

球体を作る
半径 0.01
名前は length root5 連番

0.1 間隔で11個 作る




-2,0,0から 0,1,0 の距離を求めて 0.1 で 割って その答えに1足した数の球体を等間隔で

理解しました。以下は、(-2, 0, 0)から(0, 1, 0)までの距離を求め、0.1で割ってその答えに1を足した数の球体を等間隔で作成するBlender Pythonスクリプトです。


22個の球体


import bpy
import math

# 球体の半径を指定
radius = 0.03

# 初期座標と目標座標を指定
start_coord = (-2, 0, 0)
end_coord = (0, 1, 0)

# 距離を計算
distance = math.sqrt(sum((end_coord[j] - start_coord[j])**2 for j in range(3)))

# 0.1で割って1を足した数
num_spheres = int(distance / 0.1) + 1

# 方向ベクトルを計算
direction_vector = [(end_coord[i] - start_coord[i]) / (num_spheres - 1) for i in range(3)]

# 球体を作成するループ
for i in range(num_spheres):
    # 現在の座標を計算
    current_coord = [start_coord[j] + i * direction_vector[j] for j in range(3)]
    
    # 現在の座標までの距離を計算
    distance_to_current = math.sqrt(sum((current_coord[j] - start_coord[j])**2 for j in range(3)))
    
    # 距離が1.0以下の場合に球体を作成
    if distance_to_current <= distance:
        bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=current_coord, segments=32, ring_count=16)



22個
# 初期座標と目標座標を指定
start_coord = (-2, 0, 0)
end_coord = (0, 1, 1)


import bpy
import math

# 球体の半径を指定
radius = 0.03

# 初期座標と目標座標を指定
start_coord = (-2, 0, 0)
end_coord = (0, 1, 1)

# 距離を計算
distance = math.sqrt(sum((end_coord[j] - start_coord[j])**2 for j in range(3)))

# 等間隔で球体を作成するループ
num_spheres = 22
for i in range(num_spheres):
    # 現在の座標を計算
    alpha = i / (num_spheres - 1)
    current_coord = [start_coord[j] + alpha * (end_coord[j] - start_coord[j]) for j in range(3)]
    
    # 球体を作成
    bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=current_coord, segments=32, ring_count=16)





22個

# 初期座標と目標座標を指定
start_coord = (-2, 0, 0)
end_coord = (0, 1, √5)



import bpy
import math

# 球体の半径を指定
radius = 0.03

# 初期座標と目標座標を指定
start_coord = (-2, 0, 0)
end_coord = (0, 1, math.sqrt(5))

# 距離を計算
distance = math.sqrt(sum((end_coord[j] - start_coord[j])**2 for j in range(3)))

# 等間隔で球体を作成するループ
num_spheres = 22
for i in range(num_spheres):
    # 現在の座標を計算
    alpha = i / (num_spheres - 1)
    current_coord = [start_coord[j] + alpha * (end_coord[j] - start_coord[j]) for j in range(3)]
    
    # 球体を作成
    bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=current_coord, segments=32, ring_count=16)





ああああああああああああああああああああああああああああああああああああああああああああ





 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208 





2023年10月12日木曜日

20231013 表裏 色違い立体  直角二等辺三角形



UV 展開





blender python

立方体を作る
中心 10、0,0
1辺長さ 10


import bpy

# 立方体を作成
bpy.ops.mesh.primitive_cube_add(
    size=10,
    location=(10, 0, 0)
)

# 作成したオブジェクトを取得
cube = bpy.context.object

名前は cube 裏青

立方体の内側 boolean で 取り除く

# 立方体を作成
bpy.ops.mesh.primitive_cube_add(
    size=10,
    location=(9.9, 0, 0)
)

できた
立方体の外側を Green

立方体の外側を 青にする

色指定は RGBAを使う











ああああああああああああああああああああああああああああああああああああああああああああ



直角二等辺三角形を


1辺1長さを 1単位 で描くのと

1辺1長さ √2単位で描いて


import bpy

import bmesh

import math


def create_triangle(max_edge, z_coord):

    # メッシュデータの生成

    mesh = bpy.data.meshes.new(name=f"right_angle_triangle_{max_edge}_z{z_coord}_mesh")

    obj = bpy.data.objects.new(f"right_angle_triangle_{max_edge}_z{z_coord}", mesh)


    # シーンにオブジェクトを追加

    scene = bpy.context.scene

    scene.collection.objects.link(obj)

    bpy.context.view_layer.objects.active = obj

    obj.select_set(True)


    # メッシュデータの取得

    mesh = obj.data

    bm = bmesh.new()


    # 頂点の追加

    v1 = bm.verts.new((0, 0, z_coord))

    v2 = bm.verts.new((max_edge, 0, z_coord))

    v3 = bm.verts.new((0, max_edge, z_coord))


    # 面の追加

    bm.faces.new((v1, v2, v3))


    # BMeshデータをメッシュに適用

    bm.to_mesh(mesh)

    bm.free()


# 最大辺が1の直角二等辺三角形を z=0 に描く

create_triangle(1, 0)


# 最大辺が1の直角二等辺三角形を z=-1 に描く

create_triangle(1, -1)


# 最大辺が√2の直角二等辺三角形を z=-√2 に描く

create_triangle(math.sqrt(2), -math.sqrt(2))


# 最大辺が2の直角二等辺三角形を z=-2 に描く

create_triangle(2, -2)



 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208 





20231011  瞳の縁 追加 ボロメオの輪


今日の書き出し設定 項目メモ帳 2023: 20231009 ボロメオの輪 https://2023na2022.blogspot.com/2023/10/20231009.html



「配布 20231011 ボロメオの輪 only 004.blend」を共有




















blender python

x=5 平面に トーラスを作る

中心 5,0,0
メジャー半径 3
マイナー半径 1


import bpy
import math

# 新しいメッシュオブジェクトを作成
mesh = bpy.data.meshes.new(name="TorusMesh")
obj = bpy.data.objects.new("Torus", mesh)

# オブジェクトをシーンに追加
bpy.context.collection.objects.link(obj)

# アクティブなオブジェクトに設定
bpy.context.view_layer.objects.active = obj
obj.select_set(True)

# メッシュデータを取得
mesh = bpy.context.object.data

# トーラスの設定
major_radius = 3 * 2  # メジャー半径を2倍に変更
minor_radius = 1
segments_major = 48
segments_minor = 12

bpy.ops.mesh.primitive_torus_add(
    align='WORLD',
    location=(0, 0, 0),
    rotation=(0, 0, 0),
    major_radius=major_radius,
    minor_radius=minor_radius,
    abso_major_rad=1,
    abso_minor_rad=1,
    major_segments=segments_major,
    minor_segments=segments_minor
)

# オブジェクトを選択解除
obj.select_set(False)

# オブジェクトを取得し、y軸で90度回転
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.transform.rotate(value=math.radians(90), orient_axis='Y')

# オブジェクトを選択解除
obj.select_set(False)

# オブジェクトを移動
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.transform.translate(value=(5, 0, 0))






x=5 平面に トーラスを作る
トーラスを 000で 作り
y軸で90度回転
その後に 移動させる

中心 10,0,0
メジャー半径 0.5
マイナー半径 0.1






立方体を作る
中心 10、0,0
1辺長さ 10


import bpy

# 立方体を作成
bpy.ops.mesh.primitive_cube_add(
    size=10,
    location=(10, 0, 0)
)

# 作成したオブジェクトを取得
cube = bpy.context.object




立方体 空洞化

import bpy
# 立方体を作成
bpy.ops.mesh.primitive_cube_add(
    size=9.9,
    location=(10, 0, 0)
)

# 作成したオブジェクトを取得
cube = bpy.context.object









球体を作る
中心 5,0,0
半径 2
名前を 窓面の穴


import bpy

# 球体を作成
bpy.ops.mesh.primitive_uv_sphere_add(
    radius=2,
    location=(5, 0, 0)
)

# 作成したオブジェクトを取得
sphere = bpy.context.object

# オブジェクトの名前を設定
sphere.name = "窓面の穴"






import bpy

# 球体を作成
bpy.ops.mesh.primitive_uv_sphere_add(
    radius=2,
    location=(15, 0, 0)
)

# 作成したオブジェクトを取得
sphere = bpy.context.object

# オブジェクトの名前を設定
sphere.name = "狙撃スコープ"








あああああああああああああああああああああああああああああああああああああああああああ




 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208 





2023年10月9日月曜日

20231010b 地球自転の 東京 京都 博多




blender python
コレクションだけを作る

Torus radius 1.0
Torus radius 2.0
Ball radius 0.07
Ball radius 0.03
Ball long radius 0.05



import bpy

# コレクション名のリスト
collection_names = ["Torus radius 1.0", "Torus radius 2.0", "Ball radius 0.07", "Ball radius 0.03"]

# コレクションを作成
for name in collection_names:
    new_collection = bpy.data.collections.new(name)
    bpy.context.scene.collection.children.link(new_collection)








半径0.3の球体
中心 10,0,0
中心 10,10,0

名前は t=0太陽 t=1太陽 

透明度 20%
alpha blend


import bpy

# 球体1の中心座標
center1 = (10, 0, 0)

# 球体2の中心座標
center2 = (10, 10, 0)

# 球体の半径
radius = 0.3

# 透明度
alpha = 0.2

# 球体1を作成
bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=center1)

# 作成した球体1のオブジェクトを取得
sphere1 = bpy.context.active_object

# オブジェクトの名前を設定
sphere1.name = "t=0太陽"

# マテリアルを作成または取得
if sphere1.data.materials:
    material1 = sphere1.data.materials[0]
else:
    material1 = bpy.data.materials.new(name="太陽マテリアル1")
    sphere1.data.materials.append(material1)

# 透明度を設定
material1.use_nodes = True
nodes1 = material1.node_tree.nodes
shader1 = nodes1.get("Principled BSDF")
shader1.inputs["Alpha"].default_value = alpha  # 透明度を設定
material1.blend_method = 'BLEND'  # Alpha Blendモードに設定

# 球体2を作成
bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=center2)

# 作成した球体2のオブジェクトを取得
sphere2 = bpy.context.active_object

# オブジェクトの名前を設定
sphere2.name = "t=1太陽"

# マテリアルを作成または取得
if sphere2.data.materials:
    material2 = sphere2.data.materials[0]
else:
    material2 = bpy.data.materials.new(name="太陽マテリアル2")
    sphere2.data.materials.append(material2)

# 透明度を設定
material2.use_nodes = True
nodes2 = material2.node_tree.nodes
shader2 = nodes2.get("Principled BSDF")
shader2.inputs["Alpha"].default_value = alpha  # 透明度を設定
material2.blend_method = 'BLEND'  # Alpha Blendモードに設定








light を sun で 
位置 10,0,0        光線の方向を 10,10,0 
位置 10,10,0      光線の方向を 10,10,0 


import bpy

# 太陽光源1を作成
bpy.ops.object.light_add(type='SUN', location=(10, 0, 0))

# 作成した太陽光源1のオブジェクトを取得
sun_light1 = bpy.context.active_object

# 太陽光源1の名前を設定
sun_light1.name = "太陽光源1"

# 光線の方向を設定
sun_light1.rotation_euler = (0, 0, 0)  # 光線の方向を(10, 10, 0)に向ける

# 太陽光源2を作成
bpy.ops.object.light_add(type='SUN', location=(10, 10, 0))

# 作成した太陽光源2のオブジェクトを取得
sun_light2 = bpy.context.active_object

# 太陽光源2の名前を設定
sun_light2.name = "太陽光源2"

# 光線の方向を設定
sun_light2.rotation_euler = (0, 0, 0)  # 光線の方向を(10, 10, 0)に向ける





2つ円柱を作る 半径0.1
000で 長さ2で作って x軸に 90度回転
移動させる 1,0,0 名前は t=0線路レール
移動させる 1,10,0 名前は t=1線路レール


import bpy

import math


# 円柱の半径

radius = 0.1


# 円柱の長さ

length = 2.0


# ステップ数(t=0とt=1)

steps = [(1, 0, 0, "t=0線路レール"), (1, 10, 0, "t=1線路レール")]


for step in steps:

    # 円柱を作成

    bpy.ops.mesh.primitive_cylinder_add(vertices=32, radius=radius, depth=length, location=(0, 0, 0))


    # 作成した円柱のオブジェクトを取得

    cylinder = bpy.context.active_object


    # X軸に90度回転

    cylinder.rotation_euler.x += math.radians(90)


    # 移動させる

    cylinder.location = (step[0], step[1], step[2])


    # オブジェクトの名前を設定

    cylinder.name = step[3]





半径1の球体
中心000
中心0,10,0
名前は t=0地球   t=1 地球





 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208 





20231010a 光行差の望遠鏡







コレクションだけを作る

Torus radius 1.0
Torus radius 2.0
Ball radius 0.07
Ball radius 0.03
Ball long radius 0.05

import bpy

# コレクション名のリスト
collection_names = ["Torus radius 1.0", "Torus radius 2.0", "Ball radius 0.07", "Ball radius 0.03"]

# コレクションを作成
for name in collection_names:
    new_collection = bpy.data.collections.new(name)
    bpy.context.scene.collection.children.link(new_collection)










blender pyhton


21個の球体を 等間隔に作る
球体半径 0.01
(-1,-2,0)から (1,2,0)


import bpy
import math


# 球体の数と半径を指定
num_spheres = 21
radius = 0.07

# 球体を作成する位置の範囲を指定
start_point = (-1, -2, 0)
end_point = (1, 2, 0)

# 21個の球体を作成
for i in range(num_spheres):
    # 位置を計算
    t = i / (num_spheres - 1)  # 0から1までの範囲で分割
    x = start_point[0] + t * (end_point[0] - start_point[0])
    y = start_point[1] + t * (end_point[1] - start_point[1])
    z = start_point[2] + t * (end_point[2] - start_point[2])

    # 球体を作成
    bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=(x, y, z))
    sphere = bpy.context.object

    # オブジェクト名に連番とXYZの位置情報を組み合わせて設定
    sphere.name = f"球体{i+1}_X{x:.2f}_Y{y:.2f}_Z{z:.2f}"






トーラスを21個作る

メジャー半径 1.0
マイナー半径 0.05


原点000で トーラスを作る
x軸で90度回転

トーラス中心を等間隔で
(-1,-2,0)から (1,2,0)

オブジェクト名に トーラスのメジャー半径を加える


import bpy
import math

# トーラスのパラメータ
major_radius = 2.0
minor_radius = 0.05
num_toruses = 21

# トーラスの中心を配置する範囲
start_position = (-1, -2, 0)
end_position = (1, 2, 0)

# トーラスの間隔を計算
spacing_x = (end_position[0] - start_position[0]) / (num_toruses - 1)
spacing_y = (end_position[1] - start_position[1]) / (num_toruses - 1)

# 21個のトーラスを作成して配置
for i in range(num_toruses):
    x_position = start_position[0] + i * spacing_x
    y_position = start_position[1] + i * spacing_y
    torus = bpy.ops.mesh.primitive_torus_add(
        align='WORLD',
        location=(x_position, y_position, start_position[2]),
        rotation=(math.radians(90), 0, 0),
        major_radius=major_radius,
        minor_radius=minor_radius,
        major_segments=48,
        minor_segments=12
    )
    
    # トーラスのオブジェクト名にメジャー半径を加える
    bpy.context.object.name = f"トーラス_{major_radius}"







blender pyhton


21個の球体を 等間隔に作る
球体半径 0.01
(-1,-2,0)から (1,2,0)


import bpy
import math


# 球体の数と半径を指定
num_spheres = 41
radius = 0.05

# 球体を作成する位置の範囲を指定
start_point = (-2, -4, 0)
end_point = (2, 4, 0)

# 41個の球体を作成
for i in range(num_spheres):
    # 位置を計算
    t = i / (num_spheres - 1)  # 0から1までの範囲で分割
    x = start_point[0] + t * (end_point[0] - start_point[0])
    y = start_point[1] + t * (end_point[1] - start_point[1])
    z = start_point[2] + t * (end_point[2] - start_point[2])

    # 球体を作成
    bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=(x, y, z))
    sphere = bpy.context.object

    # オブジェクト名に連番とXYZの位置情報を組み合わせて設定
    sphere.name = f"球体{i+1}_X{x:.2f}_Y{y:.2f}_Z{z:.2f}"










2023年10月8日日曜日

20231009 レイヤー トーラス 高さ違い





「配布 20231009b 集合 ベン図 002.blend」を共有






正三角形の中心を 000にして
3頂点の位置を 書き出して


the coordinates for a regular triangle with side length 2 and center at the origin:

  1. Vertex A: (1, 0)
  2. Vertex B: (-1, 0)
  3. Vertex C: (0, √3)

These coordinates represent the vertices of an equilateral triangle with side length 2, centered at the origin (0,








blender python で

3つの頂点を トーラスの中心にして
半径3で マイナー半径0.1 描いて


import bpy
import math

# 3つの頂点の座標を設定
vertices = [(1, 0, 0), (-1, 0, 0), (0, math.sqrt(3), 0)]

for vertex in vertices:
    # メッシュの作成
    mesh = bpy.data.meshes.new(name="CustomTorusMesh")
    obj = bpy.data.objects.new("CustomTorus", mesh)

    # シーンに追加
    bpy.context.scene.collection.objects.link(obj)

    # メッシュオブジェクトをアクティブに設定
    bpy.context.view_layer.objects.active = obj
    obj.select_set(True)

    # オブジェクトモードに切り替え
    bpy.ops.object.mode_set(mode='OBJECT')

    # トーラスの作成
    bpy.ops.mesh.primitive_torus_add(
        align='WORLD',
        location=vertex,  # トーラスの中心座標
        rotation=(0, 0, 0),
        major_radius=1,
        minor_radius=0.1,
        major_segments=48,
        minor_segments=12
    )










import bpy
import math

# 3つの頂点の座標を設定
vertices = [(1, 0, 0), (-1, 0, 0), (0, math.sqrt(3), 0)]

for vertex in vertices:
    # メッシュの作成
    mesh = bpy.data.meshes.new(name="CustomTorusMesh")
    obj = bpy.data.objects.new("CustomTorus", mesh)

    # シーンに追加
    bpy.context.scene.collection.objects.link(obj)

    # メッシュオブジェクトをアクティブに設定
    bpy.context.view_layer.objects.active = obj
    obj.select_set(True)

    # オブジェクトモードに切り替え
    bpy.ops.object.mode_set(mode='OBJECT')

    # トーラスの作成
    bpy.ops.mesh.primitive_torus_add(
        align='WORLD',
        location=vertex,  # トーラスの中心座標
        rotation=(0, 0, 0),
        major_radius=2,
        minor_radius=0.1,
        major_segments=48,
        minor_segments=12
    )




以上の トーラスを

z=1
Z=0
Z=-1に 作って





import bpy
import math

# 3つの頂点の座標を設定
vertices = [(1, 0, 1), (-1, 0, 0), (0, math.sqrt(3), -1)]

# 3つのトーラスを作成
for vertex in vertices:
    # メッシュの作成
    mesh = bpy.data.meshes.new(name="CustomTorusMesh")
    obj = bpy.data.objects.new("CustomTorus", mesh)

    # シーンに追加
    bpy.context.scene.collection.objects.link(obj)

    # メッシュオブジェクトをアクティブに設定
    bpy.context.view_layer.objects.active = obj
    obj.select_set(True)

    # オブジェクトモードに切り替え
    bpy.ops.object.mode_set(mode='OBJECT')

    # トーラスの作成
    bpy.ops.mesh.primitive_torus_add(
        align='WORLD',
        location=vertex,  # トーラスの中心座標
        rotation=(0, 0, 0),
        major_radius=2,
        minor_radius=0.1,
        major_segments=48,
        minor_segments=12
    )

# 3つのトーラスを z=1, z=0, z=-1 に配置
for i, obj in enumerate(bpy.data.objects['CustomTorus']):
    obj.location.z = i - 1










ああああああああああああああああああああああああああああああああああああああああああああ





 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208 





20231009 ボロメオの輪










「配布 20231011 ボロメオの輪 only 004.blend」を共有






正四面体 作成


blender python 

正四面体の中心が (0, 0, 0) にあり、かつ少なくとも一つの面が zx 平面に平行




import bpy
import math

# シーンのクリア
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()



























z=0平面に描かれたトーラス、かつその中心が原点(0, 0, 0)にあるようなスクリプト



import bpy
import math

# シーンのクリア
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.delete()

# トーラスの作成(z=0平面に描く)
bpy.ops.mesh.primitive_torus_add(
    align='WORLD',
    location=(0, 0, 0.1),  # z=0.1に設定
    rotation=(0, 0, 0),
    major_radius=2,  # x軸方向に伸ばす
    minor_radius=0.1,  # マイナー半径を0.1に設定
    mode='MAJOR_MINOR',
    abso_major_rad=2,
    abso_minor_rad=0.1,
    major_segments=48,
    minor_segments=12
)

# トーラスを選択状態にする
torus = bpy.context.active_object
torus.select_set(True)
bpy.context.view_layer.objects.active = torus

# トーラスをy軸方向に2だけ伸ばす
bpy.ops.transform.resize(value=(1, 2, 1))


zy




import bpy
import math

# 選択されているオブジェクトを取得
selected_objects = bpy.context.selected_objects

# 選択されている各オブジェクトに対して y 軸周りに90度回転を適用
for obj in selected_objects:
    bpy.context.view_layer.objects.active = obj  # アクティブなオブジェクトに設定
    bpy.ops.transform.rotate(value=math.radians(90), orient_axis='Y')




import bpy
import math

# 選択されているオブジェクトを取得
selected_objects = bpy.context.selected_objects

# 選択されている各オブジェクトに対して z 軸周りに90度回転を適用
for obj in selected_objects:
    bpy.context.view_layer.objects.active = obj  # アクティブなオブジェクトに設定
    bpy.ops.transform.rotate(value=math.radians(90), orient_axis='Z')









import bpy
import math

# 選択されているオブジェクトを取得
selected_objects = bpy.context.selected_objects

# 選択されている各オブジェクトに対して y 軸周りに90度回転を適用
for obj in selected_objects:
    bpy.context.view_layer.objects.active = obj  # アクティブなオブジェクトに設定
    bpy.ops.transform.rotate(value=math.radians(90), orient_axis='Y')

# 選択されている各オブジェクトに対して z 軸周りに90度回転を適用
for obj in selected_objects:
    bpy.context.view_layer.objects.active = obj  # アクティブなオブジェクトに設定
    bpy.ops.transform.rotate(value=math.radians(90), orient_axis='Z')










import bpy
import math

# トーラスをy軸周りに90度回転
bpy.ops.transform.rotate(value=math.radians(90), orient_axis='y')


# トーラスをz軸周りに45度回転
bpy.ops.transform.rotate(value=math.radians(45), orient_axis='Z')


# トーラスを平行移動
bpy.ops.transform.translate(value=(1, 2, 0))
















Can You Make Borromean Rings In Real-Life? https://youtu.be/2CsJOswZvGc?si=0K2REgradiYpcliU



Borromean rings https://youtu.be/rM8teT4n6D8?si=NtZSFG6bY2cpem8P





ああああああああああああああああああああああああああああああああああああああああああああ





 

基本系 配布 001 単位円 torus と xyz軸 円柱

https://drive.google.com/file/d/1adh0pC0n5MUfaPnsQcab8CnTvHu_JqLg/view?usp=drive_link

 

基本系 配布 002 単位2長さ balls

https://drive.google.com/file/d/1vyg5oFWmw_TK8nwp5TmVSfLH94I6rTaY/view?usp=drive_link

 

基本系 配布 003 単位2長さ balls 光時計セット 

https://drive.google.com/file/d/1u2Rn_nVBcewe39Vokua9C5n25cdivyyL/view?usp=drive_link

 

blender 基本系 配布 カタログ 2023 - zionad_mainのブログ https://mokuji000zionad.hatenablog.com/entry/2023/07/31/095208