Day 3
(1.5)

Z方向に並ぶSin変位ルーバー

#array#sin#wave#louver#box
Z方向に並ぶSin変位ルーバーのサムネイル

✅ Inputs

count      : int型     複製数(例:20)
spacing    : float型   Z方向の間隔(例:2.0)
width      : float型   Boxの幅(Xサイズ)(例:5.0)
height     : float型   Boxの高さ(Yサイズ)(例:1.0)
depth      : float型   Boxの厚み(Zサイズ)(例:0.3)
amplitude  : float型   Sin波の振幅(例:2.0)
frequency  : float型   Sin波の周波数(例:0.3)

✅ Outputs

results    : List[Box] Z方向に波打つように配置されたルーバーBoxのリスト
import Rhino.Geometry as rg
import math

boxes = []

hx = width / 2.0
hy = height / 2.0
hz = depth / 2.0

interval_x = rg.Interval(-hx, hx)
interval_y = rg.Interval(-hy, hy)
interval_z = rg.Interval(-hz, hz)

for i in range(count):
    z = i * (height + spacing)

    y_offset = math.sin(z * frequency) * amplitude
    center = rg.Point3d(0, y_offset, z)

    plane = rg.Plane(center, rg.Vector3d.XAxis, rg.Vector3d.YAxis)
    box = rg.Box(plane, interval_x, interval_y, interval_z)
    boxes.append(box)

results = boxes