Can not rename a family type

Hi All,

I have followed all other advise and can not work out why I can not access a walls name by using Element.Name- I get an AttributeError:Name

In the script below, I am simply passing in a Categories Node: Walls. I can successful output the walls before the for loop starts, but the error happens when I try and call name.

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

collector = FilteredElementCollector(doc)

Option 02, pass them in from dynamo (ensure you unwrap them before using them)

category_input = UnwrapElement(IN[0])

collected_walls = collector.OfCategoryId(category_input.Id).ToElements()

argument assigned the IN port

rename = IN[1]

core data processing

type_name =

for element in collected_walls:
for idx, searched in enumerate(collected_walls):
if searched == element.Name:
element.Name = rename[idx]

return assigned the OUT port

OUT = collected_walls

It doesn’t look like you are getting the WallType from the walls you have collected.

wallTypes = FilteredElementCollector(doc).OfCategoryId(catId).WhereElementIsElementType().ToElements()
for wt in wallTypes:
    wt.Name = rename

Hi @SeanP, Do you dont call .Name from the element itself, do you need to isolate the element and then do .Names

Because in the example you give, I would have thought it would be wt.Names, as you are isolating them in the loop?

1 Like

You are correct, I had a typo there. I have edited the response.

You can use a Package DynaMEP


Thankyou, the answer was that I was not bringing in ONLY types of the element that matches my parameters as you correctly mentioned- I didn’t know about this.


Thankyou very much

1 Like