GetCorner Method (ActiveX)

Gets a corner of a rectangle.

Supported platforms: Windows only

Signature

VBA:

RetVal = GetCorner(Point [, Prompt])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the base point of the rectangle.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The 3D WCS coordinates representing the corner of the rectangle.

Remarks

AutoCAD pauses for user input of the corner of a rectangle, and sets the return value to the value of the selected point. The Point parameter specifies the base point of the rectangle in the 3D WCS coordinates; this parameter is required. The Prompt parameter specifies a string that AutoCAD displays before it pauses. The prompt is optional.

The AutoCAD user can specify the corner by entering a point in the WCS coordinate format; GetCorner treats Point as a three-dimensional point. The user can specify the corner also by specifying a location on the graphics screen. AutoCAD draws a dynamically sized rectangle from Point to the current crosshair position to help the user visualize the location of the second corner. The rectangle is drawn in the XY plane of the WCS. When the pointing device is used, GetCorner ignores the Z field of Point and sets the Z field of result to the current elevation.

Examples

VBA:

Sub Example_GetCorner()
    ' This example provides a base point and prompts the user to
    ' input the second point to make a rectangle.
    
    AppActivate ThisDrawing.Application.Caption

    Dim returnPnt As Variant
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    
    ' Prompt the user to pick second point and returns the point
    returnPnt = ThisDrawing.Utility.GetCorner(basePnt, "Enter Other corner: ")
    
    ' Display the point picked
    MsgBox "The point picked was " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetCorner Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetCorner()
    ;; This example provides a base point and prompts the user to
    ;; input the second point to make a rectangle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Prompt the user to pick second point and returns the point
    (setq basePnt (vlax-3d-point 2 2 0))
    (setq returnPnt (vla-GetCorner (vla-get-Utility doc) basePnt "Enter Other corner: "))
    
    ;; Display the point picked
    (setq returnPnt (vlax-safearray->list (vlax-variant-value returnPnt)))
    (alert (strcat "The point picked was " (rtos (nth 0 returnPnt) 2) ", " (rtos (nth 1 returnPnt) 2) ", " (rtos (nth 2 returnPnt) 2)))
)