One potential use for automation is to open and manipulate files in a manner that imitates a video. In this use-case, it is important to be able to zoom in on specific objects in the main plot window. The script below shows how this can be done using the zoom rectangle command. Additional information about this and other zoom methods can be found in the PlotWindow object help page.
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 2021
Comments
0 comments
Please sign in to leave a comment.