SetSectionBox Method


Sets the section box for this 3D view.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.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.DBBoundingBoxXYZ
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

CopyC#
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

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException Bounding box cannot be empty.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsInvalidOperationException Returns true if the view is not a view template.

See Also