Class FilteredElementCollector
- Namespace
- RvtIO
- Assembly
- RvtIO.dll
Provides Revit-API-like element filtering and querying. Chainable filters applied lazily - enumeration triggers evaluation.
public class FilteredElementCollector : IEnumerable<Element>, IEnumerableInheritance
Implements
Inherited Members
Methods
Excluding(IEnumerable<int>)
Exclude specific element IDs.
public FilteredElementCollector Excluding(IEnumerable<int> elementIds)Parameters
elementIdsIEnumerable<int>
Returns
FirstElement()
Get the first matching element, or null.
public Element? FirstElement()Returns
GetElementCount()
Count matching elements without materializing.
public int GetElementCount()Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Element> GetEnumerator()Returns
- IEnumerator<Element>
-
An enumerator that can be used to iterate through the collection.
OfCategory(BuiltInCategory)
Filter by BuiltInCategory enum.
public FilteredElementCollector OfCategory(BuiltInCategory category)Parameters
categoryBuiltInCategory
Returns
OfCategory(int)
Filter by category ID (int).
public FilteredElementCollector OfCategory(int categoryId)Parameters
categoryIdint
Returns
OfCategory(string)
Filter by category name string (e.g. "OST_Walls").
public FilteredElementCollector OfCategory(string categoryName)Parameters
categoryNamestring
Returns
OfFamilyName(string)
Filter by family name.
public FilteredElementCollector OfFamilyName(string familyName)Parameters
familyNamestring
Returns
ToElementIds()
Get all matching element IDs.
public IList<int> ToElementIds()Returns
ToElements()
Materialize all matching elements into a list.
public IList<Element> ToElements()Returns
Where(Func<Element, bool>)
Custom predicate filter.
public FilteredElementCollector Where(Func<Element, bool> predicate)Parameters
Returns
WhereBoundingBoxIsNotNull()
Keep only elements that have a bounding box.
public FilteredElementCollector WhereBoundingBoxIsNotNull()Returns
WhereElementIsElementType()
Keep only type/symbol elements (not instances). Keeps elements whose ID is referenced as a type by other elements.
public FilteredElementCollector WhereElementIsElementType()Returns
WhereElementIsNotElementType()
Keep only instance elements (not type definitions). Excludes elements whose ID is referenced as a type by other elements.
public FilteredElementCollector WhereElementIsNotElementType()Returns
WhereHasFaces()
Keep only elements that have face geometry.
public FilteredElementCollector WhereHasFaces()Returns
WhereHasGeometry()
Keep only elements that have GRep geometry (faces).
public FilteredElementCollector WhereHasGeometry()Returns
WhereHasParameter(string)
Keep only elements with a specific parameter name.
public FilteredElementCollector WhereHasParameter(string paramName)Parameters
paramNamestring
Returns
WhereHasParameter(BuiltInParameter)
Keep only elements with a specific BuiltInParameter.
public FilteredElementCollector WhereHasParameter(BuiltInParameter bip)Parameters
bipBuiltInParameter
Returns
WhereHasParameters()
Keep only elements that have parameters.
public FilteredElementCollector WhereHasParameters()