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 5

螺旋状に球体を積層する

#curve#sphere#wave
螺旋状に球体を積層する

✅ Inputs

- `turns`: int – 螺旋の回転数(例:5)
- `count`: int – 球体の数
- `radius`: float – 螺旋の半径
- `height`: float – 全体の高さ
- `sphere_radius`: float – 各球体の半径

✅ Outputs

- `results`: list of `Sphere` – 螺旋上に配置された球体群

✅ Code

import Rhino.Geometry as rg
import math

angle_total = turns * 2 * math.pi
angle_step = angle_total / (count - 1)
z_step = height / (count - 1)

spheres = []

for i in range(count):
    angle = i * angle_step
    z = i * z_step
    x = math.cos(angle) * radius
    y = math.sin(angle) * radius

    center = rg.Point3d(x, y, z)
    spheres.append(rg.Sphere(center, sphere_radius))

results = spheres
← 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.