Verifying Table + Dictionary Entries
Due to language limitations of AutoCAD
AutoLISP, there are very restricted possibilities to verify the
existence of table and dictionary entries.
Usual Lisp code to verify TABLE items :
(if (tblsearch ...)
...
(if (not (tblsearch ...)) ...
and similar, in conjunction with boolean expressions and comparisons
Suggested and faster method :
a) (if (tblobjname
...)...
b) (if (vle-tblsearch ...)...
(tblobjname) is faster on all systems, as it
does not generate the entget-like definition-list as (tblsearch)
does (which involves data list generation and conversion at C/C++
and Lisp level again) - instead it only returns the entity name of
the table item;
(vle-tblsearch) does not even need to wrap the
entity name (a C/C++ ObjectId) into a Lisp ENAME, which also costs
performance;
If only the "boolean" information is needed
about the presence of a table item, but not its definition-data,
then this approach saves lot of performance and memory.
AutoCAD :
(vle-tblsearch) is provided by emulation
via
"vle-extension.lsp" - so there is no
performance gain (but also no performance loss) under AutoCAD, but
Lisp code remains compatible and uniform.
Usual Lisp code to verify DICTIONARY items
:
(if (dictsearch ...)
...
(if (not (dictsearch ...)) ...
and similar, in conjunction with boolean expressions and comparisons
Suggested and faster method :
a) (if (vle-dictsearch
...)...
b) (if (vle-dictobjname ...)...
BricsCAD :
both functions are faster, as it does not
generate the entget-like definition-list as (dictsearch) does
(which involves data list generation and conversion at C/C++ and
Lisp level again) - instead they only return a boolean result resp.
the entity name of the dictionary item;
(vle-dictsearch) does not even need to wrap
the entity name (a C/C++ ObjectId) into a Lisp ENAME, which also
costs performance;
If only the "boolean" information is needed
about the presence of a dictionary item, but not its
definition-data, then this approach saves lot of performance and
memory.
AutoCAD :
both functions are provided by emulation
via
"vle-extension.lsp" - so there is no
performance gain (but also no performance loss) under AutoCAD, but
Lisp code remains compatible and uniform.
© Menhirs NV. All rights reserved. |