ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / VoxelLayer Class / GetLockedSections Method
Example

In This Topic
    GetLockedSections Method
    In This Topic
    Gets the collection of locked sections
    Syntax
    public IList<LockedSectionDefinition> GetLockedSections()
    Public Function GetLockedSections() As IList(Of LockedSectionDefinition)
    Example
    Get the Current Collection of Locked Sections
    {
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetLockedSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerVisibility(true);
    
        var locked_sections = voxelLayer.GetLockedSections();
      });
    }
    Get a Locked Section
    {
      var my_locked_section_id = -1;
    
      var locked_section = voxelLayer.GetLockedSections().FirstOrDefault();
      var locked_section2 = voxelLayer.GetLockedSections()
                      .First(lsec => lsec.ID == my_locked_section_id);
    }
    Update Locked Section Visibility
    {
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetLockedSectionContainerExpanded(true);
        voxelLayer.SetLockedSectionContainerVisibility(true);
    
        var locked_sections = voxelLayer.GetLockedSections().Where(ls => !ls.IsVisible);
    
        //Make them visible
        foreach (var locked_section in locked_sections)
        {
          locked_section.IsVisible = true;
          //apply change
          voxelLayer.UpdateSection(locked_section);
        }
      });
    }
    Unlock a Locked Section
    {
      var mapView = MapView.Active;
    
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.Visualization != VoxelVisualization.Surface)
        {
          voxelLayer.SetVisualization(VoxelVisualization.Surface);
        }
    
        voxelLayer.SetSectionContainerExpanded(true);
        voxelLayer.SetSectionContainerVisibility(true);
        voxelLayer.SetLockedSectionContainerExpanded(true);
    
        //get the selected locked section
        var locked_section = mapView.GetSelectedLockedSections().FirstOrDefault();
        if (locked_section == null)
        {
          locked_section = voxelLayer.GetLockedSections().FirstOrDefault();
        }
    
        if (locked_section == null)
        {
          return;
        }
    
        //Unlock the locked section (Deletes the locked section, creates
        //a section)
        if (voxelLayer.CanUnlockSection(locked_section))
        {
          voxelLayer.UnlockSection(locked_section);
        }
      });
    }
    Delete a Locked Section
    {
      await QueuedTask.Run(() =>
      {
        if (voxelLayer.GetLockedSections().Count() == 0)
        {
          return;
        }
    
        //Delete the last locked section from the collection of
        //locked sections
        voxelLayer.DeleteSection(voxelLayer.GetLockedSections().Last());
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also