ArcGIS Pro 3.4 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 void DeleteSlice( 
       SliceDefinition sliceDef
    )
    Public Sub DeleteSlice( _
       ByVal sliceDef As SliceDefinition _
    ) 

    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
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    //At 2.x
    //var last_slice = voxelLayer.GetSlices().LastOrDefault();
    //   if (last_slice != null)
    //     voxelLayer.DeleteSlice(last_slice);
    
    //   //Delete all slices
    //   var slices = voxelLayer.GetSlices();
    //   foreach (var slice in slices)
    //     voxelLayer.DeleteSlice(slice);
    
    //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, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also