円周 植栽
テクスチャー作成では、配布サイト
https://styly.cc/ja/tips/blender-modeling-start4/#
Blender2.9 平面オブジェクトに画像テクスチャを貼り付ける方法
# コレクションを作る 重複の場合 作らない
import bpy
# List of collection names
collection_names = [
"土台",
"単位円 torus",
"単位円 torus",
"単位円 torus",
"単位円 torus",
"xyz 軸 円柱"
]
# 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)
blender python
xy平面に 半径1、半径2の円を作る
名前 "円板 dodai”
円中心 000
xy平面に 1辺2、1辺4の正方形を作る
名前 "正方形 dodai”
円中心 000
写真を貼れるように
メッシュと マテリアル設定して
import bpy
import math
# Function to create a circle
def create_circle(name, radius, center):
bpy.ops.mesh.primitive_circle_add(radius=radius, location=center)
obj = bpy.context.active_object
obj.name = name
return obj
# Function to create a square
def create_square(name, side_length, center):
vertices = [(-side_length/2, -side_length/2, 0),
(side_length/2, -side_length/2, 0),
(side_length/2, side_length/2, 0),
(-side_length/2, side_length/2, 0)]
edges = [(0, 1), (1, 2), (2, 3), (3, 0)]
faces = [(0, 1, 2, 3)]
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(name, mesh)
bpy.context.collection.objects.link(obj)
mesh.from_pydata(vertices, edges, faces)
mesh.update()
obj.location = center
return obj
# Clear existing objects (optional)
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
# Create circles
radius1 = 1
radius2 = 2
center = (0, 0, 0)
circle1 = create_circle("円板 dodai 1", radius1, center)
circle2 = create_circle("円板 dodai 2", radius2, center)
# Create squares
side_length1 = 2
side_length2 = 4
square1 = create_square("正方形 dodai 1", side_length1, center)
square2 = create_square("正方形 dodai 2", side_length2, center)
# Add material with image texture to the objects
def add_image_texture(obj, image_path):
mat = bpy.data.materials.new(name="Image Material")
obj.data.materials.append(mat)
mat.use_nodes = True
nodes = mat.node_tree.nodes
principled_bsdf = nodes.get("Principled BSDF")
texture_node = nodes.new(type='ShaderNodeTexImage')
texture = bpy.data.images.load(image_path)
texture_node.image = texture
mat.node_tree.links.new(texture_node.outputs["Color"], principled_bsdf.inputs["Base Color"])
# Replace "image_path" with the actual path to your image file.
image_path = "path/to/your/image.png"
add_image_texture(circle1, image_path)
add_image_texture(circle2, image_path)
add_image_texture(square1, image_path)
add_image_texture(square2, "C:\\aaa 2023 dondon\\aaa2023いつもの\\blende_gazou\\test 貼り付け 2023\\20230801 渋谷_HIT_Lemon 2.png")
基本系 配布 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