Comparing Parameter Values between different Files

We are trying to compare two Revit files. The first file is a an old survey model in which some elements were set to be demolished in the Construction Phase. Some elements were also split. The second file is a newer version of the above file and we would like to transfer the “Phase Demolished” value to the same elements (ID) (though not direct, but as a note into a custom parameter). At the same time we thought to run a comparison between the Bounding Box of each of these elements in the old file vs. the new file. If a Bounding Box has changed we would like to write a comment into yet another custom parameter.

We have managed to extract Element ID, Phase Demolished and Bounding Box into an Excel table and read that data in a new Dynamo Script. This new Script is also finding the same values for all elements in the new file.

We are now struggling to compare the two sets of lists. I have tried “List.SetDifference” with “List.IndexOf”, but it doesn’t work as I expected.
The plan was to retain only those elements from the current model file that are also in the list of elements from the excel file.

I would like to know if what I am trying is actually the right approach, or if there is a better one. Once I get past this hurdle, my next challenges would be the following steps. Maybe you have some tips there as well.

The next step would have been to write the value from the excel file for each matching Element ID from the “Demolished” list into the custom parameter “Transfer - Phase”.

After comparing the strings from each elements Bounding Box I would have liked a True/Fase value in the custom parameter “Transfer - Bounding Box Check” for whether the strings are identical or not.

I have attached the files used.
data.xlsx (139.3 KB)
Tools - Write Demolition Status for Forum.dyn (76.6 KB)
Tools - Extract Demolition Status for Forum.dyn (50.2 KB)

Thanks a lot in advance.

The element ids from Excel are being interpreted as doubles whereas the ids from the model are integers.

image

You can use a node like Math.Floor to convert the doubles to integers. Once you have both lists of integers, you can use a List.SetIntersection to only return ids present in both lists.

You can take this a step further to then use the resulting element ids to get the actual elements (in the example below I am just using a string as a placeholder for actual elements):


Tools - Write Demolition Status for Forum.dyn (45.3 KB)

2 Likes

@cgartland hanks a lot for the quick and detailed help. That did the trick (rounding down to convert from numbers to integers). Script is working now. Much appreciated.