ViewCropRegionShapeManager Class


A class that provides access to settings related to the crop assigned to a view or a reference callout.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 16.0.0.0 (16.0.0.0)
Since: 2014

Syntax

C#
public class ViewCropRegionShapeManager : IDisposable
Visual Basic
Public Class ViewCropRegionShapeManager _
	Implements IDisposable
Visual C++
public ref class ViewCropRegionShapeManager : IDisposable

Remarks

This class manages all the settings that make up the model and annotation crop geometry for a given view or reference callout. You can obtain the settings for a view from GetCropRegionShapeManager . Obtain the settings for a reference callout from GetCropRegionShapeManagerForReferenceCallout(Document, ElementId) .

The model crop region crops model elements, detail elements (such as insulation and detail lines), section boxes, and scope boxes at the model crop boundary. Visible crop boundaries of other related views are also cropped at the model crop boundary. The model crop region can be set as a polygonal boundary, a rectangular boundary, or rectangular boundary with one or more splits applied either horizontally or vertically. If a split is applied to the rectangular crop each resulting rectangular region is identified by a region index and occupies a percentage of the original crop rectangle. The regions may possibly be moved relative to one another.

The annotation crop region fully crops annotation elements when it touches any portion of the annotation element, so that no partial annotations are drawn. Annotations (such as symbols, tags, keynotes, and dimensions) that reference hidden or cropped model elements do not display in the view, even if they are inside the annotation crop region. The annotation crop region is always rectangular and at minimum occupies the same area as the rectangular model crop (or the corresponding rectangular boundary around the non-rectangular model crop), but can be offset to be bigger than the model crop in order to display more annotations.

Examples

Copy C#
public void CropAroundRoom(Room room, View view)
{
    if (view != null)
    {
        IList<IList<Autodesk.Revit.DB.BoundarySegment>> segments = room.GetBoundarySegments(new SpatialElementBoundaryOptions());

        if (null != segments)  //the room may not be bound
        {
            foreach (IList<Autodesk.Revit.DB.BoundarySegment> segmentList in segments)
            {
                CurveLoop loop = new CurveLoop();
                foreach (Autodesk.Revit.DB.BoundarySegment boundarySegment in segmentList)
                {
                    loop.Append(boundarySegment.GetCurve());
                }

                ViewCropRegionShapeManager vcrShapeMgr = view.GetCropRegionShapeManager();
                vcrShapeMgr.SetCropShape(loop);
                break;  // if more than one set of boundary segments for room, crop around the first one
            }
        }
    }
}
Copy VB.NET
Public Sub CropAroundRoom(room As Room, view As View)
    If view IsNot Nothing Then
        Dim segments As IList(Of IList(Of Autodesk.Revit.DB.BoundarySegment)) = room.GetBoundarySegments(New SpatialElementBoundaryOptions())

        If segments IsNot Nothing Then
            'the room may not be bound
            For Each segmentList As IList(Of Autodesk.Revit.DB.BoundarySegment) In segments
                Dim [loop] As New CurveLoop()
                For Each boundarySegment As Autodesk.Revit.DB.BoundarySegment In segmentList
             [loop].Append(boundarySegment.GetCurve())
                Next

                Dim vcrShapeMgr As ViewCropRegionShapeManager = view.GetCropRegionShapeManager()
                vcrShapeMgr.SetCropShape([loop])
                ' if more than one set of boundary segments for room, crop around the first one
                Exit For
            Next
        End If
    End If
End Sub

Inheritance Hierarchy

System Object
Autodesk.Revit.DB ViewCropRegionShapeManager

See Also