Retrieves a box that circumscribes all geometry of the element.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public BoundingBoxXYZ this[
View A_0
] { get; }Parameters
- A_0 View
-
Property Value
BoundingBoxXYZ
Remarks
Pass in a view to query view-specific (e.g., cut) geometry or
null for model
geometry. If the view box is not known or cannot be calculated, this will return the model box;
if the model box is not known,
this will return
null. The box will always be aligned to the default axes of the
model coordinate system (thus no rotation should be applied to the return value).
Also note that this bounding box volume
may enclose 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.
Example
C#
private void GetElementBoundingBox(Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.Element element)
{
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();
TaskDialog.Show("Revit",info);
}
VB
Private Sub GetElementBoundingBox(document As Autodesk.Revit.DB.Document, element As Autodesk.Revit.DB.Element)
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()
TaskDialog.Show("Revit", info)
End Sub
See Also
Reference