ArcGIS Pro 3.8 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
    {
      //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
    {
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetSectionContainerExpanded(true);
        voxelLayer.SetSectionContainerVisibility(true);
    
        //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
    {
      await 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;
    
        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
          volume.UpdateSection(section);
        }
      });
    }
    Update Section Visibility
    {
      await 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;
        var sections = volume.GetSections().Where(s => !s.IsVisible);
    
        //Make them all visible
        foreach (var section in sections)
        {
          section.IsVisible = true;
          //apply the change
          volume.UpdateSection(section);
        }
      });
    }
    Delete Sections
    {
      await QueuedTask.Run(() =>
      {
        //Use the SelectedVariableProfile to get the sections
        //via its associated volume
        var volume = voxelLayer.SelectedVariableProfile.Volume;
    
        foreach (var section in volume.GetSections())
        {
          volume.DeleteSection(section);
        }
    
        //optional...
        if (voxelLayer.Visualization != VoxelVisualization.Volume)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Volume);
        }
      });
    }
    Lock a Section/Create a Locked Section
    {
      var mapView = MapView.Active;
    
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerVisibility(true);
    
        //Use the SelectedVariableProfile to get the sections
        //via its associated volume
        var volume = voxelLayer.SelectedVariableProfile.Volume;
    
        //get the selected section
        var section = mapView.GetSelectedSections().FirstOrDefault();
        if (section == null)
        {
          section = volume.GetSections().FirstOrDefault();
        }
    
        if (section == null)
        {
          return;
        }
    
        //Lock the section (Creates a locked section, deletes
        //the section)
        //if (voxelLayer.CanLockSection(section))
        //	voxelLayer.LockSection(section);
        if (volume.CanLockSection(section))
        {
          volume.LockSection(section);
        }
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also