@lelesong.gothenburg wrote:
Hello Everyone,
I am a python beginner and I am having hard time to make recursion working. I want to create rectangle fractal which will multiply itself as it goes smaller and smaller.
but for some reason it does not want to multiply itself. Can anybody give me an advise? Here is the code. Thank you for the help.
import rhinoscriptsyntax as rs
import math
import Rhino as rFractal1 =
pts =
Fractals =def Fractal_split(rec,repetition,p):
explodedCurves = rs.ExplodeCurves(rec,False) for curve in explodedCurves: parameter = rs.CurveParameter(curve,p) point_on_curve = rs.EvaluateCurve(curve, parameter) pts.append(point_on_curve) A = pts[0] B = pts[1] C = pts[2] D = pts[3] Fractal1 = rs.AddPolyline([A,B,C,D,A]) if (repetition > 0): repetition -= 1 Fractal_split(Fractal1,repetition,p) else: Fractals.append(Fractal1)
Fractal_split(rec,repetition,p)
Posts: 2
Participants: 2