GuidoScript scripts/dtmutilities.tcl
global dtm_loc
global object_id
global trisolation_id
global obj_name
global tri_name
global bdy_str
global bdy_loc
global dtm_loc
global axis_y1
global axis_x1
global axis_y2
global axis_x2
global dtm_specs
global sect_type
global secint
proc validateLocationFieldForNullvalue {dtmFile} {
set no_dtm_file 0
set return_code true
global dtm_specs
for {set row 0} {$row < [$dtm_specs getRowCount]} {incr row} {
if {[$dtmFile getCurrentValue $row] != ""} {
incr no_dtm_file
set filename ""
set name [$dtmFile getCurrentValue $row]
append filename $name ".dtm"
set buffer [GuidoExecServer DoesFileExist [subst {FILE_NAME = "$filename"}]]
set status [GuidoGetParamBufferValue $buffer status]
if {$status < 0} {
GuidoMessage warning FILE_DOES_NOT_EXIST $filename
set return_code false
}
}
}
if {"$return_code" == "false"} {
return false
}
if {"$no_dtm_file" == 0} {
GuidoMessage warning APP_NEED_ATLEAST_ONE_DTM_FOR_CROSS_SECTIONS
return false
}
}
proc placeTheAxisInTheForm {} {
global dtm_loc
global axis_y1
global axis_x1
global axis_z1
global axis_y2
global axis_x2
global axis_z2
global dtm_specs
set filename [$dtm_loc getCurrentValue 0]
if {"$filename" != ""} {
set buffer [GuidoExecServer GetAxisCoordsFromFile [subst {FileName = "$filename"}]]
set status [GuidoGetParamBufferValue $buffer status]
if {$status >= 0} {
$axis_y1 setCurrentValue [ GuidoGetParamBufferValue $buffer "axis_y1"  ]
$axis_x1 setCurrentValue [ GuidoGetParamBufferValue $buffer "axis_x1"  ]
$axis_z1 setCurrentValue [ GuidoGetParamBufferValue $buffer "axis_z1"  ]
$axis_y2 setCurrentValue [ GuidoGetParamBufferValue $buffer "axis_y2"  ]
$axis_x2 setCurrentValue [ GuidoGetParamBufferValue $buffer "axis_x2"  ]
$axis_z2 setCurrentValue [ GuidoGetParamBufferValue $buffer "axis_z2"  ]
} else {
$axis_y1 setCurrentValue 0.0
$axis_x1 setCurrentValue 0.0
$axis_z1 setCurrentValue 0.0
$axis_y2 setCurrentValue 0.0
$axis_x2 setCurrentValue 0.0
$axis_z2 setCurrentValue 0.0
}
}
}
proc changeAxisInputs {dtm_loc object_num trisolation_num} {
global axis_z1
global axis_z2
set fileloc "[$dtm_loc getCurrentValue]"
set convfileloc "[string tolower $fileloc]"
set location ""
if { [string first ".dtm" $convfileloc ] == -1 } {
append location  $fileloc ".dtm"
} else {
set location $fileloc
}
if { [string length $location] > 4 } {
set currentObjectId [$object_num getCurrentValue]
set currentTrisolId [$trisolation_num getCurrentValue]
set buffer [GuidoExecServer GetHorizontalDTM [subst {FileName = "$location" CurrentObjectId = "$currentObjectId" CurrentTrisolId = "$currentTrisolId"}]]
set status [GuidoGetParamBufferValue $buffer status]
if {$status >= 0} {
set horizontalPlane [GuidoGetParamBufferValue $buffer horizontalPlane]
if {$horizontalPlane == "true"} {
$axis_z1 setInputAllowed false
$axis_z2 setInputAllowed false
} else {
$axis_z1 setInputAllowed true
$axis_z2 setInputAllowed true
}
}
}
}
proc validateValue {} {
global sect_type
global secint
if {"[ $sect_type getCurrentValue ]" == "Interval"} {
$secint setFormat double
} else {
$secint setFormat range
}
}
proc enterString {} {
global bdy_str
global bdy_loc
if {[string length [$bdy_loc getCurrentValue]] != 0} {
$bdy_str setInputAllowed true
$bdy_str setNullAllowed false
} else {
$bdy_str setInputAllowed false
$bdy_str setNullAllowed true
}
}
proc boundaryString {} {
global bdy_str
global bdy_loc
if {[string length [$bdy_loc getCurrentValue]] != 0} {
$bdy_str setInputAllowed true
} else {
$bdy_str setInputAllowed false
}
}
GuidoForm frm01100 {
-action initial { [ getObjectsTrisolationsForMultipleDTMS $dtm_loc $object_id $obj_name $trisolation_id $tri_name]}
-action initial {[placeTheAxisInTheForm]}
-default_buttons
-label "Multiple DTM sections"
-layout BoxLayout Y_AXIS
-tip "01100_TIP_001"
-action final {[destroyMultipleDtms]}
GuidoScrollPane frm01100_34 {
-scroll_size 50 10
-label "DTM Specifications"
-height 10
-width 76
GuidoTable dtm_specs {
-instances 1 1 50
-interactive true
GuidoFileBrowserField dtm_loc {
-action focusGained { [ getObjectsTrisolationsForMultipleDTMS $dtm_loc $object_id $obj_name $trisolation_id $tri_name]}
-display_length 14
-format string
-extension false
-label "DTM Location"
-max_length 252
-tip "Enter the DTM location for this level"
-file_mask *.dtm
-action valueChanged {[placeTheAxisInTheForm]}
-validation {[validateLocationFieldForNullvalue $dtm_loc]}
}
GuidoComboBox object_id {
-display_length 5
-action focusGained { [ getObjectsTrisolationsForMultipleDTMS $dtm_loc $object_id $trisolation_id]}
-action focusGained {[updateObjectDetailsForMultipleDtms $dtm_loc $object_id $trisolation_id]}
-label "Object ID"
-format none
-max_length 32
-translate none
-exclusive false
-action valueChanged {[triobjectChanged $dtm_loc $object_id $obj_name $trisolation_id $tri_name]}
-action valueChanged {[changeAxisInputs $dtm_loc $object_id $trisolation_id]}
}
GuidoLabel obj_name {
-label "Object name"
-font_style bold
}
GuidoComboBox trisolation_id {
-action focusGained {[updateTrisolationDetailsForMultipleDtms $dtm_loc $object_id $trisolation_id]}
-display_length 5
-label "Trisolation ID"
-format none
-max_length 32
-translate none
-exclusive false
-action valueChanged {[trisolationChanged $dtm_loc $object_id $trisolation_id $tri_name]}
-action valueChanged {[changeAxisInputs $dtm_loc $object_id $trisolation_id]}
}
GuidoLabel tri_name {
-label "Trisolation name"
-font_style bold
}
GuidoComboBox sect_opt {
-default Closed
-display_length 6
-font_style bold
-format none
-label "Section type"
-max_length 6
-tip "Should this section be open or closed?"
-value_in Open Closed
}
GuidoCheckBox sect_inc {
-default true
-font_style bold
-label Include
-selected_value Y
-unselected_value N
-tip "Include this level as a separate section in the output?"
}
GuidoFileBrowserField bdy_loc {
-display_length 8
-font_style bold
-format none
-label "Boundary location"
-max_length 252
-tip "Enter the boundary location for this level"
-file_mask *.str
-link bdy_id
-action valueChanged {[enterString]}
}
GuidoField bdy_id {
-display_length 3
-font_style bold
-format real_8
-label ID
-max_length 30
-tip "Enter the boundary id for this level"
}
GuidoField bdy_str {
-display_length 3
-font_style bold
-format integer_4
-label "String"
-max_length 30
-action initial {[boundaryString]}
-tip "Enter the boundary string number"
}
}
}
GuidoPanel frm01100_1 {
-layout BoxLayout X_AXIS
GuidoPanel frm01100_2 {
-border etched true
-label "Define files to create"
-layout BoxLayout Y_AXIS
GuidoPanel frm01100_3 {
-layout CentreLineLayout Vertical Left
GuidoFileBrowserField secloc {
-label Location
-display_length 28
-format none
-max_length 256
-next_focus frm01100_41
-null false
-tip "Define the output location for the sections"
-file_mask *.str
-file_access write
-extension false
}
GuidoFiller filler {
-width 0.05
}
GuidoFiller filler {
-width 0.05
}
GuidoLabel sect_type_label {
-label Section
}
GuidoPanel frm01100_4 {
-layout CentreLineLayout Vertical Left
GuidoButtonGroupPanel sect_type {
-layout BoxLayout Y_AXIS
-action initial {[validateValue]}
-action valueChanged {[validateValue]}
GuidoRadioButton frm01100_41 {
-caption "By interval"
-default true
-height 1
-selected_value Interval
}
GuidoRadioButton frm01100_42 {
-caption "By range"
-next_focus secint
-height 1
-selected_value Range
}
}
}
GuidoFiller filler {
-width 0.05
}
GuidoFiller filler {
-width 0.05
}
GuidoField secint {
-label "Section values"
-display_length 15
-max_length 26
-next_focus axis_y1
-null false
-tip "Define the interval, or the range as determined by the field above."
}
GuidoFiller frm01100_62 {
-height 0.5
}
}
}
GuidoFiller frm01100_62 {
-width 0.1
}
GuidoPanel frm01100_7 {
-layout CentreLineLayout Vertical Left
-border etched true
-label "Define axis coordinates"
GuidoPanel frm01100_7 {
-layout BoxLayout X_AXIS
GuidoPanel frm01100_8 {
-border etched true
-label "Axis start"
-layout CentreLineLayout
GuidoField axis_y1 {
-display_length 16
-decimals 3
-format double
-label Y
-max_length 16
-next_focus axis_x1
-null false
-translate upper
}
GuidoField axis_x1 {
-display_length 16
-format double
-label X
-decimals 3
-max_length 16
-next_focus axis_z1
-null false
-translate upper
}
GuidoField axis_z1 {
-display_length 16
-format double
-label Z
-decimals 3
-max_length 16
-next_focus axis_y2
-null false
-translate upper
-input false
}
}
GuidoFiller filler {
-width 1
}
GuidoPanel frm00664_3 {
-border etched true
-label "Axis end"
-layout CentreLineLayout
GuidoField axis_y2 {
-display_length 16
-format double
-decimals 3
-label Y
-max_length 16
-next_focus axis_x2
-null false
-translate upper
}
GuidoField axis_x2 {
-display_length 16
-format double
-decimals 3
-label X
-max_length 16
-next_focus axis_z2
-null false
-translate upper
}
GuidoField axis_z2 {
-display_length 16
-format double
-decimals 3
-label Z
-max_length 16
-next_focus axis_orient
-null false
-translate upper
-input false
}
}
GuidoFiller frm00664_18 {
-width 1
}
}
GuidoFiller filler {
-height 0.05
}
GuidoFiller filler {
-height 0.05
}
GuidoPanel frm01100_14 {
-layout CentreLineLayout Vertical Left
GuidoLabel axis_orient_label {
-label "Section orientation is"
}
GuidoButtonGroupPanel axis_orient {
-layout BoxLayout Y_AXIS
-tip "Extract sections parallel or perpendicular to the defined axis line?"
GuidoRadioButton frm01100_52 {
-caption "Perpendicular to the axis"
-default true
-height 1
-next_focus frm01100_53
-selected_value Perpendicular
}
GuidoRadioButton frm01100_53 {
-caption "Parallel to the axis"
-next_focus apply_button
-height 1
-selected_value Parallel
}
}
}
}
}
}
