Array in 3D
From AutoCAD ActiveX
With the ArrayRectangular method, you can create a rectangular array in 3D. In addition to specifying the number of columns (X direction) and rows (Y direction), you also specify the number of levels (Z direction).
For more information on using arrays of objects in 3D, see “Create an Array of Objects” in the User's Guide.
This example creates a circle and then uses that circle to create a rectangular array of four rows, four columns, and three levels of circles.
Sub Ch8_CreateRectangularArray()
' 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 = 0.5
Set circleObj = ThisDrawing.ModelSpace. _
AddCircle(center, radius)
' Define the rectangular arrayDim numberOfRows As LongDim numberOfColumns As LongDim numberOfLevels As LongDim distanceBwtnRows As DoubleDim distanceBwtnColumns As DoubleDim distanceBwtnLevels As DoublenumberOfRows = 4numberOfColumns = 4numberOfLevels = 3distanceBwtnRows = 1distanceBwtnColumns = 1distanceBwtnLevels = 4' Create the array of objectsDim retObj As VariantretObj = circleObj.ArrayRectangular _(numberOfRows, numberOfColumns, _numberOfLevels, distanceBwtnRows, _distanceBwtnColumns, distanceBwtnLevels)ZoomAllEnd Sub