How to change properties of family type that do not match specified list of type names?

Hello everyone,

I am looking to select certain family types IF they do not match on of the names found in an excel sheet I have attached to Dynamo. Once they are found, I want to then change their name and other properties.

So far I have got Dynamo to find family types whose names do not match the names in the excel sheet. The part that I am having an issue with is selecting the elements in the Revit model. Currently, I have only been able to find the names (in a list) of the incorrect families, but I cant find a way to use those names to address the actual elements in the model.

I will attach a screenshot of the script that I have currently. Please let me know if you have an idea of how to do this, or any questions.


Use List.Contains or == to compare the names and then filter the elements.

By my understanding, “List.Contains” is the same (but opposite) of “List.SetDifference”. However, SetDifference gives me the right families as a result.

The only issue I need to solve is how to convert the Family Names (i.e. Text Note 1, Schedule Default) to the family codes (i.e. TextNote 2515, TextNote 2517), which will let me select them and change their parameters.


I think I figured it out. I put the Family Names and Codes into a dictionary so they are related to each other. That way, I can look up the codes afterwards for JUST the types I want to select. Let me know if anyone wants a screenshot.

You figured out why SetDifference doesn’t work on it’s own. It automates the filtering for you, which is why you have to set a dictionary to tie the elements back to their names. The purpose of List.Contains and == is that they return a boolean list that you can apply as a filter directly to the elements.

1 Like

I see. So that might actually reduce the amount of steps by a bit. Good to know. Thanks for the help!

1 Like