# Python get Name of the Family from Elements

**URL:** <https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046>\
**Category:** Developers\
**Created:** [October 10, 2018, 1:32pm UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046 "2018-10-10T13:32:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ernesto\_Pellegrino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ernesto_pellegrino/32/105226_2.png) [@Ernesto\_Pellegrino](https://forum.dynamobim.com/u/Ernesto_Pellegrino)\
**Post date:** [October 10, 2018, 1:32pm UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046/1 "2018-10-10T13:32:44Z")

</div>

Hi all,  
I am trying to execute some code withe the python script node, I am a HUGE newbie at the moment, but I’m working on it 😉

At the moment I am stuck at finding the name of the family from a list of elements.  
If you can help me with that, it would be much appreciated.

This is the code so far:

```
#Collecting instances from the model with the Communication Device category
allCommDev = []
cl = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_CommunicationDevices).WhereElementIsNotElementType()
allCommDev = cl.ToElements()

```

Obviously I’ve tried a lot of different pieces of codes (that I am not writing because are almost blasphemy), but ended nowhere 😕

thanks in advance

---

<div class="post-metadata">

**Author:** ![CVestesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cvestesen/32/56704_2.png) [@CVestesen](https://forum.dynamobim.com/u/CVestesen)\
**Post date:** [October 10, 2018, 1:40pm UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046/2 "2018-10-10T13:40:29Z")

</div>

You need to loop through your list 🙂

---

<div class="post-metadata">

**Author:** ![Ernesto\_Pellegrino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ernesto_pellegrino/32/105226_2.png) [@Ernesto\_Pellegrino](https://forum.dynamobim.com/u/Ernesto_Pellegrino)\
**Post date:** [October 10, 2018, 1:43pm UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046/3 "2018-10-10T13:43:53Z")

</div>

thanks @CVestesen,  
I know it would require a loop iteration but I don’t know the syntax to do that, if you have a reference documentation it would be helpful too 🙂

---

<div class="post-metadata">

**Author:** ![CVestesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cvestesen/32/56704_2.png) [@CVestesen](https://forum.dynamobim.com/u/CVestesen)\
**Post date:** [October 10, 2018, 1:53pm UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046/4 "2018-10-10T13:53:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CVestesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cvestesen/32/56704_2.png) [@CVestesen](https://forum.dynamobim.com/u/CVestesen)\
**Post date:** [October 10, 2018, 1:58pm UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046/5 "2018-10-10T13:58:23Z")

</div>

And if you want the family name, you need to change the CollectorFilter to WhereElementIsElementType() and then get the property from ElementType “FamilyName”. On the above code I used the property from the Element class to collect the Element.Name 🙂

---

<div class="post-metadata">

**Author:** ![Ernesto\_Pellegrino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ernesto_pellegrino/32/105226_2.png) [@Ernesto\_Pellegrino](https://forum.dynamobim.com/u/Ernesto_Pellegrino)\
**Post date:** [October 11, 2018, 9:24am UTC](https://forum.dynamobim.com/t/python-get-name-of-the-family-from-elements/27046/6 "2018-10-11T09:24:03Z")

</div>

thanks @CVestesen 🙂
