Stepping Through Code

There are three buttons you can use to step through your code. These are the three left-most icons on the Debug toolbar. In sequence, they represent the following actions:

Before you make a selection, take another look at the status of the highlighted code, the cursor position, and the Step Indicator button. In summary: an expression is highlighted, consisting of a getdist function nested within a setq function, and the cursor is positioned at the very beginning of the highlighted block.

To step through the code from the breakpoint

  1. Click the Step Over button.

    After you click the Step Over button, control passes to AutoCAD and you are prompted to specify the width of the path.

  2. Reply to the prompt.

    After you specify the width, control passes back to Visual LISP. Notice where your cursor is and what the step indicator button shows.

    Visual LISP evaluates the entire highlighted expression, then stops at the end of the expression.

  3. Click the Step Over button again. Visual LISP jumps to the beginning of the next block of code, and highlights the entire block.
  4. Click the Step Into (not Step Over) button.
Note: During this exercise, if you make an incorrect selection and skip a step or two, you can restart the exercise very easily. First, choose the Reset button from the Debug toolbar. This terminates the execution of any Visual LISP code, and resets the Visual LISP system to the top level. Next, start over at step 1.

Now the first cons function is highlighted, and Visual LISP is stopped right before the function (notice the Step Indicator button).