ArrayPolar Method (ActiveX)

Creates a polar array of objects given a NumberOfObjects, AngleToFill, and CenterPoint.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.ArrayPolar(NumberOfObjects, AngleToFill, CenterPoint)
object

Type: All drawing objects

The objects this method applies to.

NumberOfObjects

Access: Input-only

Type: Long

The number of objects to be created in the polar array. This must be a positive integer greater than 1.

AngleToFill

Access: Input-only

Type: Double

The angle to fill in radians. A positive value specifies counterclockwise rotation. A negative value specifies clockwise rotation. An error is returned for an angle that equals 0.

CenterPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center point for the polar array.

Return Value (RetVal)

Type: Variant (array of objects)

The array of new objects.

Remarks

AutoCAD determines the distance from the array's center point to a reference point on the last object selected. The reference point used depends on the type of object previously selected. AutoCAD uses the center point of a circle or arc, the insertion point of a block or shape, the start point of text, and one endpoint of a line or trace.

Note that this method does not support the Rotate While Copying option of the AutoCAD ARRAY command.



Polar array with NumberOfObjects = 5, AngleToFill = 180, CenterPoint = 0,0,0.

Note: You cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

AttributeReference: You should not attempt to use this method on AttributeReference objects. AttributeReference objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference.

Examples

VBA:

Sub Example_ArrayPolar()
    ' This example creates a circle and then performs a polar array
    ' on that circle.
    
    ' Create the circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 2#: center(1) = 2#: center(2) = 0#
    radius = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "Perform the polar array on the circle.", , "ArrayPolar Example"
    
    ' Define the polar array
    Dim noOfObjects As Integer
    Dim angleToFill As Double
    Dim basePnt(0 To 2) As Double
    noOfObjects = 4
    angleToFill = 3.14          ' 180 degrees
    basePnt(0) = 4#: basePnt(1) = 4#: basePnt(2) = 0#
    
    ' The following example will create 4 copies of an object
    ' by rotating and copying it about the point (3,3,0).
    Dim retObj As Variant
    retObj = circleObj.ArrayPolar(noOfObjects, angleToFill, basePnt)
    
    ZoomAll
    MsgBox "Polar array completed.", , "ArrayPolar Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrayPolar()
    ;; This example creates a circle and then performs a polar array
    ;; on that circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)  
          radius 1)
  
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
  
    (alert "Perform the polar array on the circle.")
    
    ;; Define the polar array
    (setq basePnt (vlax-3d-point 3 3 0) 
          noOfObjects 4
          angleToFill 3.14)          ;; 180 degrees
    
    ;; The following example will create 4 copies of an object
    ;; by rotating and copying it about the point (3,3,0).
    (setq retObj (vla-ArrayPolar circleObj noOfObjects angleToFill basePnt))
    
    (vla-ZoomAll acadObj)
    (alert "Polar array completed.")
)