[求助]请帮忙看下这个程序,急!急!急!
目的是选取任意两点计算方位角,代码如下:<br/>Sub calculateangel()<br/> Dim point1 As Variant<br/> Dim point2 As Variant<br/> p1 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第一点:")<br/> p2 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第二点:")<br/> Const pi As Single = 3.14<br/> Dim x As Double<br/> Dim y As Double<br/> Dim z As Double<br/> Dim ang1to2 As Double<br/> x = point1(0) - point2(0)<br/> y = point1(1) - point2(1)<br/> z = point1(2) - point2(2)<br/> ang1to2 = pi - Sgn(y) * pi / 2 - Atn(y / x)<br/> MsgBox "两点之间的方位角为:" & ang1to2, , "个计算单位"<br/>End Sub<br/>希望高手尽快给个解答! <p>为什么没有人帮忙看下这个程序啊 ?</p><p>目的就是选取任意两个点计算角度,我不知道哪里出错了。</p><p>我是根据计算两点距离而编辑的程序</p> 怎么将point1改为P1,point2改为P2了!!!!Sub calculateangel()
Dim point1 As Variant
Dim point2 As Variant
point1 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第一点:")
point2 = ThisDrawing.Utility.GetPoint(point1, vbCrLf & "第二点:")
Const pi As Single = 3.14
Dim x As Double
Dim y As Double
Dim z As Double
Dim ang1to2 As Double
x = point1(0) - point2(0)
y = point1(1) - point2(1)
z = point1(2) - point2(2)
ang1to2 = pi - Sgn(y) * pi / 2 - Atn(y / x)
MsgBox "两点之间的方位角为:" & ang1to2, , "个计算单位"
End Sub
谢谢3楼分享,学习一下
页:
[1]