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

- tile_size: float – タイルの一辺のサイズ(正方形)
- height: float – 押し出す高さ
- rows: int – タイルの行数(縦方向)
- cols: int – タイルの列数(横方向)- results: list of Brep – 押し出された三角タイルの立体ブロック群(全体パターン)import Rhino.Geometry as rg
import random
import math
results = []
def create_triangle_tile(base_x, base_y, rotation_deg):
# タイルの四隅を定義
pt0 = rg.Point3d(0, 0, 0)
pt1 = rg.Point3d(tile_size, 0, 0)
pt2 = rg.Point3d(tile_size, tile_size, 0)
pt3 = rg.Point3d(0, tile_size, 0)
# 対角で分けた三角形2種
triangle_A = [pt0, pt2, pt3]
triangle_B = [pt0, pt1, pt2]
verts = random.choice([triangle_A, triangle_B])
# 三角形Polyline → Curve化
polyline = rg.Polyline(verts + [verts[0]]) # 閉じる
curve = polyline.ToNurbsCurve()
# Extrusion作成(cap付き)
solid = rg.Extrusion.Create(curve, height, True)
# 平行移動&回転
center = rg.Point3d(base_x + tile_size / 2, base_y + tile_size / 2, 0)
move = rg.Transform.Translation(base_x, base_y, 0)
rotate = rg.Transform.Rotation(math.radians(rotation_deg), center)
solid.Transform(move)
solid.Transform(rotate)
results.append(solid)
# グリッド配置
for row in range(rows):
for col in range(cols):
x = col * tile_size
y = row * tile_size
rotation = random.choice([0, 90])
create_triangle_tile(x, y, rotation)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. |