|
|
Sub AddArcLength()8 M' [4 \; n; _. [& p$ E5 w
' This example creates an arc in model space.
. O4 v6 D) i1 v7 K1 j/ } ' 已知圆心角、弧长绘弧5 R b' ?' [7 ?8 h0 `
Dim arcObj As AcadArc s! O3 m# z- _. `4 G
Dim centerPoint As Variant
2 L4 x, X6 |" \) R* t7 Z Dim radius As Double
2 V. O c. f2 z: O& h# J Dim startAngleInRadian As Double
2 o# u, P; s( V" f# x Dim endAngleInRadian As Double T0 w- H; @: S \/ ~5 {% T
Dim ARCLength As Double
) S& B( s4 M1 h$ W" T Dim lineobj As AcadLine9 w# C& e8 Y' @- l# q' d8 [* K
Dim getobj As ACADObject- o+ o/ V+ W1 Y \$ O: }2 Z
Dim p As Variant
: q, c0 a- p3 }. t1 D3 S
% v' e: _' x6 Z; O' k 'centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
8 [; A ]1 T& g" b centerPoint = ThisDrawing.Utility.GetPoint(, "请指定圆心:")* q+ C/ b: Z$ c
ThisDrawing.Utility.GetEntity getobj, p, "选择第一条直线:"
& [7 v) d. O# V0 i2 v0 M startAngleInRadian = getobj.Angle
4 h2 |; a* N/ u" z# l: N# p5 H ThisDrawing.Utility.GetEntity getobj, p, "选择第二条直线:"1 v5 q3 S8 V6 D( O
endAngleInRadian = getobj.Angle
( h% s$ b7 x2 p$ B; G4 Z ARCLength = ThisDrawing.Utility.GetString(0, vbCrLf & "所绘弧长:"): b# H) l, V4 `1 y& w; a
radius = ARCLength / (endAngleInRadian - startAngleInRadian)5 d- N5 u/ u: A9 _# c8 N& e6 e+ j
) I; r, w# t/ T ' Create the arc object in model space8 c8 l! x. H. x7 G q
Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)3 G9 l/ o; j1 Q2 b0 u
' ZoomAll9 @) ]7 B- B3 E% ]+ u- s
End Sub |
|