It has been quite a while since I last updated this blog and in between a lot has changed personally, professionally and in technology. For instance: German is now the language I speak the most and it has taken its toll on my English, I apologise for that in advance.
The downside [of Lisp, back in 2013 my go-to AutoCAD automation tech] is that it’s quite a mess to have a GUI for the scripts or routines you develop. I mean, sure, it can be done (there’s DCL after all) but it’s not as flexible or easy as one would hope. Luckily, for most use cases a simple custom toolbar and text input will make users happy.
Turns out, all those issues with GUI development along with some caveats with batch scripting (on hundreds and thousands of DWG files) made Lisp more of a burden than a blessing.
Performance and flexibility
Autodesk invested very heavily in creating a powerful, flexible, yet simple .Net API for AutoCAD. It allows developers to do nearly everything that is possible with ObjectARX (the low level C++ API) with a higher level language like C#, F# or VB.Net.
Better tools and support
If you want to write Lisp for Autocad, you will most likely use Notepad++ or the Visual Lisp IDE, which has probably not received significant update since before year 2000; it looks like it’s basically supported for backwards compatibility and to avoid annoying the remaining Lispers amongst us.
With .Net, you can use Visual Studio and its debugging features which are, in my opinion, far better.
It is also easier to structure, maintain and reuse code thanks to shared class libraries.
Purpose oriented routines
Most of my Lisp routines were very generic and defined a couple AutoCAD commands with the most common options. These routines could be quickly extended to do exactly what the user wanted with Lisp one-liners; my experience so far has been that end-users never do that and they end up forgetting commands they don’t use that often.
The reason for that is that most end-users have no experience with simple programming, left alone with Lisp; you can’t really blame them.
Which is why I now focus on providing users with a GUI application that allows them to perform a specific task and adjust the parameters for that in the process. This is much easier in .Net, specially when using WPF for the GUIs.
That being said, I still provide commands that allow programmatic usage of the routines; that means I sometimes use Lisp as some kind of meta-scripting to further automate .Net routines.
Packaging, distribution and deployment
Common issues with Lisp scripts were:
- Users found routine installation too complicated.
- It was difficult to provide users with updates.
- As long as users were in our office, everything worked fine because of custom AutoCAD workspaces; remote or in-client-premises workers were sometimes not as lucky.
Some of these issues were addressed by Autodesk with the introduction of the Autoloader (see the white paper), but others (e.g. updates) persist and are quite difficult do solve with Lisp but not so in .Net.
AcCoreConsole and the Cloud
Back in 2013, Autodesk had already been separating AutoCAD’s GUI from the logic; one of the reasons for that, was to provide a Mac version of AutoCAD. As a result of that separation, the AcCoreConsole was born.
The AcCoreConsole is a headless, minimalistic version of AutoCAD, that can fully interact with a DWG database. For regular users, this means nothing; for developers however, this opened up a world of possibilities.
Suddenly, running a Lisp script in a few hundred files was as easy as preparing a small
.bat file that called the AcCoreConsole with the right arguments and invoked the script. All with the performance gains of not having any GUI and not having to render each opened drawing — these performance gains are huge.
The potential of these APIs both in and outside of the engineering world is enormous and they will surely gain importance in the next couple years.
This post serves as a bit of an update and introduction for the work I’ve been doing in the past few months, stay tuned.