This article contains a sample script for turning off the visibility of a map layer.
To run this script:
- Copy the script below, or download the attached BAS file: Visibility of Map Layer OFF.bas.
- In a Windows Explorer window, navigate to C:\Program Files\GoldenSoftware\Surfer 16.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press DELETE.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- Click Script | Run to run the script.
'=================================== 'Visibility of Map Layer OFF.bas '=================================== 'Shows how to turn off the visibility of a map layer, similar to unchecking 'the checkbox in the Contents window next to the map layer in the UI. '=================================== Sub Main 'Initializes Surfer Dim SurferApp, Plot, PostLayer, PostLayer2 As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True Set Plot = SurferApp.Documents.Add 'Creates two post maps Set MapFrame = Plot.Shapes.AddPostMap(SurferApp.Path + "\samples\demogrid.dat") Set MapFrame2 = Plot.Shapes.AddPostMap(SurferApp.Path + "\samples\sample1.dat") 'Overlays the two post maps Plot.Shapes.SelectAll Plot.Selection.OverlayMaps Plot.Selection.DeselectAll 'Turns off the visibility of the second post layer Set NewMapFrame = Plot.Shapes.Item(1) Set PostLayer2 = NewMapFrame.Overlays(2) PostLayer2.Visible = False End Sub
Updated November 6, 2018
Comments
0 comments
Please sign in to leave a comment.