This video demonstrates how to create a sorted line using the OpenRail Modeling > Regression > Sort Horizontal Points tool found here: