Getting al rooms with c# — Digitteck
Getting al rooms with c#
dotnet·8 February 2018·1 min read

Getting al rooms with c#

Description

To get all rooms in Revit, you may first try to filter elements by Room type, however this will yield no results. Instead you will have to check against SpatialElement type and check if it's a room.

Solution

csharp
FilteredElementCollector filteredElementCollector
    = new FilteredElementCollector(aDocument);

filteredElementCollector.OfClass(typeof(SpatialElement));

IList<Room> m_RoomList = new List<Room>();

foreach (SpatialElement room in filteredElementCollector)
    if (room is Room)
        m_RoomList.Add((Room)room);

Tags

RevitC#Dynamo.NET
digitteck

© 2026 Digitteck