Insert node on curve

Hi there,

To asure compatibility across masters I need to add an extra node to curves in some masters, one point away from another node.

I’ve tried the insertNodeWithPathTime_ method, but for that I need to know the exact pathtime.

Is there a way to achieve this?

you can use

(nearestPoint, pathTime) = path.nearestPointOnPath_pathTime_(point, None)

But I would just add another point with he same coordinates as the curve point.

curveNode = Layer.selection[0]
index = curveNode.index
newNode = GSNode(curveNode.position)
curveNode.parent.nodes.insert(index + 1, newNode)

Thanks a lot @GeorgSeifert!

I did think about using the second solution. Are there no rendering issues, with 2 nodes in the same coordinates?

Probably not. But if you are like to be sure, move the point by one unit. I would not change the off-curve nodes.

Thanks a lot for the help. Really appreciate it!