ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVolume Class / LockSection Method
The definition of the section to lock
Example

In This Topic
    LockSection Method
    In This Topic
    Locks the specified section to the currently selected variable profile. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void LockSection( 
       SectionDefinition sectionDef
    )
    Public Sub LockSection( _
       ByVal sectionDef As SectionDefinition _
    ) 

    Parameters

    sectionDef
    The definition of the section to lock
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run
    Section is null
    Section not found in the collection of sections
    Section cannot be locked
    Remarks
    If a section cannot be locked a System.ArgumentException is thrown. Refer to CanLockSection
    . When a section is locked, its position can no longer be updated.
    Example
    Lock a Section/"Create" a Locked Section
          //var voxelLayer = ... ;
          //Must be on the 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.Active.GetSelectedSections().FirstOrDefault();
          if (section == null)
    {
              //At 2.x - section = voxelLayer.GetSections().FirstOrDefault();
              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, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also