'Grids selected data columns in selected data file using all 8 'gridding methods that support breaklines and produces 'contour maps of the resulting grids to compare results. '1. Go to Script | Run '2. Select data file and click Open. '3. Select BLN file and cilck Open. '4. Enter the column number for the X data and click OK. '5. Enter the column number for the Y data and click OK. '6. Enter the column number for the Z data and click OK. '****************************************** Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Specify the height of the map ylength = 2 'Specifies the data file to grid Data$ = GetFilePath( , "dat;csv;xls;xlsx",path1, "Data file to grid") If Data$ ="" Then End Dim Doc As Object Set Doc = SurferApp.Documents.Add 'Set data columns xcol= Val(InputBox$("Enter X column number. For example, Column A = 1", "X Column", "1")) ycol= Val(InputBox$("Enter Y column number. For example, Column B = 2", "Y Column", "2")) zcol= Val(InputBox$("Enter Z column number. For example, Column C = 3", "Z Column", "3")) 'Specifies the BLN file to use for the breakline BLN$ = GetFilePath( , "bln",path1, "BLN file to use for the breakline") If BLN$ ="" Then End '1. Inverse Distance SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=1, OutGrid:=Data$+"_InverseDistance.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map As Object Set Map = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_InverseDistance.grd") Map.yLength = ylength Map.xMapPerPU = Map.yMapPerPU If Map.Width<3.5 Then Map.xMapPerPU=Map.yMapPerPU Else Map.xLength=3.5 Map.Axes("Bottom Axis").Title = "Inverse Distance" Map.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map.Left = 0.25 Map.Top = 10.90 'Overlays a base map of the BLN file Set Map_a = Doc.Shapes.AddBaseLayer(Map:=Map, ImportFileName:=BLN$) '2. Kriging SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=2, OutGrid:=Data$+"_Kriging.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map2 As Object Set Map2 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_Kriging.grd") Map2.yLength = ylength Map2.xMapPerPU = Map.yMapPerPU If Map2.Width<3.5 Then Map2.xMapPerPU=Map2.yMapPerPU Else Map2.xLength=3.5 Map2.Axes("Bottom Axis").Title = "Kriging" Map2.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map2.Left = 4.27 Map2.Top = 10.90 'Overlays a base map of the BLN file Set Map2_a = Doc.Shapes.AddBaseLayer(Map:=Map2, ImportFileName:=BLN$) '3. Minimum Curvature SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=3, OutGrid:=Data$+"_MinimumCurvature.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map3 As Object Set Map3 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_MinimumCurvature.grd") Map3.yLength = ylength Map3.xMapPerPU = Map.yMapPerPU If Map3.Width<3.5 Then Map3.xMapPerPU=Map3.yMapPerPU Else Map3.xLength=3.5 Map3.Axes("Bottom Axis").Title = "Minimum Curvature" Map3.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map3.Left = 0.25 Map3.Top = 8.16 'Overlays a base map of the BLN file Set Map3_a = Doc.Shapes.AddBaseLayer(Map:=Map3, ImportFileName:=BLN$) '4. Nearest Neighbor SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=6, OutGrid:=Data$+"_NearestNeighbor.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map4 As Object Set Map4 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_NearestNeighbor.grd") Map4.yLength = ylength Map4.xMapPerPU = Map.yMapPerPU If Map4.Width<3.5 Then Map4.xMapPerPU=Map4.yMapPerPU Else Map4.xLength=3.5 Map4.Axes("Bottom Axis").Title = "Nearest Neighbor" Map4.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map4.Left = 4.27 Map4.Top = 8.16 'Overlays a base map of the BLN file Set Map4_a = Doc.Shapes.AddBaseLayer(Map:=Map4, ImportFileName:=BLN$) '5. Radial Basis Function SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=8, OutGrid:=Data$+"_RadialBasisFunction.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map5 As Object Set Map5 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_RadialBasisFunction.grd") Map5.yLength = ylength Map5.xMapPerPU = Map.yMapPerPU If Map5.Width<3.5 Then Map5.xMapPerPU=Map5.yMapPerPU Else Map5.xLength=3.5 Map5.Axes("Bottom Axis").Title = "Radial Basis Function" Map5.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map5.Left = 0.25 Map5.Top = 5.35 'Overlays a base map of the BLN file Set Map5_a = Doc.Shapes.AddBaseLayer(Map:=Map5, ImportFileName:=BLN$) '6. Moving Average SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=10, OutGrid:=Data$+"_MovingAverage.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map6 As Object Set Map6 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_MovingAverage.grd") Map6.yLength = ylength Map6.xMapPerPU = Map.yMapPerPU If Map6.Width<3.5 Then Map6.xMapPerPU=Map6.yMapPerPU Else Map6.xLength=3.5 Map6.Axes("Bottom Axis").Title = "Moving Average" Map6.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map6.Left = 4.27 Map6.Top = 5.35 'Overlays a base map of the BLN file Set Map6_a = Doc.Shapes.AddBaseLayer(Map:=Map6, ImportFileName:=BLN$) '7. Data Metrics SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=11, OutGrid:=Data$+"_DataMetrics.grd", _ SearchEnable:=True, SearchNumSectors:=2, SearchRad1:=2000, SearchRad2:=1500, DataMetric:=23, BreakFileName:=BLN$) Dim Map7 As Object Set Map7 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_DataMetrics.grd") Map7.yLength = ylength Map7.xMapPerPU = Map.yMapPerPU If Map7.Width<3.5 Then Map7.xMapPerPU=Map7.yMapPerPU Else Map7.xLength=3.5 Map7.Axes("Bottom Axis").Title = "Data Metrics: Terrain Slope" Map7.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map7.Left = 0.25 Map7.Top = 2.57 'Overlays a base map of the BLN file Set Map7_a = Doc.Shapes.AddBaseLayer(Map:=Map7, ImportFileName:=BLN$) '8. Local Polynomial SurferApp.GridData(DataFile:=Data$, xcol:=xcol, ycol:=ycol, zcol:=zcol, ShowReport:=False, Algorithm:=12, OutGrid:=Data$+"_LocalPolynomial.grd", SearchEnable:=1, BreakFileName:=BLN$) Dim Map8 As Object Set Map8 = Doc.Shapes.AddContourMap(GridFileName:=Data$+"_LocalPolynomial.grd") Map8.yLength = ylength Map8.xMapPerPU = Map.yMapPerPU If Map8.Width<3.5 Then Map8.xMapPerPU=Map8.yMapPerPU Else Map8.xLength=3.5 Map8.Axes("Bottom Axis").Title = "Local Polynomial" Map8.Axes("Bottom Axis").TitleFont.ForeColorRGBA.Color = srfColorRed Map8.Left = 4.27 Map8.Top = 2.57 'Overlays a base map of the BLN file Set Map8_a = Doc.Shapes.AddBaseLayer(Map:=Map8, ImportFileName:=BLN$) End Sub