Day 2
(1)
Z方向に並ぶルーバー
#array#rotate#box#louver#transform

✅ Inputs
count : int型 複製するルーバーの数(例:10)
spacing : float型 Z方向の間隔(例:3.0)
width : float型 ルーバーの幅(Xサイズ)(例:5.0)
height : float型 ルーバーの高さ(Yサイズ)(例:1.0)
depth : float型 ルーバーの厚み(Zサイズ)(例:0.3)
angle : float型 各ルーバーの回転角(度)(例:15.0)
✅ Outputs
results : List[Box] 回転・複製されたルーバー(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)
angle_rad = math.radians(angle)
for i in range(count):
z = i * (height + spacing)
center = rg.Point3d(0, 0, z)
plane = rg.Plane(center, rg.Vector3d.XAxis, rg.Vector3d.YAxis)
plane.Rotate(angle_rad, plane.XAxis, center)
box = rg.Box(plane, interval_x, interval_y, interval_z)
boxes.append(box)
results = boxes