Thursday, August 24, 2006

Edit, Load and Protect your LISP files with VLIDE

Back in May I posted an article on Basic LISP. It should help you understand the format of lisp, some simple functions and how to load a LISP through the CUI interface. After you have progressed a little down the LISP programming path, you may want a better way edit, load and protect your LISP files. Enter the Visual LISP Interactive Development Environment or VLIDE.

You can invoke this environment from inside AutoCAD by typing vlide or vlisp on the command line.

Editing Made Easy
The figure above shows how the VLIDE environment interprets characters and color codes them making the creation of lisp files much easier. Lines commented by semicolons are shown in grey. Parentheses are always red, functions blue and variables magenta. Once you get used to the colors, most people never go back to a text editor.

I should note that there are a lot of simple editors out there that can really help you create code as well. I have been partial to Edit Pad for some time.

Protect Your LISP
There are a wide variety of tools inside this environment, but what I want to focus on the ability to take all of your LISP and combine and compile it in order to simplify loading it and protect your source code when sharing your LISP. To do this I use the “Make Application” from the “File” menu. If you are new to making applications, try the “New Application Wizard”. It will walk you through the whole process.


The making application process combines your LISP into a single VLX file that will run on any station yet the source code is compiled and unreadable to the user. This is handy when you want to sell your code or share your code, but you don’t want the recipient to be able to alter or build upon your code. During the process a FAS file is created for each of the individual LISPs contained in your VLX.

Loading VLX files
There are a lot of ways to load lisps, but here is what I choose to do. Once I have created the VLX file, I edit my acaddoc.lsp file to load the VLX when I start AutoCAD.

Here is a sample line of code to place in your acaddoc.lsp file.

(load "X:/lisps/ACME_lisps.vlx")

That’s it. You can add more load calls if you create more than one VLX. To update your VLX when you add a new LISP or change existing LISP select “Rebuild Application…” under File -> Make Application.

It’s tuff to be real generic and still address the details of what you might run into when you try it, so don’t be bashful about posting a comment to this article if you run into problems.
Post a Comment