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 VLISP, but it is easier to maintain the code if you split things up into files containing logically related functions. It's 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. |
To split gpmain.lsp into four files
Save the new file in your working directory as gp-io.lsp.
vl-load-com) and commit global variable assignment (*ModelSpace*).
Also, at the beginning of the file, insert the lines of code to establish ActiveX functionality (Save the file as utils.lsp.
Save this file as gpdraw.lsp.
Your VLISP desktop is starting to get crowded. You can minimize any window within VLISP and it stays accessible. Choose the Select Window button on the toolbar to choose a window from a list, or choose Window from the VLISP menu and select a window to view.