Sub cccc() '测试函数 'Private Type Point '三维点 ' X As Single ' Y As Single 'H As Single 'End Type 'Dim sqm() As Double Dim line As AcadLine Dim s(0 To 2) As Double 'Dim e(0 To 2) As Double Dim s1() As Variant Dim e1() As Variant Dim x As Variant Dim y As Variant Dim h As Variant Dim PI As Double PI = 3.1415926 Dim d As Double Dim t As Double Dim l As Double Dim r As Double Dim d1 As Double Dim e As Double Dim f As Double Dim m As Double Dim n2 As Double Dim n As Double Dim c1 As Double Dim c2 As Double Dim c3 As Double Dim c4 As Double Dim c5 As Double Dim c As Double Dim a As Double Dim b As Double Dim DD As Double Dim g As Double Dim m1 As Double Dim n1 As Double Dim w As Double Dim p As Double Dim q As Double 'Dim sqm1 As Variant Dim sqm1(0 To 2) As Double Dim sqm(0 To 2) As Double x = 144.005: y = -14: h = 1076 a = 29: b = 2 c4 = (a - b) ^ (1 / 3) c5 = 1 / 3 If h <= 965 Then d = h - 950.5 t = 73.125 - 0.049 * d l = 34.94 + 3.7538 * d r = 176.262 + 0.2225 * d 'GoTo zbjs ElseIf h <= 975 Then d = h - 970 t = 72.207 + 0.0586 * d l = 96.186 + 1.3628 * d r = 180.601 + 0.2224 * d 'GoTo zbjs ElseIf h <= 990 Then d = h - 975 t = 72.5 - 0.0086 * d l = 103 + 1.4 * d r = 181.713 + 0.2225 * d ' GoTo zbjs ElseIf h <= 1010 Then d = h - 990 t = 72.371 - 0.0086 * d l = 124 + 1.4 * d r = 185.05 + 0.2225 * d ' GoTo zbjs ElseIf h <= 1030 Then d = h - 1010 t = 72.2 - 0.105 * d l = 152 + 1.1125 * d r = 189.5 + 0.245 * d 'GoTo zbjs ElseIf h <= 1050 Then d = h - 1030 t = 70.1 - 0.105 * d l = 174.25 + 1.1125 * d r = 194.4 + 0.345 * d ' GoTo zbjs ElseIf h <= 1070 Then d = h - 1050 t = 68 - 0.145 * d l = 196.5 + 0.8375 * d r = 201.3 + 0.5769 * d ' GoTo zbjs ElseIf h <= 1090 Then d = h - 1070 t = 65.1 - 0.145 * d l = 213.25 + 1.1375 * d r = 212.839 + 0.8769 * d GoTo zbjs ElseIf h <= 1110 Then d = h - 1090 t = 62.2 - 0.215 * d l = 236 + 1.225 * d r = 230.377 + 1.27965 * d 'GoTo zbjs ElseIf h <= 1130 Then d = h - 1110 t = 57.9 - 0.215 * d l = 260.5 + 1.225 * d r = 255.97 + 1.3297 * d ' GoTo zbjs ElseIf h <= 1150 Then d = h - 1130 t = 53.6 - 0.24 * d l = 285 + 1.175 * d r = 282.564 + 1.3258 * d ' GoTo zbjs ElseIf h <= 1170 Then d = h - 1150 t = 48.8 - 0.24 * d l = 308.5 + 1.375 * d r = 309.08 + 1.7259 * d ' GoTo zbjs ElseIf h <= 1190 Then d = h - 1170 t = 44 - 0.3375 * d l = 336 + 1.073 * d r = 343.597 + 1.5823 * d ' GoTo zbjs ElseIf h <= 1210 Then d = h - 1190 t = 37.25 - 0.3375 * d l = 357.46 + 1.073 * d r = 375.243 + 1.7824 * d ' GoTo zbjs ElseIf h <= 1230 Then d = h - 1210 t = 30.5 - 0.4143 * d l = 378.92 + 0.588 * d r = 410.89 + 1.6983 * d ' GoTo zbjs ElseIf h <= 1245 Then d = h - 1230 t = 22.214 - 0.4143 * d l = 390.68 + 0.588 * d r = 444.856 + 1.9316 * d 'GoTo zbjs End If zbjs: d1 = 1245 - h e = 6 - 0.40342 * d1 + 1.20744 * d1 ^ 2 / 10 ^ 3 + 2.78123 * d1 ^ 3 / 10 ^ 7 f = 12 + 0.440058 * d1 - 1.16241 * d1 ^ 2 / 10 ^ 3 + 1.2662856 * d1 ^ 3 / 10 ^ 6 m = -(r ^ 2 * x) n2 = e + r - y n = 2 * r * n2 / 3 c1 = Sqr(m ^ 2 + n ^ 3) c2 = (c1 - m) ^ 1/3 c3 = (-c1 - m) ^ 1 / 3 c = c2 + c3 DD = e + (1 / 2) * c ^ 2 / r g = Atn(c / r) '* 180 / pi m1 = (0.5 * l * (Sqr(r ^ 2 + l ^ 2)) + 0.5 * r ^ 2 * Log(l + Sqr(r ^ 2 + l ^ 2)) - 0.5 * r ^ 2 * Log(r)) / r n1 = (0.5 * c * (Sqr(r ^ 2 + c ^ 2)) + 0.5 * r ^ 2 * Log(c + Sqr(r ^ 2 + c ^ 2)) - 0.5 * r ^ 2 * Log(r)) / r w = f + (t - f) * (n1 / m1) ^ 2.2 p = c + 0.5 * w * Sin(g) q = DD - 0.5 * w * Cos(g) MsgBox c2 MsgBox "x=" & p & " y= " & q End Sub 其中的C2值c2 = (c1 - m) ^ 1/3 提示没问题,但算出来是(c1 - m)/3的结果,若变成c2 = (c1 - m) ^ (1/3),老提示无效的过程调用或参数. 在这里请教各位高手,先行感谢 |