SetSectionBox Method


Sets the section box for this 3D view.

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

Syntax

C#
public void SetSectionBox(
	BoundingBoxXYZ boundingBoxXYZ
)
Visual Basic
Public Sub SetSectionBox ( _
	boundingBoxXYZ As BoundingBoxXYZ _
)
Visual C++
public:
void SetSectionBox(
	BoundingBoxXYZ^ boundingBoxXYZ
)

Parameters

boundingBoxXYZ
Type: Autodesk.Revit.DB 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.

Examples

Copy 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);
}

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException Bounding box cannot be empty.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions InvalidOperationException Returns true if the view is not a view template.

See Also