Follow

How can I change the axes settings in Surfer via automation?

You can change the settings of any axis by accessing each axis through the Axes collection.  For more options for the axes, please see the Axis Object Help topic.
 

For example:

Dim Axes, XAxis As Object
Set Axes = MapFrame.Axes

'Assigns the bottom X axis to the variable named "XAxis", instead of 1 you could use "bottom axis"
Set XAxis = Axes(1)
XAxis.Title = "X Axis Title"

 

A full script example of this process is shown below. 


To run this script:

  1. Copy the script below.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 14\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. Press Ctrl+V to paste the script into Scripter.
  6. Click Script | Run to run the script.
     

*********

Sub Main

    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.Documents.Add(srfDocPlot)
    SurferApp.Visible = True

    Infile = SurferApp.Path + "\samples\demogrid.grd"
    Dim Plot, MapFrame, Axes, Axis As Object
    Set Plot = SurferApp.Documents.Add
    Set MapFrame = Plot.Shapes.AddContourMap(GridFileName:=Infile)
    Set Axes = MapFrame.Axes

    For Each Axis In Axes
        Axis.ShowLabels = False
        Axis.MajorTickType = srfTickNone
        Axis.MinorTickType = srfTickNone
    Next Axis

End

See also the attached script Axes.bas, which can also be found in the \Samples\Scripts\ folder in the Surfer installation directory.

 

Updated February 14, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.