Standardization through customization, part 1

30 Sep, 1998 By: Bill Fane

You find two common standards scenarios in a typical AutoCAD environment. In the first case, a two-inch-thick company CAD Standards Manual spells out in excruciating detail exactly how to create drawings. The standards may or may not be policed, and designers and drafters end up developing their own styles.

In the other case, there is no formal standard at all. Everything sort of grows from how the very first operator worked. All, designers and drafters eventually develop their own styles.

Which is the worst-case scenario?

Answer: Both.

It can be done
I managed a design office with a dozen people. In ten years we accumulated more than 5,000 drawings. Virtually every drawing used the same layer names, colors, and linetypes. All text styles, fonts, and sizes were consistent. Title blocks, sheet sizes, common notes, dimension styles, and scale factors all matched. Anyone could easily edit and plot everyone else’s drawings because we all knew how every drawing worked. And we did not have a written procedure manual.

Hold it! You just contradicted either or both of the preceding worst-case scenarios!

Yes. A third way to maintain CAD standards is through customization. If you set up your CAD systems properly, you won’t need a manual because standards will be implemented automatically. The users comply with the standards because it is easy. The time you save once your office is running smoothly more than makes up for the time you spend setting up your files.

First steps
Your first standardization step is to set up your prototype or template drawing to predefine all layers with the correct names, colors, and linetypes. You should also create standard text sizes and styles. Check out June’s Learning Curve to learn how to do this. If the correct layers and styles already exist when a user starts a new drawing, it’s easy to comply with the standard.

Your next leap
Menu customization takes a little more effort to learn and to do, but the benefits are enormous. No, you don’t need to be a programmer—you just need to know AutoCAD commands. I started discussing menu customization in February’s Learning Curve. That column, the second half of a two-parter on standard detail libraries, showed you how to create custom pull-down and icon menus.Let’s discuss some additional details on general menu customization and how you can apply this to help you manage CAD standards.

Menu structures. Unlike almost any other program, AutoCAD holds its menu structures in an external file—it’s not hard-coded into the program. The menu structures file is a simple ASCII text file that you can edit with almost any text editor or word processor. This offers two major benefits. First, it’s easy to create foreign-language versions of AutoCAD. Second, it’s easy to customize the menu structure to suit your needs.

The name of the file you need to modify and its location vary by AutoCAD version and platform (see table below for your specific filename).

Find that file!
 Mechanical DesktopC:\MCAD\DOS\MCAD.MNU
Windows 3.x/95/NTAutoCAD Release 12:c:\acadwin\support\ACAD.MNU
 AutoCAD LT:c:\acltwin\ACLT.MNU (short) or ACLT2.MNU (full)
 AutoCAD Release 13c:\acadr13\win\support\ACAD.MNS or ACADFULL.MNS
 Mechanical Desktopc:\mcad\win\MCAD.MNS
 AutoCAD Release 14c:\program files\autocad r14\support\ACAD.MNS
 Mechanical Desktop 2.0C:\program files\autocad R14\desktop\ support\DESKPART.MNS and \DESKTOP.MNS for parts and assemblies.
Note that files for Release 13 DOS, AutoCAD LT, and all Release 12 versions has the extension MNU, while the Release 13 Windows and Release 14 versions use the extension MNS. The latter versions also have MNU files, but if you edit them, you lose any toolbar customizing you did. See Tony Hotchkiss’ Focus on 14 column in CADALYST’s February 1998 issue, p. 62, on how to save all your customizations in the MNU file.

Start your engines

Always make a safe duplicate copy of the menu file to another directory before you modify anything. That way, you can always put things back the way they were before you started fiddling. Also save the menu file as an ASCII text file. If you save it in your word processor’s format, the formatting codes confuse AutoCAD.

You may be tempted to copy the menu file to one with a different name, such as mymenu.mns, and then edit it. Unfortunately, this doesn’t work. Each AutoCAD-supplied menu file also has an associated AutoLISP file that must be present. Its name is the same as the menu file, but it has the MNL extension. If you copy the menu file to a different name, the matching AutoLISP file is missing and many of the standard AutoCAD menu picks won’t work properly.

One final bit of review before we get into the good stuff. As you saw in the February column, the different sections of the menu file all have the same general format. Consider the following menu excerpt:
[Cons&truction Line]^C^C_xline
[&3D Polyline]^C^C_3dpoly

indicates that this excerpt affects the seventh pull-down menu from the left.

Anything enclosed in square brackets [ ] is a prompt, so [&Draw] is the title that appears in the menu bar and is the name of this pull-down menu. The ampersand (&) appears in the menu for Windows versions only. It indicates that the following letter, in this case a D, is underlined, which means you can press <Alt>–D and pick it with the mouse to activate this item.

The Windows menus also have some code to the left of the square brackets. Ignore this for now. I’ll cover it in a future column.
The next lines all start with a suitable prompt followed by the desired AutoCAD commands. Most begin with the four characters ^C^C. AutoCAD interprets them as pressing <Ctrl>–C or <Esc> twice to cancel any command in progress before it starts the one you want.

At this point, you can type in anything that you can enter at the Command prompt. The one thing you can’t do is supply entries to dialog boxes. Most dialog box commands also have a text-only Command line equivalent.

Compliance. Let’s look at the customization you can do to encourage compliance with CAD standards. For example, take a look at the fifth line. This draws a construction line with the Xline command. Let’s automate it so that all construction lines will be on a separate Const layer.

Templates and prototypes
The first step to automation is to have the layer already in the prototype or template drawing. The next step is to edit the menu file so the line in question looks just like this:
[Cons&truction Line]^C^C(setq CL (getvar "clayer"));+
clayer;const;_xline;\\;(setvar "clayer" CL)
I have already explained the prompt and ^C^C. (setq CL (getvar "clayer")) tells AutoCAD to find out the name of the current layer and save it in a variable called CL.

You may recall that AutoCAD lets you use a space whenever you need an <Enter>. In fact, <Enter>, a space, a semicolon (;), and a right mouse button click all equal a return. The best method to indicate <Enter> in menus is to use the semicolon. <Enter> doesn’t work well because in a word processor it moves the lines down. Spaces don’t work well because many text editors don’t let you put them at the ends of lines and they are hard to see.

Next, I used the plus sign (+) because this line is getting a little long. Nothing prevents me from stringing it all together in one long line, but it is easier to read if I split it into several shorter lines.

The next part, clayer;const;, tells AutoCAD to switch and set the Const layer as the current layer.

Next, _xline;\\; tells AutoCAD to start the Xline command. Each of the two backslashes tells AutoCAD to stop and wait for your input. The menu macro stops at the first backslash and asks you for a start point.

When you supply it with the mouse or enter a coordinate pair, AutoCAD moves on to the next backslash, stops, and waits for more user input.

We close it off with another cunning bit of AutoLISP: (setvar "clayer" CL). This tells AutoCAD to set the current layer back where it found it.

Set it up
When you invoke this little bit of macro magic, it automatically sets the current layer as the Const layer, draws a construction line through the two points that you specify, and then switches the current layer back to where it was. From now on, all your construction lines automatically end up on the Const layer. You don’t need a written procedure to tell people to do this—the menu does it for them. By repeating the sample macro with changes, you can easily create separate menu picks for other elements, such as part outlines, hidden lines, center lines, and section lines. You can also change the menu so that text, dimensions, and cross-hatching are all on the right layers. Be sure to come back as we delve even further into the wonderful world of menu customization.

And now for something completely different
If you go to connect your washing machine and cannot find a regular washing machine hose, don’t use a standard garden hose for the hot water supply. It softens, swells, and bursts. You must use one that is suitable for higher temperatures—such as a car heater hose.

More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!

For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!