创建对象的二维或三维矩形数组。 支持的平台:仅窗口 签名工 务 局: RetVal = object.ArrayRectangular(NumberOfRows, NumberOfColumns, NumberOfLevels, DistBetweenRows, DistBetweenColumns, DistBetweenLevels)
返回值(RetVal)类型:变体(对象数组) 新创建的对象的数组。 言论对于 2D 数组,请指定行数、列数、行之间和列之间。要创建 3D 数组,请同时指定级别数和级别之间。 矩形数组是通过将选择集中的对象复制适当的次数来构造的。如果定义一行,则必须指定多个列,反之亦然。 假定选择集中的对象位于左下角,并且数组在向上和右侧生成。如果行之间的距离为负数,则向下添加行。如果列之间的距离为负数,则列将添加到左侧。 AutoCAD 沿由当前捕捉旋转角度定义的基线构建矩形阵列。默认情况下,此角度为零,因此矩形数组的行和列相对于X和Y绘图轴是正交的。您可以通过将捕捉旋转角度设置为非零值来更改此角度并创建旋转阵列。为此,请使用属性。SnapRotationAngle ![]() Rectangular array with NumberOfRows = 4, NumberOfColumns = 3, DistBetweenRows = a, DistBetweenColumns = b. The base entity is represented in blue. Note: You cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.
AttributeReference: You should not attempt to use this method on objects. objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference. AttributeReferenceAttributeReference ExamplesVBA: 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
Visual 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-10-29 08:44
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.