Getting Lisp working (again)
Why was AutoCAD so popular in the old days? One of the main reasons was that it was very easy to automate tasks by using CAD Lisp. But over the years, Autodesk drifted away, causing a gap between them and what users really waited for. With the application plug-in model as one of the nails in the Lisp coffin, automation by ordinary users was made almost impossible.
However, with the rise of BricsCAD, the power of AutoCAD comes alive again. And, with a very high rate of compatibility, Lisp for CAD is born again. Finally Lisp runs properly on OS-X and it even runs on Linux, with only minor restrictions.
The phoenix from the flame! Millions of legacy Lisp files can be used again.
This is where ACME turns out to be a great tool. In AutoCAD, it is an application plug-in that opens the door for good old Lisp again, circumventing the application plug-in model completely. In BricsCAD it is hooked from on_doc_load.lsp.
ACME loads your Lisp code, and the only thing you have to do for that is copying your code to the right directory or create an ACME application.
Solution 1: Just load the code
This is not the gentlest solution, but it always works. That is why this solution is number 1. But please read about the other possibilities too, they may suit you better.
Simply copy your Lisp files to:
What ACME does is index the files in this directory and load it with every document. Nothing more, nothing less. It is straightforward but it also means that a lot of code may be loaded, slowing down your system and chewing away Lisp memory.
That brings us to the next solution.
Solution 2: Create Lisp links to the code
You can also put your code in:
Instead of loading the files, ACME creates a Lisp link in every drawing document.
Let’s take an example, you have put “my20th.lsp” in the Links directory.
ACME indexes these files and creates this code:
(defun c:my20th () (load “my20th”)(my20th)(setq my20th nil)(princ))
That code is loaded with every document, one line of memory instead of a complete file. However, if your file starts with (defun c:my20th …) and not (defun my20th …), you can either choose solution 1 or change your code a bit. Maybe solution 3 is an option.
Solution 3: Create ACME app definitions
The fun part of ACME is that it takes care of not only loading Lisp, but also setting the search path, loading the accompanying menu, and so on. And the only thing you have to do is write your wishes in a text file. That is what comes next.