21 | 08 | 2017

Array Entity

Code below shows how to create a array. The sample uses a circle object to show how it works but you can use any entity for it.

Sub ArrayEntity()

'*** Code from VisibleVisual.com ********
On Error GoTo errorhandler
    'Create the circle as a sample entity
    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 = 2
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    Dim aEntity As AcadEntity
    Set aEntity = circleObj
    'Define the rectangular array
    Dim NumberofLevels, NumberofRows, numberOfColumns As Double
    Dim DistanceBtwnLvls, DistanceBtwnRows, DistanceBtwnColumns As Double
    NumberofLevels = 4          'Enter a value for the amount of Levels in the array
    NumberofRows = 4            'Enter a Value for the amount of Rows
    numberOfColumns = 7         'Enter a Value for the amount of Columns
    DistanceBtwnLvls = 50       'Enter a Value for the distance between Levels
    DistanceBtwnRows = 25       'Enter a Value for the distance between Rows
    DistanceBtwnColumns = 70    'Enter a Value for the distance between Columns
    ' Create the array of objects
    Dim retObj As Variant
    retObj = aEntity.ArrayRectangular(NumberofRows, numberOfColumns, NumberofLevels, DistanceBtwnRows, DistanceBtwnColumns, DistanceBtwnLvls)
    'Array is created
Exit Sub
End Sub

Sign up now and upload your code to the website.

Help us to continue.....
Articles View Hits
Latest Articles