set dataBuffer [ GuidoExecServer GetBlockModelParameters {} ]
set xblocksize [ GuidoGetParamBufferValue $dataBuffer UserBlock(0) ]
set yblocksize [ GuidoGetParamBufferValue $dataBuffer UserBlock(1) ]
set zblocksize [ GuidoGetParamBufferValue $dataBuffer UserBlock(2) ]
set xsize [ GuidoGetParamBufferValue $dataBuffer Extents(0) ]
set ysize [ GuidoGetParamBufferValue $dataBuffer Extents(1) ]
set zsize [ GuidoGetParamBufferValue $dataBuffer Extents(2) ]
set rotated [ GuidoGetParamBufferValue $dataBuffer Rotated ]
if {$rotated == "true"} {
set rotation0 [ GuidoGetParamBufferValue $dataBuffer Rotation(0) ]
set rotation1 [ GuidoGetParamBufferValue $dataBuffer Rotation(1) ]
set rotation2 [ GuidoGetParamBufferValue $dataBuffer Rotation(2) ]
if {$rotation1 == 0.0 && $rotation2 == 0.0} {
set rotated false
}
}
set nlevels [expr {int($zsize / $zblocksize)}]
set nrows [expr {int($ysize / $yblocksize)}]
set ncolumns [expr {int($xsize / $xblocksize)}]
proc select_all {n field_in} {
upvar $field_in field
for {set i 0} {$i < $n} {incr i} {
$field setCurrentValue $i true
}
}
proc select_none {n field_in} {
upvar $field_in field
for {set i 0} {$i < $n} {incr i} {
$field setCurrentValue $i false
}
}
proc select_nth {n field_in start every_nth} {
upvar $field_in field
incr start -1
for {set i 0} {$i < $n} {incr i} {
if {$i >= $start} {
if {[expr fmod([expr $i - $start], $every_nth)]} {
$field setCurrentValue $i false
} else {
$field setCurrentValue $i true
}
} else {
$field setCurrentValue $i false
}
}
}
GuidoForm frmsectionsFromModel {
-default_buttons
-label "Block Model Sections"
-tip "FRM_SECTIONSFROMMODEL_1"
-layout BoxLayout X_AXIS
GuidoPanel columns {
-label "User blocks in X direction"
-layout BoxLayout Y_AXIS
-border etched true
GuidoLabel columns_label_lowest {
-label "Lowest X value"
}
GuidoScrollPane columns_pane {
-height 12
GuidoTable columns_table {
-instances $ncolumns $ncolumns $ncolumns
-interactive false
-row_headings_visible false
GuidoCheckBox columns_check {
-default false
-tip "FRM_SECTIONSFROMMODEL_2"
}
GuidoLabel columns_label {
-width 10
}
}
}
GuidoLabel columns_label_highest {
-label "Highest X value"
}
GuidoFiller columnf1 {
-height 0.4
}
GuidoPanel columns_buttons {
-layout BorderLayout
GuidoButton columns_all {
-caption "All"
-width 6
-position West
}
GuidoButton columns_none {
-caption "None"
-width 6
-position East
}
}
GuidoFiller columnf2 {
-height 0.4
}
GuidoPanel columns_steps {
-label "Steps"
-border etched true
-layout BorderLayout
GuidoPanel columns_steps_fields {
-position North
-layout CentreLineLayout
GuidoField columns_nth {
-label "Every nth level:"
-format integer
-low_bound 1
-default 1
-tip "FRM_SECTIONSFROMMODEL_3"
}
GuidoField columns_start {
-label "Starting from:"
-format integer
-low_bound 1
-default 1
-tip "FRM_SECTIONSFROMMODEL_3"
}
}
GuidoPanel columns_apply_panel {
GuidoButton columns_apply {
-caption "Set"
}
}
}
GuidoPanel columns_series_panel {
GuidoField columns_series {
-label "Column series:"
-default 0
-null false
-tip "FRM_PARALLELSECTIONS_6"
}
}
GuidoPanel rows_north_panel {
-height 2
GuidoCheckBox columns_east {
-default true
-label "Model looking East:"
-tip "FRM_SECTIONSFROMMODEL_4"
}
}
}
GuidoPanel rows {
-label "User blocks in Y direction"
-layout BoxLayout Y_AXIS
-border etched true
GuidoLabel rows_label_lowest {
-label "Lowest Y value"
}
GuidoScrollPane rows_pane {
-height 12
GuidoTable rows_table {
-instances $nrows $nrows $nrows
-interactive false
-row_headings_visible false
GuidoCheckBox rows_check {
-default false
-tip "FRM_SECTIONSFROMMODEL_5"
}
GuidoLabel rows_label {
-width 10
}
}
}
GuidoLabel rows_label_highest {
-label "Highest Y value"
}
GuidoFiller rowf1 {
-height 0.4
}
GuidoPanel rows_buttons {
-layout BorderLayout
GuidoButton rows_all {
-caption "All"
-width 6
-position West
}
GuidoButton rows_none {
-caption "None"
-width 6
-position East
}
}
GuidoFiller rowf1 {
-height 0.4
}
GuidoPanel rows_steps {
-label "Steps"
-border etched true
-layout BorderLayout
GuidoPanel rows_steps_fields {
-position North
-layout CentreLineLayout
GuidoField rows_nth {
-label "Every nth level:"
-format integer
-low_bound 1
-default 1
-tip "FRM_SECTIONSFROMMODEL_3"
}
GuidoField rows_start {
-label "Starting from:"
-format integer
-low_bound 1
-default 1
-tip "FRM_SECTIONSFROMMODEL_3"
}
}
GuidoPanel rows_apply_panel {
GuidoButton rows_apply {
-caption "Set"
}
}
}
GuidoPanel rows_series_panel {
GuidoField rows_series {
-label "Row series:"
-default 0
-null false
-tip "FRM_PARALLELSECTIONS_6"
}
}
GuidoPanel rows_north_panel {
-height 2
GuidoCheckBox rows_north {
-default true
-label "Model looking North:"
-tip "FRM_SECTIONSFROMMODEL_6"
}
}
}
GuidoPanel levels {
-label "User blocks in Z direction"
-layout BoxLayout Y_AXIS
-border etched true
GuidoLabel levels_label_lowest {
-label "Lowest Z value"
}
GuidoScrollPane levels_pane {
-height 12
GuidoTable levels_table {
-instances $nlevels $nlevels $nlevels
-interactive false
-row_headings_visible false
GuidoCheckBox levels_check {
-default false
-tip "FRM_SECTIONSFROMMODEL_7"
}
GuidoLabel levels_label {
-width 10
}
}
}
GuidoLabel levels_label_highest {
-label "Highest Z value"
}
GuidoFiller levelf1 {
-height 0.4
}
GuidoPanel levels_buttons {
-layout BorderLayout
GuidoButton levels_all {
-caption "All"
-width 6
-position West
}
GuidoButton levels_none {
-caption "None"
-width 6
-position East
}
}
GuidoFiller rowf2 {
-height 0.4
}
GuidoPanel levels_steps {
-label "Steps"
-border etched true
-layout BorderLayout
GuidoPanel levels_steps_fields {
-position North
-layout CentreLineLayout
GuidoField levels_nth {
-label "Every nth level:"
-format integer
-low_bound 1
-default 1
-tip "FRM_SECTIONSFROMMODEL_3"
}
GuidoField levels_start {
-label "Starting from:"
-format integer
-low_bound 1
-default 1
-tip "FRM_SECTIONSFROMMODEL_3"
}
}
GuidoPanel levels_apply_panel {
GuidoButton levels_apply {
-caption "Set"
}
}
}
GuidoPanel levels_series_panel {
GuidoField levels_series {
-label "Level series:"
-default 0
-null false
-tip "FRM_PARALLELSECTIONS_6"
}
}
GuidoPanel levels_down_panel {
-height 2
GuidoLabel levels_down_label {
-label "Model looking Down:"
-visible $rotated
}
GuidoCheckBox levels_down {
-default true
-visible $rotated
-tip "FRM_SECTIONSFROMMODEL_8"
}
}
}
for {set i 0} {$i < $nlevels} {incr i} {
$levels_label setCurrentValue $i "K = [expr $i + 1]"
}
for {set i 0} {$i < $nrows} {incr i} {
$rows_label setCurrentValue $i "J = [expr $i + 1]"
}
for {set i 0} {$i < $ncolumns} {incr i} {
$columns_label setCurrentValue $i "I = [expr $i + 1]"
}
$levels_all setActionCallback valueChanged {[select_all $nlevels levels_check]}
$rows_all setActionCallback valueChanged {[select_all $nrows rows_check]}
$columns_all setActionCallback valueChanged {[select_all $ncolumns columns_check]}
$levels_none setActionCallback valueChanged {[select_none $nlevels levels_check]}
$rows_none setActionCallback valueChanged {[select_none $nrows rows_check]}
$columns_none setActionCallback valueChanged {[select_none $ncolumns columns_check]}
$levels_apply setActionCallback valueChanged {[select_nth $nlevels levels_check [$levels_start getCurrentValue] [$levels_nth getCurrentValue]]}
$rows_apply setActionCallback valueChanged {[select_nth $nrows rows_check [$rows_start getCurrentValue] [$rows_nth getCurrentValue]]}
$columns_apply setActionCallback valueChanged {[select_nth $ncolumns columns_check [$columns_start getCurrentValue] [$columns_nth getCurrentValue]]}
}
