This article contains a sample script for resizing and moving maps.
To run this script:
- Copy the script below, or download the attached BAS file: sizemove.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.
- 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.
'======================================================= 'sizemove.bas 'This script demonstrates the following: ' Create a color filled contour map with a color scale ' Move entire map and color scale to lower left portion of page '======================================================= Sub Main 'Initialize Surfer Dim SurferApp, Plot, MapFrame, ContourLayer As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True Set Plot = SurferApp.Documents.Add 'Define 'Path' as the sample directory Path = SurferApp.Path + "\samples\" 'Create contour map from sample file demogrid.grd Set MapFrame = Plot.Shapes.AddContourMap(GridFileName:=Path+"demogrid.grd") 'Define 'ContourLayer' as the first layer in the map frame Set ContourLayer = MapFrame.Overlays(1) 'Fill contours and show the color scale ContourLayer.FillContours = True ContourLayer.ShowColorScale = True 'Select contour map and color scale MapFrame.Selected = True ContourLayer.ColorScale.Selected = True 'Move the contour map and color scale to lower left corner of the page Plot.Selection.Left = 1.0 Plot.Selection.Top = 4.0 'Shrink the contour map and color scale (like click-and-drag in the UI) Plot.Selection.Width = 3.5 Plot.Selection.Height = 3.0 'Deselect All Plot.Selection.DeselectAll End Sub
Updated November 6, 2018
Comments
0 comments
Please sign in to leave a comment.