Once you have opened an AutoLISP program file in the VLISP text editor, you can load and run it. Loading is the process by which functions in a program file are made available to the VLISP command interpreter. You can try this with the drawline.lsp sample program.
To load and run a program in a Visual LISP text editor window
- Make sure the text editor window containing the drawline.lsp program is active. If you are not sure whether the window is active, click anywhere in the window to activate it.
- Choose
the Load Active Edit Window button from the Run toolbar, or choose
Tools Load
Text in Editor from the VLISP menu.
VLISP responds by displaying a message in the Console window indicating it has loaded the program.
- Run the drawline function
from the Console prompt by entering the function name in parentheses,
then pressing ENTER:
_$ (drawline)
The drawline function will ask you to specify two points, and will then draw a straight line between those points. When drawline asks for user input, VLISP turns control over to AutoCAD to prompt you for the points. What you see next depends on whether or not the AutoCAD windows are currently displayed on your desktop. If AutoCAD is already on your desktop, you'll see the AutoCAD windows. But if AutoCAD is currently minimized on your desktop, the windows won't automatically be restored and displayed. Instead, VLISP remains visible and your mouse pointer changes to a VLISP symbol.
This symbol indicates that the VLISP window is no longer active. If this is the case, you must manually switch to the AutoCAD window. Click the AutoCAD icon on the Windows task bar to activate AutoCAD.
- Respond to the prompts
by specifying points in the graphics window or on the Command line.
After you respond to the prompts, control returns to VLISP and you will once again see the VLISP window.
When you enter commands in the VLISP Console window or run a program loaded from the text editor, you may be frequently switching back and forth between the VLISP and AutoCAD windows. Aside from using the standard Windows methods of switching between windows, you can activate the AutoCAD window by choosing Window Activate AutoCAD from the VLISP menu, or by clicking the Activate AutoCAD button on the Run toolbar. If you are in AutoCAD and want to return to the VLISP environment, you can enter vlisp at the Command prompt, or choose Tools AutoLISP Visual LISP Editor from the AutoCAD menu.