here’s a better way in python (better than the first way i did it at least):
import rhinoscriptsyntax as rs
crv = rs.GetObject()
amp = 6
amt = 11
cpt = (rs.CurveAreaCentroid(crv))[0]
def RecursivePolygon(crv, amp, amt):
if amt > 0:
pt1 = rs.CurveStartPoint(crv)
pt2 = rs.EvaluateCurve(crv,amp)
crv = rs.OrientObject(crv,[cpt,pt1],[cpt,pt2],1|2)
amt = amt - 1
RecursivePolygon(crv, amp, amt)
RecursivePolygon(crv, amp, amt)
in Grasshopper, i do it like this:
RecursivePolygon.gh (7.8 KB)
import rhinoscriptsyntax as rs
cpt = (rs.CurveAreaCentroid(crv))[0]
count = 1
def RecursivePolygon(crv, amp, amt, count):
if amt > 0:
pt1 = rs.CurveStartPoint(crv)
pt2 = rs.EvaluateCurve(crv,amp)
crv = rs.OrientObject(crv,[cpt,pt1],[cpt,pt2],2)
ang = (rs.Angle2((cpt, pt1), (cpt,pt2)))[0]
radius = rs.Distance(cpt,pt2)
angle = ang * count
amt = amt - 1
count = count + 1
print radius
print angle
RecursivePolygon(crv, amp, amt, count)
RecursivePolygon(crv, amp, amt, count)
it’s basically the same thing i did in Rhino Python except it outputs the rotation angles and radius’ numbers which are then plugged into grasshopper components… or, the additional polygons are being created by Grasshopper components instead of within the python script.
i don’t know how to make python create Grasshopper geometry… i’m on Mac and i don’t think all the necessary elements are in place to do that… (?)… so i just use GHPython to generate the numbers.