Sorting elements by coordinates alligned to a diagonal line

Hello all,

I have created a workflow that allows me to sort and number all selected structural foundations based on their x and y point.

This works great for buildings without diagonal floors in a floor plan, see the screenshot below as clarification…

The structural foundations in the top part of this building will be numbered incorrectly since my workflow just sorts the elements based on their X and Y point.

Would it be possible to draw a line paralel to these foundations and sort them accordingly?

Since English isnt my first language i am having trouble explaining what is going on, to clarify see below what happens if i run the workflow:
In green the desired numbering and in red the numbering how dynamo numbers the foundations at the moment.


A list reverse wouldnt work here because the next row of columns need to be renamed accordingly.

In short: I want to sort elements not by revit coordinates from base point but from an line allignment…
I hope this is clear enough…

My workflow:

kolom nummering volgens stramien window selectie_2020-10-08_11-25-59

Looks like you already have your grids, why not try something like this:

  • Select a grid order to number by (longitudinal or transverse)
  • Sort the grids grids by their mark.
  • Get the location curve of the grids, make sure they move in the same direction (tangent vectors all with a positive X Y values or all with a negative X Y values ) and reverse any grids that don’t follow the pattern.
  • Pull the same direction grid curves onto a plane.
  • Get the location of the foundations and pull that onto the same plane as your grids.
  • For each location point, find the nearest grid curve (minimum item by key will help here)
  • Group the foundation elements by their nearest grid curve
  • Pull the location point from the grouped foundations
  • Find the point closest to the associated grid curve for each grouped foundation point
  • For each foundation point on the grid curve get the associated parameter on the grid curve.
  • Sort the grouped foundations by these values.
  • Flatten the list of foundations and start numbering.

Thank you for your very detailed answer!
I am going to try this out over the weekend, and will report back later!

1 Like