Before AutoCAD will allow a developer to set extended entity data to an AutoCAD object, the application name in must first be registered in AutoCAD application identification or appid table. This table is used by AutoCAD to store the names of all the applications that have been registered in an AutoCAD drawing. To add an application name to the appid table, the REGAPP function (REGAPP application) must be used. This function, when supplied with the name of the application, first checks the appid table to determine if the application name is already in use. If the application name is not used then the function adds the name to the table and returns the name that was added. If the application name already exists, then the function returns nil. The nil in this particular case only means that the application name is already registered. This is illustrated in the following examples in which the application name "Visual_LISP" is registered.
Command: (REGAPP "Visual_LISP")
"VISUAL_LISP"
Command: (REGAPP "Visual_VLISP")
nil
Command:
In the first example the application name VISUAL_LISP is added to the appid table. In the second example the REGAPP function returns nil because the application name already exists in the appid table. Also notice in the first example that the application name returned by the REGAPP function is displayed as all upper case letters. When a name is supplied to the REGAPP function, all letters contained in that name are converted to upper case and are stored in the appid table as such. Application names are limited to 31 characters in length and can be made up of letters, numbers or a combination of the two. They can even contain special characters such as dollar signs ($), hyphens (-), and underscores (_), but they can not contain less-than and greater-than (<>), forward slash and backslash (/\), quotation marks ("), Question marks (?), colon (:), asterisks (*), vertical bars (|), commas (,), equal signs (=), backquotes (`) and semi-colon (;). Examples of valid and invalid application names are provided below.
Valid Application Names Invalid Applications Names
VISUAL_LISP VISUAL*LISP
VISUAL_1_LISP VISUAL<>1_LISP
VISUAL$LISP VISUAL?LISP
$VISUAL_LISP VISUAL:LISP
$1$VISUAL_LISP VISUAL`LISP
$1-VISUAL_LISP VISUAL=LISP
Although the REGAPP function takes some precautions to ensure that an overlap of application names does not occur, there is a possibility that an overlap can happen. To guarantee that this does not occur, the AutoLISP TLBSEARCH function (TBLSEARCH table-name symbol [setnext]) can be used. This function, when supplied with the name of the table to search along with the symbol name to check for, returns either nil if the symbol is not present or an association list containing the symbol's name and table if the symbol exists. To check the application identification table to determine if the application VISUAL_1$_LISP-EXAMPLE has been registered, and if not register it, the following syntax would be used.
No comments:
Post a Comment