Change type name with python


Is it possible in any way to change the type name in Revit with Dynamo? Maybe with Python?

like this?
RenameElement.dyn (7.8 KB)

# Common Language Runtime module
import clr

# Revit and Dynamo module
from Autodesk.Revit.DB import FilteredElementCollector, Family
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

# argument assigned the IN port
search = IN[0]
rename = IN[1]

# core data processing
type_name = []
collector = FilteredElementCollector(doc).OfClass(Family)
for element in collector.ToElements():
    for idx, searched in enumerate(search):
        if searched == element.Name:
            element.Name = rename[idx]

# return assigned the OUT port
OUT = type_name

Yes! Thank you…

Me also trying to change type name using the same script but i’m getting error at element.type node. Can you help on the same?

I am also trying to change but with no success.
As I am beginner in Dynamo I would realy appriciate if you could help me with this problem.
What I want to do is change so the naming convention goes like this: “Family Name_WidthxHeight”.
Anyone idea?
I am sending screenshot of my current attempt with Dynamo script.

Thank you in advance for help!

After I cleared my head I found out where was my mistake :slight_smile:
I will upload script if somebody will need.

Can you please upload it?? Thank you

Hi Tuan,
Here are two scripts - one for system families and one for non-system familes.
For system families, eg. “Walls”, I have added prefix “Z” in naming convetion - so the name of the Wall Type is for example: “Z-Basic Wall_25cm”. Ofcourse, if you don’t want this prefix you can easly remove it from script.
Hope script works good for you…let me know :slight_smile:
Type Name-non-system families.dyn (19.5 KB)
Type Name-system familes.dyn (21.6 KB)

Thank you a lot!!!

Hi, thanks for your script i am biggener in Dynamo and i apperciate your help, i can not find the types names list as shown, only IDs are there and i don´t know how i can rename the walls type, thanks in advance

Hi Kamel.

what naming convention would you like to use?