Setting knots on a NURBS curve

Hi,

I’m messing around with mopaths and access the NURBS curve with:

 mopath.xyzNurbsCurve

I’m trying to implement a system for cars driving a defined path. When I’m using blender to export the curves I get problems with the linearity of the movement, I simply want the cars to drive at constant speed. I figure this has something to do with the knots of the curve.

I could recalculate the knots myself and set them on the curve using:

num_knots = mopath.xyzNurbsCurve.getNumKnots()
        
for i in range(num_knots):
    print mopath.xyzNurbsCurve.set_knot(i, i / (num_knots - 1.0))

However I run into the problem that the knots are not set because the condition to the set them is that they are higher or equal than the previous and lower or equal than the next. Does anybody have a solution for this? Or just a better idea to implement such a system.

Thanks!

PS: I know about multiplicity which is not implemented in the example, for now I’m just messing around to understand the behaviour.