LearnRevitAPI
![](https://framerusercontent.com/images/zMFB840Y52OLteloUT4BRuogE.png)
![](https://framerusercontent.com/images/U9zjOvD4k3m6cIJd5bOiu960DeI.png)
Dec 29, 2024
Revit API Filters
![](https://framerusercontent.com/images/Sd5FTaxiqzG7oeH1ykV6yypUzXo.png?scale-down-to=512)
If you've worked with the Revit API for a while, you've probably come across Revit API Filters.
They might seem tough at first, but they're not too hard to use. The main challenge is figuring out which filters are available in the Revit API.
Even I found some new filters myself not long ago...
💡So Let's look at all filters in Revit API
Filter Types
When I talk about Revit API filters, I mean filters that can be applied to FilteredElementCollector for get elements.
Don’t confuse them with View Filters, which is another topic.
Generally, there are 3 types of filters in Revit API:
Let's briefly explore each of them to understand how they work.
Slow vs Quick Filters?
You might be wondering why there are both 'slow' and 'quick' filters.
Does 'slow' mean we shouldn't use those filters?
And the answer is - Not at all!
As the name suggest one type of filters is quicker than the other.
Quick filters work faster because they look at a database record. They don't need to know every detail about the elements to filter them
![](https://framerusercontent.com/images/nAQSTrZqYNwujzjRtErlmnXYs.png)
On the other hand, slow filters need more information about each element. That means they have to load all the details of the elements into memory to check their different properties.
❗But you shouldn't even worry about this difference.
Most of the time, this just means your script will take a tiny bit longer - like a fraction of a second instead of one second.
For most of our scripts, this small difference doesn't matter. The main thing is to make it work. Worrying about speed only matters if it's really slow.
💪 So just use whatever works for you!
Quick FIlters
All quick filters are based on ElementQuickFilter Class.
This means you can scroll down to Inheritance Hierarchy to see all of them.
I would recommend scrolling through the list and read their names. They are quite self-explanatory.
![](https://framerusercontent.com/images/WgJKZTyy7mS4wI9aIVN9BP1TOE.png)
Also, almost half of these filters have shortcuts in the methods of FilteredElementCollector.
💡 Shortcut means that there is a method in FilteredElementCollector that applies that filter to the collector.
For Example:
.OfClass() method applies ElementClassFilter to the collectorSo, if a filter has a shortcut like this, just use it. It makes things easier!
Slow Filters
Just like quick filters, all slow filters are based on ElementSlowFilter class. So you can scroll down to inheritance Hierarchy and get a list of all these filters!
![](https://framerusercontent.com/images/RjbwypC9KpjwHGgPk8FsxNY1No.png)
💡None of Slow Filters have shortcuts in FEC class. However, there are many interesting filters to explore.
Especially ElementParameterFilter and ElementIntersectsFilter. These are not as simple to use, but they are really powerful!
I've recently created a detailed video about ElementParameterFilters. You can watch it by clicking on this thumbnail:
![](https://framerusercontent.com/images/Vh41z889b4dhHO8gWnUyHv75nYE.png)
Logical Filters
Lastly, there are just 2 logical filters:
- LogicalAndFilter
- LogicalOrFilter
These filters combine other filters using AND/OR logic. When applied to a collector, either all filters must be true (AND logic) or at least one (OR logic) to select your elements.
How to Apply Filters?
FilteredElementCollector has a method called WherePasses, which takes your Filter as an argument.
To create a filter you would need to look in Filter's Constructors.
Let's start simple and look at - ElementIsCurveDrivenFilter
This filter requires no arguments, so you simply call it to create and apply the collector.
![](https://framerusercontent.com/images/JjiySMzbzuxhRH7ymGDw1EWPUg.png)
Other filters might have more arguments to create them.
For example - FamilySymbolFilter
This filter needs Family Id as an argument.
I will manually write Id of that Family in this example:
![](https://framerusercontent.com/images/tLNl3rdXTg5TXOyv7iURac1pOgs.png)
💡 Generally, most filters are quite straightforward to use.
The key is knowing if there's a filter that can help you find the right elements. Once you know that, you will figure out how to use it.
So, I would encourage you to scroll through the list of filters to better understand them.
Resources
I recently discovered the Revit API Developer's Guide by Autodesk.
It has an nice page about all these filters, which I highly recommend for a deeper understanding.
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 6700+ people!
![](https://framerusercontent.com/images/svHzzMLtnnRCxtCUwbgAm6CUeB8.jpg)
![](https://framerusercontent.com/images/Y44kwhY0i7q37LzXUjrlxeGUo.jpg)
![](https://framerusercontent.com/images/lqKYmh8rqwZwgY2C9MSQER6iBCI.jpg)
![](https://framerusercontent.com/images/SyGCvJ3dbHsJEyklWWBhweY.jpg)
![](https://framerusercontent.com/images/DwiaUdmQHs3FVdDH2PXwAr0Y.jpg)