CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于创建极坐标阵列 (VBA/ActiveX)

2023-1-5 01:00| 发布者: admin| 查看: 654| 评论: 0|来自: AutoCAD

摘要: 可以排列所有图形对象以填充圆形图案。

可以排列所有图形对象以填充圆形图案。

要创建极坐标阵列,请使用为该对象提供的方法。此方法要求您提供要创建的对象数、填充角度和数组的中心点。对象数必须是大于 1 的正整数。填充角度必须以弧度为单位。正值指定逆时针旋转。负值指定顺时针旋转。对于等于 0 的角度,将返回错误。中心点是一个包含三个双精度的变体数组。这些双精度表示指定极坐标阵列中心点的 3D WCS 坐标。ArrayPolar



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

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

创建极坐标阵列

此示例创建一个圆,然后执行该圆的极坐标数组。这将创建四个围绕 (4, 4, 0) 基点填充 180 度的圆。

Sub Ch4_ArrayingACircle()
  ' 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

  ' 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
End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 14:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部