ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / GridOptions Class / SetGridOrigin Method / SetGridOrigin(Coordinate3D) Method
The origin of the grid. Z value, i.e. grid elevation, must be in meters
Example

In This Topic
    SetGridOrigin(Coordinate3D) Method
    In This Topic
    Sets the origin of the grid.
    Syntax
    Public Overloads Sub SetGridOrigin( _
       ByVal origin3D As Coordinate3D _
    ) 
    public void SetGridOrigin( 
       Coordinate3D origin3D
    )

    Parameters

    origin3D
    The origin of the grid. Z value, i.e. grid elevation, must be in meters
    Remarks
    The X and Y units must be in the spatial reference of the map on which the grid will be shown. Addins are responsible for performing any necessary projection of values prior to calling this method. Grid origin elevation - i.e. "Z" must be in meters. Grid elevation specifies the z-value height (in meters) at which the grid will appear in a 3D scene otherwise it is ignored.
    Example
    Set Grid Origin for Grid Options for a Map
    {
        //assume
        //var map = MapView.Active.Map;
        var center_pt = MapView.Active.Extent.Center;
        var width = MapView.Active.Extent.Width;
        var height = MapView.Active.Extent.Height;
        var qtr_width = width * 0.25;
        var qtr_ht = height * 0.25;
    
        QueuedTask.Run(() =>
        {
            //If grid options have not been set for the map, then default grid options are added
            //for the map and returned otherwise the existing gridoptions are returned.
            //NOTE: Grid options are by value meaning a copy is returned. Any changes made to the
            //grid options need to be -set- back on the map using SetGridOptions for the changes to persist.
            var gridOptions = GridOptionsEnvironment.Instance.GetGridOptions(map);
    
            //Set the grid origin
            var x1 = center_pt.X + qtr_width;
            var y1 = center_pt.Y + qtr_ht;
            gridOptions.SetGridOrigin(new Coordinate2D(x1, y1));
            //or use Coordinate3D
            gridOptions.SetGridOrigin(new Coordinate3D(x1, y1, 0));
    
            //To apply changes, the gridoptions must be set back on the map
            GridOptionsEnvironment.Instance.SetGridOptions(map, gridOptions);
        });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.7 or higher.
    See Also