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 16

レンガを積み上げる

#pattern#grid#transform#structure
レンガを積み上げる

✅ Inputs

- brick_w: float – レンガの幅(X方向)
- brick_h: float – レンガの高さ(Z方向)
- brick_d: float – レンガの奥行き(Y方向)
- num_x: int – X方向のレンガ数
- num_z: int – Z方向の段数
- gap_x: float – レンガ間のX方向隙間(横の目地)
- gap_z: float – レンガ間のZ方向隙間(縦の目地)

✅ Outputs

- results: list of Box – レンガブロックの集合体

✅ Code

import Rhino.Geometry as rg

# === 🔧 パラメータ例 ===
# brick_w = 200.0    # レンガの幅(X方向)
# brick_h = 60.0     # レンガの高さ(Z方向)
# brick_d = 100.0    # レンガの奥行き(Y方向)

# num_x = 20         # X方向のレンガ数
# num_z = 40         # Z方向の段数

# gap_x = 4.0        # レンガ間のX方向隙間(横の目地)
# gap_z = 4.0        # レンガ間のZ方向隙間(縦の目地)

# === 🧱 レンガ配置処理 ===
results = []

for z in range(num_z):
    z_pos = z * (brick_h + gap_z)
    is_odd = z % 2 == 1
    x_offset = - (brick_w + gap_x) / 2 if is_odd else 0

    for x in range(num_x):
        x_pos = x * (brick_w + gap_x) + x_offset
        base_pt = rg.Point3d(x_pos, 0, z_pos)

        box = rg.Box(
            rg.Plane(base_pt, rg.Vector3d.XAxis, rg.Vector3d.YAxis),
            rg.Interval(0, brick_w),
            rg.Interval(0, brick_d),
            rg.Interval(0, brick_h)
        )

        results.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.
Day Day 16 - レンガを積み上げる | Grasshopper Python 入門チュートリアル | STUDIO TAMA