ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping.Voxel Namespace / VoxelVolume Class / CanLockSection Method
The definition of the section to determine whether it can be locked
Example

In This Topic
    CanLockSection Method
    In This Topic
    Determines whether a section can be locked. Sections are locked to the current variable profile. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public bool CanLockSection( 
       SectionDefinition sectionDef
    )
    Public Function CanLockSection( _
       ByVal sectionDef As SectionDefinition _
    ) As Boolean

    Parameters

    sectionDef
    The definition of the section to determine whether it can be locked

    Return Value

    True if the specified section can be locked.
    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
    Remarks
    For a section to be lockable it must at least be partially within the sliced volume.
    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