In Revit API, Spatial Elements are represented by the DB.SpatialElement. This type is then used to create custom spatial types for Rooms (DB.Architecture.Room), Spaces (DB.Mechanical.Space), and Areas (DB.Area). DB.Space elements can be grouped by HVAC Zones (DB.Mechanical.Zone)

Querying Spatial Elements

Use a combination of category component, connected Category Filter to collect specific Spatial Elements:

Querying Separation Lines

To find the separation (or boundary) lines associated with a category of spatial elements (e.g. Rooms, Areas, Spaces) use the Separation Lines dropdown component shared here. This component helps filtering down the list of categories to the separation lines. The output can be used with Category Filter and Query Elements components to grab the desired separation lines from the model.

Separation Lines
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Querying Area Schemes

Area Schemes are container for Area element. Each Area Schemes can contain many Area element, host on various levels. Area plans are directly associated with a Level (just like any other plan view) and also a specific Area Scheme. This is why you would see the Area Scheme name in parentheses in front of the Area plan name e.g. My Area Plan (Gross Building).

Use the Get Area Schemes component shared here to query the available Area Schemes. Note that Area Schemes are Elements and you can use the Element.Identity component to grab their Name:

Grabbing the name as shown above, can help filtering Area Schemes by their Name:

 

Get Area Schemes
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Querying HVAC Zones

HVAZ Zones can be collected just like any other element type:

Analyzing Spatial Elements

Use the Analyse Spatial Element component shared here to get the common properties of Spatial Elements:

Analyse Spatial Element
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Filtering Spatial Elements by Level

The component shared above can be used to filter the Spatial Elements by level:

Getting Spatial Element Geometry

To grab the most accurate geometry of a spatial element, use the custom Analyse Spatial Element (shared above) and Boundary Location components shared here.

Boundary Location
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Currently Revit API does not return geometry for CoreBoundary and CoreCenter boundary locations

Make sure that the Area and Volume is checked under Area and Volume Computations configuration in your Revit model. Otherwise room geometry is not going to be correctly bound at the top and bottom.

Here is an example of using this workflow to get geometry of rooms:

Spatial Elements as Containers

Sometimes it is necessary to use the spatial elements as spatial containers, meaning that you would want a single surface separating two containers from each other and not two overlapping surfaces that you would usually get when extracting spatial element geometries.

This is an example of a geometry extracted from spatial elements. Each space has its own closed geometry. See the orange and light gray boxes representing two independent spatial elements:

Using the NonManifold Merge component shared here, you can merge the geometries shown above into a single Brep with single faces separating the containers. See the single red surface in the image below, separating the orange and light gray containers:

Make sure to grab the Center location lines when working with spatial containers. The extracted geometry is then passed to NonManifold Merge component to be merged:

 

NonManifold Merge
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Analyzing Area Schemes

Use the Analyse Area Scheme component shared here to analyze the Area Scheme elements:

 

Analyse Area Scheme
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Analyzing Areas

Use the Analyse Area component shared here to analyze the Area elements:

Analyse Area
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Filtering Areas by Area Scheme

Use the Analyse Area component shared above to filter the Area elements by their associated Area Scheme:

Creating Separation Lines

Area Boundary Lines

To create area boundary lines, use the Create Area Boundaries component shared here. The component needs an Area Plan and curves as input.

Create Area Boundaries
Place under Grasshopper User Objects folder. Find in Revit > Custom panel