LearnRevitAPI
📙How To Master Getting Elements in Revit API
Dec 10, 2024
👉 Master Getting Elements
Getting the right Elements is half the solution, and it doesn't need to be complicated.
Let's explore how to get elements elements by using FilteredElementCollector Class.
What is FEC?
FilteredElementCollector(FEC) is one of the most used classes in Revit API. It allows you to get elements by applying filters.
There are 2 ways to apply filters:
Use FEC methods (Simple Filtering)
Create actual Revit API Filters (More Advanced)
In a nutshell here is how FEC is usually used.
You create collector by providing correct doc
Then filter by Class or Category (or both)
Then you filter Instances or Types
And you convert to a list of Elements or Element Ids
This is the most typical way of getting elements with FEC
Revit API is Repetitive
FilteredElementCollector is easier than it looks!
I know it might be confusing to see that loooong line of code for the first time. However, it's one of the most repetitive classes.
👀 Have a look at the image below.
You can see that to get different kinds of elements we use nearly the same line of code with minor changes. You just need to use it a few times to get used to that.
More FEC Examples
The best way to learn about FEC class is to see a lot of examples and then copy a few yourself.
So, have a look at even more examples of using FEC and compare the code when you get different elements.
Video Tutorial
If you want to learn more about FilteredElementCollectors, I recommend you to watch this video where I will break it down and provide more examples.
Download E-Book on FEC
Additionally, I want to provide you my older E-Book on how to work with FilteredElementColletor. It has explanation and also a lot of code examples.
I made this E-Book in 2022 and it had thousands of downloads since. So I hope you will like it.
Download E-Book Here:
Master Getting Elements with Revit API
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 7500+ people!