As a result of the work you did in Lesson 3, your gpmain.lsp file was getting rather large. This is not a problem for Visual LISP, but it is easier to maintain the code if you split things up into files containing logically related functions. It is also easier to debug your code. For example, if you have a single file with 150 functions, a single missing parenthesis can be difficult to find.
In the tutorial, the files will be organized as follows:
Tutorial file organization |
|
---|---|
File name |
Contents |
gp-io.lsp |
All input and output (I/O) functions) such as getting user input. Also contains the AutoLISP code required for the dialog box interface you will be adding. |
utils.lsp |
Includes all generic functions that can be used again on other projects. Also contains load-time initializations. |
gpdraw.lsp |
All drawing routines—the code that actually creates the AutoCAD entities. |
gpmain.lsp |
The basic C:GPath function. |
Save the new file in your working directory as gp-io.lsp.
Also, at the beginning of the file, insert the lines of code to establish ActiveX functionality (vl-load-com) and commit global variable assignment (*ModelSpace*).
Save the file as utils.lsp.
Save this file as gpdraw.lsp.
Your desktop is starting to get crowded. You can minimize any window within Visual LISP and it stays accessible. Click the Select Window button on the toolbar to choose a window from a list, or click Window from the Visual LISP menu and select a window to view.