Follow

How can I move and size my map from a Surfer script?

This article contains a sample script for resizing and moving maps.

To run this script:

  1. Copy the script below, or download the attached BAS file: sizemove.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.
     

*********

'==========================================================================
'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
	Dim SurferApp As Object
	Set SurferApp = CreateObject("Surfer.Application")
	SurferApp.Visible = True

	Path = SurferApp.Path + "\samples\"

	Dim Plot As Object
	Set Plot = SurferApp.Documents.Add
	Dim MapFrame As Object
	Set MapFrame = Plot.Shapes.AddContourMap(GridFileName:=Path+"demogrid.grd")

	Dim ContourLayer As Object
	Set ContourLayer = MapFrame.Overlays(1)
	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 of the page
	Plot.Selection.Left = 1.0
	Plot.Selection.Top = 4.0

'Shrink the contour map and color scale equivalent to
'dragging the corners of the object in the user interface
	Plot.Selection.Width = 3.5
	Plot.Selection.Height = 3.0
	
'Deselect All
	Plot.Selection.DeselectAll
	
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.