ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / IsosurfaceDefinition Class / IsCustomColor Property
Example

In This Topic
    IsCustomColor Property (IsosurfaceDefinition)
    In This Topic
    Gets and sets whether the color is a custom color.
    Syntax
    Public Property IsCustomColor As Boolean
    public bool IsCustomColor {get; set;}
    Example
    How to Change Value and Color on an Isosurface
    {
      // Note: call within 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);
        }
      }
    }
    Change Isourface Color Back to Default
    {
      var variable = voxelLayer.SelectedVariableProfile;
      //Change the color of the first surface for the given profile
      var surface = variable.GetIsosurfaces().FirstOrDefault();
      // Note: call within QueuedTask.Run()
      {
        if (surface.IsCustomColor)
        {
          surface.Color = variable.GetIsosurfaceColor((double)surface.Value);
          surface.IsCustomColor = false;
          //update the surface
          variable.UpdateIsosurface(surface);
        }
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also