Follow

How can I turn off the visibilty of a map or other object in a Surfer script? Normally I would uncheck the object in the Contents window.

Use the .Visible property of the Shape object to turn the visibility of objects on/off. For a full example script, see 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 it into Scripter.
  6. Click Script | Run to run the script.
     
*********
Sub Main

    Dim SurferApp As Object
    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.Visible = True

    'Opens an SRF file
    Dim Plot As Object
    Set Plot = SurferApp.Documents.Open(FileName:=SurferApp.Path+"\Samples\MapLayers.srf")

    'Identifies a layer in the map. This is a shape object.
    Dim MapFrame1 As Object
    Set MapFrame1 = Plot.Shapes.Item(Index:=1)
    Set ContoursLayer = MapFrame1.Overlays(2)

    'Sets that layer to be invisible
    ContoursLayer.Visible = False

End Sub

 

For more information, please see the Visible Property [Shape] Help page. 

 

Updated September 27, 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.