ArcGIS Pro 3.7 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 Function CanLockSection( _
       ByVal sectionDef As SectionDefinition _
    ) As Boolean
    public bool CanLockSection( 
       SectionDefinition sectionDef
    )

    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
    {
      // 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