This article contains a sample script for creating a multi-layer cross section in Surfer from overlain grid-based map layers. This script is valid in Surfer v15 and above. To run the script, you must have grid files for the tops of various formations.
To run this script:
- Copy the script below, or download the attached BAS file: Profile.BAS.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 16.
- 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.
- In the USER VARIABLES section of the script, near the top, enter the appropriate file path and grid file names. If you have more than two grids, enter more grid#="name.grd" lines below the existing lines.
- Adjust the points for the profile line. Each vertex in your line will require a line like the existing lines:
pts(n)=# : pts(n+1)=#
After adjusting the points, set m in the Dim pts(m) As Double line to the n+1 number from the last vertex.
- If you have more than two grids, copy and paste line 32, incrementing the 2 in MapFrame2 and grid2 (so the next line would be MapFrame3 and grid3), until maps are created for all of your grids.
- Click Script | Run to run the script.
Sub Main 'Initialize Surfer Dim SurferApp, Plot As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True Set Plot = SurferApp.Documents.Add '====================================== 'User-defined variables '====================================== 'Path where grid files are located filepath = "c:\temp\" 'Grid files. If there are more than two, add grid3 = ..., grid4 = ..., etc. grid1 = "layer1.grd" grid2 = "layer2.grd" 'Create 2 Points for Profile Line (in map units). 'Adjust number in Dimmed pts (should be odd) and number of rows below as needed. Dim pts(3) As Double pts(0) = 521421.4 : pts(1) = 6811877.6 pts(2) = 534224.1 : pts(3) = 6792017.0 '====================================== 'Create a contour map and assigns the map frame to the variable "MapFrame" Set MapFrame = Plot.Shapes.AddContourMap(filepath+grid1) 'Create another contour map. 'If there are more than two grid files, copy/paste this line, incrementing the 2 in grid2 and MapFrame2 Set MapFrame2 = Plot.Shapes.AddContourMap(filepath+grid2) 'Overlay maps Plot.Shapes.SelectAll Set NewMapFrame = Plot.Selection.OverlayMaps 'Create Profile object Set Profile = NewMapFrame.Profiles.Add(pts) End Sub
Updated November 7, 2018