Table of Contents

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>, IEnumerable

Inheritance

Implements

Inherited Members

Methods

Excluding(IEnumerable<int>)

Exclude specific element IDs.

public FilteredElementCollector Excluding(IEnumerable<int> elementIds)

Parameters

elementIds IEnumerable<int>

Returns

FilteredElementCollector

FirstElement()

Get the first matching element, or null.

public Element? FirstElement()

Returns

Element?

GetElementCount()

Count matching elements without materializing.

public int GetElementCount()

Returns

int

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

category BuiltInCategory

Returns

FilteredElementCollector

OfCategory(int)

Filter by category ID (int).

public FilteredElementCollector OfCategory(int categoryId)

Parameters

categoryId int

Returns

FilteredElementCollector

OfCategory(string)

Filter by category name string (e.g. "OST_Walls").

public FilteredElementCollector OfCategory(string categoryName)

Parameters

categoryName string

Returns

FilteredElementCollector

OfFamilyName(string)

Filter by family name.

public FilteredElementCollector OfFamilyName(string familyName)

Parameters

familyName string

Returns

FilteredElementCollector

ToElementIds()

Get all matching element IDs.

public IList<int> ToElementIds()

Returns

IList<int>

ToElements()

Materialize all matching elements into a list.

public IList<Element> ToElements()

Returns

IList<Element>

Where(Func<Element, bool>)

Custom predicate filter.

public FilteredElementCollector Where(Func<Element, bool> predicate)

Parameters

predicate Func<Element, bool>

Returns

FilteredElementCollector

WhereBoundingBoxIsNotNull()

Keep only elements that have a bounding box.

public FilteredElementCollector WhereBoundingBoxIsNotNull()

Returns

FilteredElementCollector

WhereElementIsElementType()

Keep only type/symbol elements (not instances). Keeps elements whose ID is referenced as a type by other elements.

public FilteredElementCollector WhereElementIsElementType()

Returns

FilteredElementCollector

WhereElementIsNotElementType()

Keep only instance elements (not type definitions). Excludes elements whose ID is referenced as a type by other elements.

public FilteredElementCollector WhereElementIsNotElementType()

Returns

FilteredElementCollector

WhereHasFaces()

Keep only elements that have face geometry.

public FilteredElementCollector WhereHasFaces()

Returns

FilteredElementCollector

WhereHasGeometry()

Keep only elements that have GRep geometry (faces).

public FilteredElementCollector WhereHasGeometry()

Returns

FilteredElementCollector

WhereHasParameter(string)

Keep only elements with a specific parameter name.

public FilteredElementCollector WhereHasParameter(string paramName)

Parameters

paramName string

Returns

FilteredElementCollector

WhereHasParameter(BuiltInParameter)

Keep only elements with a specific BuiltInParameter.

public FilteredElementCollector WhereHasParameter(BuiltInParameter bip)

Parameters

bip BuiltInParameter

Returns

FilteredElementCollector

WhereHasParameters()

Keep only elements that have parameters.

public FilteredElementCollector WhereHasParameters()

Returns

FilteredElementCollector