⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gridspacing.bas

📁 Surfer是地学中常用的一个软件
💻 BAS
字号:
Sub Main
	Debug.Print "----- ";Time;" -----"
	On Error GoTo createnew
  	Set Surf = GetObject(, "Surfer.Application")
  On Error GoTo 0
	GoTo skipnew
	createnew:
	Set Surf = CreateObject("Surfer.Application")
	Surf.Visible = True
	skipnew:
	path1 = surf.Path+"\samples\"
	infile1 = GetFilePath(path1+"demogrid.dat","dat;csv;xls",path1,"Input Data File",0)
	Debug.Print infile1
	outfile1 = GetFilePath(,"grd",surf.Path+"\samples\","Outfile",2)
	Debug.Print outfile1
	gridspacing = InputBox("Enter Grid Spacing","Grid Spacing")
	Debug.Print gridspacing
	Set Wks = surf.Documents.Open(infile1)
	Set WksRange = Wks.Columns(Col1:=1, Col2:=2)
	Set WksStatistics = WksRange.Statistics

 	'Calculates the min/max for the X and Y columns
	xmin=WksStatistics.Minimum(1)
	xmax=WksStatistics.Maximum(1)
	ymin=WksStatistics.Minimum(2)
	ymax=WksStatistics.Maximum(2)
	wks.Close
	Debug.Print xmin;xmax;ymin;ymax
	'Calculate number of columns and rows from desired spacing.
	ncol=1+(xmax-xmin)/gridspacing
	nrow=1+(ymax-ymin)/gridspacing
	
	Set plotdoc1 = surf.Documents.Add
	surf.GridData(infile1, _
		NumCols:=ncol, NumRows:=nrow, Outgrid:=outfile1)
	plotdoc1.Shapes.AddContourMap(outfile1)
End Sub

⌨️ 快捷键说明

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