Levels Collection

The Levels collection contains all levels in a contour map or wireframe. An individual member of the Levels collection is the Level object. Methods exist to automatically create a range of levels and to load or save the levels from disk.

The following table provides the properties of the Levels collection:

Property

Description

Application

Returns the application object. Its a read-only property

Count

Returns the number of levels in the collection. It is a read-only property.

Parent

Returns the parent object. It is a read-only property.

The following table provides the methods of the Levels collection:

Method

Description

AutoGenerate

Generates an evenly spaced series of levels.

Item*

Returns an individual level.

LoadFile

Loads the specified level file.

SaveFile

Saves the current levels in a level file.

Set

Creates a level from each element of the specified array.

SetHachFrequency

Turns on/off a range of hachures.

SetLabelFrequency

Turns on/off a range of labels.

*default method

Example

The following script demonstrates how the Levels collection is used in reference to the ContourLayer object.

Sub Main

 

'Declares SurferApp as an object

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

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Plot as an object

Dim Plot As Object

 

'Creates a plot document in Surfer and assigns it to the variable named

'"Plot"

Set Plot = SurferApp.Documents.Add(srfDocPlot)

 

'Declares Shapes as an object

Dim Shapes As Object

 

'Assigns the Shapes collection to the variable named "Shapes"

Set Shapes = Plot.Shapes

 

'Declares MapFrame as an object

Dim MapFrame As Object

 

'Creates a contour map and assigns the map coordinate system to the

'variable named "MapFrame"

Set MapFrame = Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\demogrid.grd")

 

'Declares ContourLayer as an object

Dim ContourLayer As Object

 

'Assigns the contour map properties to the variable named "ContourLayer"

Set ContourLayer = MapFrame.Overlays(1)

 

'Declares Levels as an object

Dim Levels As Object

 

'Assigns the Levels collection to the variable named "Levels"

Set Levels = ContourLayer.Levels

  

End Sub