ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVariableProfile Class / GetIsosurfaces Method
Example

In This Topic
    GetIsosurfaces Method
    In This Topic
    Gets the collection of isosurfaces
    Syntax
    public IList<IsosurfaceDefinition> GetIsosurfaces()
    Public Function GetIsosurfaces() As IList(Of IsosurfaceDefinition)
    Remarks
    Isosurfaces are created for specific (continuous) variable profiles
    Example
    Check the MaxNumberofIsoSurfaces for a Variable
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    var variable = voxelLayer.GetVariableProfiles().First();
    var max = variable.MaxNumberOfIsosurfaces;
    if (max >= variable.GetIsosurfaces().Count)
    {
        //no more surfaces can be created on this variable
    }
    
    How to Change Value and Color on an Isosurface
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    var variable = voxelLayer.SelectedVariableProfile;
    
    //Change the color of the first surface for the given profile
    var surface = variable.GetIsosurfaces().FirstOrDefault();
    if (surface != null)
    {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
            voxelLayer.SetVisualization(VoxelVisualization.Surface);
    
        //Change the iso surface voxel value
        surface.Value = surface.Value * 0.9;
    
        //get a random color
        var count = new Random().Next(0, 100);
        var colors = ColorFactory.Instance.GenerateColorsFromColorRamp(
            ((CIMVoxelStretchRenderer)variable.Renderer).ColorRamp, count);
    
        var idx = new Random().Next(0, count - 1);
        surface.Color = colors[idx];
        //set the custom color flag true to lock the color
        //locking the color prevents it from being changed if the
        //renderer color range or color theme is updated
        surface.IsCustomColor = true;
    
        //update the surface
        variable.UpdateIsosurface(surface);
    }
    
    Delete Isosurface- s
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    var variable = voxelLayer.SelectedVariableProfile;
    
    //delete the last surface
    var last_surface = variable.GetIsosurfaces().LastOrDefault();
    
    if (last_surface != null)
    {
        variable.DeleteIsosurface(last_surface);
    }
    
    //delete all the surfaces
    foreach (var surface in variable.GetIsosurfaces())
        variable.DeleteIsosurface(surface);
    
    //Optional - set visualization back to Volume
    if (variable.GetIsosurfaces().Count() == 0)
    {
        voxelLayer.SetVisualization(VoxelVisualization.Volume);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also