# Get all elements of multiple wall types

**URL:** <https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212>\
**Category:** Developers\
**Tags:** python\
**Created:** [November 13, 2020, 9:48am UTC](https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212 "2020-11-13T09:48:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![borna.molnar-erhatic](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/borna.molnar-erhatic/32/96923_2.png) [@borna.molnar-erhatic](https://forum.dynamobim.com/u/borna.molnar-erhatic)\
**Post date:** [November 13, 2020, 9:48am UTC](https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212/1 "2020-11-13T09:48:20Z")

</div>

Hello!

I filtered out a couple of wall types and now I would like to select all the elements of this wall types but cant seem to find the solution for it in python. I know there are Dynamo nodes for it but I am trying to take a deeper dive in the Revit API, but yeah it is confusing. There are probably multiple ways of doing this, but am I supposed to construct a filter of some sorts and than use the FilteredElementCollector method? Can anybody help me out?

This is what I got so far

> types =
> 
> category = ListBuiltInCategory  
> category.Add(BuiltInCategory.OST\_Walls)  
> filter = ElementMulticategoryFilter(category)  
> collector = FilteredElementCollector(doc).WherePasses(filter).WhereElementIsElementType().ToElements()
> 
> TransactionManager.Instance.EnsureInTransaction(doc)
> 
> for item in collector:  
> if item.GetParameters(“LV\_Beschreibung”)[0].AsString() == “Einfachständerwand”:  
> types.append(item)
> 
> TransactionManager.Instance.TransactionTaskDone()
> 
> OUT = types

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/0/00d698582906cb0ca290c0385350e1cb8065d01d.png)

---

<div class="post-metadata">

**Author:** ![MartinSpence](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/martinspence/32/25208_2.png) [@MartinSpence](https://forum.dynamobim.com/u/MartinSpence)\
**Post date:** [November 13, 2020, 10:02am UTC](https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212/2 "2020-11-13T10:02:57Z")

</div>

Hi @borna.molnar-erhatic,

You can set up the collector with a filter element, but it’s not a necessity. You can simply do:

`collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType().ToElements()`

The transaction is not necessary either in your case, as you aren’t making any changes to the document.

So from the collector, you can simply go:

```
for item in collector:
    if item.LookupParameter('LV_Beschreibung').AsString() == 'Einfachständerwand':
        types.append(item)
    else:
        pass

OUT = items

```

See if it works. Otherwise, perhaps you could upload a small sample rvt with the walls for further testing 🙂

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [November 13, 2020, 10:14am UTC](https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212/3 "2020-11-13T10:14:12Z")

</div>

Hi,

seeing the previous reply I think I might have misunderstood you - but I thought that you already have the wall types and you want to find wall elements that have those specific types assigned.  
If that’s the case you can do it like this:

 ![obraz](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/2/12e86617f36032edb69f86abf6f17900d5d6c853.png)

```
# Enable Python support and load DesignScript library
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
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.
wall_types = UnwrapElement(IN[0])
type_ids = [a.Id for a in wall_types]
output = []

collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()

for wall in collector:
	if wall.WallType.Id in type_ids:
		output.append(wall)

# Assign your output to the OUT variable.
OUT = output
```

---

<div class="post-metadata">

**Author:** ![borna.molnar-erhatic](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/borna.molnar-erhatic/32/96923_2.png) [@borna.molnar-erhatic](https://forum.dynamobim.com/u/borna.molnar-erhatic)\
**Post date:** [November 13, 2020, 10:54am UTC](https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212/4 "2020-11-13T10:54:12Z")

</div>

That is it! Thank you very much

---

<div class="post-metadata">

**Author:** ![MartinSpence](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/martinspence/32/25208_2.png) [@MartinSpence](https://forum.dynamobim.com/u/MartinSpence)\
**Post date:** [November 13, 2020, 12:09pm UTC](https://forum.dynamobim.com/t/get-all-elements-of-multiple-wall-types/57212/5 "2020-11-13T12:09:36Z")

</div>

Ah sorry! I was a bit quick to read the post and missed a crucial part of the first line 😆 😆
