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 10

ジグザグ折りを並べて立体化 – 折り紙構造

#zigzag#origami#pattern#surface
ジグザグ折りを並べて立体化 – 折り紙構造

✅ Inputs

- `segment_length`: float – ジグザグ1区間の長さ
- `segment_count`: int – ジグザグの折れ数(1列あたり)
- `row_count`: int – ジグザグ列の数(X方向の繰り返し数)
- `angle`: float – ジグザグの折れ角度(度数)
- `x_spacing`: float – 各列のX方向の間隔
- `z_drop`: float – 交互にZ方向へ下げる量(立体感の調整)

✅ Outputs

- `results`: list of `Brep` – 折り構造を構成する四角形のサーフェイス群

✅ Code

import Rhino.Geometry as rg
import math

results = []

zigzag_base = []
pt = rg.Point3d(0, 0, 0)
dir_angle = math.radians(angle)
direction = 1

for i in range(segment_count + 1):
    zigzag_base.append(pt)
    angle = direction * dir_angle
    dx = math.sin(angle) * segment_length
    dy = math.cos(angle) * segment_length
    pt = rg.Point3d(pt.X + dx, pt.Y + dy, 0)
    direction *= -1

zigzag_rows = []
for j in range(row_count):
    dx = j * x_spacing
    dz = -z_drop if j % 2 == 1 else 0

    row = [rg.Point3d(p.X + dx, p.Y, p.Z + dz) for p in zigzag_base]
    zigzag_rows.append(row)

for j in range(row_count - 1):
    row_a = zigzag_rows[j]
    row_b = zigzag_rows[j + 1]

    for i in range(segment_count):
        p0 = row_a[i]
        p1 = row_a[i + 1]
        p2 = row_b[i + 1]
        p3 = row_b[i]

        face = rg.Brep.CreateFromCornerPoints(p0, p1, p2, p3, 0.001)
        results.append(face)
← 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 10 - ジグザグ折りを並べて立体化 – 折り紙構造 | Grasshopper Python 入門チュートリアル | STUDIO TAMA