Day 1
(0.5)

XY方向に並ぶキューブ

#array#grid#box#move
XY方向に並ぶキューブのサムネイル

Inputs

x_count    : int型    X方向の数(例:10)
y_count    : int型    Y方向の数(例:10)
spacing    : float型  配置の間隔(例:2.0)
size       : float型  各キューブの半サイズ(例:1.0)

Outputs

boxes    : List[Box] 生成されたキューブ(Box)のリスト
import Rhino.Geometry as rg

box_size = rg.Interval(-size, size)

boxes = []

for i in range(x_count):
    for j in range(y_count):
        base_pt = rg.Point3d(i * spacing, j * spacing, 0)
        plane = rg.Plane(base_pt, rg.Vector3d.XAxis, rg.Vector3d.YAxis)
        box = rg.Box(plane, box_size, box_size, box_size)
        boxes.append(box)