Gets the distance from
the prompt line or a selected set of points on the screen.
Signature
VBA : RetVal =
Object.GetDistance([Point][, Prompt])
VL : RetVal = (vla-GetDistance
Object Point Prompt)
(setq
dist (vla-GetDistance util pt1 "\nFirst Point"))
-
Object : Utility
The object or objects this method applies to.
-
Point : 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.
-
Prompt : Variant
(string); input-only; optional
The text to display to prompt the user for input.
-
RetVal : Variant
(double or array of doubles)
The distance from the prompt line or a selected set of points on the
screen.
Remarks
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.
Example :
;get a reference to the Utilities Object :
(setq util (vla-get-utility
(vla-get-activedocument
(vlax-get-acad-object))))
(setq dist (vla-getdistance util nil "\nFirst Point : \n"))
(setq dist (vla-getdistance util PT1 "\nSecond Point : \n"))
|
|