|
|
发表于 2010-1-23 21:19:09
|
显示全部楼层
来自: 中国浙江宁波
本帖最后由 sealive_leafage 于 2010-1-23 21:21 编辑 , B+ g" ?; v/ n4 M7 I
) z- d' n4 f1 z. ]) ^& t% |: ]circle对象的center属性返回的是一维三元素数组,0代表圆心的x坐标,1代表圆心的y坐标,2代表圆心的z坐标,可以分别通过比较x、y、z坐标判断圆心是否相同,注意控制坐标值的对比位数; j1 c, t! k; @% `
circle对象的center属性示例代码如下:
* p2 {1 q# j9 E" ~* J6 ^Sub Example_Center() , ^/ d! A( ^6 i8 u" O, O
Dim circObj As AcadCircle ' E4 M+ _( l/ u
Dim currCenterPt(0 To 2) As Double & S+ U2 c% r, e- _7 l8 `9 F( Q
Dim newCenterPt(0 To 2) As Double
% `0 T/ x( m! D5 P: g1 NDim radius As Double - |6 Y3 N4 p. ^+ l4 R% C
' Define the initial center point and radius for the circle : B3 X c$ A2 P( }" J3 l
currCenterPt(0) = 20: currCenterPt(1) = 30: currCenterPt(2) = 0
" A$ A. s8 X- x- Nradius = 3 4 G' L; Z( S$ ~2 u
' Create the circle in model space
3 B: g. D1 j6 @- P0 d3 M5 KSet circObj = ThisDrawing.ModelSpace.AddCircle(currCenterPt, radius)
: o" k" j8 H: i+ ~! OZoomAll
1 S% e2 Z7 o3 f# c3 _MsgBox "The center point of the circle is " & currCenterPt(0) & ", " & currCenterPt(1) & ", " & currCenterPt(2),vbInformation, "Center Example" ) @' y0 p1 A7 U
' Change the center point of the circle
: L% K7 L: V; v; U; C+ |# `7 {. wnewCenterPt(0) = 25: newCenterPt(1) = 25: newCenterPt(2) = 0
1 h6 L! e% k" l8 F" ycircObj.center = newCenterPt # ^9 h2 R. W9 `0 {
circObj.Update 8 }5 A% L5 O. t# g, e0 N/ t4 W
' Query the results of the new center position
7 ~# i- ]) L' t3 n* a) o2 S3 D3 _' Notice the output from the center property is a variant
! E. j' v2 \1 {! ?Dim centerPoint As Variant : O$ b: l$ M9 A9 R* {3 l: D, p
centerPoint = circObj.center 8 L* d$ l- X' a# v2 A$ l3 S3 o
MsgBox "The center point of the circle is " & centerPoint(0) & ", " & centerPoint(1) & ", " & centerPoint(2),vbInformation, "Center Example"
$ e6 |5 Z; x+ |$ sEnd Sub |
评分
-
查看全部评分
|