ViewCropRegionShapeManager Class


View Crop Region Shape Manager Class

A class that provides access to settings related to the crop assigned to a view or a reference callout.
Inheritance Hierarchy
System Object
Autodesk.Revit.DB ViewCropRegionShapeManager

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class ViewCropRegionShapeManager : IDisposable

The ViewCropRegionShapeManager type exposes the following members.

Properties
Name Description
Public property BottomAnnotationCropOffset The offset from the bottom of the view crop that determines the location of the annotation crop bottom boundary.
Public property CanBeSplit Verifies that the crop of the associated view is permitted to have multiple regions.
Public property CanHaveAnnotationCrop Verifies that the view is allowed to have an annotation crop.
Public property CanHaveShape Verifies that the crop of the associated view is permitted to have a non-rectangular shape.
Public property IsSplitHorizontally Whether or not the view's crop is split (and the split is horizontal).
Public property IsSplitVertically Whether or not the view's crop is split (and the split is vertical).
Public property IsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public property LeftAnnotationCropOffset The offset from the left of the view crop that determines the location of the annotation crop left boundary.
Public property NumberOfSplitRegions The number of split crop regions (1 if the crop is not currently split).
Public property RightAnnotationCropOffset The offset from the right of the view crop that determines the location of the annotation crop right boundary.
Public property ShapeSet Whether or not the view crop has a non-rectangular shape set.
Public property Split Whether or not the view crop is split.
Public property TopAnnotationCropOffset The offset from the top of the view crop that determines the location of the annotation crop top boundary.
Top
Methods
Name Description
Public method Dispose Releases all resources used by the ViewCropRegionShapeManager
Public method Equals Determines whether the specified object is equal to the current object.
(Inherited from Object )
Public method GetAnnotationCropShape Gets the annotation crop box assigned to the view.
Public method GetCropShape Gets the crop boundaries that are curently active.
Public method GetHashCode Serves as the default hash function.
(Inherited from Object )
Public method GetSplitRegionMaximum Returns the proportional location of the maximum boundary of the specified split crop region.
Public method GetSplitRegionMinimum Returns the proportional location of the minimum boundary of the specified split crop region.
Public method GetSplitRegionOffset Returns the offset for the specified split crop region.
Public method GetType Gets the Type of the current instance.
(Inherited from Object )
Public method IsCropRegionShapeValid Verifies that boundary represents one closed curve loop without self-intersections, consisting of non-zero length straight lines in a plane parallel to the view plane.
Public method RemoveCropRegionShape Removes any non-rectangular boundary of the view's crop.
Public method RemoveSplit Removes any split applied to the view's crop.
Public method RemoveSplitRegion Removes one region in split crop.
Public method SetCropShape Sets the boundary of the view's crop to the specified shape.
Public method SplitRegionHorizontally Splits horizontally one region in split crop.
Public method SplitRegionVertically Splits vertically one region in split crop.
Public method ToString Returns a string that represents the current object.
(Inherited from Object )
Top
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.

Example
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
            }
        }
    }
}
See Also