|
Sub AddArcLength()2 G. J2 I, ?; d6 D* h
' This example creates an arc in model space.
" M; A$ F% n/ n9 k! q ' 已知圆心角、弧长绘弧+ S# M5 L/ ~: x+ [6 H& G+ l4 W/ U
Dim arcObj As AcadArc
9 `( n% T c; X; E1 `9 N- ?5 Q Dim centerPoint As Variant
& Z! @6 x) H) d. t& r Dim radius As Double/ ]: h2 x2 }6 m
Dim startAngleInRadian As Double6 Z5 r3 c* J5 s) l& j" A
Dim endAngleInRadian As Double
+ B4 ?# g8 z$ }" ~5 T0 f- |/ j Dim ARCLength As Double0 a9 p/ ?8 _. r- ]9 a
Dim lineobj As AcadLine
/ h, c/ h4 u3 G( [ Dim getobj As ACADObject( c/ x7 ?6 E1 C. L0 {
Dim p As Variant' N1 j& W+ r5 M: p0 `
! ^) J. Q3 M$ s/ R2 l4 S
'centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#, T0 T* k; @% `9 s
centerPoint = ThisDrawing.Utility.GetPoint(, "请指定圆心:")( G! s% T+ W; q+ R' \: V, K) [
ThisDrawing.Utility.GetEntity getobj, p, "选择第一条直线:"' v2 r% B- V m& M
startAngleInRadian = getobj.Angle$ U# ]0 z+ k4 V
ThisDrawing.Utility.GetEntity getobj, p, "选择第二条直线:"
8 E/ k" |9 B* r0 }. V2 q* F endAngleInRadian = getobj.Angle' s! k: p, x2 Y9 r5 m8 y, [( V
ARCLength = ThisDrawing.Utility.GetString(0, vbCrLf & "所绘弧长:")' r( H: y8 e1 j1 g3 V0 @
radius = ARCLength / (endAngleInRadian - startAngleInRadian)
! u) w& H8 V6 ?% x
/ ]8 S4 U: q0 k4 h( k* c ' Create the arc object in model space
, z/ Y* ]1 \$ m" [" c Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian) P- U2 {- [. u( m
' ZoomAll& D- I. K3 M& ?% C E0 h" H
End Sub |
|