Changing Revit Family to another Revit Family, but keeping same type

Hello, I am still quite new to using Dynamo within Revit, and was exploring various options of how this process can be automated. I know that mapping can be set up in Robot, but this seems to be a very time-consuming process, so Dynamo seemed the better option.

The workflow is as follows:

  1. A model is created in Robot Structural Analysis, this is then transferred to Revit using the integrator.
  2. Dynamo script converts Analytical model to Physical model

Which all works fine, but I am now looking how to automate Step 3 of the process.

  1. Families are changed from those from Robot to Company Standard Revit families of the same Family Type.

I should note that these Families would need to be loaded into the model from a file directory, as we like to keep our Templates light.

Any thoughts on how this can be achieved? Thank you!

Welcome to the forum!

What have you tried so far? Assuming they’re both the same category, you should just be able to change the type without much effort.

Hi Nick,

Thanks for the reply, this is where I’ve got to so far (found some of your work on the forums I believe haha)

It’s working in concept. The script looks for a family in the project and maps it to a different family using an Excel spreadsheet. If the project doesn’t contain that family, then it returns a null value. The problem is that if the project doesn’t contain that family (and gives the null value) it won’t map any of the others families. I’ve tried to use ignore nulls and preserve the structure, but met with the a number of error messages (can’t convert non-convertible types, etc.)

I’d also like to expand it further to use one excel spreadsheet, that contains multiple Sheets with section databases - any thoughts? Thank you

Just filter out the nulls with something like FilterByBoolMask. You’ll have to do that for both lists (current type and new type) but that’s not an issue.

You can provide multiple sheet names, you’ll just want to flatten your data once you have everything so it’s easier to work with.

Thank you, I’ve removed the null values, but I want to retain the original value structure before the nulls are removed (as they are currently mapping to the wrong Type) - basically so that the rows from Excel still correspond to one another - how can this be achieved?

You need to filter both lists. That’s why I suggested FilterByBoolMask. Then you can apply the same filter to both lists and maintain the same structure.

Sorry, but do you have an example? I’m still quite new to all of this, thanks

I highly recommend you work through the Dynamo Primer to get some experience with the basics. There are also plenty of examples here on the forum, so once you get an idea of what’s available to you you’ll have an easier time finding it here.

Nick, many thanks for all of your help, I really appreciate it.

Here is the completed script for anyone else to use, the script uses Structural Columns, but this is expandable to any other categories! (Note; the top part of the script isn’t required for it to work, I just included it to view all elements in model):

DATABASE.xlsx (13.4 KB)
NewFamilySwapperV1.0.dyn (37.8 KB)