GetDistance Method

Gets the distance from the prompt line or a selected set of points on the screen.

See Also | Example


RetVal = GetDistance([Point][, Prompt])


The object or objects this method applies to.


Variant (three-element array of doubles); input-only; optional
The 3D WCS coordinates specifying the base point. If this point is not provided, the user must input two points.


Variant (string); input-only; optional
The text to display to prompt the user for input.


Variant (double or array of doubles)
The distance from the prompt line or a selected set of points on the screen.


AutoCAD pauses for user input of a linear distance and sets the return value to the value of the selected distance. The Point parameter specifies a base point in WCS coordinates. The Prompt parameter specifies a string that AutoCAD displays before it pauses. Both Point and Prompt are optional.

The AutoCAD user can specify the distance by entering a number in the current units format. The user can also set the distance by specifying two locations on the graphics screen. AutoCAD draws a rubber-band line from the first point to the current crosshair position to help the user visualize the distance. If the Point parameter is provided, AutoCAD uses this value as the first of the two points.

By default, GetDistance treats Point and the return value as three-dimensional points. A prior call to the InitializeUserInput method can force Point to be two-dimensional, ensuring that this method returns a planar distance.

Regardless of the method used to specify the distance or the current linear units (for example, feet and inches), this method always sets the return value to a double-precision floating-point value.