This article contains a sample script for utilizing ZoomRectangle to zoom into the corners of a map layer.
To run this script:
- Copy the script below, or download the attached BAS file: ZoomRectangle.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.
'===================================== 'Zoom Rectangle.bas '===================================== 'Utilizes ZoomRectangle to zoom into the corners of a map. '===================================== Sub Main 'Initializes Surfer Set SurferApp = CreateObject("Surfer.Application") Dim Doc, Plot As Object SurferApp.Visible = True Set Plot = SurferApp.Documents.Add(srfDocPlot) 'Creates a contour map from Demogrid.grd Set MapFrame = Plot.Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\Demogrid.grd") 'Sets the corners of the Contours map layer TopCorner = MapFrame.Top LeftCorner = MapFrame.Left BottomCorner = MapFrame.Top - MapFrame.Height RightCorner = MapFrame.Left + MapFrame.Width 'Zooms to the small map Plot.NewWindow.ZoomRectangle(Left:=LeftCorner, Top:=TopCorner, Right:=RightCorner, Bottom:=BottomCorner) End Sub
Updated November 8, 2018
Comments
0 comments
Please sign in to leave a comment.