dictnext

AutoCad AutoLISP Functions

 
dictnext
 
 
 

Finds the next item in a dictionary

(dictnext ename [rewind])

Arguments

ename

Name of the dictionary being viewed.

rewind

If this argument is present and is not nil, the dictionary is rewound and the first entry in it is retrieved.

Return Values

The next entry in the specified dictionary; otherwise nil, when the end of the dictionary is reached. Entries are returned as lists of dotted pairs of DXF-type codes and values. Deleted dictionary entries are not returned.

The dictsearch function specifies the initial entry retrieved.

Use namedobjdict to obtain the master dictionary entity name.

NoteOnce you begin stepping through the contents of a dictionary, passing a different dictionary name to dictnext will cause the place to be lost in the original dictionary. In other words, only one global iterator is maintained for use in this function.

Examples

Create a dictionary and an entry as shown in the example for dictadd. Then make another Xrecord object:

Command: (setq xname (entmakex datalist))

<Entity name: 1b62d60>

Add this Xrecord object to the dictionary, as the second record in the dictionary:

Command: (dictadd newdict "DATA_RECORD_2" xname)

<Entity name: 1b62d60>

Return the entity name of the next entry in the dictionary:

Command: (cdr (car (dictnext newdict)))

<Entity name: 1bac958>

dictnext returns the name of the first entity added to the dictionary.

Return the entity name of the next entry in the dictionary:

Command: (cdr (car (dictnext newdict)))

<Entity name: 1bac960>

dictnext returns the name of the second entity added to the dictionary.

Return the entity name of the next entry in the dictionary:

Command: (cdr (car (dictnext newdict)))

nil

There are no more entries in the dictionary, so dictnext returns nil.

Rewind to the first entry in the dictionary and return the entity name of that entry:

Command: (cdr (car (dictnext newdict T)))

<Entity name: 1bac958>

Specifying T for the optional rewind argument causes dictnext to return the first entry in the dictionary.

See Also