Hello again. In Bootstrap AutoCAD Deployments for Customizations Part 1 and Part 2, I described why it made sense to bootstrap AutoCAD® deployments if you have customizations. Now we’ll get into some of the details including the AutoCAD startup sequence, the acad.lsp file, the default search path, trusted locations, and profiles.
The virtues of bootstrapping AutoCAD deployments for customizations
Minimal deployment modifications–The fewer modifications made to the deployment, the easier it is to maintain, right? Perhaps the best thing about bootstrapping is it can be performed by adding just a single file to the deployment. With a bootstrap, all AutoCAD customizations are handled outside of the deployment. So you can change customizations and leave the AutoCAD deployment alone.
No secondary installer issues–Because the bootstrap recognizes when AutoCAD is initially launched for a new user, the bootstrap provides the correct experience no matter how users actually launch AutoCAD, including:
- Launching AutoCAD from the desktop shortcut provided by deployment—preferred, since it will use the correct profile
- Launching AutoCAD from the Start menu, which may have several options—bet they pick the wrong one
- Right-clicking a DWG file and selecting the AutoCAD DWG Launcher—all bets are off
- Directly double-clicking a DWG file—did I mention the bets?
No matter which method they choose, the bootstrap process works.
Bootstrap deployments leverage the AutoCAD startup sequence
The acad.lsp file—One of the first AutoCAD customizations that loads is acad.lsp, a user-created AutoLISP® file that executes only once per AutoCAD session. The bootstrap process checks each folder specified in the AutoCAD search path for acad.lsp and, when found, the file is automatically executed.
AutoCAD default search path—The default search path for AutoCAD includes %ProgramFiles%\Autodesk\AutoCAD 20xx\Support—see Figure 1. This location is read-only to non-administrators, which makes it possible for you to enforce the bootstrap for all “normal” users of the computer.
After the bootstrap process loads the correct profile, the search paths are changed so that the normal acad.lsp file (located on the network) is executed next time. Even if a normal acad.lsp file doesn’t exist, the bootstrap still recognizes the correct profiles are installed and acts accordingly.
AutoCAD trusted locations—%ProgramFiles%\Autodesk\AutoCAD 20xx\Support is automatically a trusted location. A fairly new concept to AutoCAD, trusted locations are folders (see Figure 2) deemed trustworthy for running code such as AutoLISP. The bootstrap process will add at least one location to trusted locations. This means the AutoCAD customizations location on the network should be read-only to non-administrators.
Bootstrap deployments, profiles, and a little bit of AutoLISP
AutoCAD profiles, critical to properly setting up your software, are easy to create and deploy. But what you really need is a way for AutoCAD to recognize, during the initial per-user launch, whether the correct profile is loaded.
AutoCAD customizability provides the solution. It goes like this.
First, before deployment, you create your profiles and export them from AutoCAD as ARG files. Then you place them on the network to be used as part of the bootstrap process.
The next part—making sure those profiles get added to AutoCAD no matter how the user starts the application—requires a little bit of coding. Relax! Over the next few posts I’ll show you all the code you need, as well as where to edit it for your purposes.
Bootstrap deployments and pre-built AutoLISP profile functions
Before we start creating any code for the bootstrap process, we need some way to handle the profiles.
Great news: You don’t need to write your own functions to control profiles. Jimmy Bergmark, of JTB World, has done it for you. (Jimmy has been writing code to customize AutoCAD, among other applications, for many years.) Among his many free samples is this AutoLISP gem for controlling AutoCAD profiles.
The following are useful for this topic:
- getAllProfileNames: returns a list of profiles in AutoCAD for the current user
- existProfile: returns T if a profile exists
- importProfile: imports a profile
- forceImport: imports a profile and makes it current
Download Jimmy’s profiles.lsp file and place it on the network where customizations for AutoCAD normally reside. Remember: You need to do this before we start writing any of our own code.
In my next post (Bootstrap AutoCAD Deployments for Customizations Part 4) I’ll provide the actual code you need to bootstrap your AutoCAD deployment. Don’t worry, this is going to be easy. I promise.
Here’re the previous installments: