AddPolygon
AddPolygon adds a new simple polygon shape. Returns a Polygon object.
Syntax
object.AddPolygon( Vertices )
Parameter |
Type |
Default |
Description |
Vertices |
Array of Doubles |
required; This provides the vertices as XY coordinates. |
Remarks
Either page units or map coordinates are used for the vertices. When the polygon is added to the plot, use page units for the vertices' coordinates. When the polygon is added to a map layer, use map coordinates to specify the vertices' coordinates. Vertices is an array containing alternating XY coordinates. This assumes the entire array is used. VB users can use
Example 1
This example demonstrates how to create a polygon using an array of doubles named Coordinates. The even numbered elements within the Coordinates array represent X values, while the odd numbered elements represent their corresponding Y values.
'declares Polygon object
Dim Polygon As Object
'declares Coordinates array and sets the element values
Dim Coordinates(5) As Double
Coordinates(0) = 4: Coordinates(1) = 1
Coordinates(2) = 7: Coordinates(3) = 3
Coordinates(4) = 2: Coordinates(5) = 6
'creates a new polygon
Set Polygon = Shapes.AddPolygon(Coordinates)
Example 2
This script displays all the methods and properties in the Shapes collection.
Used by: Shapes collection