proc updateSamplePanel {sampleScroll stopePrefix startAt incrementPanel stopeName pillarName crownPillarName startObjId labelSep prefixTable prefix to sliceMethod} {
set prefixTableList ""
for {set idx 0} {$idx < [$prefixTable getRowCount]} {incr idx} {
set prefixValue [$prefix getCurrentValue $idx]
if {$prefixValue != ""} {
if {$idx > 0} {
append prefixTableList ";"
}
append prefixTableList "$prefixValue"
append prefixTableList ";"
append prefixTableList "[$to getCurrentValue $idx]"
}
}
set buffer [GuidoExecServer getExampleStopeNames [subst {stopePrefix = "[$stopePrefix getCurrentValue]" startAt = "[$startAt getCurrentValue]" \
incrementMethod = "[$incrementPanel getCurrentValue]" pillarName = "[$pillarName getCurrentValue]" \
crownPillarName = "[$crownPillarName getCurrentValue]" startObjId = "[$startObjId getCurrentValue]" \
labelSep = "[$labelSep getCurrentValue]" prefixTableList = "$prefixTableList" \
stopeName = "[$stopeName getCurrentValue]" sliceMethod = "[$sliceMethod getCurrentValue]"}]]
set stopeNames [ GuidoGetParamBufferValue $buffer "exampleStopeNames" ]
$sampleScroll setCurrentValue $stopeNames
}
proc setEditingRow { table hiddenField } {
set tableRow [$table getEditingRow]
$hiddenField setCurrentValue $tableRow
if {$tableRow >= 0} {
$table setRowSelected $tableRow
}
}
proc setStopeMethods {stopeMethod} {
set containerName "Vertical sections"
set buffer [GuidoExecServer PlaneTreeStructure [subst {type = "$containerName"}]]
set nSeries "[GuidoGetParamBufferValue $buffer nSeries ]"
if {$nSeries > 0} {
$stopeMethod setValues "Planes" "Start plane and length" "Start plane, length and target" "Centreline and length" "Centreline, length and target"
} else {
$stopeMethod setValues "Centreline and length" "Centreline, length and target"
}
$stopeMethod setExclusive "true"
}
proc setSliceOptions {sliceUsing} {
set containerName "Plan view"
set buffer [GuidoExecServer PlaneTreeStructure [subst {type = "$containerName"}]]
set nSeries "[GuidoGetParamBufferValue $buffer nSeries ]"
$sliceUsing setValues "Elevation"
if {$nSeries > 0} {
$sliceUsing addItem "Planes"
}
$sliceUsing setExclusive "true"
$sliceUsing setDefault "Elevation"
}
proc get_rows_between_CP_levels { table elevationLinesFrom elevationLinesTo currRowNum lastRowBeforePillar lastPillarHeight} {
set topPillar 0
set rowsBetween 0
upvar $lastPillarHeight localPillarHeight
upvar $lastRowBeforePillar localBottomPillar
set localPillarHeight 0
set localBottomPillar -1
set rows [expr $currRowNum - 1]
if { $rows > 1 } {
for {set i $rows} {$i > 0} {incr i -1} {
set curr_from [$elevationLinesFrom getCurrentValue $i]
if {$i != 0} {
set prev_row [expr $i-1]
set prev_to [$elevationLinesTo getCurrentValue $prev_row]
} else {
set prev_to [expr $curr_from -1]
}
if {$curr_from != $prev_to} {
set localPillarHeight [expr $curr_from - $prev_to]
if {$localBottomPillar != -1} {
set topPillar $i
break
} else {
set localBottomPillar $i
}
}
}
}
if {$localBottomPillar != -1} {
set rowsBetween [expr $localBottomPillar - $topPillar]
}
return $rowsBetween
}
proc set_line_from_value_initial {table elevationLinesFrom elevationLinesTo} {
set rowNum [$table getEditingRow]
if {$rowNum == 0} {
} else {
if {$rowNum == -1} {
set  ndx1 [$table getRowCount]
incr ndx1 -1
set  ndx2 $ndx1
incr ndx2 -1
set  lastFrom [$elevationLinesFrom getCurrentValue $ndx2]
if {"$lastFrom" == ""} {
$elevationLinesFrom setCurrentValue $ndx1 [$elevationLinesFrom getCurrentValue $ndx2]
} else {
$elevationLinesFrom setCurrentValue $ndx1 [$elevationLinesTo getCurrentValue $ndx2]
}
} else {
set lastRowBeforePillar -1
set lastPillarHeight 0
set rowsBetweenCP [get_rows_between_CP_levels $table $elevationLinesFrom $elevationLinesTo $rowNum lastRowBeforePillar lastPillarHeight]
set pillarOffset [expr $rowNum - $lastRowBeforePillar]
set prev_from [$elevationLinesFrom getCurrentValueRelative -1]
set prev_to [$elevationLinesTo getCurrentValueRelative -1]
if {[$elevationLinesFrom getCurrentValue $rowNum] == ""} {
if {$pillarOffset == $rowsBetweenCP} {
set prev_to [expr $prev_to + $lastPillarHeight]
set prev_from [expr $prev_from + $lastPillarHeight]
}
$elevationLinesFrom setCurrentValue $rowNum $prev_to
}
if { "$prev_from" != "" && "$prev_to" != "" } {
set diff [expr $prev_to - $prev_from]
set total [expr $prev_to + $diff]
if {[$elevationLinesTo getCurrentValue $rowNum] == ""} {
$elevationLinesTo setCurrentValue $rowNum $total
}
}
}
}
}
proc get_rows_between_CP_planes { table elevationPlanesFrom elevationPlanesTo currRowNum lastRowBeforePillar lastPillarHeight} {
set topPillar 0
set rowsBetween 0
upvar $lastPillarHeight localPillarHeight
upvar $lastRowBeforePillar localBottomPillar
set localPillarHeight 0
set localBottomPillar -1
set rows [expr $currRowNum - 1]
if { $rows > 1 } {
for {set i $rows} {$i > 0} {incr i -1} {
set curr_from [$elevationPlanesFrom getCurrentValue $i]
if {$i != 0} {
set prev_row [expr $i-1]
set prev_to [$elevationPlanesTo getCurrentValue $prev_row]
} else {
set prev_to ${curr_from}_a
}
if {$curr_from != $prev_to} {
set values [$elevationPlanesFrom getItemCount]
set currFromIdx 0
set prevToIdx 0
for {set v 0} {$v < $values} {incr v} {
if { [$elevationPlanesFrom getItemAt $v] == "$curr_from"} {
set currFromIdx [expr $v]
}
}
for {set v 0} {$v < $values} {incr v} {
if { [$elevationPlanesFrom getItemAt $v] == "$prev_to"} {
set prevToIdx [expr $v]
}
}
set localPillarHeight [expr $currFromIdx - $prevToIdx]
if {$localBottomPillar != -1} {
set topPillar $i
break
} else {
set localBottomPillar $i
}
}
}
}
if {$localBottomPillar != -1} {
set rowsBetween [expr $localBottomPillar - $topPillar]
}
return $rowsBetween
}
proc set_plane_from_value_initial {table elevationPlanesFrom elevationPlanesTo} {
set rowNum [$table getEditingRow]
if {$rowNum == 0} {
} else {
if {$rowNum == -1} {
set  ndx1 [$table getRowCount];
incr ndx1 -1
set  ndx2 $ndx1
incr ndx2 -1
set  lastFrom [$elevationPlanesFrom getCurrentValue $ndx2]
if {"$lastFrom" == ""} {
$elevationPlanesFrom setCurrentValue $ndx1 [$elevationPlanesFrom getCurrentValue $ndx2]
} else {
$elevationPlanesFrom setCurrentValue $ndx1 [$elevationPlanesTo getCurrentValue $ndx2]
}
} else {
set lastRowBeforePillar -1
set lastPillarHeight 0
set rowsBetweenCP [get_rows_between_CP_planes $table $elevationPlanesFrom $elevationPlanesTo $rowNum lastRowBeforePillar lastPillarHeight]
set pillarOffset [expr $rowNum - $lastRowBeforePillar]
set prev_from [$elevationPlanesFrom getCurrentValueRelative -1]
set prev_to [$elevationPlanesTo getCurrentValueRelative -1]
if { "$prev_from" != "" && "$prev_to" != "" && [$elevationPlanesTo getCurrentValue $rowNum] == "" && [$elevationPlanesFrom getCurrentValue $rowNum] == ""} {
set values [$elevationPlanesFrom getItemCount]
set toIdx 0
set fromIdx 0
set delta 0
set newIndx 0
for {set i 0} {$i < $values} {incr i} {
if { [$elevationPlanesFrom getItemAt $i] == "$prev_from"} {
set fromIdx [expr $i]
}
}
for {set i 0} {$i < $values} {incr i} {
if { [$elevationPlanesFrom getItemAt $i] == "$prev_to"} {
set toIdx [expr $i]
}
}
if {$pillarOffset == $rowsBetweenCP} {
set fromIdx [expr $fromIdx + $lastPillarHeight]
set toIdx [expr $toIdx + $lastPillarHeight]
if {$fromIdx >= 0 && $fromIdx < $values} {
$elevationPlanesFrom setCurrentValue $rowNum [$elevationPlanesTo getItemAt $toIdx]
}
} else {
$elevationPlanesFrom setCurrentValue $rowNum $prev_to
}
set delta [expr $toIdx - $fromIdx]
set newIndx [expr $toIdx + $delta]
if {$newIndx >= 0 && $newIndx < $values && $delta != 0} {
$elevationPlanesTo setCurrentValue $rowNum [$elevationPlanesTo getItemAt $newIndx]
} else {
$elevationPlanesTo setCurrentValue $rowNum ""
}
}
}
}
}
proc set_layer_string_segment_from_value_initial {table layer string segment} {
set rowNum [$table getEditingRow]
if {$rowNum == 0} {
} else {
if {$rowNum == -1} {
set  ndx1 [$table getRowCount];
incr ndx1 -1
set  ndx2 $ndx1
incr ndx2 -1
set  lastLayer [$layer getCurrentValue $ndx2]
set  lastString [$string getCurrentValue $ndx2]
set  lastSegment [$segment getCurrentValue $ndx2]
if {"$lastLayer" != ""} {
$layer setCurrentValue $ndx1 [$layer getCurrentValue $ndx2]
}
if {"$lastString" != ""} {
$string setCurrentValue $ndx1 [$string getCurrentValue $ndx2]
}
if {"$lastSegment" != ""} {
$segment setCurrentValue $ndx1 [$segment getCurrentValue $ndx2]
}
} else {
if {[$layer getCurrentValue] == ""} {
$layer setCurrentValue [$layer getCurrentValueRelative -1]
}
if {[$string getCurrentValue] == ""} {
$string setCurrentValue [$string getCurrentValueRelative -1]
}
if {[$segment getCurrentValue] == ""} {
$segment setCurrentValue [$segment getCurrentValueRelative -1]
}
}
}
}
proc activateTab {tabpanel value} {
set tabNum [$value getCurrentValue]
$tabpanel setSelectedIndex $tabNum
}
GuidoScript scripts/StopeCommonFunctions.tcl
GuidoForm SolidsIntoStopes {
-layout BoxLayout Y_AXIS
-default_buttons
-label STOPE_SLICER_MENU
-help_id 1748
GuidoPanel borderLayout {
-layout borderlayout
GuidoTabbedPane mainTabPanel {
GuidoPanel slicingTab {
-width 45
-layout BoxLayout Y_AXIS
-label "Slicing"
GuidoScript forms/StopesSlicingTab.tcl
}
GuidoPanel exclusionsTab {
-label "Exclusions"
-width 45
-layout BoxLayout Y_AXIS
-position Centre
GuidoScript forms/StopesExclusionsTab.tcl
}
GuidoPanel namingTab {
-label "Naming"
-width 45
-layout BoxLayout Y_AXIS
-position Centre
GuidoScript forms/StopesNamingTab.tcl
}
GuidoPanel blockModelTab {
-label "Block Model"
-width 45
-layout BoxLayout Y_AXIS
-position Centre
GuidoScript forms/StopesBlockModelTab.tcl
}
GuidoPanel resultsTab {
-label "Results"
-width 45
-layout BoxLayout Y_AXIS
-position Centre
GuidoScript forms/StopesResultsTab.tcl
}
-action mousePressed {[updateSamplePanel $sampleScroll $stopePrefix $startAt $incrementMethod $stopeName $pillarName $crownPillarName $startObjId $labelSep $prefixTable $prefix $prefixName $sliceMethod]}
-action keyReleased {[updateSamplePanel $sampleScroll $stopePrefix $startAt $incrementMethod $stopeName $pillarName $crownPillarName $startObjId $labelSep $prefixTable $prefix $prefixName $sliceMethod]}
}
}
GuidoField hiddenFieldActiveTab {
-max_length 10
-null true
-display_length 10
-format integer
-visible false
-default 0
}
-action initial {[updateSamplePanel $sampleScroll $stopePrefix $startAt $incrementMethod $stopeName $pillarName $crownPillarName $startObjId $labelSep $prefixTable $prefix $prefixName $sliceMethod]}
-action initial {[activateTab $mainTabPanel $hiddenFieldActiveTab]}
}
