Forgot password?

Create an account!

Forum

« back

RhinoScript – recursive function

Messages

Please log in to write a message.

  • 1. maxkeil (Nov 28, 2014 18.19):

    hey guys!
    I've been working with grashopper for quite some time and since I came to some limitations concerning recursive loops i want to dig into python and scripting.
    what i want to do is wirte a function that draws a circle and divides the circle.
    then i want to redo the function for every division point but reducing the new radius by 1 and the divisions also by 1...i want to redo this function just as long as my divisions are higher than 0.
    the script i managed to write so far looks like this:

    ________________________________________________
    import rhinoscriptsyntax as rs



    def recursion(pt,r,div):
    if div > 0:
    circle = rs.AddCircle(pt,r)
    division = rs.DivideCurve(circle,div,True,True)
    for d in division:
    return recursion(d,r-1,div-1)


    recursion([0,0,0],10,5)

    __________________________________________


    but somehow my function isn't applied to every divison point...do you know what to change or how to rewrite the function?

    thanks in advance

Recommend

Why are these buttons gray?