Creating Selection Filters in Revit
Filters are divided into Selection Filters and Rule-based Filters.
For Rule-based Filters, you can refer to my previous article:
Revit Secondary Development: Attaching Filters to Linked Models in Projects
Selection Filters, as the name suggests, allow you to pass a collection of selected element IDs and add them to the view filter. In some scenarios, you need to filter and select specific elements, but when there is no common logic rule for filtering, you can choose to use a selection filter.
Here is my code, which adds code for setting cut background patterns and solid fill styles:
1 | var selectionFilter = SelectionFilterElement.Create(doc, "OutRange"); |
The method for getting the solid fill PatternId is also provided:
1 | /// <summary> |
Selection Filter (SelectionFilterElement Class) API:

All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.





