ArrayRectangular 方法 (ActiveX)
创建对象的 2D 或 3D 矩形阵列。 支持的平台:仅限 Windows 签名VBA: RetVal = object.ArrayRectangular(NumberOfRows, NumberOfColumns, NumberOfLevels, DistBetweenRows, DistBetweenColumns, DistBetweenLevels)
返回值 (RetVal)类型:变体(对象数组) 新创建的对象的数组。 言论对于 2D 数组,请指定 NumberOfRows、NumberOfColumns、DistBetweenRow 和 DistBetweenColumns。若要创建 3D 数组,请同时指定 NumberOfLevels 和 DistBetweenLevels。 矩形数组是通过将选择集中的对象复制适当的次数来构造的。如果定义一行,则必须指定多列,反之亦然。 假定选择集中的对象位于左下角,并且数组在上下和右下生成。如果行之间的距离为负数,则向下添加行。如果列之间的距离为负数,则列将添加到左侧。 AutoCAD 沿由当前捕捉旋转角度定义的基线构建矩形阵列。默认情况下,此角度为零,因此矩形数组的行和列相对于 X 和 Y 绘图轴是正交的。您可以通过将捕捉旋转角度设置为非零值来更改此角度并创建旋转数组。为此,请使用该属性。SnapRotationAngle NumberOfRows = 4、NumberOfColumns = 3、DistBetweenRows = a、DistBetweenColumns = b 的矩形数组。基本图元以蓝色表示。 注意:不能在同时循环访问集合时执行此方法。迭代将为只读操作打开工作空间,而此方法将尝试执行读写操作。在调用此方法之前,请完成任何迭代。
AttributeReference:不应尝试在对象上使用此方法。 对象继承此方法,因为它们是绘图对象之一,但是,对属性参照执行此操作是不可行的。AttributeReferenceAttributeReference 例子VBA: Sub Example_ArrayRectangular() ' This example creates a circle and then performs ' a rectangular 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 = 0.5 Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius) ThisDrawing.Application.ZoomAll MsgBox "Perform the rectangular array on the circle.", , "ArrayRectangular Example" ' 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 = 5 numberOfColumns = 5 numberOfLevels = 2 distanceBwtnRows = 1 distanceBwtnColumns = 1 distanceBwtnLevels = 1 ' Create the array of objects Dim retObj As Variant retObj = circleObj.ArrayRectangular(numberOfRows, numberOfColumns, numberOfLevels, distanceBwtnRows, distanceBwtnColumns, distanceBwtnLevels) ZoomAll MsgBox "Rectangular array completed.", , "ArrayRectangular Example" End Sub 可视化 LISP: (vl-load-com) (defun c:Example_ArrayRectangular() ;; This example creates a circle and then performs ;; a rectangular array on that circle. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create the circle (setq center (vlax-3d-point 2 2 0) radius 0.5) (setq modelSpace (vla-get-ModelSpace doc)) (setq circleObj (vla-AddCircle modelSpace center radius)) (vla-ZoomAll acadObj) (alert "Perform the rectangular array on the circle.") ;; Define the rectangular array (setq numberOfRows 5 numberOfColumns 5 numberOfLevels 2 distanceBwtnRows 1.0 distanceBwtnColumns 1.0 distanceBwtnLevels 1.0) ;; Create the array of objects (setq retObj (vla-ArrayRectangular circleObj numberOfRows numberOfColumns numberOfLevels distanceBwtnRows distanceBwtnColumns distanceBwtnLevels)) (vla-ZoomAll acadObj) (alert "Rectangular array completed.") ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-19 06:43
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.