I’m trying to retrieve the TextNoteType matching a desired name string so that I can then change the style of a text note using my_text_note.ChangeStyleId(text_note_type.Id). Unfortunately, it seems like I can’t access the Name property which the TextNoteType class inherits from ElementType. Any workarounds?
from pyrevit import DB
from Autodesk.Revit.DB import FilteredElementCollector
text_note_types = FilteredElementCollector(doc).WhereElementIsElementType().OfClass(DB.TextNoteType).ToElements()
for text_note_type in text_note_types:
print text_note_type.Name
Not too sure actually. I’m pretty certain it’s not a bug by the way it seems to be structured.
An element has a .Name property that gives us a Type Name
An element type has a .FamilyName property that gives us the family.Name
if we consider the hierarchy:
family > type > instance
So there is a level of consistancy there. As if a child always has some property directly relating to a parent’s parameter. But it’s weird then that the parent does not have that same property available for ease of acces.
Perhaps it’s to prevent people from getting confused when dealing with .Name properties. And hence mixing elemnttype and element in the process?
It’s a bit hazy for me too, never really thought about it tbh.