Shape Object

The Shape object is a base object for all graphical objects within the plot document. The properties and methods of this object are shared by all objects derived from the Shape object. The Shapes collection contains all the shapes in the document. Selected shapes are also contained within the Selection collection.

Entering/Exiting groups, such as base layers, will be performed internally by the application, if necessary.

The following table provides all properties of the Shape object.

Property

Description

Application

Returns the application object. It is a read only property.

Height

Returns/sets the height of the shape..

Left

Returns/sets the coordinate for the left edge of the shape.

Name*

Returns/sets the name or id of this shape.

Parent

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

Rotation

Returns/sets the rotation (in degrees) of the shape.

Selected

Returns/sets the selection state of the shape.

Top

Returns/sets the coordinate for the top edge of the shape.

Type

Returns the shape type. It is a read only property.

Visible

Returns/sets the visibility state of the shape.

Width

Returns/sets the width of the shape.

The following table provides the methods of the Shape Object:

Method

Description

Delete

Deletes the shape.

Deselect

Deselects the object.

Select

Selects the object.

SetZOrder

Move the object forward or backward in the Z (drawing) order.

Remarks

The Deselect and Select methods cannot be used for objects within a base layer or composite object.

*default property

Example 1

This script displays all the methods and properties in the Shape object.

Example 2

The following script demonstrates how to access the Shapes collection. Use the Shapes collection to access any Shape 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

 

End Sub