Function Definitions

 17  -  Symbol Tables

NOTE:  AutoCAD keeps information on named objects in symbol tables which you can access with the tblsearch and tblnext functions, defined below.  Here is a list of the table names (used as the first argument in these functions), and the tables they refer to:
tblsearch ..... Finds specified entries in a symbol table.  The first argument can be any of the names listed in the above note.

(tblsearch "style" "simplex3")  If a text style called simplex3 is found, its entry is returned in a form similar to entries returned by tblnext (see tblnext below). If the specified text style is not found, nil is returned.

An optional third, non-nil argument can be used to affect the tblnext function (see tblnext below) so that the next use of tblnext returns the entry following the one reported by this use of tblsearch.

tblnext ..... Returns successive entities from a symbol table

Assuming 2 layers are present in the drawing -- the default layer 0 and another one called "1A" with color 1 (red) and hidden linetype, created by the user:

(tblnext "layer" 1) the  1  causes the return of the first entry in the table (not because it is number 1, but because it is non-nil; anything that is non-nil could be used as the optional second argument to rewind the pointer back to the beginning of the table.  Here is a partial sample of what is returned:
   ((0 . "LAYER") - - - - - -   table category (symbol type)
   (2 . "0") - - - - - - - - - - -   layer name
   (70 . 0)  - - - - - - - - - - -   flags
   (62 . 7) - - - - - - - - - - - -  color number, negative if off
   (6 . "CONTINUOUS")) - - linetype
(tblnext "layer") returns the next entry in the table (note the absence of the second argument).  See "Note" below):
   ((0 . "LAYER")
   (2 . "lA")
   (70 .0)
   (62. 1)
   (6 . "HIDDEN"))
If no more entries exist in the table, nil is returned.

Note: If the last use of the tblsearch function (see tblsearch above) included a non-nil third argument, then the above tblnext function would return information on the next entry in the table after the one specified in that tblsearch function.

Blocks have a -2 code which holds the entity name of the first entity in the block. This entity name can be used by the entnext and entget functions if you want to access the entities contained in the block.

snvalid ..... Tests for valid characters in a string to be used as the name of a named object.

(snvalid "layer25")  returns T
(snvalid "layer  25")  returns nil because of the space
(snvalid "block-abc")  returns T
(snvalid "block/abc")  returns nil because of the forward slash

tblobjname ..... Returns the database name of a named entity based on its specifications.  This entity name can be used with entget to retrieve the association list defining the entity.  In turn, that association list can be modified with subst and used to change the entity with entmod.

(tblobjname "layer" "red")  returns the entity name for a layer "red" if such a layer exists.


Copyright © 1988, 1998 Ronald W. Leigh