Set current type / Family Type in Python

I have a favourite graph that I use a lot, but i’m getting a bit fed up of constantly using the drop downs to change types every time I run it. Is there a method of setting the current type of these two nodes programmatically in Python.
I’m thinking its something like:

famType.append(wallkind.'WhatIWant')
famType.append(family.'WhatIWant')

Essentially I just want to replicate these nodes in Python but automatically assign the selection.

A filtered element collector could do the trick. How would you know what the name should be on the next project though? Would you want to have to edit the Python of that family didn’t exist or had to use a different naming standard for another project?

Good point, I would have to ensure that the same template file was used - thus ensuring that the types within the document remained consistent. I have been doing some digging around the forum and found that I can employ:
return = WallType.ByName(“Generic - 150mm”); in a codde block

How would I use this within an ‘if’ statement in Python ?

Look into the filtered element collector class of the Revit API. FilteredElementCollector Class

There are some great examples of how to use these on @solamour’s Dynamo Python repository.

1 Like

Thanks for your help Jacob - I will dive into it !!