Count segment point
On 09/05/2017 at 01:03, xxxxxxxx wrote:
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() :
#Lock base points
for i in range(1,pointCount) :
On 09/05/2017 at 01:57, xxxxxxxx wrote:
Here is a way counting through the segments of the spline.
Result is a array with first and last point of a segment per row.
seg_list =  pnt_cnt = 0 seg_cnt = spline.GetSegmentCount() for i in range(0, seg_cnt) : segment = spline.GetSegment(i) seg_list.append([pnt_cnt+i, segment["cnt"]-1+pnt_cnt+i]) pnt_cnt += segment["cnt"]-1 for row in seg_list: print str(row) + " - " + str (row)
On 13/05/2017 at 05:15, xxxxxxxx wrote:
Thank you for your help, it works perfect!