//var voxelLayer = ... ;
//Must be on the QueuedTask.Run()
if (voxelLayer.Visualization != VoxelVisualization.Surface)
voxelLayer.SetVisualization(VoxelVisualization.Surface);
voxelLayer.SetSectionContainerExpanded(true);
voxelLayer.SetSectionContainerVisibility(true);
voxelLayer.SetLockedSectionContainerExpanded(true);
//get the selected locked section
var locked_section = MapView.Active.GetSelectedLockedSections().FirstOrDefault();
if (locked_section == null)
locked_section = voxelLayer.GetLockedSections().FirstOrDefault();
if (locked_section == null)
return;
//Unlock the locked section (Deletes the locked section, creates
//a section)
if (voxelLayer.CanUnlockSection(locked_section))
voxelLayer.UnlockSection(locked_section);