Dividing a Circle

Hi, I am trying to adapt this script so that it will run in GH. I am having trouble defining the output for the small circles and also not sure how to define the variable input B so that I can divide radius by any number rather than 2.
I include the script that works well, directly from python and the script I have used in GH.

So far I have only had success with output “a” showing up in Rhino from GH

circlesoncircles.py (929 Bytes)
circlesaroundcircle.gh (6.6 KB)

Any help would be much appreciated

rhinoscriptsyntax is meant to be used in Rhino. In Grasshopper, you should use the API, also called RhinoCommon.

Here’s an example:

import Rhino.Geometry as rg
import math

if __name__ == "__main__":
    circle = rg.Circle(center, radius)
    curve = circle.ToNurbsCurve()
    params = curve.DivideByCount(division, True)
    
    circles = []
    for t in params:
        pt = curve.PointAt(t)
        circles.append(rg.Circle(pt, (2 * math.pi * radius / division) * 0.5))
        
    a = circles

Thank you for the advice…