To Set a Breakpoint that Interrupts Program Execution (Visual LISP IDE)

Breakpoints allow you to pause the execution of a program and step through the code line by line.

Note: The Visual LISP IDE is available on Windows only.
  1. In the Visual LISP text editor window, position the cursor in front of the open parenthesis of the code expression that you want the program to be interrupted on.
  2. Click Debug Toggle Breakpoint.

    Toggle Breakpoint switches breakpoints on and off. When no breakpoint exists, Toggle Breakpoint adds a break; if a breakpoint already exists at the cursor position, Toggle Breakpoint removes it.

  3. Click Tools Load Text in Editor.
  4. At the AutoCAD command prompt, enter the command or function to begin the execution of the program.

    When program execution reaches the breakpoint, Visual LISP interrupts execution and displays the code in the text editor window.

  5. Click Debug Continue to resume execution of the program.

Example

Begin by entering some debugging information in the Visual LISP text editor window containing the yinyang.lsp program.

  1. Move the cursor in front of the open parenthesis in the line of code that reads:
    (setq half-r (/ radius 2))

    The following screen snapshot indicates the position of this statement within the program:

  2. Click Debug Toggle Breakpoint.

    Toggle Breakpoint switches breakpoints on and off. When no breakpoint exists, Toggle Breakpoint adds a break; if a breakpoint already exists at the cursor position, Toggle Breakpoint removes it.

  3. Click Tools Load Text in Editor to load the yinyang function, if you have not done so already, run it from the Visual LISP Console window prompt by entering the following:
    (yinyang)

    After you reply to the prompts the program displays at the AutoCAD Command prompt, Visual LISP pauses execution at the breakpoint you set and displays the code in the text editor window:

    Note how the statement following the cursor is highlighted.

  4. Click Debug Continue to resume execution of the program.