View |
Sets the section box for this 3D view.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Parameters
- boundingBoxXYZ BoundingBoxXYZ
- The bounding box to use for the section box. To turn off the section box, set IsSectionBoxActive to false. Individual bound enabled flags in the input box are ignored.
| Exception | Condition |
|---|---|
| ArgumentException | Bounding box cannot be empty. |
| ArgumentNullException | A non-optional argument was null |
| InvalidOperationException | Returns true if the view is not a view template. |
C#
private void ExpandSectionBox(View3D view)
{
// The original section box
BoundingBoxXYZ sectionBox = view.GetSectionBox();
// Expand the section box (doubling in size in all directions while preserving the same center and orientation)
Autodesk.Revit.DB.XYZ deltaXYZ = sectionBox.Max - sectionBox.Min;
sectionBox.Max += deltaXYZ / 2;
sectionBox.Min -= deltaXYZ / 2;
//After resetting the section box, it will be shown in the view.
//It only works when the Section Box is active
view.SetSectionBox(sectionBox);
}