Hi everyone
I have a script in which I collect all the Title Block Types in the project, but I can’t seem to figure out how to get the type name
This is my code:
import clr
#import RevitAPI
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, Element, FamilySymbol
doc = __revit__.ActiveUIDocument.Document
titleBlocks = FilteredElementCollector(doc).WhereElementIsElementType().OfCategory(BuiltInCategory.OST_TitleBlocks).ToElements()
The Family Name can be easily called with the ‘FamilyName’-attribute, but how do I get the Type Name, I have to be missing something…
Any help is welcome!
1 Like
@PieterL_TM ,
i copied the template Python primier - it works!
import sys
import System
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
titleBlocks = FilteredElementCollector(doc).WhereElementIsElementType().OfCategory(BuiltInCategory.OST_TitleBlocks).ToElements()
OUT = titleBlocks
KR
Andreas
My bad, I didn’t specify that I was writing this outside of dynamo. I want the Type Name as a string in Python.
If you’re already dealing with the Types then the Name property should be the type name or you can always look up the Type Name parameter value.
Yes the lookup worked, I don’t understand why just calling the Name doen’t work though.