Home
GH Sample Files
GH Python Tutorials
Rhino Assets
Books
Blog
Plugins
About
Privacy Policy
Terms of Service
Contact
© 2025 STUDIO TAMA

- brick_w: float – レンガの幅(X 方向)
- brick_h: float – レンガの高さ(Z 方向)
- brick_d: float – レンガの奥行き(Y 方向)
- gap_x: float – レンガ間の X 方向隙間(横の目地)
- gap_z: float – レンガ間の Z 方向隙間(縦の目地)
- num_z: int – Z 方向の段数
- amplitude: float – Sin 波の振幅(Y 方向の高さ)
- frequency: float – Sin 波の周波数(1/波長)
- length: float – Sin 波の X 方向長さ
- resolution: int – Sin 波を構成する点の数(滑らかさ)- results: list of Box – 曲線方向に整列し、積み上げられたレンガの集合体import Rhino.Geometry as rg
import math
# === 🔧 パラメータ例 ===
# brick_w = 200.0
# brick_h = 60.0
# brick_d = 100.0
# gap_x = 40.0 # 横方向の目地
# gap_z = 2.0 # 段ごとの縦目地
# num_z = 40 # 段数
# amplitude = 400.0
# frequency = 0.01
# length = 3000.0
# resolution = 3
# === 🌊 Sin波カーブを生成 ===
points = []
for i in range(resolution + 1):
t = float(i) / resolution
x = t * length
y = math.sin(x * frequency) * amplitude
pt = rg.Point3d(x, y, 0)
points.append(pt)
curve = rg.Curve.CreateInterpolatedCurve(points, 3)
# === 🧱 曲線に沿って段ごとにレンガを配置 ===
spacing = brick_w + gap_x
params = curve.DivideByLength(spacing, True)
results = []
for z in range(num_z):
z_shift = z * (brick_h + gap_z)
is_odd = z % 2 == 1
for p in params:
pt = curve.PointAt(p)
tangent = curve.TangentAt(p)
tangent.Unitize()
# 基本軸定義
xaxis = tangent
zaxis = rg.Vector3d(0, 0, 1)
yaxis = rg.Vector3d.CrossProduct(zaxis, xaxis)
yaxis.Unitize()
plane = rg.Plane(pt, xaxis, yaxis)
# 奇数段だけ X軸方向にオフセット(半レンガ分)
if is_odd:
shift_vec = rg.Vector3d(xaxis)
shift_vec *= (brick_w + gap_x) / 2
plane.Origin += shift_vec
# Z方向に持ち上げる
plane.Origin += rg.Vector3d(0, 0, z_shift)
# レンガ生成
box = rg.Box(
plane,
rg.Interval(-brick_w/2, brick_w/2),
rg.Interval(-brick_d/2, brick_d/2),
rg.Interval(0, brick_h)
)
results.append(box)License & Terms of Use
| Item | Allowed | Description |
|---|---|---|
| Integration into your projects | ○ | You are free to use the code as part of your scripts or works, whether for personal or commercial purposes. |
| Code modification & learning use | ○ | Customizing the code for your own learning or specific purposes is very welcome. |
| Sharing on SNS / showcasing | ○ | No 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 / link | Optional | Not required, but including a link to the source would be greatly appreciated. |