Latest news
TutorialsRevit

Creating Rooms and Reading Their Boundaries with the Revit API: A Step-by-Step Guide

This guide covers creating a room on a level with the Revit API, reading its boundaries, and updating those boundaries after model changes. We also highlight version differences in the API documentation.

A sectional perspective of a contemporary interior with clearly defined room boundariesAI image
Representative image, generated with AI.Image: 3dsınıfı / FCA AI

In brief

  1. The Revit API SDK can be installed from the Tools and Utilities section of the Revit installation.
  2. The API can create a room on a level using a UV location.
  3. GetBoundarySegments() returns room boundaries as lists of segments; it may return null if the room is not in a closed region or exists only in a schedule.
  4. The Revit 2025 user documentation and the Revit 2018 API room example refer to different versions; check that the code is compatible with your target Revit version.

What will you learn in this guide?

In Revit, room objects are used to define spaces within a building. Whether the elements enclosing a room are designated as room-bounding affects calculations such as perimeter and area. The Revit API can be used to create rooms, read their properties, and inspect their boundary geometry.

By the end of this guide, you’ll understand the basic workflow for creating a room on a level through the API, how to retrieve room boundary segments, and why you need to query them again after making model changes. The room API example appears in Autodesk’s Revit 2018 developer guide, while user-facing explanations of room behavior are in the Revit 2025 documentation. Treat the examples as a starting point to verify against the SDK documentation for your target version—not as code guaranteed to work unchanged in every release.

Requirements and setup

  • Software: You’ll need Revit and a development environment suitable for API development. Autodesk says the Revit API SDK is installed from the Tools and Utilities section of the Revit installation.

  • Documentation and examples: The SDK includes sample files that can help you understand how to use the API. The examples also include .addin manifest files. The information in the manifest must be configured and the file placed in an appropriate folder that Revit checks on startup.

  • Development: Autodesk’s guide has a separate section on debugging in Microsoft Visual Studio. Use the SDK and API reference for your target Revit version.

  • Account and license: The source documents do not explain account requirements or licensing costs for implementing this example.

  • Before you begin, note which version of Revit you’ll be using. Check whether the online example is from the same period as the API reference for your installed version. The room API discussion here is based on the Revit 2018 guide, while the user documentation comes from the Revit 2025 page. This version difference makes it especially important to verify that the API calls and development environment are suitable.

    1. Understand rooms and their boundaries

    A room’s geometric extent is determined by the building elements that enclose it and are treated as room-bounding in the model. Elements such as walls, floors, roofs, and ceilings can affect this calculation. In Revit, the Room Bounding property can be turned on or off for many elements; room separation lines can be used to divide an area where there are no room-bounding elements.

    In the user interface, rooms can be placed only in plan views. Early in the design process, before walls or other room-bounding elements have been drawn, rooms can be added to a room schedule. Once the boundaries are ready, those rooms can be placed in the plan. The API guide also distinguishes between a room in a schedule that has no plan location and a room placed in the model.

    This distinction matters when retrieving boundary data through the API. A room that exists only in a schedule may not have segments around a location. Similarly, if a room in a plan view does not form a closed region, the boundary method may not return the expected list.

    2. Create a room on a level with the API

    In Autodesk’s API example, the room location is specified using the UV structure, and the room is created on the selected Level. The following example shows the same basic call:

    csharp
    UV odaKonumu = new UV(0, 0);
    Room oda = document.Create.NewRoom(level, odaKonumu);
    
    if (oda == null)
    {
        throw new Exception("Oda oluşturulamadı.");
    }

    Here, document represents the project document, and level is the level on which the room will be created. (0, 0) is the coordinate used in the source example; use an appropriate UV value for the room’s location in your project. The room creation call may return null, so check the result before proceeding. This code snippet is not a Revit add-in on its own; verify the application context in which it will run and the API for your target version.

    Another workflow is to first create a room without a location in a room schedule, then place it in a plan through a PlanCircuit. According to Autodesk’s guide, the room must already exist in the schedule; the placement operation creates a model room with the same name and number. The plan circuit to use is obtained from the plan topology for the relevant level. This method may be useful when the room list is prepared early in the design and spaces are added to the plan later.

    3. Read room boundaries

    The boundary segments around a room are retrieved with SpatialElement.GetBoundarySegments(). The method returns the segments that make up each boundary region as nested lists. Since a room can have more than one region, don’t assume the result will always consist of a single continuous boundary. The result may be null if the room is not in a closed region or exists only in a schedule.

    csharp
    IList<IList<BoundarySegment>> sinirlar =
        oda.GetBoundarySegments(new SpatialElementBoundaryOptions());
    
    if (sinirlar == null)
    {
        return;
    }
    
    foreach (IList<BoundarySegment> bolge in sinirlar)
    {
        foreach (BoundarySegment parca in bolge)
        {
            Curve sinirEgrisi = parca.Curve;
            // Sınır eğrisini burada inceleyin.
        }
    }

    Each item in the outer list represents a region, while the items in the inner list represent that region’s segments. Autodesk’s guide explains that boundary geometry can be inspected through BoundarySegment, and that the segment’s curve can be accessed. However, information about the element associated with a boundary may not always be available: in some cases, Element can return null while Curve is not empty. As a result, evaluating boundaries solely by element ID may produce incomplete results.

    The Room Bounding property must be enabled for elements such as walls, columns, and roofs to be included in a room boundary. If model curves are used, room separation lines must also comply with the relevant category and boundary rules. The source guide notes that an element may not appear in the boundary data if it has not been designated as a room boundary.

    4. Refresh the data after model changes

    Creating a new element, such as a wall, through the API can change a room’s boundary. Don’t treat a segment list retrieved before the change as current afterward. In Autodesk’s API example, the room boundary is queried again after the wall creation operation is completed within a transaction.

    One detail about room names and tags can also help avoid confusion during implementation. According to the API guide, Room.Name returns the room name and number together. To retrieve only the room name, use the built-in ROOM_NAME parameter. Also, RoomTag.Name is assigned automatically, so trying to change this property manually can cause an error.

    Common mistakes

    • Not checking the result: The boundary method may return null if the room is not in a closed region or exists only in a schedule. Check for this before processing the list.

    • Assuming a scheduled room is placed in a plan: A room added to a schedule may not yet have a plan location. Treat room creation and plan placement as separate scenarios.

    • Overlooking the Room Bounding property: If this property is disabled for an element expected to define a boundary, the element may not be included in the room perimeter.

    • Using stale boundary data: Call GetBoundarySegments() again after an operation that affects boundaries, such as adding a wall.

    • Ignoring version differences: Before using the Revit 2018 API example with a newer installation, check it against the SDK and API documentation for your target version.

    Next steps

    Start by testing the workflow for creating a room and reading its boundaries in a copy of a project, using a closed space on a single level. Then explore the workflow for placing a room from a schedule into a plan circuit. Refer to the API documentation for the Revit version you’re using at each step; retrieve boundary data again after operations that change geometry, such as adding a wall. Before moving on to multiple rooms, different plan topologies, or phases, confirm that the basic workflow produces the expected result in your installed version.

    Sources and licensing

    This guide is adapted into English from Autodesk’s Revit API developer documentation, Revit room user documentation, and Revit API SDK information. The sources are freely accessible Autodesk help pages. The room API example comes from the Revit 2018 developer guide, while the user-facing explanations of room behavior are from the Revit 2025 documentation; the version difference is noted accordingly.

    Sources

    3 sources
    H
    help.autodesk.comhelp.autodesk.com/view/RVT/2025/ENU
    Summary
    H
    help.autodesk.comhelp.autodesk.com/cloudhelp/2018/ENU/Revit-API/Revit_API_Developers_Guide/Discipline_Specific_Functionality/Architecture/Rooms.html
    Summary
    H
    help.autodesk.comhelp.autodesk.com/view/RVT/2025/ENU
    Summary

    Source texts are not republished; short quotes are marked, everything else is our own summary and commentary.

    3dsınıfı’s take
    3dEditor’s assessment

    Using room and boundary data through the Revit API can be useful for office automation that connects spatial information to the model and for recurring checks. However, it’s important to set aside time not only to write code but also to install the right SDK and match the example to the Revit version in use.

    For offices and students in Turkey, testing in a small copy of a model is a cautious approach. The sources do not explain licensing costs or hardware requirements, so it would be unwise to assume any advantages in those areas. Keep in mind that the Revit 2018 API example and the 2025 user documentation refer to different versions, and verify compatibility using the documentation for your installed version.

    Frequently asked questions

    How do you create a room with the Revit API?

    In Autodesk’s API guide, a room is created by calling `document.Create.NewRoom` with a `Level` and a `UV` value specifying its location. The call may return null, so check the result.

    How do you retrieve room boundaries in the Revit API?

    `SpatialElement.GetBoundarySegments()` returns room boundaries as lists of segments. The result may be null if the room is not in a closed region or exists only in a schedule.

    Where can you install the Revit API SDK from?

    According to Autodesk, the SDK is installed from the Tools and Utilities section of the Revit installation. The SDK includes sample files and `.addin` manifest examples.

    Comments and the forum are in Turkish.Join the discussion
    +

    Related news