ellen finkelstein logo

Ellen Finkelstein.com
AutoCAD PowerPoint About Links
       

Over 165 AutoCAD tips and tutorials!

AutoCAD Tips
AutoCAD Tips Blog

Get a free dynamic block tutorial and free AutoCAD tips!


RSS: What is it? Why do I want it? How do I get it?

Add to My Yahoo!
Subscribe with Bloglines

Buy a Book

E-mail This Page 
to a Friend

Submit a tip! If you include your name and I post your tip, I'll give you credit.

AutoCAD Tips & Tutorials

Record macros with the Action Recorder

In AutoCAD 2009, you can record macros for later use. This is a long-requested time saver. You can include requests for user input and messages to make the macro work interactively.

When you save a macro, it has an ACTM filename extension. You'll find it in your Support\Actions folder of your AutoCAD installation. You can share ACTM files with others.

Start by thinking about the conditions that you'll need when you run the macro. Will you be in model space or paper space? The macro doesn't keep track of all of the current settings. If a certain setting is necessary, use the system variable or the SETVAR command while recording the macro to make sure that you have the setup you'll need at playback time.

Action Recorder macros have some limitations:

  • You can't open files
  • You can't grip edit or use PRESSPULL
  • You can't load VBA files
  • Macros also don't record changes to a dialog box, which means that you may need to use the command line version of a command. If you've worked with scripts, you're familiar with this type of functioning.

You may find other limitations.

You'll find the Action Recorder on the Tools tab, in the Action Recorder panel. You can also choose Menu Browser (the A button)> Tools> Action Recorder.

Here's an example of how you would create a macro to change all objects to the default 0.25mm lineweight. You might get drawings from a company that adds lineweights to objects. Moreover, their default might be different. So this macro sets the default to 0.25, turns on the display of lineweights, and then uses the CHPROP command to change the lineweight of selected objects to the default. At the end, the macro turns off lineweight display.

Figuring out which commands to use often involves some research. For example, I knew that I could turn the lineweight display off and on using the button on the status bar, but I couldn't do that in the macro, since I didn't know which way the display would be when I played back the macro. If I wanted to turn the display on, and it was already on, clicking the button would turn it off! So I needed to find the system variable involved, which was LWDEFAULT. Then, it was easy to turn it on and off as needed.

When you've figured out the steps that you want to take, and tried them out a couple of times in different situations, you're ready to record.

Choose Tools tab> Action Recorder panel> Record. Your cursor now has a red dot, to show you that you're recording.

Go through the steps that you practiced. When you're done. click the Stop button that has replaced the Record button. You now have the opportunity to name and save the macro, as well as choose a few options.

Here is the command line that I created as I recorded:

Because I specified all at the Select objects: prompt, the macro will always select all objects. I tested that by adding more objects with a non-default lineweight; they were also changed.

Here's what the macro looks like in the Action Recorder drop-down window:

I might want to be able to select individual objects. Letting the user select objects makes the macro interactive, and it's a very helpful feature.

To do this, I reorganized the macro and used the SELECT command before the CHPROP command. While recording, I simply picked any objects. For the CHPROP command, I then used the p (Previous) option at the Select objects: prompt. When I was done, the macro looked like this:

Then I right-clicked the Select Objects item, and chose Request User Input, as shown below:

When I ran the macro, I got a dialog box asking if I wanted to provide user input. By accepting that option, I was able to either select objects, or enter all.

If you have a useful macro that you recorded, I'd like to hear about it. Contact me, and attach the ACTM file. If I can successfully use it and it might be useful for others, I'll publish it (giving credit to you, of course).

More Tips

101 Tips

Page copy protected against web site content infringement by Copyscape


Books by Ellen

New!
AutoCAD 2009 and AutoCAD LT 2009 Bible

This is the 9th edition of this book! Completely updated to conform to the new interface and, of course, it covers all the new features, such as the ribbon, Quick View, ShowMotion, the View Cube, the SteeringWheel, and more.

AutoCAD 2008 and AutoCAD LT 2008 Bible
Learn the great new features with wide application to all disciplines. Get the most comprehensive book on AutoCAD! DVD contains a 30-day trial of AutoCAD and AutoCAD LT. Thorough exercises guide you through each feature.

AutoCAD 2007 and AutoCAD LT 2007 Bible 
Discover the 2007 features, especially the radically improved 3D tools. CD has AutoCAD 30-day trial, 3rd-party software, and drawings for exercises.

AutoCAD 2006 and AutoCAD LT 2006 Bible 
Understand and use the 2006 features, including dynamic blocks and the new method of customizing menus and toolbars. CD-ROM has AutoCAD trial, software, and drawings for all exercises.


AutoCAD 2005 and AutoCAD LT 2005 Bible
Fully explains latest 2005 features:  tables, fields, and sheet sets. For the first time, covers AutoCAD LT! CD-ROM comes with software and drawings for all exercises.


AutoCAD 2004 Bible

Covers all features in detail. Hands-on exercises. Over 1300 pages + CD-ROM with software and drawings for all exercises.

                                  Home  |  AutoCAD  |  PowerPoint  | E-StoreAbout  | Links | Contact | Site Map
Copyright Ellen Finkelstein, Inc.