One of the less obvious features introduced by AutoCAD 2012 is the Autoloader mechanism that has been provided to make installation of plug-ins (current standard Autodeskspeak for add-ons, apps, utilities, routines, etc.) easier for both developers and users. It may not be immediately obvious, but it’s a useful and important addition.
This mechanism has nothing to do with the AppLoad command, the Startup Suite, acad*.lsp, the (autoload) function or anything else that existed in earlier releases. This is completely new, it has not replaced or broken any of the existing loading mechanisms, and is, in short, A Good Thing. Developers don’t have to use it, but those who do, and their customers, will have certain advantages. I have used it for the ClassicArray loading mechanism, and I expect to see it used by more and more plug-ins over time. It works fine with all of the usual AutoCAD add-on APIs, including LISP.
User perspective
As a user, what this means is that for AutoCAD and related applications from 2012 on, there is a standard loading mechanism for plug-ins. The installation should be straightforward, with no multi-step processes to go through for different AutoCAD variants and releases. The result of the installation should automatically present itself in a standard way, with a short-lived welcome bubble, an extra panel in the new Plug-ins Ribbon tab, plus any other interface additions the developer wants to provide. If you subsequently install another AutoCAD variant or release, the plug-in will automatically appear in that variant with no further user action required, as long as that AutoCAD variant is supported by the plug-in.
Developer perspective
What this means for me as a developer is that I have much less to worry about in terms of installation. All that needs to be done to make the loading happen is for a folder full of ‘stuff’ to be copied into a certain location. (There are actually two possible locations, but more on that later).
In Betas of ClassicArray, I just provided the folder, plus instructions that asked the user to copy that folder into place. I could have simplified that further by providing batch files that did the copying. In the end, I created setup executables using the free Inno Setup utility, but that was a much easier job that it would have been if this Autoloader mechanism didn’t exist. I didn’t have to worry about discovering what releases were installed, deciphering Registry entries, creating user installaton scripts, or issuing instructions to users to edit files or mess with the AppLoad command. I don’t have to worry about what happens if the user subsequently installs another AutoCAD variant.
Of course, for developers who support releases prior to 2012, there is no less work to do than before, and some time needs to be spent to learn and implement the new mechanism. In the case of ClassicArray, that was not an issue because it’s only needed and supported in 2012. I expect this is one of those problems that will resolve itself over time as developers adopt the new mechanism.
The bundle folder
So what is this ‘stuff’ that needs copying into place? It’s called a bundle folder. It’s just a folder with a name that ends in .bundle (e.g. ClassicArray.bundle), and it typically contains the usual files needed to run your add-in, often tidied up within other folders. The only new thing that it needs to contain is a file called PackageContents.xml. That XML file is the key to the Autoloader mechanism. AutoCAD finds the file, reads it, and acts accordingly in terms of version support, loading program files, partial cuix files and so on.
Bundle folder location
So where does this folder with its XML file have to go? There are two possible locations. If you want the plug-in to be available to all users on the computer, you place it in the Autodesk\ApplicationPlugins folder underneath the system’s ProgramFiles folder. For example, ClassicArray usually gets put here:
C:\Program Files\Autodesk\ApplicationPlugins\ClassicArray.bundle
If you only want the plug-in to be loaded for the current user, it goes in the Autodesk\ApplicationPlugins folder underneath the system’s AppData folder instead, for example:
C:\Documents and Settings\[login]\Application Data\Roaming\Autodesk\ApplicationPlugins\ClassicArray.bundle
in XP or
C:\Users\[login]\AppData\Roaming\Autodesk\ApplicationPlugins\ClassicArray.bundle
in Windows 7.
Describing the contents of that all-important XML file is beyond the scope of this post, but I may do a follow-up post if there is enough interest. In either case, the reference material is available in the AutoCAD Help, under Help > Customization Guide > Introduction to Programming Interfaces > Install and Uninstall Plug-In Applications > PackageContents.xml Format.