一部のビューのトリミング領域は、Revit API を使用して変更できる場合があります。ViewCropRegionShapeManager.Valid プロパティは、ビューにトリミング領域のシェイプの管理を許可するかどうか、ShapeSet プロパティはシェイプが設定されたかどうかを示します。次の例では、部屋の境界のまわりをトリミングしています。
|
コード領域: ビューのトリミング |
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
}
}
}
}
|