ラベル blenderparts の投稿を表示しています。 すべての投稿を表示
ラベル blenderparts の投稿を表示しています。 すべての投稿を表示

2023年3月15日水曜日

A large immovable sphere 半径300

aaa

不動の球体 大きいの 英語にして

A large immovable sphere. 





import bpy

# タグ名
tag_name = "fudou_kyuutai300"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 球体の半径を設定
radius = 300.0

# 球体Aの初期位置と移動先の位置を設定
loc_a_start = (0, 0, 0)
# loc_a_end = (0, 0, radius)
loc_a_end = (0, 0, 0)



# 球体Aを作成し、初期位置を設定する
bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=loc_a_start)
obj_a = bpy.context.object

# コレクションにオブジェクトを追加する
collection.objects.link(obj_a)

# アニメーションのフレーム設定を行う
start_frame = 1  # アニメーションの最初のフレーム
end_frame_a = int(20 * bpy.context.scene.render.fps)  # 球体Aの移動が終わるフレーム
bpy.context.scene.frame_start = start_frame  # アニメーションの開始フレームを設定
bpy.context.scene.frame_end = end_frame_a  # アニメーションの終了フレームを設定

# キーフレームを設定する
obj_a.location = loc_a_start  # 球体Aの開始位置を設定
obj_a.keyframe_insert(data_path="location", frame=start_frame)  # 開始フレームでキーフレームを設定
obj_a.location = loc_a_end  # 球体Aの終了位置を設定
obj_a.keyframe_insert(data_path="location", frame=end_frame_a)  # 終了フレームでキーフレームを設定

# アニメーション再生
bpy.ops.screen.animation_play()  # アニメーションを再生

































bbb

1番目 合体 線分から線分に降る 同じ速度 雨50 A raindrop falls from a line segment at z=300 at the same speed

aaa

A raindrop falls from a line segment at z=300 at the same speed.
同じ速度で z=300の線分から落下する 雨粒 50 英語にして
 


修正後のコードは以下のようになります。50個の球体を表示するかどうかを指定するためのフラグ show_sphere を追加しました。また、球体オブジェクトを表す変数名が obj_b になっていたので、obj_a に修正しました

 

import bpy
import random

# タグ名
tag_name = "rain_l_line_drops50"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 球体の半径を設定
radius = 5.0

# 球体を表示するかどうかのフラグ
show_sphere = True

for i in range(50):
    # 球体の初期位置と移動先の位置をランダムに設定
    y = random.uniform(-300, 300)
    loc_a_start = (0, y, 300)
    loc_a_end = (0, y, 0)

    # 球体Aを作成し、初期位置を設定する
    bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, location=loc_a_start)
    obj_a = bpy.context.object

    # コレクションにオブジェクトを追加する
    collection.objects.link(obj_a)

    if not show_sphere:
        obj_a.hide_render = True

    # アニメーションのフレーム設定を行う
    start_frame = 1  # アニメーションの最初のフレーム
    end_frame_a = int(20 * bpy.context.scene.render.fps)  # 球体Aの移動が終わるフレーム
    bpy.context.scene.frame_start = start_frame  # アニメーションの開始フレームを設定
    bpy.context.scene.frame_end = end_frame_a  # アニメーションの終了フレームを設定

    # キーフレームを設定する
    obj_a.location = loc_a_start  # 球体Aの開始位置を設定
    obj_a.keyframe_insert(data_path="location", frame=start_frame)  # 開始フレームでキーフレームを設定
    obj_a.location = loc_a_end  # 球体Aの終了位置を設定
    obj_a.keyframe_insert(data_path="location", frame=end_frame_a)  # 終了フレームでキーフレームを設定

# アニメーション再生
bpy.ops.screen.animation_play()  # アニメーションを再生



# アニメーション再生時間を5秒延長
bpy.context.scene.frame_end += 5 * bpy.context.scene.render.fps





























bbb

位置を示す 大きな 円錐 2つ 4つ

aaa

# 円錐を作成する
radius = 300
depth = 300

obj1.location = (-600, 0, 0)
obj2.location = (600, 0, 0)

loc_a = (0, -600, 0)
loc_b = (0, 600, 0)


 
import bpy
import random

# タグ名
tag_name = "zion Bigcones"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐を作成する
radius = 300
depth = 300
bpy.ops.mesh.primitive_cone_add(radius1=radius, depth=depth)

# 作成したオブジェクトをコレクションに追加する
obj1 = bpy.context.active_object
obj1.location = (-600, 0, 0)
collection.objects.link(obj1)

# もう一つの円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=radius, depth=depth)

# 作成したオブジェクトをコレクションに追加する
obj2 = bpy.context.active_object
obj2.location = (600, 0, 0)
collection.objects.link(obj2)






追加の 円錐 2つ


import bpy

# タグ名
tag_name = "zion Bigcones"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐を作成する
radius = 300
depth = 300

# 円錐1を作成し、初期位置を設定する
loc_a = (0, -600, 0)
bpy.ops.mesh.primitive_cone_add(radius1=radius, depth=depth, location=loc_a)
obj_a = bpy.context.object

# コレクションにオブジェクトを追加する
collection.objects.link(obj_a)

# 円錐2を作成し、初期位置を設定する
loc_b = (0, 600, 0)
bpy.ops.mesh.primitive_cone_add(radius1=radius, depth=depth, location=loc_b)
obj_b = bpy.context.object

# コレクションにオブジェクトを追加する
collection.objects.link(obj_b)







































bbb

Moving cones moving towards origin O at a constant speed.

aaa

一定速度で 原点O へ 進む 円錐 英語にして
 


import bpy
import random

# タグ名
tag_name = "zion cone50 line ittei sokudo center"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐の半径と高さを設定
radius = 5.0
height = 10.0

for i in range(50):
    # 円錐の初期位置と移動先の位置をランダムに設定
    y = random.uniform(-300, 300)
    loc_a_start = (0, y, 300)
    loc_a_end = (0, 0, 0)

    # 円錐Aを作成し、初期位置を設定する
    bpy.ops.mesh.primitive_cone_add(radius1=radius, radius2=0, depth=height, location=loc_a_start)
    obj_a = bpy.context.object

    # コレクションにオブジェクトを追加する
    collection.objects.link(obj_a)

    # アニメーションのフレーム設定を行う
    start_frame = 1  # アニメーションの最初のフレーム
    distance = (((0-0)**2 + (y-0)**2 + (300-0)**2)**0.5)  /300
    end_frame_a = int(distance * 20 * bpy.context.scene.render.fps)  # 円錐Aの移動が終わるフレーム
    bpy.context.scene.frame_start = start_frame  # アニメーションの開始フレームを設定
    bpy.context.scene.frame_end = end_frame_a  # アニメーションの終了フレームを設定

    # キーフレームを設定する
    obj_a.location = loc_a_start  # 円錐Aの開始位置を設定
    obj_a.keyframe_insert(data_path="location", frame=start_frame)  # 開始フレームでキーフレームを設定
    obj_a.location = loc_a_end  # 円錐Aの終了位置を設定
    obj_a.keyframe_insert(data_path="location", frame=end_frame_a)  # 終了フレームでキーフレームを設定

# アニメーション再生
bpy.ops.screen.animation_play()  # アニメーションを再生










































bbb

失敗 blender zion cone

aaa
これを参考に

import bpy
import random

# タグ名
tag_name = "zion cone"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=300, depth=300)

# 作成したオブジェクトをコレクションに追加する
obj = bpy.context.active_object
collection.objects.link(obj)






















import bpy

# タグ名
tag_name = "zion cone"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=300, depth=600)

# 作成したオブジェクトをコレクションに追加する
obj = bpy.context.active_object
collection.objects.link(obj)

# オブジェクトの変換を変更する
obj.location = (-600, 0, 0)  # 円錐の頂点を指定
obj.data.vertices[0].co = (0, 0, 300)  # 円錐底面の中心を指定







import bpy
import random

# タグ名
tag_name = "zion cone"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=100, depth=200)

# 作成したオブジェクトをコレクションに追加する
obj = bpy.context.active_object
collection.objects.link(obj)

# オブジェクトの位置を変更する
obj.location = (0, 0, 0)

# カメラの位置を設定する
cam = bpy.data.objects["Camera"]
cam.location = (0, 500, 0)

# カメラをオブジェクトに向ける
look_at_vector = obj.location - cam.location
rot_quat = look_at_vector.to_track_quat('Z', 'Y')
cam.rotation_euler = rot_quat.to_euler()

# オブジェクトが画面内に収まるようにカメラ位置を微調整する
bpy.ops.view3d.camera_to_view_selected()





円錐をランダムに 50個 obj.location = (0, 0, 0) から500 離れた位置に 円錐の頂点を置いて 円錐の底面中心が700 離れた位置になるようにして

2 / 2

以下のようにスクリプトを書くことで、ランダムな位置に円錐を50個生成し、円錐の頂点を指定された距離に配置することができます。また、円錐の底面中心が指定された距離になるように、底面の中心を計算して位置を微調整しています。

import bpy
import random

# タグ名
tag_name = "zion cone"

# コレクションを取得する
collection = bpy.data.collections.get(tag_name)

# コレクションが存在しない場合は作成する
if not collection:
    collection = bpy.data.collections.new(tag_name)
    bpy.context.scene.collection.children.link(collection)

# 円錐を50個作成する
for i in range(50):
    # 円錐を作成する
    bpy.ops.mesh.primitive_cone_add(radius1=100, depth=200)

    # 作成したオブジェクトをコレクションに追加する
    obj = bpy.context.active_object
    collection.objects.link(obj)

    # 円錐の頂点位置を指定された距離に移動する
    obj.location = (random.uniform(-500, 500), random.uniform(-500, 500), random.uniform(0, 500))

    # 円錐の底面中心が指定された距離になるように微調整する
    bottom_center = obj.location - (0, 0, obj.dimensions.z/2)
    obj.location += (0, 0, 700 - bottom_center.z)

    # マテリアルを作成する
    mat = bpy.data.materials.new(name=f"MyMaterial_{i}")
    mat.diffuse_color = (random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1))

    # オブジェクトにマテリアルを割り当てる
    if obj.data.materials:
        obj.data.materials[0] = mat
    else:
        obj.data.materials.append(mat)

# カメラの位置を設定する
cam = bpy.data.objects["Camera"]
cam.location = (0, 0, 1000)

# カメラをオブジェクトに向ける
look_at_vector = collection.objects[0].location - cam.location
rot_quat = look_at_vector.to_track_quat('Z', 'Y')
cam.rotation_euler = rot_quat.to_euler()

# オブジェクトが画面内に収まるようにカメラ位置を微調整する
bpy.ops.view3d.camera_to_view_selected()












from vapory import *

# 2つの円錐頂点
v1 = [-600, 0, 0]
v2 = [600, 0, 0]

# 円錐の底面中心を求める
center = [(v1[0] + v2[0]) / 2, (v1[1] + v2[1]) / 2, (v1[2] + v2[2]) / 2]

# 円錐の高さと半径
height = 300
radius = 300

# 円錐の底面を中心に配置するための変換行列
translate_matrix = [Translation([center[0], center[1] - radius, center[2]])]

# 円錐の生成
cone = Cone(v1, height, v2, radius, Texture(Pigment('color', [1, 1, 1])))

# カメラの設定
camera = Camera('location', [0, 0, -1000], 'look_at', [0, 0, 0])

# ライトの設定
light = LightSource([0, 0, -1000], 'color', [1, 1, 1])

# 3Dシーンの生成
scene = Scene(camera, objects=[light, cone], included=['colors.inc'])

# 画像の保存
scene.render('cone.png', width=800, height=600, antialiasing=0.01, auto_camera=True, include_alpha=False, remove_temp=True, quality=11)













2つ円錐頂点 (-600,0,0) 
(600,0,0)

円錐の頂点と
円錐底面の中心が 2つの円錐頂点が存在する直線上にする

円錐高さ 300
円錐底面半径 300





















bbb

連番 007 未来光円錐 過去光円錐 円周中心からの球体放出

aaa 参考 2023年3月26日日曜日 製作 002b 未来光円錐の方向 線路レールで https://ia2023sha.blogspot.com/2023/03/002b.html import bpy import math zion_co...