Provides access to view crop region shape settings.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2014
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Remarks
Can be obtained from view or reference callout.
Examples

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.Curve);
}
ViewCropRegionShapeManager vcrShapeMgr = view.GetCropRegionShapeManager();
vcrShapeMgr.SetCropRegionShape(loop);
break; // if more than one set of boundary segments for room, crop around the first one
}
}
}
}

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.Curve)
Next
Dim vcrShapeMgr As ViewCropRegionShapeManager = view.GetCropRegionShapeManager()
vcrShapeMgr.SetCropRegionShape([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