Function to align handles

Hello, I am wondering whether this is some function to align offcurve nodes based on the smooth nodes preceding them, like in this example:

Currently, I need to manually move the node by a unit for it to snap to its intended angle.

I usually hit the enter twice to toggle smooth curve off&on then it aligns

Run GSNode.toggleConnection() twice realign the handle

Is there no other method? Apart from running GSNode.toggleConnection() twice for all smooth nodes? It works, thanks, but it’s not exactly the most elegant way.

Just had another look. ToggleConnection calls node.makeSmooth().

Ah, thanks!

Look at the Align BCPs script. It takes care of some edge cases and prefers orthogonality.