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
category = ListBuiltInCategory
filter = ElementMulticategoryFilter(category)
collector = FilteredElementCollector(doc).WherePasses(filter).WhereElementIsElementType().ToElements()
for item in collector:
if item.GetParameters(“LV_Beschreibung”).AsString() == “Einfachständerwand”:
OUT = types
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':
OUT = items
See if it works. Otherwise, perhaps you could upload a small sample rvt with the walls for further testing
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:
# Enable Python support and load DesignScript library
from Autodesk.Revit.DB import *
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)
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:
# Assign your output to the OUT variable.
OUT = output
That is it! Thank you very much
Ah sorry! I was a bit quick to read the post and missed a crucial part of the first line