|
|
发表于 2010-1-23 21:19:09
|
显示全部楼层
来自: 中国浙江宁波
本帖最后由 sealive_leafage 于 2010-1-23 21:21 编辑 2 C" o' h% n0 x$ X4 i* y
: l! U+ k- J2 f( i
circle对象的center属性返回的是一维三元素数组,0代表圆心的x坐标,1代表圆心的y坐标,2代表圆心的z坐标,可以分别通过比较x、y、z坐标判断圆心是否相同,注意控制坐标值的对比位数;0 Q+ u' m9 B- F0 |
circle对象的center属性示例代码如下:
2 n4 D, j( D. B' t- TSub Example_Center() ' w- |, n4 R9 ^# {5 V' G
Dim circObj As AcadCircle
# l' k+ I; l! QDim currCenterPt(0 To 2) As Double
S0 D I0 ^' \% W, @$ V) |Dim newCenterPt(0 To 2) As Double % p; |' C* K. ~9 \
Dim radius As Double 3 V3 N: E- ]( W; S8 K2 u
' Define the initial center point and radius for the circle Q0 B; R1 O5 Q- s
currCenterPt(0) = 20: currCenterPt(1) = 30: currCenterPt(2) = 0
8 r2 |6 ?3 I$ m9 h. {radius = 3 2 w6 W1 n5 ]" {2 p! s
' Create the circle in model space
, h/ G4 m4 ~8 Y1 m; w8 q+ U ~Set circObj = ThisDrawing.ModelSpace.AddCircle(currCenterPt, radius) 7 i4 J E% Q8 {& M
ZoomAll
0 W% w$ X: P# g1 L) }MsgBox "The center point of the circle is " & currCenterPt(0) & ", " & currCenterPt(1) & ", " & currCenterPt(2),vbInformation, "Center Example"
^: v1 t4 b: G- [5 F' Change the center point of the circle
% q# [! M" g) lnewCenterPt(0) = 25: newCenterPt(1) = 25: newCenterPt(2) = 0
6 z% ~! }5 N) {" o$ z/ T! KcircObj.center = newCenterPt
- a, R7 j* B- LcircObj.Update / b3 Q6 B( D# h9 m* ~3 B4 D8 j
' Query the results of the new center position
' ^4 @- q( P$ Q4 ?$ d' Notice the output from the center property is a variant # e3 w7 H h2 y- U5 ~. I U
Dim centerPoint As Variant
. m* Q! b- V! x- mcenterPoint = circObj.center
: R" Y' _$ R, J* W' ]MsgBox "The center point of the circle is " & centerPoint(0) & ", " & centerPoint(1) & ", " & centerPoint(2),vbInformation, "Center Example"
3 N4 r! r, t7 r. L, mEnd Sub |
评分
-
查看全部评分
|