Hi,

I want to use this code to generate some circles along a sin curve and when I complete the code and click on ‘Test’ or ‘Ok’ in ghpython component, everything works just fine, but when I want to refresh the algorithm by pressing ‘F5’ button or change the number sliders, the first circle’s radius starts to change abnormally and I guess it’s having a conflict with globals but I don’t know how to fix it.

```
from math import sin , pi
import Rhino.Geometry as rg
import ghpythonlib.components as gh
a = []
for i in range(x):
j = t * sin(y*i*pi/x)
a.append(rg.Point3d( i , j , 0))
b = cylinders = []
c = rads =[]
for i in range(len(a)):
if 'radius' not in globals() or reset:
radius = 0.65
else :
radius = gh.Distance(a[i], a[i-1]) / 2
circle = rg.Circle(a[i] , radius)
cylinders.append(rg.Cylinder(circle , radius*h))
rads.append(radius)
```

how can I stop this from happening? I want every circle’s radius to calculate from the distance of origin point with that of the previous circle and exit the loop when it gets to the last point, but in my algorithm, the last radius calculation gets wrong and I guess it calculates the distance between the last and first point somehow!