Collecting all types of a family available in document


Hello guys,
I am facing a problem in a python script. I want to collect all types of a certain family using the FIlteredElementCollector method. Any suggestions?

Thank you


You can use the WhereElementIsElementType() method for the FilteredElementCollector, e.g.:
elements = FilteredElementCollector(doc).WhereElementIsElementType().ToElements()
Keep in mind that this will get all types currently loaded into the document, not necessarily those which also have instances in the document.


Hello @cgartland,
Thank you for your reply. I tried this and it is actually giving the families not the types. I defined a function to get all the families in the document in a certain category(see image). But what I want next is to get all the types of the selected family and that’s what I didn’t achieve.

Any help will be appreciated.


Hmm…when directly outputting from Dynamo, it looks like it’s providing the correct information, but the actual object is a FamilySymbol. I’m not sure what the correct method is for getting the isolated types from each of these elements. Here’s what I’ve output so far:


import clr

from Autodesk.Revit.DB import *

from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
id = UnwrapElement(IN[0]).Id

fam_types = FilteredElementCollector(doc)\

OUT = fam_types

Not sure if you have seen these or not but its a good place to start. These are posts I have started in the past with similar topics. I think the first one should be close to what you want. The solution allows you to select all instances of a particular type.


I actually have a node for this in my MEPover package (although it does not use the FilteredElementCollector, but you can probably incorporate the code into your own):

This is the code for it:

import clr
from Autodesk.DesignScript.Geometry import *

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

#The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0], list):
	toggle = 0
	family = UnwrapElement(IN[0])
	toggle = 1
	family = [UnwrapElement(IN[0])]

listout = []
for fam in family:
	ids = fam.GetFamilySymbolIds()
	types = []
	for i in ids:
		type = doc.GetElement(i)

#Assign your output to the OUT variable.
if toggle == 0:
	OUT = listout
	OUT = types

Hello guys, thank you all for your contribution!
Actually I don’t know if things are different between writing python code in a dynamo node and writing the code in a separate IDE. Because I tried the function UnwrapElement and it is not working!

Anyway, I found a solution for my problem, maybe it is a workaround method but at least I achieved what I want.

The method is the following:

Step1 : I defined a function to get all the available types of a certain category and then get their families (of course I prevented family duplication in the returned dictionary)

Step 2: I defined another function that will filter types according to the desired family selected by user.

feedback is appreciated


If your input is going to be the family then the fastest way to get all of its types is as follows:

ids = family.GetFamilySymbolIds()
types = []
for i in ids:
	type = doc.GetElement(i)

UnwrapElement is indeed only used in Dynamo python nodes.


@T_Pover Thank you man I can change my code now. appreciated :slight_smile:

1 Like