Arbitrary Keyboard Input
 
 
 

The initget function also allows arbitrary keyboard input to most getxxx functions. This input is passed back to the application as a string. An application using this facility can be written to permit the user to call an AutoLISP function at a getxxx function prompt.

These functions show a method for allowing AutoLISP response to a getxxx function call:

(defun C:ARBENTRY ( / pt1) 
 (initget 128)                     ; Sets arbitrary entry bit 
 (setq pt1 (getpoint "\nPoint: ")) ; Gets value from user. 
 (if (= 'STR (type pt1))           ; If it's a string, convert it
 (setq pt1 (eval (read pt1)))    ; to a symbol, try evaluating
 ; it as a function; otherwise,
 pt1                             ; just return the value. 
 )
)
(defun REF ( )
 (setvar "LASTPOINT" (getpoint "\nReference point: "))
 (getpoint "\nNext point: " (getvar "LASTPOINT"))
)

If both the C:ARBENTRY and REF functions are loaded into the drawing, the following command sequence is acceptable.

Command: arbentry

Point: (ref)

Reference point: Select a point

Next point: @1,1,0