# Get a Revit family type from a FamilySymbol, with Python

**URL:** <https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886>\
**Category:** Revit\
**Tags:** python\
**Created:** [October 15, 2019, 8:03pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886 "2019-10-15T20:03:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![iliaspitserov](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iliaspitserov](https://forum.dynamobim.com/u/iliaspitserov)\
**Post date:** [October 15, 2019, 8:03pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/1 "2019-10-15T20:03:55Z")

</div>

Hi everyone,

I’m trying to place several instances in a model, using the “doc.Create.NewFamilyInstance()” method.  
Hence, I want to narrow my list of family types down to a single type, to be passed as a FamilySymbol parameter.  
I do get the Revit family I want, however, the Revit family contains several types and I just can’t boil it down to one of them.

Here’s a snapshot of what works so far:

 ![FamilySymbol](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/f/1f1bbae1246deff29f003e04f65dc2a0a93dfa8a.jpeg)

Would really appreciate some help.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Kibar](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kibar/32/80416_2.png) [@Kibar](https://forum.dynamobim.com/u/Kibar)\
**Post date:** [October 15, 2019, 9:28pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/3 "2019-10-15T21:28:22Z")

</div>

Your `fam_sys_lst` collector collects all elements of the FamilySymbol class.  
There are multiple ways of getting only 1 item:

- [Indexing](https://www.tutorialspoint.com/python/python_lists.htm): e.g. `fam_sys_lst[0]` would return the first element of that list and is similar to the `GetItemAtIndex` node of Dynamo.
- Narrow down your collector: [This blog post](https://danimosite.wordpress.com/2017/04/16/filteredelementcollector-and-how-to-use-it-in-python-for-dynamo/) gives good examples on how to use it.

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [October 15, 2019, 11:39pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/4 "2019-10-15T23:39:29Z")

</div>

a Familysymbol is a Type

to filter your collector try this:

`filter_typ = [x for x in fam_symb_lst if x.Family.Name == "SP_2D Chair" and Element.Name.GetValue(x) == "40/40"][0]`

---

<div class="post-metadata">

**Author:** ![iliaspitserov](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iliaspitserov](https://forum.dynamobim.com/u/iliaspitserov)\
**Post date:** [October 16, 2019, 5:02am UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/5 "2019-10-16T05:02:19Z")

</div>

Great, it worked!  
Thanks!

---

<div class="post-metadata">

**Author:** ![iliaspitserov](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iliaspitserov](https://forum.dynamobim.com/u/iliaspitserov)\
**Post date:** [October 16, 2019, 5:05am UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/6 "2019-10-16T05:05:14Z")

</div>

I would like to select the type with a user controlled input, such as type name.  
Thanks for the reply and the link, though. I’ll check it out.

---

<div class="post-metadata">

**Author:** ![iliaspitserov](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iliaspitserov](https://forum.dynamobim.com/u/iliaspitserov)\
**Post date:** [October 16, 2019, 8:10am UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/7 "2019-10-16T08:10:10Z")

</div>

Just another little question:  
“x.Family.Name” and “Element.Name.GetValue” - are those pure API methods?  
I mean, would they work outside of Dynamo environment (Python shell, C# addins and such)?  
Thanks again!

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [October 16, 2019, 12:14pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/8 "2019-10-16T12:14:43Z")

</div>

`x.Family.Name` is is the combination of 2 properties (Revit API) [Family Property](https://www.revitapidocs.com/2018.2/14272fe6-5fc3-f053-b4c6-2f44d05786f2.htm) and [Name Property](https://www.revitapidocs.com/2018.2/e372092e-ff47-71c2-1272-50ab08e5a41d.htm) (Inherited from [Element]

`Element.Name.GetValue(objet)` is a dotnet method [PropertyInfo.GetValue Méthode (System.Reflection) | Microsoft Learn](https://docs.microsoft.com/fr-fr/dotnet/api/system.reflection.propertyinfo.getvalue?view=netframework-4.8) to get value from a Property because Dynamo use [IronPython](https://ironpython.net/)  
you can also use  
`Element.Name. __get__ (objet)`  
[\_\_get\_\_ — Python Reference (The Right Way) 0.1 documentation](https://python-reference.readthedocs.io/en/latest/docs/dunderdsc/get.html)

Note: FamilySymbol.Name does not work due to a IronPython limitation

more info here

> [@Get FamilySymbol's name (Family Type Name)](https://forum.dynamobim.com/t/get-familysymbols-name-family-type-name/7831):
>
> Hi everyone, I’m writing a Revit macro using Python trying to collect all Family Type 's names but the returned result seems strange. I did collect successfully the Family Type elements (FamilySymbol) but somehow I can’t manage to get their name. Could anyone advise ? Greatly appreciate. Cheers allcollector = FilteredElementCollector(self.ActiveUIDocument.Document).OfClass(FamilySymbol) allelementlist = allcollector.ToElements() string1= "... \n" for i in allel…

---

<div class="post-metadata">

**Author:** ![iliaspitserov](https://avatars.discourse-cdn.com/v4/letter/i/e19b73/32.png) [@iliaspitserov](https://forum.dynamobim.com/u/iliaspitserov)\
**Post date:** [October 16, 2019, 3:19pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/9 "2019-10-16T15:19:17Z")

</div>

Great, thanks again!  
Indeed, I was struggling with the FamilySymbol.Name method and couldn’t get why it keeps giving me errors.

---

<div class="post-metadata">

**Author:** ![ruben.romero](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ruben.romero/32/115842_2.png) [@ruben.romero](https://forum.dynamobim.com/u/ruben.romero)\
**Post date:** [June 14, 2022, 11:27am UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/10 "2022-06-14T11:27:50Z")

</div>

> [@c.poupin](#):
>
> filter\_typ = [x for x in fam\_symb\_lst if x.Family.Name == “SP\_2D Chair” and Element.Name.GetValue(x) == “40/40”][0]

```auto
IndexError: index out of range: 0

```

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [June 14, 2022, 1:22pm UTC](https://forum.dynamobim.com/t/get-a-revit-family-type-from-a-familysymbol-with-python/41886/11 "2022-06-14T13:22:36Z")

</div>

Hello, a variant

`filter_typ = next((x for x in fam_symb_lst if x.Family.Name == "SP_2D Chair" and Element.Name.GetValue(x) == "40/40"), None)`

_What is the purpose to digging up this 3-year-old subject without context ? Please Start a new topic in this case._  
_here is one of the valid reasons why old topics could be automatically closed_
