(initget)

(initget [bits] [string])


Establish keywords.


This function helps you to restrict the user's choices when responding to LISP expressions, such as the getkwordfunction.

The options for initget are specified with the bits argument. Use the sum-the-bits technique for specifying more than one error-checking option: simply add bits together to combine options. For example, a flag of 36 is a sum of 32 + 4, which uses dashed lines with drawing the guide line and does not allow negative values.

The following table describes the possible meanings for the bits argument:

Bits Meaning
1 Do not allow null input (user not allowed to press Enter).
2 Do not allow zero values.
4 Do not allow negative values.
8 Do not check drawing limits, regardless of LIMCHECK setting.
16 reserved for future use
32 Use dashed lines when drawing rubber band lines and boxes.
64 For getdist only: do not allow input of a z-coordinate.
128 Ignore above settings, allow any input.

For example, if you want to limit the user's input to only positive numbers (non-negative and non-zero), and draw a rubber-band line with dashes, you add 4 + 2 + 32 to get a value of 38 for the accept variable.

Once the bit code is set, you use string to determine the values that the user is limited to entering in response to the prompt displayed by the following function. This string is a list of keywords to be accepted by the next command. In essence, initget lets you define keywords. If keywords are not to be used, argument keys should be null or an empty string (""). The function always returns nil.

When defining your list of keywords, separate each keyword with a space. Show allowable abbreviations by capitalizing the required letter(s). When the entire word is in capital letters, the user is required to enter the entire word. Keywords may contain letters, numbers, and dashes. Here is an example of a list of keywords:

"One Two THree Four"

Given this, the user can type "three" or just "th" for three.

An alternative method of listing keywords is to write each word in all-capital letters, followed by a comma and the abbreviation for the word, as in the following example:

"ONE,O TWO,T THREE,TH FOUR,F"

This is usually used with (human) languages that do not use upper- and lower-case letters.

"~A B C _F _G ~_H"

The ~ prefix causes the keyword that follows to not be displayed in the popup menu. Use ~~ if you need to have ~ appear as a keyword. Entering a single ~ as a keyword will insert a separator between menu entries.

The first underscore prefix indicates that the remaining keywords are globalized forms of the preceding keywords. The first keyword ("A" in this example) will match the first globalized keyword ("F" in this example), the second keyword will match the next globalized keyword ("B" will match "G" in the example), and so on. The user can enter either the localized or globalized keyword; the globalized keyword will be returned in either case. Only the first globalized keyword is required to have the underscore prefix.

This function can be used with many LISP functions, but not all bits make sense. The functions and their possible bits are as follows:

Function Bit
(getint) 1, 2, 4, 128
(getreal) 1, 2, 4, 128
(getdist) 1, 2, 4, 32, 64, 128
(getangle) 1, 2, 32, 128
(getorient) 1, 2, 32, 128
(getpoint) 1, 8, 32, 128
(getcorner) 1, 8, 32, 128
(getkword) 1, 128
(getstring) none
(entsel) none
(nentsel) none
(nentselp) none

Examples

Code Returns
(initget 1) nil
(initget 6 "red blue green") nil

Tell me about...

LISP Compatibility

Programming Overview of LISP (LISt Processing) Language