Examining Program Variables

AutoCAD Visual LISP

 
Examining Program Variables
 
 
 

VLISP provides you with an entire toolkit of programming and debugging tools. One of the most valuable tools is a Watch, which lets you examine variables in more detail than appears in the VLISP Console window. You can also watch local variables within functions as the function executes.

To watch the value of a variable

  1. Choose Debug Add Watch from the VLISP menu. VLISP displays a dialog box titled “Add Watch.”

    Enter the name of the variable you wish to examine. For this example, specify gp_PathData, the variable you just set from the Console window. VLISP displays a Watch window:

    VLISP displays the value of the variable on a single line within the Watch window—the base window shown in the illustration. In this case, the value of the variable is a long list, and you cannot see its entire value. You can resize the Watch window by dragging its border, but there is a better alternative.

  2. Double-click on the variable name in the Watch window. This opens an Inspect window:

    The Inspect window indicates the data type of the variable you are inspecting (in this case, a list), and the value of the variable. For lists, Inspect displays each list item on its own line.

  3. Double-click on the line with the association list key 11. VLISP opens another Inspect window:

  4. When you are done inspecting variables, close all the Inspect windows but keep the Watch window open.