GetAllElementsOfCategory
IEnumerable<Element> GetAllElementsOfCategory(this Document doc, BuiltInCategory builtInCategory, bool includeTypes = false)Collects all elements of a given built-in category, optionally including element types.
Parameters
- docDocument
The Revit document instance.
- builtInCategoryBuiltInCategory
The built-in category to filter by.
- includeTypesbool
If true, returns element types; otherwise returns only instance elements.
Returns: A collection of elements in the specified category.
Example
var walls = doc.GetAllElementsOfCategory(BuiltInCategory.OST_Walls);foreach (var w in walls){ TaskDialog.Show("Wall", w.Name);}