Elegant AutoCAD customization eliminates problems1 Nov, 2000 By: Mark Middlebrook
General-purpose CAD programs such as AutoCAD beg to be customized. AutoCADs 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 applications 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.
Common AutoCAD customization problems include:
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, AutoCADs 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. Thats 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 wont work for some companys needs. Rather than edit the standard support files, youre 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. Its hard to tell what files youve customized, let alone maintain them, especially on multiple computers. And its 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:
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, youll leave the standard AutoCAD support files, menus, and toolbars as is and add your custom support files, menus, and toolbars as follows:
If youre 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.
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 youve 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.
and custom toolbars
If you want to create custom toolbars, you might be tempted to use the AutoCAD Toolbars dialog box. Dont. Its 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. Its also best to include a brief description of assumptions and a list of dependent files, global variables, known bugs, and limitations.
If youre 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 thats easiest to maintainassuming that you have a reliable networkis 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 dont want to modify login scripts (or the IS folks wont 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!
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:
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 users 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.
Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's Tips & Tricks Tuesdays free e-newsletter and we'll notify you every time a new video tip is available. All exclusively from Cadalyst!
The Infinite Resource: the case for GMO instead of organic farming 22 May, 2013
TERA Semicon Drives Its Own Destiny with CAD and PDM 22 May, 2013
Excel Hyperlinks & Document Management Tricks 22 May, 2013
SolidWorks Simulation Tips: Parameters and Design Studies 22 May, 2013
Is This the All-in-One Bike Helmet of the Future? 22 May, 2013