Standardization through customization, part 11 Oct, 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?
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 elses 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 wont 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.
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 Junes Learning Curve to learn how to do this. If the correct layers and styles already exist when a user starts a new drawing, its 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 dont need to be a programmeryou just need to know AutoCAD commands. I started discussing menu customization in Februarys 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.Lets 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 fileits 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, its easy to create foreign-language versions of AutoCAD. Second, its 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).
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 processors 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 doesnt 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 wont 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:
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. Ill 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 cant do is supply entries to dialog boxes. Most dialog box commands also have a text-only Command line equivalent.
Compliance. Lets 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. Lets 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:
I have already explained the prompt and
[Cons&truction Line]^C^C(setq CL (getvar "clayer"));+
clayer;const;_xline;\\;(setvar "clayer" CL)
^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> doesnt work well because in a word processor it moves the lines down. Spaces dont work well because many text editors dont 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.
_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 dont need a written procedure to tell people to do thisthe 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, dont use a standard garden hose for the hot water supply. It softens, swells, and bursts. You must use one that is suitable for higher temperaturessuch as a car heater hose.
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!
AutoCAD 2013 Service Packs 17 May, 2013
Teaching Old Designs New Tricks 17 May, 2013
Ideate - Ideate BIMLink for Revit 2014 now available 17 May, 2013
5 SolidWorks Tips You May Have Never Seen Before 16 May, 2013
EngineerVsDesigner: E69 – Steven Heller 17 May, 2013