ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / VoxelLayer Class / SetCartographicOffset Method
Example

In This Topic
    SetCartographicOffset Method
    In This Topic
    Sets the cartographic offset. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetCartographicOffset( 
       double offsetInMeters
    )
    Public Sub SetCartographicOffset( _
       ByVal offsetInMeters As Double _
    ) 

    Parameters

    offsetInMeters
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run
    Example
    Lighting Properties, Offset, Vertical Exaggeration
    {
      await QueuedTask.Run(() =>
      {
        //Offset
        var offset = voxelLayer.CartographicOffset;
        //apply an offset
        voxelLayer.SetCartographicOffset(offset + 100.0);
    
        //VerticalExaggeration
        var exaggeration = voxelLayer.VerticalExaggeration;
        //apply an exaggeration
        voxelLayer.SetVerticalExaggeration(exaggeration + 100.0);
    
        //Change the exaggeration mode to "ScaleZ" - corresponds to 'Z-coordinates'
        //on the Layer properties UI - must use the CIM
        var def = voxelLayer.GetDefinition() as CIMVoxelLayer;
        def.Layer3DProperties.ExaggerationMode = ExaggerationMode.ScaleZ;
        //can set vertical exaggeration via the CIM also
        //def.Layer3DProperties.VerticalExaggeration = exaggeration + 100.0;
    
        //apply the change
        voxelLayer.SetDefinition(def);
    
        //Diffuse Lighting
        if (!voxelLayer.IsDiffuseLightingEnabled)
        {
          voxelLayer.SetDiffuseLightingEnabled(true);
        }
    
        var diffuse = voxelLayer.DiffuseLighting;
        //set Diffuse lighting to a value between 0 and 1
        voxelLayer.SetDiffuseLighting(0.5); //50%
    
        //Specular Lighting
        if (!voxelLayer.IsSpecularLightingEnabled)
        {
          voxelLayer.SetSpecularLightingEnabled(true);
        }
    
        var specular = voxelLayer.SpecularLighting;
        //set Diffuse lighting to a value between 0 and 1
        voxelLayer.SetSpecularLighting(0.5); //50%
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also