Commands, Macros, Action! in AutoCAD 2009 and 20107 Oct, 2009 By: Bill Fane
Learning Curve tutorial: The Action Macro recorder functions in AutoCAD 2009 and 2010 let you easily automate commonly repeated tasks.
It was a hot summer afternoon; in fact it was over 93° F, making it the hottest day ever in Vancouver since recordkeeping began in 1881. Fortunately, the air conditioning in the Bentley was working as Captain LearnCurve drove his gorgeous wife to . . .
Hello! You used the 'test driving a Bentley' introduction last November.
Ah, but this wasn't a test drive. The Captain's birthday present to his wife was a 1989 Bentley that had only 27,000 miles on it. It is a 5,400-pound, four-door luxury sedan with a 6.7-liter V8 engine, leather headlining, and fold-out picnic tables in the rear.
Cool. What model is it? An Arnage, a Mulsanne, a Brooklands?
No, it's a Turbo R. The Turbo designation means it has a Garrett AiResearch turbocharger, and the R indicates larger, wider high-traction tires and stiffer suspension. It will do 0 to 60 mph in 6.1 seconds, and the top speed is governed to 155 mph. It can outrun a Porsche Boxster and will startle a 911.
|Captain LearnCurve's birthday present to his wife: a 1989 Bentley Turbo R.|
Anyway, Captain and Mrs. LearnCurve were on their way to the Christmas party of the Vancouver AutoCAD Users Society (VAUS -- The World's Oldest and Most Dangerous).
A Christmas party in the summer?
Yes, we have been doing it this way for many years now because everyone is too busy in December.
That's it! This month's topic! Doing things repeatedly!
My previous article, "Going for the Record!," introduced the new Action Macro recorder that Autodesk added in AutoCAD 2009.
Let's start with a bit of a review and then I'll expand on some of the details that I glossed over last time. I'll finish by covering what's new in the AutoCAD 2010 Action Recorder.
In "Going for the Record!," I showed how easy it is to simply click a button and then continue working normally. The Macro Recorder records almost everything you do until you click the Stop button. The software then asks for a name for the macro. All macros are stored in individual external files, so they are available to any drawing in any AutoCAD session.
I also showed how easy it is to run the macro again, because the name of the macro simply becomes a new AutoCAD command.
Ah, but there are a couple of crunchy bits.
One problem is that it records the x and y coordinate value of mouse picks, so when you run the macro again it repeats exactly what you did the first time. No problem. I showed last time how to edit a macro so it stops for user input instead of using the previously recorded values.
Go Back! Go Back!
Last time, I skipped a couple of interesting bits and said I would return to them later. Well, it's later now.
Let's start with the two dialog boxes that I said may or may not appear when a macro runs. The first appears only if you have edited a macro entry to have it pause for user input, and the second signals that the macro has completed running. I said last time that you can turn them off simply by clicking the check box in the lower-left corner of each dialog box.
|This dialog box can be turned off so the macro always asks for user input.|
This dialog box can be turned off so that macros complete quietly.
The crunchy bit is that making these choices turns them off in all macros, even previously recorded ones, and in all user profiles and workspaces. I also said last time that it was a little convoluted to turn them back on, but you can. Here is how:
• Run the Options command, click on the menu browser (the red A), and then click the Options button.
• Click on the System tab.
• Click on the Hidden Message Settings button.
• Expand the Action Recorder entry.
• Select the message boxes that you want to turn on again. Once again, this choice affects all macros for all user profiles and workspaces.
|The Options command can be used to turn those hidden messages again.|
Thinking Inside the Box
Another crunchy bit is the fact that the Action Recorder cannot record activity inside a dialog box. It simply waits until you click OK after entering whatever values you want, which may be a problem if you always want specific values entered. As mentioned last time, a solution exist. In many cases, it consists of simply entering a hyphen (-) before the command name while you are recording the macro, but in other cases some unique commands will perform desired actions directly.
Here is a list of a few commands that you might find useful:
• -Layer is the command-line version of the Layer Manager palette.
• -Insert is the command-line version of the Insert dialog box.
• -Block is the command-line version of the Block dialog box.
• CLayer asks for the name of an existing layer and then makes it the current layer.
• DimStyle sets the current dimension style.
• TextStyle sets the current text style.
Commands such as Save, Save As, and WBlock normally invoke a file dialog box. To override them, run the FileDia command first and set it to 0 (zero). Next run Save or whatever, supplying a specific file name. Good practice would then be to reset FileDia to 1 to restore normal behavior.
Just a Note
Sometimes you forget a few details of a little-used macro, or you may not have forgotten but you might be training new people in your office. No problem. Simply right-click at an appropriate point in the macro and select Insert User Message. A simple dialog box will appear into which you type your message to yourself or others. When the macro runs, it will stop at this point and display an alert box containing your message. Read it and then click on Close to continue execution of the macro.
Macro Odds and Ends
I mentioned last time that AutoCAD 2009 has no specific command to run a macro because the name of the macro has become a new command. You can use an Action Macro name within macros contained in menus, toolbars, and the Ribbon. You can even invoke an Action Macro while recording another Action Macro!
Each macro is recorded in its own separate file, whose name is the macro name with the extension ACTM appended to it. By default, macro files are stored in
C:\Documents and Settings\
The good news is that the Files tab of the Options dialog box can be used to reroute them to any desired location. In an office environment, you can save them to a file server so that everyone has access to them.
And Now, What's New in AutoCAD 2010
AutoCAD 2010 added some new functionality to Action Macros.
AutoCAD 2010 now has an Action Macro Manager dialog box. It is invoked using the Act Manager command (Ribbon | Manage | Action Recorder | Manage Action Macros). With it you can Copy, Rename, Modify, or Delete macro files. Note that the Modify function does not let you edit the contents of the macro; editing still must be done through the Action Recorder tree view. Modify just lets you rename the macro, add or edit the description, and change a couple of options that control its behavior. In addition, the Options button conveniently takes you straight to the macro file location entry of the Options dialog box.
The Action Macro Manager dialog box is new in AutoCAD 2010.
Action Macros now can have a base point inserted into them. After you have finished recording the macro, you can right-click a command entry in the browser tree and then select Insert Base Point. You next will be asked to select a base point.
When the macro runs, it automatically pauses for user input of a point location at this command. The difference between the 2009 and 2010 versions is that in AutoCAD 2009 any request for an input point is applied directly to the command object, such as the center of a circle. In AutoCAD 2010, the base point can be anywhere, and the object is located relative to the base point, which is very much like the insertion point for a block definition.
Action Macros are a simple but powerful weapon in the search for improved productivity.
And Now for Something Completely Different . . .
Any good aviation buff knows about the legendary DC-3 aircraft, and most also know it as the C-47 military transport plane. What many don't know is that Douglas built far more C-47s than DC-3s, and after World War II many C-47s were sold and converted to civilian use. Here is how you can tell a true DC-3 from a converted C-47: the C-47 had the main cabin door on the left side, but a true DC-3 had it on the right side.