AutoCAD: Secrets Every User Should Know

In chapter 8, the programs you tried were simple enough that you probably had little problem getting them to run. As you start developing more complex programs, however, you ll have to enter the realm of problem-solving known in programming as debugging. Before we begin looking at more complex program examples, let s go over some techniques you can use while you re creating new programs. Those techniques include the following:
Testing sections of code in the Visual LISP Console or at the AutoCAD command prompt
Finding matching parentheses as you type or after you ve typed your code
Modifying the format of your code so it s easier to read
Checking your code for structural flaws
Running code fragments from the Visual LISP editor
Finding the current value of a variable
AutoLISP programs deal with two kinds of variables: system variables defined by AutoCAD, such as OSMODE; and program variables defined by you and named by you. Program variables can be either local, having a value in only one program, or global, holding a value after the program in which it s defined has terminated.
Stopping the program as it runs so you can see if a problem has developed
Slowing the program so you can watch it as it runs to see how it s working
Make sure you saved any open drawing files before you start debugging a program in the Visual LISP Interactive Editing Environment (VLIDE). Have an expendable drawing...