ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVariableProfile Class / SetRenderer Method
The renderer to be set.
Example

In This Topic
    SetRenderer Method (VoxelVariableProfile)
    In This Topic
    Sets the variable profile's renderer object. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetRenderer( 
       CIMVoxelRenderer renderer
    )
    Public Sub SetRenderer( _
       ByVal renderer As CIMVoxelRenderer _
    ) 

    Parameters

    renderer
    The renderer to be set.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Change Stretch Renderer Color Range
    {
      //Typically, the default color range covers the most
      //commonly occurring voxel values. Usually, the data
      //range is much broader than the color range
    
      await QueuedTask.Run(() =>
      {
        //Get the variable profile whose renderer will be changed
        var variable = voxelLayer.SelectedVariableProfile;
    
        //Check DataType
        if (variable.DataType != VoxelVariableDataType.Continuous)
        {
          //must be continuous to have a Stretch Renderer...
        }
    
        var renderer = variable.Renderer as CIMVoxelStretchRenderer;
        var color_min = renderer.ColorRangeMin;
        var color_max = renderer.ColorRangeMax;
        //increase range by 10% of the current difference
        var dif = (color_max - color_min) * 0.05;
        color_min -= dif;
        color_max += dif;
    
        //make sure we do not exceed data range
    
        if (color_min < variable.Statistics.MinimumValue)
        {
          color_min = variable.Statistics.MinimumValue;
        }
    
        if (color_max > variable.Statistics.MaximumValue)
        {
          color_max = variable.Statistics.MaximumValue;
        }
    
        //variable.Statistics.MinimumValue
        renderer.ColorRangeMin = color_min;
        renderer.ColorRangeMax = color_max;
    
        //apply changes
        variable.SetRenderer(renderer);
      });
    }
    Change The Visibility on a CIMVoxelColorUniqueValue class
    {
      await QueuedTask.Run(() =>
      {
        //Get the variable profile whose renderer will be changed
        var variable = voxelLayer.SelectedVariableProfile;
    
        //Check DataType
        if (variable.DataType != VoxelVariableDataType.Discrete)
        {
          return;//must be Discrete to have a UV Renderer...
        }
    
        var renderer = variable.Renderer as CIMVoxelUniqueValueRenderer;
    
        //A CIMVoxelUniqueValueRenderer consists of a collection of
        //CIMVoxelColorUniqueValue classes - one per discrete value
        //in the associated variable profile value array
    
        //Get the first class
        var classes = renderer.Classes.ToList();
        var unique_value_class = classes.First();
        //Set its visibility off
        unique_value_class.Visible = false;
    
        //Apply the change to the renderer
        renderer.Classes = classes.ToArray();
        //apply the changes
        variable.SetRenderer(renderer);
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also