Allocating a topology iterator.
(tpm_iterstart [source [loaded]])
Returns an iterator ID (real) or nil.
source | Source flag (int): T Iterate through the current and source drawings nil Iterate through the current drawing only (default) |
loaded | Loaded in memory flag (int): T Iterate through topologies in memory only nil Iterate through all topologies (default) |
This function allocates an iterator and positions it before the first topology definition. This behavior has implications to remember when you use the function.
- Because tpm_iterstart always generates an iterator ID, even if the drawing has no topologies to iterate through, the function fails only when it is out of memory.
- Because tpm_iterstart positions the iterator before the first topology definition, the function cannot indicate whether any topologies exist in the drawing. The only way to determine whether the drawing has topologies is to call tpm_internext, which fails if no topology exists beyond the current position of the iterator.
You can have more than one iterator running at the same time.
This example shows how you can use Topology Iterating functions to find all the topologies the system knows about.
(setq itr_id (tpm_iterstart)) (if (null itr_id) (prompt "\nERROR: Unable to start topology iterator.") (while (not done) (if (null (tpm_iternext itr_id)) (setq done T) (progn (setq lst (list (tpm_itername itr_id) (tpm_itertype itr_id) (tpm_iterdesc itr_id) ) ) (setq tpmlist (cons lst tpmlist)) ) ; progn ) ; if ) ; while ) ; if