GuidoScript scripts/geologyutilities.tcl
proc getDatabaseHandle {} {
set buffer [GuidoExecServer LegacyGetCurrentDatabaseHandle [subst {sessionType = "GeologyDatabase"}]]
return [GuidoGetParamBufferValue $buffer DatabaseHandle]
}
proc updateGeologyTableField { field table } {
if {![info exists table]} {
return
}
set dbHandle [getDatabaseHandle]
set current_field "[$field getCurrentValue]"
set current_table "[$table getCurrentValue]"
if {"$current_table" == ""} {
$field removeAllItems
$field setCurrentValue ""
return 0
} else {
$field setDatabaseHandle $dbHandle
$field setTableHandle "$current_table"
$field updateBrowserList
if {[$field findItemIndex "$current_field"] == -1} {
$field setCurrentValue ""
} else {
$field setCurrentValue "$current_field"
}
return 1
}
}
proc updateSpecificationList {table field specification selectionMethod} {
if {"[$selectionMethod getCurrentValue]" == "M"} {
if {[info exists specification]} {
set dbHandle [getDatabaseHandle]
set current_field "[$field getCurrentValue]"
set current_table "[$table getCurrentValue]"
if {"$current_table" == ""} {
$specification removeAllItems
$specification setCurrentValue ""
} else {
$specification setDatabaseHandle $dbHandle
$specification setTableHandle "$current_table"
$specification setColumnHandle "$current_field"
$specification updateBrowserList
}
}
}
}
proc updateZoneList {table field StartIntervalZoneCode EndIntervalZoneCode selectionMethod} {
if {"[$selectionMethod getCurrentValue]" == "Z"} {
if {[info exists StartIntervalZoneCode] && [info exists EndIntervalZoneCode]} {
set dbHandle [getDatabaseHandle]
set current_field "[$field getCurrentValue]"
set current_table "[$table getCurrentValue]"
if {"$current_table" == ""} {
$StartIntervalZoneCode removeAllItems
$StartIntervalZoneCode setCurrentValue ""
$EndIntervalZoneCode removeAllItems
$EndIntervalZoneCode setCurrentValue ""
} else {
$StartIntervalZoneCode setDatabaseHandle $dbHandle
$StartIntervalZoneCode setTableHandle "$current_table"
$StartIntervalZoneCode setColumnHandle "$current_field"
$StartIntervalZoneCode updateBrowserList
$EndIntervalZoneCode setDatabaseHandle $dbHandle
$EndIntervalZoneCode setTableHandle "$current_table"
$EndIntervalZoneCode setColumnHandle "$current_field"
$EndIntervalZoneCode updateBrowserList
}
}
}
}
proc updateFieldList {table field} {
if {[info exists field]} {
$field setTableHandle [$table getCurrentValue]
$field updateBrowserList
}
}
GuidoForm frmDefineGeologicalZones {
-label "Define geological zones"
-layout BoxLayout Y_AXIS
-help_id 1713
-tip "00614_TIP_001"
GuidoPanel MainPanel1 {
-layout BoxLayout Y_AXIS
GuidoPanel Panel_1000 {
-layout BoxLayout Y_AXIS
-border etched true
-label "Define zone selection"
GuidoButtonGroupPanel selectionMethod {
-layout BoxLayout Y_AXIS
-tip "DYNAMIC_SHELLS_TIP_001"
GuidoRadioButton frmDefineGeologicalZones_1 {
-caption "No zone definition"
-selected_value N
}
GuidoRadioButton frmDefineGeologicalZones_2 {
-caption "Multiple zones"
-selected_value M
}
GuidoRadioButton frmDefineGeologicalZones_3 {
-caption "Zone From/To"
-selected_value Z
}
}
}
GuidoPanel overlaypanel {
-layout OverlayLayout
-border etched true
GuidoPanel NoZonePanel {
-dependency {"[$selectionMethod getCurrentValue]" == "N"}
GuidoPanel Panel_2222 {
-layout CentreLineLayout
-border etched true
}
GuidoFiller filler_3332 {
-height 13.5
}
}
GuidoPanel MultipleZonesPanel {
-dependency {"[$selectionMethod getCurrentValue]" == "M"}
GuidoPanel Panel_2000 {
-layout CentreLineLayout
-border etched true
set databaseHandle [getDatabaseHandle]
GuidoScrollPane MultipleZonesScroll {
-scroll_size 44 11
GuidoTable MultipleZonesTable {
-instances 1 1 100
-interactive true
GuidoDatabaseTableBrowser geologyTable {
-format none
-display_length 10
-database_handle $databaseHandle
-max_length 32
-table_types interval
-translate lower
-label "Table"
-tip "Enter the names of the interval tables containing the geology codes that you want to select by."
}
$geologyTable updateBrowserList
GuidoTableFieldBrowser geologyField {
-validation {[validateTableFieldPair $geologyTable $geologyField]}
-database_handle $databaseHandle
-dependency {"[updateGeologyTableField $geologyField $geologyTable]"}
-field_types "optional"
-display_length 10
-format none
-tip "Enter the names of the fields containing the geology codes that you want to select by."
-label "Field"
-max_length 32
-translate lower
}
GuidoColumnValueBrowser specification {
-display_length 14
-format none
-label "Specification"
-sorted_list true
-distinct true
-tip "00613_TIP_004"
-max_length 32
}
}
}
$geologyField setActionCallback valueChanged {[updateSpecificationList $geologyTable $geologyField $specification $selectionMethod]}
}
}
GuidoPanel ZoneFromToPanel {
-dependency {"[$selectionMethod getCurrentValue]" == "Z"}
-border etched true
-layout BoxLayout Y_AXIS
GuidoPanel Panel_3000 {
-layout BoxLayout X_AXIS
-label "Select table & field"
-border etched true
GuidoDatabaseTableBrowser table1 {
-null false
-format none
-display_length 12
-database_handle $databaseHandle
-max_length 32
-table_types interval
-translate lower
-label "Table"
-tip "00614_TIP_002"
}
GuidoFiller filler_101 {
-width 12
}
GuidoTableFieldBrowser field1 {
-validation {[validateTableFieldPair $table1 $field1]}
-database_handle $databaseHandle
-table_handle [$table1 getCurrentValue]
-field_types "optional"
-display_length 10
-null false
-format none
-label "Field"
-max_length 32
-tip "Enter the name of the field containing the geology zone selection codes."
-translate lower
}
$table1 updateBrowserList
$field1 setActionCallback initial {[updateFieldList $table1 $field1]}
$table1 setActionCallback valueChanged {[updateFieldList $table1 $field1]}
}
GuidoPanel Panel_44444 {
-layout BoxLayout Y_AXIS
-label "Start interval"
-border etched true
GuidoPanel Panel_44 {
-layout BoxLayout X_AXIS
GuidoColumnValueBrowser StartIntervalZoneCode {
-display_length 12
-format none
-null false
-sorted_list true
-distinct true
-label "Zone code"
-max_length 32
-tip "00614_TIP_004"
}
GuidoFiller filler_231 {
-width 1
}
GuidoComboBox StartIntervalBeginAt {
-display_length 18
-format none
-label "Start at the"
-exclusive true
-null false
-value_in "Top of the zone" "Bottom of the zone"
-alternative_values "Top of the zone" "Bottom of the zone"
-tip "00614_TIP_005"
-default "Top of the zone"
-max_length 32
}
}
GuidoFiller filler_4 {
-height 0.5
}
GuidoPanel Panel_444 {
-layout BoxLayout X_AXIS
GuidoComboBox StartIntervalMissingZone {
-display_length 12
-format none
-label "For missing zones, use the"
-exclusive true
-null false
-tip "00614_TIP_006"
-value_in "Start of the drillhole" "Bottom of the zone"
-alternative_values "Start of the drillhole" "Bottom of the zone"
-default "Start of the drillhole"
-max_length 32
}
}
}
GuidoPanel Panel_55555 {
-layout BoxLayout Y_AXIS
-label "End interval"
-border etched true
GuidoPanel Panel_55 {
-layout BoxLayout X_AXIS
GuidoColumnValueBrowser EndIntervalZoneCode {
-display_length 12
-format none
-label "Zone code"
-sorted_list true
-distinct true
-null false
-tip "00614_TIP_007"
-max_length 32
}
GuidoFiller filler_33 {
-width 1
}
GuidoComboBox EndIntervalFinishAt {
-display_length 18
-format none
-label "Finish at the"
-exclusive true
-null false
-tip "00614_TIP_005"
-value_in "Top of the zone" "Bottom of the zone"
-alternative_values "Top of the zone" "Bottom of the zone"
-default "Bottom of the zone"
-max_length 32
}
}
GuidoFiller filler_5 {
-height 0.5
}
GuidoPanel Panel_555 {
-layout BoxLayout X_AXIS
GuidoComboBox EndIntervalMissingZone {
-display_length 12
-format none
-label "For missing zones, use the"
-exclusive true
-null false
-tip "00614_TIP_009"
-value_in "End of the drillhole" "Top of the zone"
-alternative_values "End of the drillhole" "Top of the zone"
-default "Top of the zone"
-max_length 32
}
}
}
$field1 setActionCallback valueChanged {[updateZoneList $table1 $field1 $StartIntervalZoneCode $EndIntervalZoneCode $selectionMethod]}
}
}
GuidoPanel buttonPanel2 {
-layout FlowLayout Left
GuidoButton helpButton1 {
-action valueChanged { [$frmDefineGeologicalZones setStatus "help"] }
-icon "icons/16/help.png"
-caption " "
}
GuidoFiller filler12215 {
-width 14
}
GuidoButton prevButton1 {
-action valueChanged { [$frmDefineGeologicalZones setStatus "previous"] }
-display_length 10
-icon "icons/LeftArrow.gif"
-caption "Previous"
}
GuidoButton nextButton1 {
-action valueChanged { [$frmDefineGeologicalZones setStatus "next"] }
-display_length 8
-icon "icons/RightArrow.gif"
-caption "Next"
}
GuidoButton cancelButton1 {
-action valueChanged { [$frmDefineGeologicalZones setStatus "cancel"] }
-display_length 9
-icon "icons/cancel.png"
-caption "Cancel"
}
}
}
}
