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.

Create a 3D rectangular array

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 array
```
```	Dim numberOfRows As Long
```
```	Dim numberOfColumns As Long
```
```	Dim numberOfLevels As Long
```
```	Dim distanceBwtnRows As Double
```
```	Dim distanceBwtnColumns As Double
```
```	Dim distanceBwtnLevels As Double
```
```	numberOfRows = 4
```
```	numberOfColumns = 4
```
```	numberOfLevels = 3
```
```	distanceBwtnRows = 1
```
```	distanceBwtnColumns = 1
```
```	distanceBwtnLevels = 4
```

```	' Create the array of objects
```
```	Dim retObj As Variant
```
```	retObj = circleObj.ArrayRectangular _
```
```		(numberOfRows, numberOfColumns, _
```
```		 numberOfLevels, distanceBwtnRows, _
```
```		 distanceBwtnColumns, distanceBwtnLevels)
```
```	ZoomAll
```
```End Sub
```