# Python: Trying to get all family types in all families into one list, is that possible?

**URL:** <https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816>\
**Category:** Developers\
**Tags:** python, dynamo\
**Created:** [May 8, 2024, 11:50pm UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816 "2024-05-08T23:50:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe.said](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@joe.said](https://forum.dynamobim.com/u/joe.said)\
**Post date:** [May 8, 2024, 11:50pm UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816/1 "2024-05-08T23:50:04Z")

</div>

Just like the title, I can get all elements by category or by Family Instance or by Family Symbol, but is there a way to get all of the family types in the project. I’m also not trying to get the ones modelled as elements in the project. Basically we have a template with all families imported and my goal is to check and change the prefix of all the families, but I can’t seem to select all the family types.

---

<div class="post-metadata">

**Author:** ![pyXam](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/pyxam/32/163009_2.png) [@pyXam](https://forum.dynamobim.com/u/pyXam)\
**Post date:** [May 9, 2024, 12:17am UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816/2 "2024-05-09T00:17:10Z")

</div>

There are quite a few ways of getting what you want.

This is one possible way.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/5/65de8360083b7ae7cf7e069f675691c1b6078531.png)

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [May 9, 2024, 1:41am UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816/3 "2024-05-09T01:41:03Z")

</div>

With a python node

```python
import clr

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager 

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import FamilySymbol, FilteredElementCollector

doc = DocumentManager.Instance.CurrentDBDocument

OUT = FilteredElementCollector(doc).OfClass(FamilySymbol).ToElements()

```

---

<div class="post-metadata">

**Author:** ![joe.said](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@joe.said](https://forum.dynamobim.com/u/joe.said)\
**Post date:** [May 9, 2024, 5:08pm UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816/4 "2024-05-09T17:08:21Z")

</div>

@Mike.Buttery @pyXam Thank you both for the input, I was already getting the FamilySymbols before, but it seems like I wasn’t as clear in my question. I want to rename all family types and things like this Segmented Bend / Tee is obviously renamable, but it doesn’t show up when I try both your methods. I’m guessing this will turn out to be more of an educational instruction on why I can’t grab these family types while I’m able to grab other family types, than it being a direct solution to include these types as well:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/b/dbbb949a1ddabaae20d1d930e696c2c208c8d8af.png)

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [May 10, 2024, 9:24am UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816/5 "2024-05-10T09:24:27Z")

</div>

If you want to get all _ElementType_ elements that can be renamed you can use this code

```python
import clr
from System import Enum

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import (
    BuiltInCategory,
    BuiltInParameter,
    FilteredElementCollector,
    ParameterUtils,
)

def flatten(x):
    out = []
    for i in x:
        out.extend(i)
    return out

def get_elementtype_name(et, typeid):
    fn, tn = et.FamilyName, et.GetParameter(typeid).AsValueString()
    if fn:
        if tn:
            return f"{fn}: {tn}"
        return fn
    return tn

def fec(bic):
    return (
        FilteredElementCollector(doc)
        .OfCategory(bic)
        .WhereElementIsElementType()
        .ToElements()
    )

doc = DocumentManager.Instance.CurrentDBDocument

typeid = ParameterUtils.GetParameterTypeId(BuiltInParameter.SYMBOL_NAME_PARAM)

bics = Enum.GetValues(BuiltInCategory)

elem_types = flatten(filter(None, [fec(bic) for bic in bics]))

# remove duplicates with dict comprehension
elem_types = {et.Id.ToString(): et for et in elem_types}

OUT = sorted(
    [
        (get_elementtype_name(et, typeid), et)
        for et in elem_types.values()
        if et.CanBeRenamed
    ],
    key=lambda n: n[0],
)

```

---

<div class="post-metadata">

**Author:** ![haganjake2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/haganjake2/32/119069_2.png) [@haganjake2](https://forum.dynamobim.com/u/haganjake2)\
**Post date:** [May 27, 2024, 4:23pm UTC](https://forum.dynamobim.com/t/python-trying-to-get-all-family-types-in-all-families-into-one-list-is-that-possible/100816/6 "2024-05-27T16:23:02Z")

</div>

Going to copy paste something I said to someone the other day which sounds like exactly what you need also:

Whilst this is definitely possible with Dynamo, I would recommend you check out the free plugin by DiRoots called “Family Reviser” ([found here](https://diroots.com/revit-plugins/manage-revit-families-and-worksets-with-familyreviser/)).

I have used it a lot to find & replace family names across an entire library of families with the dropdown option for system families also. You can also save and export them from here, it really is a great tool.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/8/e898c9bd2dc97be46d24f6fbdd454ef3a8899d54.png)
