本文主要是介绍全站仪角度自由定向,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Sub 坐标高程计算()
Dim I, D, F, M As Integer, W, H, Z, T, J, S, G As Double
Dim PI As Double
PI = 3.14159265258979
For I = 1 To 245
If Cells(I, 1) = "SD" Then
W = Application.Atan2((Cells(3, 7) - Cells(2, 7)), (Cells(3, 8) - Cells(2, 8)))
If W < 0 Then
W = W + 2 * PI
End If
D = Int(Cells(I, 2))
F = Int((Cells(I, 2) - D) * 100)
M = (Cells(I, 2) - D) * 10000 - F * 100
H = D * PI / 180 + F * PI / 180 / 60 + M * PI / 180 / 60 / 60 + W
If H > 2 * PI Then
H = H - 2 * PI
End If
Z = 90 - Cells(I, 3)
T = Int(Z)
If T < 0 Then
T = Int(Z * -1)
End If
J = Int((Z - T) * 100)
If J < 0 Then
J = Int((Z - T) * -1 * 100)
End If
S = Z * 10000 - J * 100
If S < 0 Then
S = Z * 10000 * -1 - J * 100
End If
G = T * PI / 180 + J * PI / 180 / 60 + S * PI / 180 / 60 / 60
If Z < 0 Then
G = G * -1
End If
Cells(I - 1, 7) = Round(Cells(I, 4) * Cos(H) + Cells(2, 7), 3)
Cells(I - 1, 8) = Round(Cells(I, 4) * Sin(H) + Cells(2, 8), 3)
Cells(I - 1, 9) = Round(Cells(I, 4) * Sin(G) + 1.558 + 8.781, 3)
End If
Next
End Sub
这篇关于全站仪角度自由定向的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!