ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / VoxelLayerCreationParams Class / SetDefaultVariable Method
The variable param to be set as the default
Example

In This Topic
    SetDefaultVariable Method
    In This Topic
    Sets the default variable profile after the layer creation. Any current default is cleared.
    Syntax
    Public Sub SetDefaultVariable( _
       ByVal variable As VoxelVariableCreationParams _
    ) 
    public void SetDefaultVariable( 
       VoxelVariableCreationParams variable
    )

    Parameters

    variable
    The variable param to be set as the default
    Remarks
    The variable must be contained in the Variables list or setting it as default will have no effect. See also ArcGIS.Desktop.Mapping.Voxel.VoxelVariableProfile
    Example
    Create Voxel Layer
    {
      // Note: call within QueuedTask.Run()
      {
        //Must be a .NetCDF file for voxels
        var url = @"C:\MyData\AirQuality_Redlands.nc";
        var cim_connection = new CIMVoxelDataConnection()
        {
          URI = url
        };
        //Create a VoxelLayerCreationParams
        var createParams = VoxelLayerCreationParams.Create(cim_connection);
        createParams.IsVisible = true;
    
        //Can also just use the path directly...
        //var createParams = VoxelLayerCreationParams.Create(url);
    
        //Use VoxelLayerCreationParams to enumerate the variables within
        //the voxel
        var variables = createParams.Variables;
        foreach (var variable in variables)
        {
          var line = $"{variable.Variable}: {variable.DataType}, " +
             $"{variable.Description}, {variable.IsDefault}, {variable.IsSelected}";
          System.Diagnostics.Debug.WriteLine(line);
        }
        //Optional: set the default variable
        createParams.SetDefaultVariable(variables.Last());
    
        //Create the layer - map must be a local scene
        voxelLayer = LayerFactory.Instance.CreateLayer<VoxelLayer>(createParams, map);
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also