Description
To get all rooms in Revit, you may be 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
1 2 3 4 5 6 7 8 9 10 |
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); |