ArrayPolar Example [ActiveX and VBA Reference: AAR]

AEC Auto

ArrayPolar Example

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