ArcGIS Pro 3.7 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 Sub LockSection( _
       ByVal sectionDef As SectionDefinition _
    ) 
    public void LockSection( 
       SectionDefinition sectionDef
    )

    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
    {
      // Note: call within 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)
        {
          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