Compare with Excel, meet 3 conditions and return data to Revit

Hello all,

We’ve been trying to write a graph in which we want to compare the ducts in our Revit model with an Excel list.
When the dimensions of the ducts in the model meet the conditions in the Excel list a keynote has to be returned to the comments field of the specified duct in Revit.

The graph consists of 2 parts;

  • rectangular ducts (a numbering in the group titles, or the upper part of the graph)
  • round ducts (b numbering in the group titles or the bottom part of the graph

The round ducts work fine, here only 2 criteria have to meet, system type and diameter.
The part where we struggle are the rectangular ducs where 3 criteria have to meet, system type, width and height.
Underneath the part where we think it goes wrong.

  • not the whole list gets compared, it stops at the first result?
    example width for line 2 and 3, at position 6 we have the first time the corresponding width in the excel list, but we have at more positions.

Added underneath, our excel file and a link to the Revit file.

VME_2024_Ducts_schedule.xlsx (22.9 KB)
Revit file → KEYNOTES_2_DUCTS_R2024

Graph with the used node titles visible added.

If someone can help us in the right direction that would be much appreciated!

Hi @Tim0, welcome :wave:

Thanks for updating with files and a clean screen shot with titles

Your task is fairly straight forward, however I would argue that Dynamo does not make it easy as there is going to be a lot of list level manipulation to achieve a result

Your excel data has a lot of duplicate keynotes and they align with height and width (or diameter) so you can effectively remove one layer of choice… except here where you may have to check for oval ducts (plastic or metal) - there isn’t enough information to resolve
image

Let’s group our ducts for processing

Updating round ducts (I would use OpenXML nodes as they are more stable)

It gets more complicated with width and height which requires some grouping

You can use nested dictionaries from python which can be simpler - please note that as some versions of Dynamo append six zeros to the end of a string integer I have adjusted for that

rect = IN[0]

rect_dict = {}
for duct in rect:
    if "metaal" in duct[4]:
        (
            rect_dict.setdefault("{:.6f}".format(duct[1]), {})
            .setdefault("{:.6f}".format(duct[2]), duct[3])
        )
    
OUT = rect_dict
1 Like

Hi @Mike.Buttery,

Thanks for the welcome and going gentle on my first post :wink:

I honestly don’t think we would’ve come to this solution any time soon, so thanks a lot!
This is much appreciated.