' ATTENTION! ATTENTION! ATTENTION ATTENTION! ATTENTION! Surfer 6.0 version ' The last UNcommented "OutputType$" variable will determine the output OutputType$ = "TEST" 'OutputType$ = "SURF" if OutputType$ = "" then print "No output type specified" end endif ' The last UNcommented "GridMethodType%" variable will determine the grid method ' GridMethodType% = 0 ' Inverse Distance GridMethodType% = 1 ' Kriging ' GridMethodType% = 2 ' Minimum Curvature ' GridMethodType% = 3 ' Polynomial Regression ' GridMethodType% = 4 ' Radial Bias ' GridMethodType% = 5 ' Shepard's ' GridMethodType% = 6 ' Triangulation ' ATTENTION! ATTENTION! ATTENTION ATTENTION! ATTENTION! ATTENTION! ' Declare all variables Option Explicit Dim FileData$ as String Dim FileBlank$ as String Dim FileBlank2$ as String Dim FileOut$ as String Dim FileGrid$ as String Dim FileFont$ as String Dim NoBLNFile% as Integer Dim hWnd% as Integer Dim iMap% as Integer Dim Result% as Integer Dim CmdLine$ as String ' Create the Surfer OLE object Dim Surf As Object Set Surf = CreateObject("Surfer.App") ' Make a new plot window Surf.FileNew(0) ' First make sure that the file directory names are upper case Directory$ = UCASE$(Directory$) File$ = UCASE$(File$) OutputType$ = UCASE$(OutputType$) ' Open the .DAT data file and then close the worksheet FileData$ = TRIM$(Directory$) + TRIM$(File$) + ".DAT" FileBlank$ = TRIM$(Directory$) + TRIM$(File$) + ".BLN" FileBlank2$ = TRIM$(File$) + ".BLN" if OutputType$ = "TEST" then Print "Opening Data File : " + FileData$ hWnd% = Surf.FileOpen(FileData$,1) if hWnd% = 0 then end Surf.DocClose(2) ' If in test mode enable auto-redraw Surf.ViewAutoRedraw(0) if OutputType$ = "TEST" then Surf.ViewAutoRedraw(1) ' Specify Page Orientation (landscape) Surf.FilePageLayout(1) if OutputType$ = "TEST" then Print "Setting Landscape Page Mode" ' Loop through columns and create the grids For iMap% = 0 to MaxCol% - 1 ' Check for blank elements if ASC(ZLabel$(iMap%)) = 0 then goto continue: ' Make the Output File Name FileOut$ = TRIM$(Directory$) + "OUT.GRD" FileGrid$ = TRIM$(Directory$) + TRIM$(File$) + "_" + TRIM$(ZLabel$(iMap%)) + ".GRD" FileFont$ = "Times New Roman" ' Grid the current X,Y,Z data if OutputType$ = "TEST" then Print "Gridding Column " + STR$(iMap%) + " for " + ZLabel$(iMap%) if Surf.GridData(FileData$, xCol=0, yCol=1, zCol=iMap%+2, nRow=40, nCol=40, GridMethod=GridMethodType%, OutGrid=FileOut$) = 0 then End ' Spline smooth the grid and blank it if OutputType$ = "TEST" then Print "Smoothing Column " + STR$(iMap%) + " for " + ZLabel$(iMap%) if Surf.GridSplineSmooth(FileOut$, nInsertRow=2, nInsertCol=2, OutGrid=FileOut$) = 0 then End ' See if the .BLN file is present NoBLNFile% = 1 if UCASE$(DIR$(Directory$+FileBlank2$)) = FileBlank2$ then NoBLNFile% = 0 if NoBLNFile% = 0 then ' If BLN file was found blank the grid if OutputType$ = "TEST" then Print "Blanking Column " + STR$(iMap%) + " for " + ZLabel$(iMap%) if Surf.GridBlank(FileOut$, BlankFile=FileBlank$, OutGrid=FileGrid$) = 0 then End else ' If the BLN file was not found, spline smooth the grid to change the name if NoBLNFile% = 1 then Surf.GridSplineSmooth(FileOut$, nInsertRow=0, nInsertCol=0, OutGrid=FileGrid$) endif ' Load base map if .BLN file is available if OutputType$ = "TEST" then Print "Loading Base Map : " + FileBlank$ if NoBLNFile% = 0 then Surf.MapLoadBaseMap(FileBlank$,ID="BaseMap") ' Create a contour map if OutputType$ = "TEST" then Print "Contouring Column" + STR$(iMap%) + " for " + ZLabel$(iMap%) if Surf.MapContour(FileGrid$, ID="GridMap") = 0 then End ' Add post points from data file if OutputType$ = "TEST" then Print "Posting Column " + STR$(iMap%) + " for " + ZLabel$(iMap%) Surf.MapPost(FileData$, Symbol=11, SymSize=0.1, ID="PostMap") ' Add the Left axis label to the contour plot Surf.Deselect() Surf.Select("GridMap:Left Axis") Surf.MapEditAxis("Left Axis", Title=YLabel$) ' Select the text and add the sample name Surf.Deselect() Surf.DrawText(5.5, 1, Sample$, ID="NameMap") Surf.Select("NameMap") Surf.DrawTextAttributes(Face=FileFont$, Size=14, HorzAlign=1, VertAlign=2) ' Select the text and label the map Surf.Deselect() Surf.DrawText(5.5, .75, ZLabel$(iMap%), ID="FontMap") Surf.Select("FontMap") Surf.DrawTextAttributes(Face=FileFont$, Size=18, HorzAlign=1, VertAlign=2) ' Select Base and grid and overlay maps if base map was loaded if NoBLNFile% = 0 then Surf.Deselect() Surf.Select("BaseMap") Surf.Select("GridMap") Surf.Select("PostMap") if OutputType$ = "TEST" then Print "Overlaying Maps" Surf.MapOverlayMaps() ' Show the axis label, again for overlayed plots Surf.Deselect() Surf.Select("BaseMap:Left Axis") Surf.MapEditAxis("Left Axis", Title=YLabel$) endif ' Print the plot to fit the page if OutputType$ = "SURF" then Surf.FilePrint(Method=1) if OutputType$ = "TEST" then Print "Waiting for 8 seconds" if OutputType$ = "TEST" then Sleep(8) ' Select all objects and delete if OutputType$ = "TEST" then Print "Selecting and deleting contour plot" Surf.Select() Surf.EditDelete() ' Now plot a 3d map if OutputType$ = "TEST" then Print "Surfacing Column " + STR$(iMap%) + " for " + ZLabel$(iMap%) if Surf.MapSurface(FileGrid$, Border=1, BaseOptions=1, ID="GridMap") = 0 then End ' Add the Left and bottom axis labels to the surface plot if OutputType$ = "TEST" then Print "Adding text for axes" Surf.Deselect() Surf.Select("GridMap:Left Axis") Surf.MapEditAxis("Left Axis", Title=YLabel$) Surf.Deselect() Surf.Select("GridMap:Bottom Axis") Surf.MapEditAxis("Bottom Axis", Title=XLabel$) ' Select the text and add the sample name Surf.Deselect() Surf.DrawText(5.5, 1, Sample$, ID="NameMap") Surf.Select("NameMap") Surf.DrawTextAttributes(Face=FileFont$, Size=14, HorzAlign=1, VertAlign=2) ' Select the text and label the map Surf.Deselect() Surf.DrawText(5.5, .75, ZLabel$(iMap%), ID="FontMap") Surf.Select("FontMap") Surf.DrawTextAttributes(Face=FileFont$, Size=18, HorzAlign=1, VertAlign=2) ' Print the plot to fit the page if OutputType$ = "SURF" then Surf.FilePrint(Method=1) if OutputType$ = "TEST" then Print "Waiting for 8 seconds" if OutputType$ = "TEST" then SLEEP(8) ' Select all objects and delete for next plot if OutputType$ = "TEST" then Print "Selecting and deleting surface plot" Surf.Select() Surf.EditDelete() continue: Next ' Close the Surfer App Surf.FileExit(2) End