Another way to load and test routines is to use the Visual LISP console window. This lets you run certain lines or complete programs while giving you feedback in Visual LISP if you are using debugging tools.
To run selected lines of code
1. In the edit window, highlight the text (from parenthesis to parenthesis) by double-clicking in front of the opening or behind the closing parenthesis.
2. Press the Load selection button on the Tools toolbar in Visual LISP.
To run the entire program
1.Make sure the file you want to run is the active window.
2 Press the Load active edit window button on the Tools toolbar in Visual LISP.
- The program will automatically switch to the AutoCAD graphics window if needed to choose a point or gather other input and then switch back to Visual LISP when you are done.
- The Console window will display the values of expressions, as well as error messages if errors are detected in the code.
- You can also enter AutoLISP functions directly to the console.
- To clear the Console window, right-click in it and choose ClearConsole.
- If you are having trouble with a program you may want to turn on the Console Log. This saves all the information in the console window to a log file. Right-click in the console window and choose Toggle Console Log. The Open Log dialog box will come up. Create a new or select an existing log file. Log files can be read by any text editor.
PRACTICE : USING THE VISUAL LISP CONSOLE WINDOW
1. Continue using the file BOX1.LSP that you have loaded in the Visual LISP editor.
2. Highlight the first line and Load it to the console. When it switches to AutoCAD, choose a point.
3. Highlight the last line and load it to the console. Minimize Visual LISP and you will see that it created a new box using the first point you just picked but it remembered the rest of the points from the last time you created the box.
4. Load the entire active edit window and follow the prompts. Notice this time that it automatically switched you back to the Visual LISP editor once you picked the points.