STUDIO TAMA

Rhinoceros & Grasshopper Utilities

Home

GH Sample Files

GH Python Tutorials

Rhino Assets

Books

Blog

Plugins

About

Privacy Policy

Terms of Service

Contact

© 2025 STUDIO TAMA

Day 1

XY方向に並ぶキューブ

#grid#box#transform
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)のリスト

✅ Code

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)
← Back to Grasshopper Python Tutorials

License & Terms of Use

ItemAllowedDescription
Integration into your projectsYou are free to use the code as part of your scripts or works, whether for personal or commercial purposes.
Code modification & learning useCustomizing the code for your own learning or specific purposes is very welcome.
Sharing on SNS / showcasingNo permission is required to share images or URLs of your works. Please feel free to showcase them!
Redistribution / republishing×Do not publish the code or files in their entirety as content on your own site or elsewhere.
Reselling as materials/programs×Do not sell the content of this site, either as-is or with only minor modifications, for a fee.
Copyright notice / linkOptionalNot required, but including a link to the source would be greatly appreciated.