Calculate Points and Values

By using the methods provided by the Utility object, you can quickly solve a mathematical problem or locate points on your drawing. By using methods on the Utility object, you can do the following:

- Find the angle of a line from the
*X*axis with the AngleFromXAxis method - Convert an angle as a string to a real (double) value with the AngleToReal method
- Convert an angle from a real (double) value to a string with the AngleToString method
- Convert a distance from a string to a real (double) value with the DistanceToReal method
- Create a variant that contains an array of integers, floating numbers, doubles, and so forth, with the CreateTypedArray method
- Find the point at a specified angle and distance from a given point with the PolarPoint method
- Translate a point from one coordinate system to another coordinate system with the TranslateCoordinates method
- Find the distance between two points entered by the user with the GetDistance method

Find the distance between two points with the GetDistance method

MsgBox function to display the calculated distance.

This example uses the GetDistance method to obtain the point coordinates, and theSub Ch3_GetDistanceBetweenTwoPoints()

Dim returnDist As Double

' Return the value entered by user. A prompt is provided.

returnDist = ThisDrawing.Utility.GetDistance _

(, "Pick two points.")

MsgBox "The distance between the two points is: " & returnDist

End Sub