SpatialElementGeometryCalculator Class


Spatial Element Geometry Calculator Class

Use this class to calculate the geometry of a spatial element and obtain the relationships between the geometry and the element's boundary elements.
Inheritance Hierarchy
System Object
Autodesk.Revit.DB SpatialElementGeometryCalculator

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class SpatialElementGeometryCalculator : IDisposable

The SpatialElementGeometryCalculator type exposes the following members.

Constructors
Name Description
Public method SpatialElementGeometryCalculator(Document) Constructs a new calculator with default options for the geometry of spatial elements.
Public method SpatialElementGeometryCalculator(Document, SpatialElementBoundaryOptions) Constructs a new calculator for the geometry of spatial elements.
Top
Properties
Name Description
Public property IsValidObject Specifies whether the .NET object represents a valid Revit entity.
Top
Methods
Name Description
Public method CalculateSpatialElementGeometry Compute the spatial element geometry and returns the boundary face information.
Public method Static member CanCalculateGeometry This indicates whether the input spatial element is a valid one.
Public method Dispose Releases all resources used by the SpatialElementGeometryCalculator
Public method Equals Determines whether the specified object is equal to the current object.
(Inherited from Object )
Public method GetHashCode Serves as the default hash function.
(Inherited from Object )
Public method GetOptions The options that control the calculation.
Public method GetType Gets the Type of the current instance.
(Inherited from Object )
Public method Static member IsRoomOrSpace This indicates whether the input spatial element is a room or a space.
Public method ToString Returns a string that represents the current object.
(Inherited from Object )
Top
Remarks
This class maintains an internal cache for geometry it has already processed. If you intend to calculate geometry for several elements in the same project you should use a single instance of this class. Note that the cache will be cleared when any change is made to the document.
Example
// Calculate a room's geometry and find its boundary faces
SpatialElementGeometryCalculator calculator = new SpatialElementGeometryCalculator(doc);
SpatialElementGeometryResults results = calculator.CalculateSpatialElementGeometry(room); // compute the room geometry 
Solid roomSolid = results.GetGeometry(); // get the solid representing the room's geometry
foreach (Face face in roomSolid.Faces)
{
    double faceArea = face.Area;
    IList<SpatialElementBoundarySubface> subfaceList = results.GetBoundaryFaceInfo(face); // get the sub-faces for the face of the room
    foreach (SpatialElementBoundarySubface subface in subfaceList)
    {
        if (subfaceList.Count > 1) // there are multiple sub-faces that define the face
        {
            double subfaceArea = subface.GetSubface().Area; // get the area of each sub-face
            // sub-faces exist in situations such as when a room-bounding wall has been
            // horizontally split and the faces of each split wall combine to create the 
            // entire face of the room
        }
    }
}
See Also