计算两点间距离,出错,代码是不是有问题
Public Sub Ch2_CalculateDistance()
Dim Point1 As Vuarant
Dim Point2 As Vuarant
Point1 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第一点:")
Point2 = ThisDrawing.Utility.GetPoint(Point1, vbCrLf & "第二点:")
Dim x As Double, y As Double, z As Double
Dim Dist As Double
x = Point1(0) - Point2(0)
y = Point1(1) - Point2(1)
z = Point1(2) - Point2(2)
Dist = Sqr((Sqr((x ^ 2) + (y ^ 2)) ^ 2) + (z ^ 2))
MsgBox "两点间的距离是:" & Dist
End Sub