Gets the point selected in AutoCAD.
Supported platforms: Windows only
VBA:
RetVal = object.GetPoint([Point [, Prompt]])
Type: Utility
The object this method applies to.
Access: Input-only; optional
Type: Variant (three-element array of doubles)
The 3D WCS coordinates specifying the relative base point.
Access: Input-only; optional
Type: Variant (string)
The text used to prompt the user for input.
Type: Variant (three-element array of doubles)
The 3D WCS coordinates of the point the AutoCAD user has selected.
AutoCAD pauses for user input of a point, and sets the return value to the value of the selected point. The Point parameter specifies a relative base point in the WCS. The Prompt parameter specifies a string that AutoCAD displays before it pauses. Both Point and Prompt are optional.
The AutoCAD user can specify the point by entering a coordinate in the current units format; GetPoint treats the Point parameter and the return value as three-dimensional points. The user can specify the point also by specifying a location on the graphics screen. If the Point parameter is provided, AutoCAD draws a rubber-band line from Point to the current crosshair position.
The coordinates of the point stored in the return value are expressed in terms of the WCS.
If a keyword is returned instead of a point, AutoCAD will generate the error message "User input keyword." Use the GetInput method to obtain the keyword from the return value.
VBA:
Sub Example_GetPoint() ' This example returns a point entered by the user. AppActivate ThisDrawing.Application.Caption Dim returnPnt As Variant ' Return a point using a prompt returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point: ") MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2) & vbCrLf & _ "(Enter the next value without prompting.)", , "GetPoint Example" ' Return a point, no prompt returnPnt = ThisDrawing.Utility.GetPoint MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetPoint Example" ' Return a point using a base point and a prompt Dim basePnt(0 To 2) As Double basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0# returnPnt = ThisDrawing.Utility.GetPoint(basePnt, "Enter a point: ") MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2) ' Create a line from the base point and the last point entered Dim lineObj As AcadLine Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt) ZoomAll End Sub
Visual LISP:
(vl-load-com) (defun c:Example_GetPoint() ;; This example returns a point entered by the user. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Return a point using a prompt (setq returnPnt (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "Enter a point: "))) (alert (strcat "The WCS of the point is: " (rtos (vlax-safearray-get-element returnPnt 0) 2) ", " (rtos (vlax-safearray-get-element returnPnt 1) 2) ", " (rtos (vlax-safearray-get-element returnPnt 2) 2) "\n" "(Enter the next value without prompting.)")) ;; Return a point, no prompt (setq returnPnt (vlax-variant-value (vla-GetPoint (vla-get-Utility doc)))) (alert (strcat "The WCS of the point is: " (rtos (vlax-safearray-get-element returnPnt 0) 2) ", " (rtos (vlax-safearray-get-element returnPnt 1) 2) ", " (rtos (vlax-safearray-get-element returnPnt 2) 2))) ;; Return a point using a base point and a prompt (setq basePnt (vlax-3d-point 2 2 0)) (setq returnPnt (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) basePnt "Enter a point: "))) (alert (strcat "The WCS of the point is: " (rtos (vlax-safearray-get-element returnPnt 0) 2) ", " (rtos (vlax-safearray-get-element returnPnt 1) 2) ", " (rtos (vlax-safearray-get-element returnPnt 2) 2))) ;; Create a line from the base point and the last point entered (setq modelSpace (vla-get-ModelSpace doc)) (setq lineObj (vla-AddLine modelSpace basePnt returnPnt)) (vla-ZoomAll acadObj) )