ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVolume Class / DeleteSlice Method
The definition of the slice to delete.
Example

In This Topic
    DeleteSlice Method
    In This Topic
    Deletes the specified slice. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub DeleteSlice( _
       ByVal sliceDef As SliceDefinition _
    ) 
    public void DeleteSlice( 
       SliceDefinition sliceDef
    )

    Parameters

    sliceDef
    The definition of the slice to delete.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run
    Slice not found in the collection of slices
    Slice is null
    Example
    Delete Slice
    {
      // Note: call within QueuedTask.Run()
      {
        //Use the SelectedVariableProfile to get the slices currently in the TOC
        //via its associated volume
        var volume = voxelLayer.SelectedVariableProfile.Volume;
    
        var last_slice = volume.GetSlices().LastOrDefault();
        if (last_slice != null)
          volume.DeleteSlice(last_slice);
    
        //Delete all slices
        var slices = volume.GetSlices();
        foreach (var slice in slices)
          volume.DeleteSlice(slice);
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also