//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);