|
|
Sub AddArcLength()8 G: b Z( M- s6 A( w
' This example creates an arc in model space.2 Y8 J7 `5 `2 `* ^3 R
' 已知圆心角、弧长绘弧1 s% D" Z6 d8 E: U
Dim arcObj As AcadArc
9 j {" n- R( a& I& x5 ] Dim centerPoint As Variant
2 V8 e4 G* f9 y, C# a7 ]1 G Dim radius As Double* M9 O! z: I! x8 ~
Dim startAngleInRadian As Double m- `4 p$ ~- f. T! e9 [$ }
Dim endAngleInRadian As Double
& X o$ q2 _( N' Z8 } Dim ARCLength As Double
. N6 ~7 @- {+ \, x2 c3 v/ m Dim lineobj As AcadLine. R4 @2 r5 @" l3 s5 U
Dim getobj As ACADObject
0 `: e5 C3 Z/ H' Y Dim p As Variant \# g0 a) G v |5 K+ ]8 U, q
0 h' W# ?2 Z2 @6 F& z
'centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#- c0 o: L! R5 y j6 T
centerPoint = ThisDrawing.Utility.GetPoint(, "请指定圆心:")
+ Z+ U9 H' ~* E- b! c+ T( F: g ThisDrawing.Utility.GetEntity getobj, p, "选择第一条直线:"; t- {& u+ ~# l% s) t$ O' B. h
startAngleInRadian = getobj.Angle/ @5 t) f( [8 x4 O1 V$ F
ThisDrawing.Utility.GetEntity getobj, p, "选择第二条直线:"
' f y" l7 D" Z6 H4 @' T5 J; E endAngleInRadian = getobj.Angle
; A' y1 P& X* Q/ N! A* T ARCLength = ThisDrawing.Utility.GetString(0, vbCrLf & "所绘弧长:")
! K& S% d6 w# e5 h radius = ARCLength / (endAngleInRadian - startAngleInRadian); Q2 J( A" g7 k* i. i
7 }. Y" `5 H, ?. ~ ' Create the arc object in model space
2 R, [* }8 {$ `) ]' w% B6 p: V Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)# W. [, q+ \ Y$ X
' ZoomAll
' [' d- A# V) n0 u1 |! JEnd Sub |
|