Shapes Collection

 

Within automation, graphic drawing objects are called Shapes. The Shapes collection object contains all of the drawing objects in a document. Methods exist to enumerate all the shapes in the collection, add objects to the Selection collection, and create new shapes.

 

One of the most common uses of the Shapes collection is to create new shapes. There is a unique method to create each type of shape. For example, to create an ellipse use the AddEllipse method.

 

Properties

Application

Count

MultipleRegion

Parent

 

Methods

AddComplexPolygon

AddComplexPolygon2

AddEllipse

AddLine

AddPoint

AddPolygon

AddPolygon2

AddPolyline

AddPolyLine2

AddRectangle

AddText

AdvancedFindObj

AutoBufferZone

BlockSelect

ClearRegions

CreateBlendedBoundaryBitmap

DefineRegionArea

DefineRegionArea2

DefineRegionByPID

DefineRegionCircle

DefineRegionRectangle

Find1stBitmapObj

InvertSelection

Item*

Paste

SelectAll

SelectByPID

SelectByType

ShowByType

 

*default method

 

Example

The following script references the Shapes collection for the active layer.

 

Sub Main

'Declares mvApp as an object

 Dim mvApp As Object

 

'Creates an instance of the MapViewer Application

'object and assigns it to the variable named "mvApp"

 Set mvApp = CreateObject("MapViewer.Application")

 

'Makes MapViewer visible

 mvApp.Visible = True

 

'Declares Plot as an object

 Dim Plot As Object

 

'Creates a map document in MapViewer and assigns

'it to the variable named "Plot"

 Set Plot = mvApp.Documents.Add(mvDocPlot)

 

'Declares PlotLayers as an object

 Dim PlotLayers As Object

 

'Assigns the map document layers to the

'variable named " PlotLayers"

 Set PlotLayers = Plot.Layers

 

'Declares CurrentLayer as an object

 Dim CurrentLayer As Object

 

'Assigns the active plot layer to the

'variable named "CurrentLayer"

 Set CurrentLayer = PlotLayers.ActiveLayer

 

'Assign the Shapes collection to the

'variable named "MapShapes"

 Set MapShapes = CurrentLayer.Shapes

End Sub