```
import Rhino
import Rhino.Geometry as rg
import scriptcontext as sc
import rhinoscriptsyntax as rs
import math
import random
sc.doc = Rhino.RhinoDoc.ActiveDoc
crv = rs.GetObject("sel crv",rs.filter.curve,True)
rs.EnableObjectGrips(crv)
cps = rs.GetObjectGrips("sel control point")
cpps = rs.coercegeometry(crv).Points
def linspace(start,end,count):
step = (end - start) / (count - 1)
numbers = [start + i * step for i in range(count)]
return numbers
l = len(cps)
r = range(l)
z = []
for i in r:
z.append(cps[i][2].Z)
nz = linspace(min(z),max(z),l)
for i in r:
index = cps[i][1]
cpps.SetPoint(index,rg.Point3d(cps[i][2].X,cps[i][2].Y,nz[i]),cpps[index].Weight)
```

I’m trying to write a small tool for uniformizing control points on the Z axis,

So I wrote a piece of code and it didn’t go wrong but it didn’t work either.

So I don’t know how to correct itself.

Please help me.