Elegant AutoCAD customization eliminates problems

1 Nov, 2000 By: Mark Middlebrook

General-purpose CAD programs such as AutoCAD beg to be customized. AutoCAD’s out-of-the-box program menus and default settings have improved over the years, and the Express Tools add a lot of the functionality that we used to cobble together from various sources. Still, most CAD managers modify settings, add little programs, and append menus. Some of these needs, especially for discipline-specific drafting tasks, are addressed by third-party applications, but then sometimes you have to customize the third-party application’s settings!

This type of customization usually falls to the CAD manager because no one else in the office is willing to or has the time to figure it out. Also, many CAD managers enjoy customization. Writing scripts, custom menus, and AutoLISP and VBA programs and installing them on a bunch of CAD computers in your office helps keep the job interesting.

Managing a bunch of custom support files is much more complicated than it was when you had just a few of them. This month, I present some suggestions on how to customize elegantly, with emphasis on how to make your customization robust, portable, and maintainable. This article grew out of a presentation that I gave to the San Francisco AutoCAD Users Group Customization Special Interest Group meeting in August 2000. View additional information from that presentation, including code samples.

The presentation uses WimpyPoint, a free Web service for creating PowerPoint-like slide presentations.

Problems managing customization
Common AutoCAD customization problems include:

  • As the number and complexity of custom support files grow, so does the difficulty of keeping them all functional.
  • It’s difficult to keep custom support files synchronized on all workstations.
  • Internally written customization tends to break easily, is not very portable to computers with different AutoCAD program directories or network drive mappings, and can be difficult to maintain. Most likely, you’ll spend a lot of time maintaining and updating it for new versions of AutoCAD.
  • There often isn’t the time or talent to use full-blown software development techniques such as specifications, full debugging cycle, and documentation.

AutoCAD comes with a slew of support files. Most of these files reside in the AutoCAD Support directory (\Program Files\Acad2000\Support) and other directories under the AutoCAD program directory.

In the bad old days, AutoCAD’s out-of-the-box default support files were woefully inadequate. We had to tweak many of these support files to create a usable AutoCAD system. That’s no longer the case. Many default support files, such as ACAD.MNU and ACAD.PGP, contain fairly complete and sensible settings.

If you still tweak every support file and rearrange all of the menus, this is a good time to consider a simpler approach. If you leave most of the standard support files alone, you simplify your customization work and avoid disorienting users, many of whom learned AutoCAD with standard menus and toolbars.

Of course, some support files (such as ACAD.DWT) contain default settings that won’t work for some company’s needs. Rather than edit the standard support files, you’re better off using modularization to create an office-specific version with a different name.

A typical, but generally not good, approach to AutoCAD customization is editing and adding to the AutoCAD Support files directory. It’s hard to tell what files you’ve customized, let alone maintain them, especially on multiple computers. And it’s always a risk that custom files could be overwritten or deleted when you reinstall AutoCAD.

The key to avoiding these problems is modularization: separate your custom support files from stock AutoCAD support files, and separate your custom interface components from the standard AutoCAD menus and toolbars.

Figure 1. Add custom support file directories in the Options dialog box (Preferences dialog box in Release 14).

To separate your custom support files from stock AutoCAD support files, create a separate set of custom support file directories and follow these rules:

  • Don’t edit files anywhere in the AutoCAD program directory structure.
  • Don’t add custom support files to directories in the AutoCAD program directory structure.
  • Put your custom support files in separate directories and add those directories to the AutoCAD support file search path, above the standard AutoCAD directories— see figure 1. The AutoCAD support file search path is part of the library search path. Go to WimpyPoint if you’re not familiar with the library search path.
  • If you must customize the standard AutoCAD support files, copy them to one of your custom directories and edit the copy.

Why all these rules? Because you want your customized AutoCAD system to be impervious to AutoCAD reinstalls. Ideally, installing and reinstalling AutoCAD should be as simple as running SETUP.EXE, launching AutoCAD, and adding a few directories to the support file search path.
If you follow these rules, you’ll leave the standard AutoCAD support files, menus, and toolbars as is and add your custom support files, menus, and toolbars as follows:

  • Additional pull-down menus defined in partial menu files. Don’t change ACAD.MNU and ACAD.MNS.
  • Additional toolbars defined in partial menu files. Don’t change ACAD.MNU and ACAD.MNS.
  • Custom template drawing files. Don’t change ACAD.DWT and ACADISO.DWT.
  • Custom font files. Don’t change the standard SHP and SHX files.
  • Custom hatch pattern and linetype files, if needed. Don’t change ACAD.PAT and ACAD.LIN.

If you’re not familiar with partial menu files, see the Custom Menus chapter in the online AutoCAD Customization Guide. My article, “AutoCAD toolbar customization the right way,” on the Web demonstrates a simple example. Also, see “Standardization through Customization, Part 2” by Bill Fane.

You can extend modularization to named objects. Leave the Standard text and dimension styles alone and create your own versions with different names. The custom names insulate your drawings from surprises if they are inserted into other drawings.

Modularization and support file paths
A common bad customization habit is to include the path with filenames in custom support files. This approach works fine until you reorganize your directories, change the mappings to network server drives, or need to install the custom files for a user who insists that the files need to go on the D drive instead of C.

After you’ve added your custom support file directories to the AutoCAD support file search path, you can get rid of all those path names in menu macros and AutoLISP programs and let AutoCAD find your files. See the table “Custom support file paths” for examples.

Modularization and custom toolbars
If you want to create custom toolbars, you might be tempted to use the AutoCAD Toolbars dialog box. Don’t. It’s nearly impossible to control or manage toolbars that you edit with this dialog box. Bite the bullet and learn to do it the right way, with a text editor and bitmap editor. See my article, “AutoCAD toolbar customization the right way.”

A CAD manager rarely has time to document AutoCAD customization thoroughly, but you should make a habit of adding quick and dirty documentation to every source file that you touch.

As a minimum, include what it is, who wrote it, and when it was done at the top of the file. It’s also best to include a brief description of assumptions and a list of dependent files, global variables, known bugs, and limitations.

If you’re modifying an existing file, especially a copy of one of the standard AutoCAD support files, insert a comment above changed lines. The Web-based WimpyPoint presentation mentioned at the beginning of this article includes some samples.

The main reason to do this is not to tell users how to use the file in question, but to remind you or your successor what you did, when, and why. These comments speed your work when you need to fix bugs or transfer customization to a new version of AutoCAD.

If your office has more than a few AutoCAD computers, you probably struggle to keep them similarly configured. The method that’s easiest to maintain—assuming that you have a reliable network—is to keep all custom support files on the network and add the network directories to the AutoCAD support file search path on each computer. You should mark the files read-only or use network permissions to restrict access.

One potential problem with this approach arises in AutoCAD Release 14. If you launch AutoCAD without the network drive mappings in place, such as after a failed network login, AutoCAD removes the directories from the support file search path and you have to add them back manually.

If you prefer not to keep shared custom support files on the network, you can automate the process of updating modified support files on each computer. In the network login script for AutoCAD users, run a batch file that refreshes custom support files on the local hard disk. Most networks have a Copy Only If Changed utility, such as the DOS Xcopy command and ROBOCOPY.EXE in the NT Resource Kit.

If you don’t want to modify login scripts (or the IS folks won’t let you), you can semiautomate the update procedure using e-mail and a batch file. After you make changes, e-mail a message to all AutoCAD users with a link to a batch file that updates the custom support files.

If all else fails, you get to run around to each computer and copy the files. Ugh!

User-specific customization modularization
One AutoCAD customization dilemma in an office with more than a couple of users is how to let savvy users customize their own systems without wreaking havoc for everyone else and making it impossible for you to maintain the office customization. In these situations, add a third layer of modularity that includes:

  • Stock AutoCAD interface and support files,
  • office-wide customization in their own directories, and
  • user-specific customization in its own directory.

As shown in figure 1, above, you add the user-specific customization directory to the beginning of the support file search path so that AutoCAD finds any user-specific version of a file before any office-wide or stock AutoCAD version.

This approach works reasonably well for simple things such as ACAD.PGP or adding a user’s favorite AutoLISP programs.

Things get more complicated when the user wants to customize ACAD. LSP or menus. My WimpyPoint presentation includes some code snippets with suggestions for dealing with these situations.

 Table 1. Custom support file paths
Bad[Insert Widget]^c^c^c_.INSERT c:/here/there/everywhere/widget.dwg
Good[Insert Widget]^c^c^c_.INSERT widget.dwg
 (C:\Here\There\Everywhere added to the support file search path)
Bad(load “f:/mylisp/foo.lsp”)
Good(load “foo.lsp”)
 (F:\Mylisp added to the support file search path)

About the Author: Mark Middlebrook

AutoCAD Tips!

Lynn Allen

In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!

Follow Lynn on TwitterFollow Lynn on Twitter

Which device do you typically use to read content?
A desktop computer / tower workstation
A tablet
A smartphone
A laptop or mobile workstation
I regularly use both a desktop computer and a smartphone for this purpose
I regularly use another combination of devices for this purpose
I prefer to print out articles from the website and read them on paper
Submit Vote

Download Cadalyst, Fall 2015

Download Cadalyst Magazine Special Edition