Resources
Summary
Slow Filters
We explored all Quick Filters in previous lesson, now let's look at Slow Filters.
First of all, remember - These 'slow' filters are very efficient, but they operate on properties and methods of elements that require to read all element properties.
So don't even think about ignoring them because they are categorized as such!
So what Filters are Slow Filters?
To see a list of all Slow Filters we can look in Inheritance Hierarchy of ElementSlowFilter.
So you can see a lot of different filters in this screenshot.
There are many filters that I consider useless like RoomFilter, RoomTagFilter and similar ones.
I find them useless because we can get these elements by Category instead of creating these filters.
However, you still have this option! And I will show you snippets of how to use them.
Also these filters don't have any shortcuts in FEC Class, so we only have 1 way of using them.
Let's structure all these filters in a better list below and go through each of them.
Revit API - Quick Filters
1️⃣CurveElementFilter
It is necessary to use the CurveElementFilter, and not an ElementIsCurveDrivenFilter because subclasses of CurveElement are not supported by that method.
This method takes an argument - CurveElementType enumeration.
It has the following options:
Invalid - An invalid curve element type.
ModelCurve - A model curve.
DetailCurve - A detail curve.
SymbolicCurve - A symbolic curve.
ReferenceLine - A reference line.
SpaceSeparation - A space separation curve.
RoomSeparation - An room separation curve.
AreaSeparation - An area separation curve.
CurveByPoints - A curve created by connecting a set of points.
RepeatingDetail - The profile of a repeating detail set.
Insulation - A detail curve representing insulation.
Cloud - A portion of a revision cloud.
AreaBasedLoadBoundary - An Area Based Load Boundary curve.
Here is a snippet to get only Room Separation Lines using this Filter:
2️⃣ElementLevelFilter
A filter used to match elements by their associated level.
Very easy to use as we only need ElementId of a Level.
Here is a snippet to get Rooms and Walls associated with a random level. Feel free to select specific level for your testing!
3️⃣FamilyInstanceFilter
A filter used to find elements that are family instances of the given family symbol.
Let's make an example where we will take all FamilySymbols from the project and count how many instances are placed in the project.
1️⃣ Get All FamilySymbols
2️⃣ Create FamilyInstanceFilter
3️⃣ Apply filter to the collector
👀 Print Results.
4️⃣ElementParameterFilter (see Lesson 07.05)
A filter used to match elements by one or more parameter filter rules.
This filter can be really useful, as we can check Parameter values. There are multiple steps in creating this filter, because we need to define:
Parameter
Evaluator
RuleValue
Tollerance / CaseSensetivity
And while these are the same steps as creating a View Filter, it might be overwhelming first time you do it.
So there will be a whole lesson about this filter in-depth, so you can understand all the steps necessary to create these filters!
👇 Meanwhile, I will provide here a code snippet on how it can be used:
The code is doing the following:
1️⃣ Select Parameter
2️⃣ Select Evaluator (Contains, Equal, Greater…)
3️⃣ Rule Value
4️⃣ Create Rule
5️⃣ Create FIlter
6️⃣ Apply Filter to collector
👉 Set Selection in Revit to visually see collector's elements
💡 NB! There are different classes for Rules depending on parameter's StorageType!
5️⃣ElementIntersectsElementFilter (see Lesson 07.06 for more)
A filter to find elements that intersect the solid geometry of a given element.
💪 This is an amazing filter and it's very easy to use!
We need to select an element and then provide it to create this filter. And it will find all intersecting elements.
💡I Highly recommend you to try it out, it has a lot of potential!
Here is a code snippet:
When you use this filter, you might see this message (I got it with Rooms):
⚠️ 'The category of the element is not supported for element intersection filters.'
So in this case we would need to use the next filter, where we should use Geometry instead of an Element.
6️⃣ElementIntersectsSolidFilter (see Lesson 07.06 for more)
A filter to find elements that intersect the given solid geometry.
This filter is similar to the previous one, but we use the Geometry instead of Elements to look for intersections.
I would recommend sticking to ElementIntersectsElementFilter when possible, but sometimes you might want to work with geometry instead.
So here is an example on how to use, This snippet will:
Pick and Element
Ensure it's FilledRegion Selected
Create Solid from FilledRegion
Create ElementIntersectsSolidFilter
Apply Filter to Collector
Set Selection to elements in the collector
7️⃣ElementPhaseStatusFilter
A filter used to match elements that have a given phase status on a given phase.
It takes ElementOnPhaseStatus Enumeration as an argument, and has the following options
None - Phase status is undefined (e.g., for annotations)
Past - Created and demolished before the given phase
Existing - Created in a previous phase, existing through the end of the given phase
Demolished - Created before the given phase, to be demolished on the given phase
New - Created on this phase (and not demolished)
Temporary - Created and demolished during this phase
Future - Created after this phase
8️⃣PrimaryDesignOptionMemberFilter
A filter used to find elements contained in any primary design option of any design option set.
9️⃣StructuralInstanceUsageFilter
Constructs a new instance of a filter to match structural family instances (typically columns, beams, or braces) of the given structural usage.
This Filter takes StructuralInstanceUsage Enumeration and it has the following options:
Undefined - indicates automatic
Wall - Structural usage is as wall.
Column - Structural usage is as column.
Girder - Structural usage is as girder.
Joist - Structural usage is as joist.
Purlin - Structural usage is as purlin.
Other - Structural usage is as "other".
Brace - Structural usage is as brace.
HorizontalBracing - Structural usage is as horizontal bracing.
KickerBracing - Structural usage is as kicker bracing.
Automatic - Structural usage is automatic.
TrussChord - Structural usage is as truss chord.
TrussWeb - Structural usage is as truss web.
💡 Also remember that this filter and enumeration are from Revit.DB.Structure !
🔟FamilyStructuralMaterialTypeFilter
A filter used to match families that have the given structural material type.
It will get you families that have a built-in parameter Material for Model Behaviour.
This filter takes StructuralMaterialType Enumeration argument.
It has the following options to choose from:
Undefined - Structural material type is undefined.
Steel - Structural material type is steel.
Concrete - Structural material type is concrete.
Wood - Structural material type is wood.
Other - Structural material type is other.
PrecastConcrete - Structural material type is precast concrete.
Generic - Structural material type is generic.
Aluminum - Structural material type is aluminum.\
💡 Make sure you import these classes from DB.Structure!
1️⃣1️⃣StructuralMaterialTypeFilter
A filter used to match family instances that have the given structural material type.
This filter takes StructuralMaterialType Enumeration as an argument.
And it has the following options:
Undefined - Structural material type is undefined.
Steel - Structural material type is steel.
Concrete - Structural material type is concrete.
Wood - Structural material type is wood.
Other - Structural material type is other.
PrecastConcrete - Structural material type is precast concrete.
Generic - Structural material type is generic.
Aluminum - Structural material type is aluminum.
💡 Also remember that this filter and enumeration are from Revit.DB.Structure !
1️⃣2️⃣StructuralWallUsageFilter
A filter used to match walls that have the given structural wall usage.
This filter need StructuralWallUsage Enumeration argument
And it has the following options:
NonBearing - Structural usage is non-bearing.
Bearing - Structural usage is bearing.
Shear - Structural usage is shear.
Combined - Structural usage is combined.
💡 Also remember that this filter and enumeration are from Revit.DB.Structure !
1️⃣3️⃣ SelectableInViewFilter ❌
A filter that passes elements that are selectable in the given view.
I don't know what's the point of this filter, because it gave me the same result as VisibleInViewFilter Quick filter or using 2nd constructor of FilteredElementCollector. Maybe there is some exception case, but I am not sure about it.
So I would recommend ignoring it and sticking to the constructor to get elements in a view.
1️⃣4️⃣AreaFilter / AreaTagFilter ❌
We can't get Area and AreaTag with OfClass method.
So there is a separate filters for that.
💡However, we can always us OfCategory to get Area or AreaTags.
1️⃣5️⃣RoomFilter / RoomTagFilter ❌
We can't get Room and RoomTag with OfClass method.
So there is a separate filters for that.
💡However, we can always us OfCategory to get Rooms or RoomTags.
1️⃣6️⃣SpaceFilter / SpaceTagFilter ❌
We can't get Space and SpaceTag with OfClass method.
So there is a separate filters for that.
💡However, we can always us OfCategory to get Spaces or SpaceTags.