The AutoCADET's Guide to Visual LISP: Optimize and Customize Your AutoCAD Design Environment

Inspecting Symbols

When creating applications, you will often find yourself needing to check the values, or binding, of various symbols. There are two times when you will need to do this the most: to check global variables after running a program and to check local variables while the program is running. After running the application, you may want to check the global variable bindings to see whether they are what you expect them to be. This is accomplished by typing the name of the symbol at the console (at the _$ prompt in Visual LISP) or by typing an exclamation point ( !) followed by the symbol name at the AutoCAD command prompt.

At the console in Visual LISP, the sequence appears as follows.

<span style="background-color:d9d9d9">_$ (setq A 100)</span><span style="background-color:d9d9d9">100</span><span style="background-color:d9d9d9">_$ A</span><span style="background-color:d9d9d9">100</span><span style="background-color:d9d9d9">_$</span>

At the AutoCAD command line, the same result is obtained by typing the following.

<span style="background-color:d9d9d9">Command: (setq A 100)</span><span style="background-color:d9d9d9">100</span><span style="background-color:d9d9d9">Command: !A</span><span style="background-color:d9d9d9">100</span><span style="background-color:d9d9d9">Command:</span>

The only difference is the addition of the exclamation point at the AutoCAD command prompt. The result is the same. The value for the symbol stored in the Visual LISP heap is displayed.

When using local variables or when you want to watch the value of a symbol while the program is running, you must use the Watch window in Visual LISP and run the application from inside the console. The Watch window works with breakpoints you set. This requires that you prepare the program and environment before the test...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: SCR Power Controllers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.