User input in AutoLISP is done with the GETXXX functions, and ENTSEL. Options are defined with INITGET.
We will define enhanced two groups of functions:
Enhancements over the standard GETXXX functions are handling defaults, lisp input and formatting messages for easier localization.
The well known AutoLISP counterparts have no special prefix besides STD-, i.e. STD-GET and STD-ENT. The others are prefixed with STD-INP-
The two YES-OR-NO prompts are similar to Common Lisp.
Advanced versions e.g. with dialogs are not supported in this version besides STD-INP-EDIT-STRING, but are free to be implemented if their behavior matches the description.
(STD-ENTSEL msg) ; same as (entsel)
(STD-NENTSEL msg) ; same as (nentsel)
(STD-GET1DIST msg) ; with one argument
(STD-GET2DIST bpt msg) ; with two arguments
(STD-GET1POINT msg) ; with one argument
(STD-GET2POINT bpt msg) ; with two arguments
(STD-GETKWORD flag kwd def) ; autoformatted keywords
(STD-YESNO msg def) ; y or n is sufficient
(STD-YES-OR-NO-P msg) ; requires explicit YES or NO
(STD-SSGET msg filterlist) ;
(STD-GETANGLE flag kwd msg def bpt) ; like initget getangle
(STD-GETANGLE-DEG flag kwd msg def bpt) ; accepts and returns degrees
(STD-GETCORNER flag kwd msg def bpt) ; like initget getcorner
(STD-GETDIST flag kwd msg def bpt) ; like initget getdist
(STD-GETINT flag kwd msg def) ; like initget getint
(STD-GETPOINT flag kwd msg def bpt) ; like initget getpoint
(STD-GETREAL flag kwd msg def) ; like initget getreal
(STD-GETSTRING flag msg def spflag) ; like initget getstring
(STD-INP-ENTSEL flag kwd msg def) ; like initget entsel
(STD-INP-NENTSEL flag kwd msg def) ; like initget nentsel
(STD-INP-GETNAME flag msg def) ; accepts valid table name
(STD-INP-GETKWORD flag kwd msg def) ; special msg prefix for (std-getkword)
(STD-INP-GETSCALE flag kwd msg def bpt) ; with option "Reference"
(STD-INP-GETVECTOR flag kwd msg def bpt) ; like "base point or displacement"
(STD-INP-SSGET msg filterlist def)
(STD-INP-YESNO msg def) ; on console, Enter, y or n
(STD-DCL-YESNO msg def) ; via DCL, Enter or Escape is sufficient.
The following problems arise with the standard AutoLISP mechanism:
Our enhancements contain INITGET flags and keywords, handling defaults, pre-selected entities and lisp input which return usable values.
SSGET does currently not work with INITGET. So we must provide an additional prompt to allow options.
A correct GETXXX implementation is not that simple because of any lisp input. Basically it goes like this:
Set flag 128 for INITGET and remember the old.
Check the input from GETXXX
If it's a string check the first char.
If it's a "!" or "(" eval the string.
If a valid type returns from the evaluation (e.g. GETPOINT needs a point), take this as return value.
If not check for matching keywords in INITGET.
If not reject the input and do it again, if flag 1 was set initially.
On empty input return the default.
The input functions may raise a dialog box or not.
Possible input methods are:
- selecting the table name by picking a entity and getting its property from this entity if it provides this information,
- choosing it from a dialog or from the menu,
- typing it with the keyboard.
At least one of the features above must be provided by the implementation.