CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

ArrayPolar Method (ActiveX)

2023-1-4 11:45| 发布者: admin| 查看: 751| 评论: 0|来自: AutoCAD

摘要: 创建给定对象数、填充角度和中心点的极坐标数组。

创建给定对象数、填充角度和中心点的极坐标数组。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.ArrayPolar(NumberOfObjects, AngleToFill, CenterPoint)
对象

类型:所有图形对象

此方法适用的对象。

对象数

访问:仅输入

类型:

要在极坐标阵列中创建的对象数。这必须是大于 1 的正整数。

填充角度

访问:仅输入

类型:

填充弧度的角度。正值指定逆时针旋转。负值指定顺时针旋转。对于等于 0 的角度,将返回错误。

中心点

访问:仅输入

类型:变体(双精度的三元素数组)

指定极坐标阵列中心点的 3D WCS 坐标。

返回值(RetVal)

类型:变体(对象数组)

新对象的数组。

言论

AutoCAD 确定从阵列中心点到最后一个选定对象的参考点的距离。使用的参考点取决于先前选择的对象类型。AutoCAD 使用圆或圆弧的中心点、块或形状的插入点、文本的起点以及线条或轨迹的一个端点。

请注意,此方法不支持 AutoCAD 阵列命令的“复制时旋转”选项。



极坐标阵列,对象数 = 5,填充角度 = 180,中心点 = 0,0,0。

注意:不能在循环访问集合的同时执行此方法。迭代将为只读操作打开工作空间,而此方法将尝试执行读写操作。在调用此方法之前完成任何迭代。

属性引用:不应尝试对对象使用此方法。objects 继承此方法,因为它们是图形对象之一,但是,对属性参照执行此操作是不可行的。AttributeReferenceAttributeReference

例子

工 务 局:

Sub Example_ArrayPolar()
    ' This example creates a circle and then performs a polar 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 = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "Perform the polar array on the circle.", , "ArrayPolar Example"
    
    ' Define the polar array
    Dim noOfObjects As Integer
    Dim angleToFill As Double
    Dim basePnt(0 To 2) As Double
    noOfObjects = 4
    angleToFill = 3.14          ' 180 degrees
    basePnt(0) = 4#: basePnt(1) = 4#: basePnt(2) = 0#
    
    ' The following example will create 4 copies of an object
    ' by rotating and copying it about the point (3,3,0).
    Dim retObj As Variant
    retObj = circleObj.ArrayPolar(noOfObjects, angleToFill, basePnt)
    
    ZoomAll
    MsgBox "Polar array completed.", , "ArrayPolar Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrayPolar()
    ;; This example creates a circle and then performs a polar 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 1)
  
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
  
    (alert "Perform the polar array on the circle.")
    
    ;; Define the polar array
    (setq basePnt (vlax-3d-point 3 3 0) 
          noOfObjects 4
          angleToFill 3.14)          ;; 180 degrees
    
    ;; The following example will create 4 copies of an object
    ;; by rotating and copying it about the point (3,3,0).
    (setq retObj (vla-ArrayPolar circleObj noOfObjects angleToFill basePnt))
    
    (vla-ZoomAll acadObj)
    (alert "Polar array completed.")
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部