FamilyType.ByName - strange behaviour

Hi all,

I’m trying to create a script in which I can select an elementtype by name. I would expect the script shown below to work but it does not, can anyone explain why?

Thanks in advance

Hi, try this methode:

code for copy/pasting:

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import BuiltInParameter, FilteredElementCollector
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

el_types = FilteredElementCollector(doc).WhereElementIsElementType().ToElements()

for i in el_types:
name = i.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
if name ==IN[0]:
type = i
OUT = type

1 Like

Hi,

thanks a lot, your solution worked.
The tabs are missing from the copy/paste part of your answer so I added those:

import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import BuiltInParameter, FilteredElementCollector
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

el_types = FilteredElementCollector(doc).WhereElementIsElementType().ToElements()

for i in el_types:
	name = i.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
	if name ==IN[0]:
		type = i
OUT = type