'============================================================================ 'NAMING.BAS ' 'This script demonstrates the following: ' ' Shows how to use Shape.Name =, ' overlay objects, ' use the SetZOrder command ' ' SKP 9/99 Surfer 7 '============================================================================ Sub Main 'Declare the variable that will reference the application Dim SurferApp As Object 'Creates an instance of the Surfer Application object ' and assigns it to the variable named "SurferApp" Set SurferApp = CreateObject("Surfer.Application") 'Make Surfer visible SurferApp.Visible = True 'Set path Path=SurferApp.Path+"\Samples\" 'Declares Doc as an Object Dim Doc As Object 'Creates a new plot window with variable name "Doc" Set Doc = SurferApp.Documents.Add 'Declares MapFrame1 as an Object Dim MapFrame1 As Object 'Creates a contour map & assigns the map frame to the variable "MapFrame" Set MapFrame1 = Doc.Shapes.AddContourMap(GridFileName:=Path+"demogrid.grd") 'Declares ContourMap as an Object Dim ContourMap As Object 'Assigns the contour overlay to the variable "ContourMap" for easier access Set ContourMap = MapFrame1.Overlays(1) 'Name the map frame (left side of colon) MapFrame1.Name = "Demogrid" 'Name contour map overlay (right side of colon) ContourMap.Name = "Contour Map" 'Declares MapFrame2 as an Object Dim MapFrame2 As Object 'Creates a post map & assigns the map frame to the variable "MapFrame2" Set MapFrame2 = Doc.Shapes.AddPostMap(DataFileName:=Path+"demogrid.dat") 'Declares PostMap as an Object Dim PostMap As Object 'Assigns the post map overlay to the variable "PostMap" for easier access Set PostMap = MapFrame2.Overlays(1) 'Name map frame (left side of colon) MapFrame2.Name = "Demogrid" 'Name post map overlay (right side of colon) PostMap.Name = "Post Map" 'Select map objects Mapframe1.Selected = True Mapframe2.Selected = True 'Overlay selected maps Doc.Selection.OverlayMaps 'Arrange map objects ContourMap.SetZOrder(Zorder:=srfZOToFront) End Sub