ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVariableProfile Class / Renderer Property
Example

In This Topic
    Renderer Property (VoxelVariableProfile)
    In This Topic
    Gets the variable profile renderer.
    Syntax
    public CIMVoxelRenderer Renderer {get;}
    Public ReadOnly Property Renderer As CIMVoxelRenderer
    Remarks
    Example
    Subscribe for Changes to a Voxel Layer
    ArcGIS.Desktop.Mapping.Events.MapMemberPropertiesChangedEvent.Subscribe((args) =>
    {
        var voxel = args.MapMembers.OfType<VoxelLayer>().FirstOrDefault();
        if (voxel == null)
            return;
        //Anything changed on a voxel layer?
        //At 2.x - if (args.EventHints.Any(hint => hint == MapMemberEventHint.VoxelSelectedVariableProfileIndex))
        if (args.EventHints.Any(hint => hint == MapMemberEventHint.VoxelSelectedVariable))
        {
            //Voxel variable profile selection changed
            var changed_variable_name = voxel.SelectedVariableProfile.Variable;
            //TODO respond to change, use QueuedTask if needed
    
        }
        else if (args.EventHints.Any(hint => hint == MapMemberEventHint.Renderer))
        {
            //This can fire when a renderer becomes ready on a new layer; the selected variable profile
            //is changed; visualization is changed, etc.
            var renderer = voxel.SelectedVariableProfile.Renderer;
            //TODO respond to change, use QueuedTask if needed
    
        }
    });
    
    ArcGIS.Desktop.Mapping.Voxel.Events.VoxelAssetChangedEvent.Subscribe((args) =>
    {
        //An asset changed on a voxel layer
        System.Diagnostics.Debug.WriteLine("");
        System.Diagnostics.Debug.WriteLine("VoxelAssetChangedEvent");
        System.Diagnostics.Debug.WriteLine($" AssetType: {args.AssetType}, ChangeType: {args.ChangeType}");
    
        if (args.ChangeType == VoxelAssetEventArgs.VoxelAssetChangeType.Remove)
            return;
        //Get "what"changed - add or update
        //eg IsoSurface
        VoxelLayer voxelLayer = null;
        if (args.AssetType == VoxelAssetEventArgs.VoxelAssetType.Isosurface)
        {
            var surface = MapView.Active.GetSelectedIsosurfaces().FirstOrDefault();
            //there will only be one selected...
            if (surface != null)
            {
                voxelLayer = surface.Layer;
                //TODO respond to change, use QueuedTask if needed
            }
        }
        //Repeat for Slices, Sections, LockedSections...
        //GetSelectedSlices(), GetSelectedSections(), GetSelectedLockedSections();
    });
    
    Get the Variable Renderer
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    var variable = voxelLayer.GetVariableProfiles().First();
    var renderer = variable.Renderer;
    if (variable.DataType == VoxelVariableDataType.Continuous)
    {
        //Renderer will be stretch
        var stretchRenderer = renderer as CIMVoxelStretchRenderer;
        //access the renderer
    
    }
    else //VoxelVariableDataType.Discrete
    {
        //Renderer will be unique value
        var uvr = renderer as CIMVoxelUniqueValueRenderer;
        //access the renderer
    }
    
    Access Stats and Color Range for a Stretch Renderer
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    //Get the variable profile on which to access the data
    var variable = voxelLayer.SelectedVariableProfile;
    //or use ...voxelLayer.GetVariableProfiles()
    
    //Data range
    //At 2.x - 
    //var min = variable.GetVariableStatistics().MinimumValue;
    //var max = variable.GetVariableStatistics().MaximumValue;
    
    var min = variable.Statistics.MinimumValue;
    var max = variable.Statistics.MaximumValue;
    
    //Color range (Continuous only)
    double color_min, color_max;
    if (variable.DataType == VoxelVariableDataType.Continuous)
    {
        var renderer = variable.Renderer as CIMVoxelStretchRenderer;
        color_min = renderer.ColorRangeMin;
        color_max = renderer.ColorRangeMax;
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also