GetReal Method (ActiveX)

Gets a real (double) value from the user.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetReal([Prompt])
object

Type: Utility

The object this method applies to.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Double

The value returned from the user.

Remarks

AutoCAD pauses for user input of a real value, and sets the return value to the value that the user enters. The Prompt parameter specifies a string that AutoCAD displays before it pauses. The Prompt is optional.

If a keyword is returned instead of a double, AutoCAD will generate the error message "User input keyword." Use the GetInput method to obtain the keyword from the return value.

Examples

VBA:

Sub Example_GetReal()
    ' This example returns the Real entered by the user.
    
    AppActivate ThisDrawing.Application.Caption
    
    Dim returnReal As Double
    
    ' Return the value entered by user. A prompt is provided.
    returnReal = ThisDrawing.Utility.GetReal("Enter an Real: ")
    MsgBox "The real entered was " & returnReal & vbCrLf & _
            "(Enter the next value without prompting.)", , "GetReal Example"
    
    ' Return the value entered by user. No prompt is provided.
    returnReal = ThisDrawing.Utility.GetReal()
    MsgBox "The real entered was " & returnReal, , "GetReal Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetReal()
    ;; This example returns the Real entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))    
    
    ;; Return the value entered by user. A prompt is provided.
    (setq returnReal (vla-GetReal (vla-get-Utility doc) "Enter an Real: "))
    (alert (strcat "The real entered was " (rtos returnReal 2) "\n"
                   "(Enter the next value without prompting.)"))
    
    ;; Return the value entered by user. No prompt is provided.
    (setq returnReal (vla-GetReal (vla-get-Utility doc)))
    (alert (strcat "The real entered was " (rtos returnReal 2)))
)