2024 Class
Changes 1
C

ViewCropRegionShapeManager

Description:
A class that provides access to settings related to the crop assigned to a view or a reference callout.
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.

Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.ViewCropRegionShapeManager
public class ViewCropRegionShapeManager : IDisposable
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
            }
        }
    }
}
Name Return Type Description
M Dispose() None Releases all resources used by the
M GetAnnotationCropShape() CurveLoop Gets the annotation crop box assigned to the view.
M GetCropShape() The crop boundaries. Gets the crop boundaries that are curently active.
M GetSplitRegionMaximum(Int32) double Returns the proportional location of the maximum boundary of the specified split crop region.
M GetSplitRegionMinimum(Int32) double Returns the proportional location of the minimum boundary of the specified split crop region.
M GetSplitRegionOffset(Int32) XYZ Returns the offset for the specified split crop region.
M IsCropRegionShapeValid(CurveLoop) bool 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.
M RemoveCropRegionShape() None Removes any non-rectangular boundary of the view's crop.
M RemoveSplit() None Removes any split applied to the view's crop.
M RemoveSplitRegion(Int32) None Removes one region in split crop.
M SetCropShape(CurveLoop) None Sets the boundary of the view's crop to the specified shape.
M SplitRegionHorizontally(Int32, Double, Double) None Splits horizontally one region in split crop.
M SplitRegionVertically(Int32, Double, Double) None Splits vertically one region in split crop.
Name Return Type Description
P BottomAnnotationCropOffset double The offset from the bottom of the view crop that determines the location of the annotation crop bottom boundary.
P CanBeSplit bool Verifies that the crop of the associated view is permitted to have multiple regions.
P CanHaveAnnotationCrop bool Verifies that the view is allowed to have an annotation crop.
P CanHaveShape bool Verifies that the crop of the associated view is permitted to have a non-rectangular shape.
P IsSplitHorizontally bool Whether or not the view's crop is split (and the split is horizontal).
P IsSplitVertically bool Whether or not the view's crop is split (and the split is vertical).
P IsValidObject bool Specifies whether the .NET object represents a valid Revit entity.
P LeftAnnotationCropOffset double The offset from the left of the view crop that determines the location of the annotation crop left boundary.
P NumberOfSplitRegions int The number of split crop regions (1 if the crop is not currently split).
P RightAnnotationCropOffset double The offset from the right of the view crop that determines the location of the annotation crop right boundary.
P ShapeSet bool Whether or not the view crop has a non-rectangular shape set.
P Split bool Whether or not the view crop is split.
P TopAnnotationCropOffset double The offset from the top of the view crop that determines the location of the annotation crop top boundary.