'BlankByLevel blanks a grid above or below a given Z value. Sub Main Debug.Clear Set surf = CreateObject("Surfer.Application") 'surf.Visible = True Set plot = surf.Documents.Add(srfDocPlot) Set shapes = plot.Shapes Set Grid = surf.NewGrid 'Choose a grid file gridfilepath = GetFilePath( , "grd",surf.Path+"\samples\","Open Grid File",0) ' Set level cutoff and flag above or below Dim level As Double Dim below As Boolean Begin Dialog UserDialog 270,112 ' %GRID:10,7,1,1 Text 10,7,90,14,"Z Level value:",.Text0 TextBox 10,28,180,21,.LevlVal OptionGroup .Group1 OptionButton 20,77,130,14,"Blank Below",.below OptionButton 20,56,130,14,"Blank Above",.above OKButton 170,70,80,21 End Dialog Dim entervalue As UserDialog Dialog entervalue level = Val(entervalue.LevlVal$) Debug.Print "Z Level Value = ";entervalue.LevlVal$ If entervalue.Group1 = 0 Then below = True If entervalue.Group1 = 1 Then below = False Grid.LoadFile(gridfilepath,False) Debug.Print "Processing GridRow:" For row=1 To Grid.NumRows() For col=1 To Grid.NumCols() If below = True Then If Grid.GetNode(row,col) < level And Grid.IsBlanked(row,col) = False Then Grid.BlankNode(row,col) ElseIf below = False Then If Grid.GetNode(row,col) > level And Grid.IsBlanked(row,col) = False Then Grid.BlankNode(row,col) End If Next col Debug.Print row; If row Mod 20 = 0 Then Debug.Print Next row gridfilepath = Left(gridfilepath,InStrRev(gridfilepath,".")-1) + "_Blanked.grd Grid.SaveFile(gridfilepath, srfGridFmtS7) Debug.Print "" 'newline Debug.Print "" 'newline Debug.Print "File saved as ";gridfilepath shapes.AddContourMap(gridfilepath) surf.Visible = True End Sub