GetOrientation Method (ActiveX)

Gets the angle specified. Ignores the setting of the ANGBASE system variable.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetOrientation([Point [, Prompt]])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the base point.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Double

The specified angle.

Remarks

AutoCAD pauses for user input of an angle, and sets the return value to the value of the selected angle. The Point parameter specifies an angle 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 angle by entering a number in the current angular units format. The user can also specify the angle by specifying two 2D locations on the graphics screen. AutoCAD draws a rubber-band line from the first point to the current crosshairs position to help the user visualize the angle. If the Point parameter is provided, AutoCAD uses this value as the first of the two points. The angle is measured in the XY plane of the WCS (this method ignores the Z field of Point). The direction of angular increase is always counterclockwise.

Regardless of the method used to specify the angle, GetOrientation always sets the return value to a value expressed in radians.

This method is similar to the GetAngle method, but it ignores the current direction of angle 0, which is stored in the ANGBASE system variable. The 0 angle employed by GetOrientation is always to the right: "east" or "three o'clock."

If a keyword is returned instead of an angle, 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_GetOrientation()
    ' This example uses the GetOrientation method to demonstrate three different ways to retrieve
    ' an orientation from the user.
    
    AppActivate ThisDrawing.Application.Caption
        
    Dim retOrientation As Double
    
    ' Return the Orientation in radians with a prompt
    retOrientation = ThisDrawing.Utility.GetOrientation(, "Enter an Orientation: ")
    MsgBox "The Orientation entered was " & retOrientation & vbCrLf & _
            "(Enter the next value without prompting.)", , "GetOrientation Example"
    
    ' Return the Orientation in radians without any prompt
    retOrientation = ThisDrawing.Utility.GetOrientation()
    MsgBox "The Orientation entered was " & retOrientation, , "GetOrientation Example"
    
    ' Return the Orientation in radians with a prompt and an Orientation base point
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    retOrientation = ThisDrawing.Utility.GetOrientation(basePnt, "Enter an Orientation: ")
    MsgBox "The Orientation entered was " & retOrientation, , "GetOrientation Example"
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetOrientation()
    ;; This example uses the GetOrientation method to demonstrate three different ways to retrieve
    ;; an orientation from the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Return the Orientation in radians with a prompt
    (setq retOrientation (vla-GetOrientation (vla-get-Utility doc) nil "Enter an Orientation: "))
    (alert (strcat "The Orientation entered was " (rtos retOrientation 2) "\n"
                   "(Enter the next value without prompting.)"))

    ;; Return the Orientation in radians without any prompt
    (setq retOrientation (vla-GetOrientation (vla-get-Utility doc)))
    (alert (strcat "The Orientation entered was " (rtos retOrientation 2)))
    
    ;; Return the Orientation in radians with a prompt and an Orientation base point
    (setq basePnt (vlax-3d-point 2 2 0))
    (setq retOrientation (vla-GetOrientation (vla-get-Utility doc) basePnt "Enter an Orientation: "))
    (alert (strcat "The Orientation entered was " (rtos retOrientation 2)))
)