CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于 3D 中的阵列 (VBA/ActiveX)

2023-1-4 21:03| 发布者: admin| 查看: 410| 评论: 0|来自: AutoCAD

摘要: 使用 ArrayRectangular 方法,可以在 3D 中创建矩形数组。

使用该方法,您可以在 3D 中创建矩形数组。ArrayRectangular

除了指定列数(X方向)和行数(Y方向)之外,还可以指定级别数(Z方向)。

创建 3D 矩形数组

本示例创建一个圆,然后使用该圆创建一个包含四行、四列和三级圆的矩形数组。

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

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 13:05

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部