gridinfo.bas

来自「Surfer是地学中常用的一个软件」· BAS 代码 · 共 43 行

BAS
43
字号
'==========================================================================
'GRIDINFO.BAS
'
'This script demonstrates the following:
'
'	How to print out grid information
'	Note that you need to have the View | Always Split option checked to
'	view the results
'
'												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")

	'Assigns the location of the data and grid files to the variable "Path"
	Path = SurferApp.Path + "\samples\"

	'Grid the data file using the current method.  This returns False if the grid
	' could not be created
	If SurferApp.GridData(DataFile:=Path+"demogrid.dat", ShowReport:=False, _
		Algorithm:=srfKriging, OutGrid:=Path+"sample.grd") <>True Then Stop
	
	'Create a new grid object and load the created grid
	Dim Grid As Object
	Set Grid = SurferApp.NewGrid
	Grid.LoadFile(Path+"sample.grd", False)
	
	'Print results to the immediate window
	Debug.Print Grid.FileName
	Debug.Print Grid.xMin
	Debug.Print Grid.xMax
	Debug.Print Grid.yMin
	Debug.Print Grid.yMax
	Debug.Print Grid.NumCols
	Debug.Print Grid.NumRows
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?