Follow

How can I export my map to a BMP with Surfer automation?

This sample script in this article demonstrates how to create a contour map and export to bitmap using Scripter.

To run this script:

  1. Copy the script below, or download the attached BAS file: ExportBitmap.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 15\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.
     

*********

'==========================================================================
'ExportBitmap.bas
'
'This script demonstrates the following:
'
'	Create a contour map
'	Export to bitmap

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

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")

'Export to Bitmap with 200 DPI resolution
	Plot.Export(FileName:=Path+"demogrid.bmp", Options:="Defaults=1,HDPI=200,VDPI=200,ColorDepth=4")
	
End Sub

 

Updated October 11, 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.