Follow

How can I use the Zoom Rectangle command from a Surfer script?

This article contains a sample script for utilizing ZoomRectangle to zoom into the corners of a map layer.

To run this script:

  1. Copy the script below, or download the attached BAS file: ZoomRectangle.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 14\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. 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.
  6. Click Script | Run to run the script.
     

*********

'Zoom Rectangle.bas utilizes ZoomRectangle to zoom into the corners of a map.

'=====================================

Sub Main

'Declare the variable that will reference the application
	Set SurferApp = CreateObject("Surfer.Application")
	Dim Doc As Object
	SurferApp.Visible = True

'Declares Plot as an object
	Dim Plot As Object
	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 February 14, 2017

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.