This video demonstrates how to create a sorted line using the OpenRail Modeling > Regression > Sort Horizontal Points tool found here:
https://youtu.be/IL7jAtWmz3Y