When overlaying multiple layers into a single map, you may want to name them so that they are easier to call for later manipulation. There are two steps to naming your maps in Surfer Scripter:
- Name the Map "frame" that holds the layers and axes (e.g. called Map in the user interface)
- Name the "overlays", which are the actual map layers (e.g. called Contours or Base in the user interface)
The script below shows how to use the .Name property of the Shape object to rename a layer or map object.
To run this script:
- Copy the script below, or download the attached BAS file: AssignName.BAS
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- Press Ctrl+V to paste the script into Scripter.
- Click Script | Run to run the script.
*********
Sub Main Dim SurferApp, Plot, MapFrame1, ContourLayer, MapFrame2, PostLayer As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Set path Path=SurferApp.Path+"\Samples\" Set Plot = SurferApp.Documents.Add 'Creates a contour map Set MapFrame1 = Plot.Shapes.AddContourMap(GridFileName:=Path+"demogrid.grd") Set ContourLayer = MapFrame1.Overlays(1) 'Name the contour layer ContourLayer.Name = "This is My Contour Layer" 'Creates a post map Set MapFrame2 = Plot.Shapes.AddPostMap(DataFileName:=Path+"demogrid.dat") Set PostLayer = MapFrame2.Overlays(1) 'Name the post layer PostLayer.Name = "This is My Post Layer" 'Select and overlays the map objects MapFrame1.Selected = True MapFrame2.Selected = True Set NewMapFrame = Plot.Selection.OverlayMaps 'Name the map frame NewMapFrame.Name = "Demogrid Map" End Sub
Updated November 2021
Comments
Please sign in to leave a comment.