ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMAutoCamera Class / Extent Property
Example

In This Topic
    Extent Property (CIMAutoCamera)
    In This Topic
    Gets or sets the extent for a map frame when using the fixed constraint.
    Syntax
    public Envelope Extent {get; set;}
    Public Property Extent As Envelope
    Example
    SetAutoCameraFixedExtent
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.Fixed;
    autoCamera.AutoCameraType = AutoCameraType.Extent;
    
    var mf_extent = mf.GetViewExtent();
    
    var extent = EnvelopeBuilderEx.CreateEnvelope(
      400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
    autoCamera.Extent = extent;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also