######################################################################
#
# Macro Name    : c:/users/public/gemcom/surpac/63/demo_data/18_adjust_coordinates.tcl
#
# Version       : Surpac 6.3
#
# Creation Date : Wed Jun 27 13:22:44 2012
#
# Description   : 
#
######################################################################

set adjustCoordsForm {
  GuidoForm adjustCoordsForm {
    -label "Adjust Coordinates"
    -default_buttons

    GuidoFileBrowserField in_location {
      -label "Input location"
      -width 20
      -format none
      -null false
      -file_mask "*.*"
      -link in_id
    }

    GuidoField in_id {
      -label "Id"
      -format float
      -null false
    }

    GuidoField out_location {
      -label "Output location"
      -width 20
      -format none
      -null false
    }

    GuidoField adjust_x {
      -label "Adjust X"
      -format float
      -null false
      -default 0
    }
    GuidoField adjust_y {
      -label "Adjust Y"
      -format float
      -null false
      -default 0
    }
    GuidoField adjust_z {
      -label "Adjust Z"
      -format float
      -null false
      -default 0
    }
  }
}

SclCreateGuidoForm adjustCoordsFormHandle $adjustCoordsForm {}
$adjustCoordsFormHandle SclRun {}

 # perform the conversion by calling string maths with the form inputs
set status [ SclFunction "STR MATHS" {
  frm00700={
    {
      file_loc="$in_location"
      file_id="$in_id"
      result_loc="$out_location"
      main=table { str_range constraint field expr } {
        { "all" "" "x" "x+$adjust_x" }
        { "" "" "y" "y+$adjust_y" }
        { "" "" "z" "z+$adjust_z" }
      }
    }
  }
}]
