CAD设计论坛

 找回密码
 立即注册
论坛新手常用操作帮助系统等待验证的用户请看获取社区币方法的说明新注册会员必读(必修)
查看: 2886|回复: 0

[开发] 已知圆心角、弧长,VBA绘圆弧

[复制链接]
发表于 2009-6-10 08:42 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关于|免责|隐私|版权|广告|联系|手机版|CAD设计论坛

GMT+8, 2024-11-27 09:57

CAD设计论坛,为工程师增加动力。

© 2005-2024 askcad.com. All rights reserved.

快速回复 返回顶部 返回列表