BoundingBoxXYZ
A three-dimensional rectangular box at an arbitrary location and orientation within the Revit model.
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.BoundingBoxXYZ
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class BoundingBoxXYZ : APIObject
The BoundingBoxXYZ type exposes the following members.
Constructors
Name
Description
Public Method
BoundingBoxXYZ
Constructs a new BoundingBoxXYZ with a default transform and extents of (-100, -100, -100) to (100, 100, 100).
Properties
Name
Description
Public Property
BoundEnabled
Indexed access for loops.
Public Property
Bounds
Indexed access for loops. Use 0 for Min and 1 for Max.
Public Property
Enabled
Defines whether the entire bounding box is enabled.
Public Property
Code Example
IsReadOnly
Identifies if the object is read-only or modifiable.
(Inherited from APIObject)
Public Property
IsSet
Indicates whether the bounding box is set.
Public Property
Max
Maximum coordinates (upper-right-front corner of the box).
Public Property
MaxEnabled
Defines whether the maximum bound is active for given dimension.
Public Property
Min
Minimum coordinates (lower-left-rear corner of the box).
Public Property
MinEnabled
Defines whether the minimum bound is active for given dimension.
Public Property
Code Example
Transform
The transform from the coordinate space of the box to the model coordinate space.
Methods
Name
Description
Public Method
Dispose
Causes the object to release immediately any resources it may be utilizing.
(Inherited from APIObject)
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
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Remarks
BoundingBoxXYZ objects are used in Revit in several places related to views (for example, the section box of a 3D view or the definition of a section or detail view). BoundingBoxXYZ objects can also be obtained from elements representing the boundary of the element in a given view.
The extents of the box are determined by three orthogonal planes extended through the minimum ( Min) and maximum ( Max) points, but the coordinates of these points and the orientation of the planes in relation to the coordinates of the source model is determined by the box Transform ( Transform).
This class also has the ability to detect and mark certain extents as disabled. Note that in the current Revit API uses of this class it is not expected that Revit will give objects with disabled extents, and disabled extents in objects sent to Revit will likely be ignored.
Example
public void GetBoundingBoxXYZInfo(View3D view3D){ string message = "BoundingBoxXYZ : "; message += "\nView name : " + view3D.Name; BoundingBoxXYZ boundingBox = view3D.GetSectionBox(); // The section box of the 3D view can cut the model. if (view3D.IsSectionBoxActive) { BoundingBoxXYZ sectionBox = view3D.GetSectionBox();
// Note that the section box can be rotated and transformed. // So the min/max corners coordinates relative to the model must be computed via the transform. Transform trf = sectionBox.Transform;
XYZ max = sectionBox.Max; //Maximum coordinates (upper-right-front corner of the box before transform is applied). XYZ min = sectionBox.Min; //Minimum coordinates (lower-left-rear corner of the box before transform is applied).
// Transform the min and max to model coordinates XYZ maxInModelCoords = trf.OfPoint(max); XYZ minInModelCoords = trf.OfPoint(min);
message += "\nView has an active section box: "; message += "\n'Maximum' coordinates: " + maxInModelCoords; message += "\n'Minimum' coordinates: " + minInModelCoords; } TaskDialog.Show("Revit", message);}