Sort elements in flow order

you can tell me if it is possible to organize based on the flow order, in this link: https: //forum.dynamobim.com/t/reading-direction-property-of-connectors-on-ducts-pipes/8424/3

the link routine follows the direction above, I would like to know if using it mine could be organize