Back to Avenue Source Code Home

'---------------------------------
'Name: grid2asc.bat
'Date: 1-10-01
'Author: Marco Morais
'
' prompts the user for grids on disk
'
' exports each grid to ASCII raster file
' of same name in same directory
'
'Returns:
'NILL
'
'Called By:
'MANY
'
'Calls:
'None
'
'Arguments:
'None
'---------------------------------

MsgBox.Report("grid2asc.bat" + NL +
              "1. prompts the user for grids on disk" + NL +
              "2. exports each grid to ASCII raster file" + NL +
              "   of same name in same directory", "About Script....")

'---------------------------------------
'retrieve list of grids to export
'---------------------------------------
theExportGridsSrcNameList = SourceDialog.ShowClass("Select the Grid(s) to export as ASCII raster files", Grid)
if ( theExportGridsSrcNameList.Count = 0 )  then
  return NIL
end

'---------------------------------------
'make grids from srcnames and export 
'---------------------------------------
theExportGridsList = List.Make
for each srcn in theExportGridsSrcNameList
  theGrid = Grid.Make(srcn)
  if ( theGrid.HasError ) then
    MsgBox.Error("Grid not able to be created", "Error")
    return NIL
  end
  theGrid.SaveAsASCII((srcn.GetFileName.GetName + ".asc").AsFileName)
end

av.PurgeObjects

return NIL



Last Updated: Marco Morais