ViewCropRegionShapeManager
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.
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)
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 } } }}