ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVolume Class / GetSections Method
Example

In This Topic
    GetSections Method
    In This Topic
    Gets the collection of (dynamic) sections
    Syntax
    public IList<SectionDefinition> GetSections()
    Public Function GetSections() As IList(Of SectionDefinition)
    Example
    Get a Section
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    //At 2.x -
    //var section = voxelLayer.GetSections().FirstOrDefault();
    //var section2 = voxelLayer.GetSections().First(sec => sec.Id == my_section_id);
    
    //Use the SelectedVariableProfile to get the sections currently in the TOC
    //via its associated volume
    var volume = voxelLayer.SelectedVariableProfile.Volume;
    
    var section = volume.GetSections().FirstOrDefault();
    var section2 = volume.GetSections().First(sec => sec.ID == my_section_id);
    
    Get the Current Collection of Sections
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    if (voxelLayer.Visualization != VoxelVisualization.Surface)
        voxelLayer.SetVisualization(VoxelVisualization.Surface);
    voxelLayer.SetSectionContainerExpanded(true);
    voxelLayer.SetSectionContainerVisibility(true);
    
    //At 2.x - var sections = voxelLayer.GetSections();
    
    //Use the SelectedVariableProfile to get the sections currently in the TOC
    //via its associated volume
    var volume = voxelLayer.SelectedVariableProfile.Volume;
    var sections = volume.GetSections();
    
    
    Update Section Orientation and Tilt
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    if (voxelLayer.Visualization != VoxelVisualization.Surface)
        voxelLayer.SetVisualization(VoxelVisualization.Surface);
    voxelLayer.SetSectionContainerExpanded(true);
    voxelLayer.SetSectionContainerVisibility(true);
    
    //Use the SelectedVariableProfile to get the sections
    //via its associated volume
    var volume = voxelLayer.SelectedVariableProfile.Volume;
    
    //At 2.x - foreach (var section in voxelLayer.GetSections())
    foreach (var section in volume.GetSections())
    {
        //set each normal to 45.0 orientation and tilt
        section.Normal = voxelLayer.GetNormal(45.0, 45.0);
        //apply the change
        //At 2.x - voxelLayer.UpdateSection(section);
        volume.UpdateSection(section);
    }
    
    Update Section Visibility
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    if (voxelLayer.Visualization != VoxelVisualization.Surface)
        voxelLayer.SetVisualization(VoxelVisualization.Surface);
    voxelLayer.SetSectionContainerExpanded(true);
    voxelLayer.SetSectionContainerVisibility(true);
    
    //At 2.x - var sections = voxelLayer.GetSections().Where(s => !s.IsVisible);
    
    //Use the SelectedVariableProfile to get the sections
    //via its associated volume
    var volume = voxelLayer.SelectedVariableProfile.Volume;
    var sections = volume.GetSections().Where(s => !s.IsVisible);
    
    //Make them all visible
    foreach (var section in sections)
    {
        section.IsVisible = true;
        //apply the change
        //At 2.x - voxelLayer.UpdateSection(section);
        volume.UpdateSection(section);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also