# How to get all family types of a family in python?

**URL:** <https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631>\
**Category:** Revit\
**Tags:** revit, python, dynamo\
**Created:** [April 2, 2024, 10:22am UTC](https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631 "2024-04-02T10:22:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubenVivancos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rubenvivancos/32/185795_2.png) [@RubenVivancos](https://forum.dynamobim.com/u/RubenVivancos)\
**Post date:** [April 2, 2024, 10:22am UTC](https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631/1 "2024-04-02T10:22:16Z")

</div>

How to get all family types of a family in project environment with python code? I tried [GetValidTypes Method](https://www.revitapidocs.com/2019/086554ba-3c70-9c0f-8a09-55a4da4ef905.htm) but I get Empty List as result, and obviously the family that I target has types in the project environment.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [April 2, 2024, 10:39am UTC](https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631/2 "2024-04-02T10:39:50Z")

</div>

This should do what you want: [GetFamilySymbolIds Method](https://www.revitapidocs.com/2023/8989a269-c516-0ace-5365-864a61df1103.htm)

Well that and a line along the lines of `familyTypes = [doc.GetElement(i) for i in symbols]`

---

<div class="post-metadata">

**Author:** ![RubenVivancos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rubenvivancos/32/185795_2.png) [@RubenVivancos](https://forum.dynamobim.com/u/RubenVivancos)\
**Post date:** [April 2, 2024, 11:06am UTC](https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631/3 "2024-04-02T11:06:27Z")

</div>

> [@jacob.small](#):
>
> GetFamilySymbolIds Method

I resolved like that surprisingly:

```auto
    # Find the FamilySymbol that matches the family name
    all_family_symbols = FilteredElementCollector(doc).OfClass(FamilySymbol).ToElements()
    family_symbols = UnwrapElement([sym for sym in all_family_symbols if hasattr(sym, 'Family') and sym.Family.Name.lower() == family_name_part.lower()])

```

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [April 2, 2024, 11:13am UTC](https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631/4 "2024-04-02T11:13:19Z")

</div>

That’ll be slower, but if it works it’s a victory!

---

<div class="post-metadata">

**Author:** ![GavinNicholls](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/gavinnicholls/32/190442_2.png) [@GavinNicholls](https://forum.dynamobim.com/u/GavinNicholls)\
**Post date:** [April 2, 2024, 2:01pm UTC](https://forum.dynamobim.com/t/how-to-get-all-family-types-of-a-family-in-python/99631/5 "2024-04-02T14:01:48Z")

</div>

Definitely recommend Jacob’s approach as it will scale better given your proposed alternative goes through all family types. Both technically work, but scalability is pretty handy when deploying solutions in models which might be potentially large or unpredictable.
