*On 09/05/2017 at 01:03, xxxxxxxx wrote:*

Hello,

I am working on a python script which constrains the points of a spline. (fixed position for the first and last point, position limit for the other points). I have it working when I have a single spline.

Now my issue is when I add another spline in the same spline object, my last point is no more the last ID point but the last point of the segment starting with the point ID 0.

So what I need is to get the point ID of the last point of the segment starting with the point ID 0.

What I would need then is to get the number of points of my first segment. Can anyone help me with that? (I search the documentation but couldn't find it...)

Here is my code so far (working with a single segment spline but not working with a multi segement spline object) which stands on a python tag of the spline object:

def main() :

obj=op.GetObject()

pointCount=obj.GetPointCount()-1

#Lock base points

obj.SetPoint(0, c4d.Vector(-.5,0,-.5))

obj.SetPoint(pointCount, c4d.Vector(.5,0,-.5))

#Points constraints

for i in range(1,pointCount) :

point=obj.GetPoint(i)

if point.x<-.5:

pointX=-.5

elif point.x>.5:

pointX=.5

else:

pointX=point.x

if point.z<-.5:

pointZ=-.5

elif point.z>.5:

pointZ=.5

else:

pointZ=point.z

obj.SetPoint(i, c4d.Vector(pointX,0,pointZ))

Many thanks,

H.