It looks to me that in order to get through a path’s segments, i need to add 2 to the 0.x time. Sometimes counting from 2 in whole steps actually brings me to the correct segments. e.g. path.pointAtPathTime_(2.5) is the half of my first segment when it has handles. when it doesn’t have handles, its middle is at t = 0.5

Is there a way to determine pointAtPathTime with the same fractional value between 0 and 1 on every path segment, no matter if it is a line [ len(segment) == 2 ] or a curve?

Currently I am trying add 2 to the fractional value plus the index of the segment. But I get strange results. I kinda don’t see what’s happening here.

If the first segment is a line, the node at the end of this segment has the index (and therefore the integer part) 0.
If the first segment is a line, the second segment is a curve, the node at the end of the second segment has the index (and therefore the integer part) 3 and third segment has the 4. And so on.

I think I understand how it works now and can make function to properly iterate over the segments. Thank you.

This is what I came up with:

t = 0.25
for path in layer.paths:
nodeCOunter = -1
for segment in path.segments:
if len(segment) == 2: # is a line
nodeCOunter += 1
if len(segment) == 4: # is a curve
nodeCOunter += 3
# or instead the last 4 lines: `nodeCOunter += len(segment) - 1`
division = path.pointAtPathTime_(nodeCOunter + t)

Don’t iterate the segments! The data model is build around the node list. The segments have to be generated (and then they are never used).

Iterate the nodes.

t = 0.25
for path in layer.paths:
nodeCOunter = 0
for node in path.nodes:
if node.type != OFFCURVE:
division = path.pointAtPathTime_(nodeCOunter + t)
nodeCOunter += 1

The whole thing I am working on is more complex than the snippet I posted here. I need the length for an apparent equal division of the segments. The longer it is, the more divisions I want. What is the problem with using segments?