Element Geometry Order

Hi All,

I’m trying to figure what happend here:

I selected my 4 story elevation (4 walls - each one in a different story), and when I use the “Element.Geometry” node to explode it after, I realized that the order of the solid elements is:

  • First element of the list - Story 1
  • Second element of the list - Story 3
  • Third element of the list - Story 2
  • Fourth element of the list - Story 4

What am I doing wrong? I want them in bottom-top order.

The elements where created in that order.

Notice the element IDs are listed sequentially in your first node. This is native to revit and Dynamo as you’re really working with a database - the first thing added to the database is first in the list, the second item added is second, the third is third, etc… So despite your best efforts somehow they are not actually created by Story 1, Story 2, Story 3, Story 4, but instead were made Story 1, Story 3, Story 2, Story 4. This often a function of paste aligned to selected levels, which I have a vague recollection from 7 or 8 years back that this creates elements on the selected levels in the order the level was created rather than sequentially based on the level’s elevation.

If you want to work with them in the order of their base elevation, no need to redraw or rework things. You just have to use a List.SortByKey node, but it’s not very straight forward. First you have to get the “Base Constraint” of the walls using an Element.GetParamterValueByName node, this will feed you level elements which aren’t sortable (even if they were you’d just sort by the level’s element IDs in the order they were created, which may have put you where you are to begin with so that’s no good). Then you need to get the “Elevation” of the levels using another Element.GetParamterValueByName node. Finally you can wire the original list of walls into the list section of the List.SortByKey node using the results of the level’s “Elevation” as your key.

That all said (in the hopes to help others learn) this graph should work for you:

You could build the dynamo geometry and sort by minimum z values as an alternative, but i prefer geometry creation as far along the graph as possible as I have experienced better run times that way, likely because it’s easier to look up an known value than to calculate one from scratch.

3 Likes

Thanks @jacob.small. In addition to solving the problem, your explanation is quite illustrative. I really appreciated.

Best Regards.