GridFunction2

GridFunction2 creates a new grid from the specified function. Returns a Boolean. Returns 'True', if the grid is created successfully. Otherwise, returns 'False'.

Syntax

object.GridFunction( Function, xMin, xMax, xInc, yMin, yMax, yInc, OutGrid, OutFmt, OutGridOptions )

Parameter

Type

Required/

Optional

Default

Description

Function

String

Required

 

This specifies the function equation.

xMin

Double

Required

 

This specifies the X minimum for equation calculation. This is the beginning X value used in the specified function. The first grid node is calculated based on this value.

xMax

Double

Required

 

This specifies the X maximum for equation calculation. This is the upper X value to be applied to the function.

xInc

Double

Required

 

This specifies the X increment.

yMin

Double

Required

 

This specifies the Y minimum for equation calculation. This is the beginning Y value used in the specified function. The first grid node is calculated based on this value.

yMax

Double

Required

 

This specifies the Y maximum for equation calculation. This is the upper Y value to be applied to the function.

yInc

Double

Required

 

This specifies the Y increment.

OutGrid

String

Optional

""

This provides the path and file name of the output grid file.

OutFmt

SrfGridFormat

Optional

srfGridFmtS7

This provides the output grid file format.

OutGridOptions

String

Optional

""

This provides the output option string for the grid format.

Example 1

This example demonstrates how to create a grid from a specified function, saving the result as dgrid1.grd.

SurferApp.GridFunction(Function:="z=(pow(x,2)+pow(y,2))*(sin(8*atan2(x,

xMin:=-25, xMax:=25, xInc:=0.1, yMin:=-25, yMax:=25, yInc:=0.1, _

OutGrid:="c:\temp\dgrid1.grd", OutFmt:=srfGridFmtS7)

Example 2

This example demonstrates how to set export options for an output grid.

Sub Main

 

Dim Surfer As Object

Set Surfer = GetObject(, "Surfer.Application")

Set OptionsRefs = "ForgetOptions=1, ValuesPerLine=4, BlankLinePerGridRow=1"

Set OutGridPath = "C:\Documents\"

 

'outputs a grid (Surfer 6 Text Grid format) and uses this file type's 'ValuesPerLine' and 'BlankLinePerGridRow' export options

Surfer.GridFunction2(Function:="z=x*y", xMin:=0, xMax:=15, xInc:=.5, yMin:=-10, yMax:=10, yInc:=1.5, OutGrid:=OutGridPath + "function.grd", OutFmt:=srfGridFmtAscii, OutGridOptions:=OptionsRefs)

 

End Sub

Example 3

This script displays all the methods in the Application object.

Used by: Application object