'============================================================================ 'GRIDMATH.BAS ' ' This script demonstrates the following: ' ' How to use the grid math command, including functions ' ' SKP 9/99 Surfer 7 '============================================================================ Sub Main 'Declare the variable that will reference the application Dim SurferApp As Object 'Creates an instance of the Surfer Application object ' and assigns it to the variable named "SurferApp" Set SurferApp = CreateObject("Surfer.Application") 'Make Surfer visible SurferApp.Visible = True 'Set path Path = SurferApp.Path + "\samples\" 'Declares Doc as an Object Dim Doc As Object 'Creates a new document with variable name "Doc" Set Doc = SurferApp.Documents.Add 'Grid the data file using the current method SurferApp.GridData (DataFile:=Path+"demogrid.dat", ShowReport:=False, Algorithm:=srfKriging, _ OutGrid:=Path+"sample.grd") 'Use the GridMath command SurferApp.GridMath (InGridA:=Path+"sample.grd", InGridB:=Path+"demogrid.grd", _ OutGridC:=Path+"test.grd", Function:="c=a+b", OutFmt:=srfGridFmtS7) 'Creates a contour map Doc.Shapes.AddContourMap(GridFileName:=Path+"test.grd") End Sub