Application Object
|
The Application object represents the Surfer program. All navigation through the Surfer object model begins with the Application object. The Application object is a single instance of Surfer and it is the root of all objects in Surfer. External programs will typically create an instance of the Application object during initialization. In Visual Basic (VB) this is done using the function as in:
Set SurferApp = CreateObject("Surfer.Application")
The CreateObject function activates a new instance of Surfer, and returns a reference to the Application object to your script. If Surfer is already running, and you do not want to start a new instance of Surfer, use the VB GetObject function instead of CreateObject:
Dim SurferApp As Object
Set SurferApp = GetObject(,"Surfer.Application")
The GetObject function obtains the Application object from the currently running instance of Surfer. If Surfer is not already running, the function will fail. Call the Application object’s Quit method to close Surfer from a script.
When Surfer is started by a script, its main window is initially hidden. To make the Surfer window visible, you must set the Application object’s Visible property to True:
Set SurferApp = GetObject(,"Surfer.Application")
SurferApp.Visible = True
Most of the gridding-related operations are methods of the Application object. Use the GridData, GridFunction, GridMath, GridFilter, GridSplineSmooth, GridAssignNoData, GridConvert, GridVolume, GridSlice, GridTransform, GridExtract, and GridCalculus methods to create new grids and perform computations with grids.
Other methods and properties of the Application object let you move and resize the Surfer window, adjust the main window state (maximized, minimized, hidden), change the window caption, and modify preference settings.
The Application object provides two important collections that allow access to the next level of objects in the hierarchy. Use the Documents property to obtain a reference to the Documents collection object, and use the Windows property to obtain a reference to the Windows collection object. The Documents and Windows collection objects provide access to the other objects in the object hierarchy. You can access the currently active document and window objects with the Application object’s ActiveDocument and ActiveWindow properties.
Set the ScreenUpdating property to False to disable screen updating and make your scripts execute more quickly. Turning off screen updating can greatly increase the performance of Automation when you want to perform a number of actions that cause screen redraws.
The following table provides the properties of the application object:
Property |
Description |
Returns the active document object. It is a read-only property. |
|
Returns the active window object. It is a read-only property. |
|
Returns the application object. It is a read-only property. |
|
Returns/sets the global file backup state. |
|
Returns/sets the main window title. |
|
Gets/Sets the default path for opening files. |
|
Returns the Documents collection. It is a read-only property. |
|
Returns the Full path and name of the application. It is a read-only property. |
|
Returns/sets the height of the window. |
|
Returns/sets the coordinate for the left edge of the window. |
|
Name* |
Returns the name of the application (no path). It is a read-only property. |
Returns/sets the global page unit type. |
|
Returns this object. It is a read-only property. |
|
Returns the path of the application (no filename). It is a read-only property. |
|
Returns/sets the redraw flag for all view windows. |
|
Returns the status bar visibility state. |
|
Returns/sets the visibility state of all the toolbars. |
|
Returns/sets the coordinate for the top edge of the window. |
|
Returns the application version. |
|
Returns/sets the application window visibility. |
|
Returns/sets the width of the window. |
|
Returns the Windows collection. |
|
Returns/sets the state of the main application window. |
The following table provides the methods of the application object:
Methods |
Description |
Performs cross validation. |
|
Assigns the NoData value to grid nodes inside or outside specified boundaries. |
|
Performs various calculus operations on an existing grid. |
|
Converts between various grid formats. |
|
Creates a grid from irregularly spaced XYZ data. |
|
Creates a grid from irregularly spaced XYZC data. |
|
Extracts a subset from an existing grid file. |
|
Applies a filter to an existing grid. |
|
Creates a new grid from the specified function. |
|
Grid-to-grid and grid-to-constant math operations when more than two grids are combined or when assigning Z values to NoData nodes. |
|
Creates a new grid by mosaicing one or more input grids. |
|
Converts the coordinate system of a grid file from one system to another and saves the results to a new grid file. |
|
Compute the difference between XYZ data and a grid surface. |
|
Compute cross section data through a grid surface. |
|
Smooths an existing grid using cubic splines. |
|
Scales, Offsets, Mirrors, or Rotates an existing grid file. |
|
Computes the volume under or over a grid surface. |
|
Creates a new grid object. |
|
Creates a new XYZC grid object. |
|
Sets the grid names and parameters to use with the GridMath2 command. |
|
Creates a variogram component object. |
|
Computes the interpolated Z value on a gridded surface at given XY locations saved in a data file. |
|
Terminates the application. |
*default property
Example 1
This script displays all the properties in the Application object.
Example 2
This script displays all the methods in the Application object.
Example 3
The following script demonstrates how the Application object is used.
Sub Main
'Declare SurferApp as an object
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")
'Makes Surfer visible
SurferApp.Visible = True
End Sub