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 11

中心から放射する折り紙 – 交互に浮き沈みする風車構造

#curve#polar#3d#origami#windmill
中心から放射する折り紙 – 交互に浮き沈みする風車構造

✅ Inputs

- `square_size`: float – 放射構造が収まる正方形のサイズ(中心を原点とする)
- `arc_angle_deg`: float – 各アークの曲げ角度(deg)
- `arc_count`: int – 放射状に配置するアークの数(奇数推奨)
- `z_offset`: float – 交互に Z 方向へ持ち上げる高さ(立体感の調整)

✅ Outputs

- `results`: list of `Brep` – Loft でつながれたアーク面群

✅ Code

import Rhino.Geometry as rg
import math

results = []

# 中心
center = rg.Point3d(0, 0, 0)

# 正方形(XY平面、中心原点)
half = square_size / 2
square_corners = [
    rg.Point3d(-half, -half, 0),
    rg.Point3d(half, -half, 0),
    rg.Point3d(half, half, 0),
    rg.Point3d(-half, half, 0),
    rg.Point3d(-half, -half, 0)
]
square_crv = rg.Polyline(square_corners).ToNurbsCurve()

# Arcを構築
arcs = []
for i in range(arc_count):
    angle_rad = i * (2 * math.pi / arc_count)
    dir_vec = rg.Vector3d(math.cos(angle_rad), math.sin(angle_rad), 0)
    ray_crv = rg.Line(center, dir_vec * 1000).ToNurbsCurve()

    intersections = rg.Intersect.Intersection.CurveCurve(ray_crv, square_crv, 0.001, 0.001)
    if intersections.Count == 0:
        continue

    end_pt = intersections[0].PointA
    tangent = rg.Vector3d(
        math.cos(angle_rad + math.radians(arc_angle_deg)),
        math.sin(angle_rad + math.radians(arc_angle_deg)),
        0
    )

    arc = rg.Arc(center, tangent, end_pt)
    arcs.append(arc.ToNurbsCurve())

# Z方向交互オフセット
arcs_shifted = []
for i, arc in enumerate(arcs):
    copy = arc.DuplicateCurve()
    if i % 2 == 1:
        copy.Transform(rg.Transform.Translation(0, 0, z_offset))
    arcs_shifted.append(copy)


results = []
for i in range(len(arcs_shifted)):
    crv_a = arcs_shifted[i]
    crv_b = arcs_shifted[(i + 1) % len(arcs_shifted)]
    loft = rg.Brep.CreateFromLoft([crv_a, crv_b], rg.Point3d.Unset, rg.Point3d.Unset, rg.LoftType.Normal, False)
    if loft: results.append(loft[0])
← 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 11 - 中心から放射する折り紙 – 交互に浮き沈みする風車構造 | Grasshopper Python 入門チュートリアル | STUDIO TAMA