Curve Edit > Sort Sections

Sorts section lines into layers based on their axis orientation.