Sort selected elements by coordinate

I use the script to get the selected cable tray element in revit. But the problems in the prank. Now he’s all Id sequentially, how can they be sorted, for example, left to right?

Hi Ivan,

you could try this

  1. select your elements
  2. get their location in terms of xyz coordinates.
  3. get pointX or pointY depending on how you wish to sort your elements.

now you can use one of the nodes below to sort the values of your points, then use the List.SortByKey node to sort the order you elements.

Hope this helps

1 Like

Hi Renzoj,

I think this will not help.
The task proved to be more complicated.
It is required to sort the lines sequentially from the beginning of the chain to the end or from the end to the beginning.

Thank you for your time.

Are you able to extract the duct and joiners curves? Try the Shortest Path By Curve node from the Sastrugi package. Once it finds the paths through the system you can pick the route that goes through where you are needing, and get the Polycurve.Curves from there.

Curves by duct - no problem. But start point and end point can not be found, since they will be found after sorting. If understand this block correctly.

Use the Pick Points on Workplane node to select the start and end points directly in Revit. Have a look at the package website for an example.