BoundingBox Property
Retrieves a box that circumscribes all geometry of the element.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public BoundingBoxXYZ this[
	View A_0
] { get; }
Visual Basic
Public ReadOnly Property BoundingBox ( _
	A_0 As View _
) As BoundingBoxXYZ
	Get
Visual C++
public:
property BoundingBoxXYZ^ BoundingBox[View^ A_0] {
	BoundingBoxXYZ^ get (View^ A_0);
}

Parameters

A_0
Type: Autodesk.Revit.DB..::..View

Remarks

Pass in a view to query view-specific (e.g., cut) geometry or nullNothingnullptra null reference (Nothing in Visual Basic) for model geometry. If view box is not known, will return model box; if model box is not known, will return nullNothingnullptra null reference (Nothing in Visual Basic). Also note that this bounding box value may include geometry that is not obvious. For example, the "flip controls" that could be part of a family will be included in the computation of the bounding box even though they are not always visible in the family instance of the family.

Examples

CopyC#
private void GetElementBoundingBox(Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.Element element)
{
    // Get the BoundingBox instance for current view.
    BoundingBoxXYZ box = element.get_BoundingBox(document.ActiveView);
    if (null == box)
    {
        throw new Exception("Selected element doesn't contain a bounding box.");
    }

    string info = "Bounding box is enabled: " + box.Enabled.ToString();

    // Give the user some information.
    TaskDialog.Show("Revit",info);
}
CopyVB.NET
Private Sub GetElementBoundingBox(document As Autodesk.Revit.DB.Document, element As Autodesk.Revit.DB.Element)
    ' Get the BoundingBox instance for current view.
    Dim box As BoundingBoxXYZ = element.BoundingBox(document.ActiveView)
    If box Is Nothing Then
        Throw New Exception("Selected element doesn't contain a bounding box.")
    End If

    Dim info As String = "Bounding box is enabled: " & box.Enabled.ToString()

    ' Give the user some information.
    TaskDialog.Show("Revit", info)
End Sub

See Also