[Search tip detail and code files using keywords, tip number, author name, etc ]
Time-Saving Macro for Repetitive Tasks
Tip# 4533 By Jerri Thompson On 31-Aug-2015
Rated By 0 users
Categories : Programming Examples
Software type : AutoCAD 2016
Rename File To : No Files to download.
This tip is a good example of scripting a repetitive task to save you time

Editor's Note: The macro code has been revised per the reader comments. Our apologies for the confusion. (9/30/15)

I like to make buttons for things I do over and over, if only for a day. Yesterday I had to nest a lot of rectangle plates for the plasma machine. Before nesting, I had to draw the rectangle in individual files and save as AutoCAD 2004 for the older plasma machine.

So I made a button to select the rectangle command and start a rectangle at 0,0. It paused for the opposite corner then saved the file as 2004 and started a new file.

The macro:


Notes from Cadalyst tip reviewer R.K. McSwain: Although you may not need to create rectangles in AutoCAD 2004 format over and over like Jerri, this is a good example of scripting a repetitive task to save you time. In Jerri's example, the task could be streamlined even more by defining a default template and then calling the QNew command instead of New. If you know the steps to manually complete a task such as this, it's probably possible to create a macro, script, AutoLISP routine, or recorded action to help you complete the task with minimal user time involved, which will speed up the process and eliminate errors.


Average Rating:

User comments
Comment by Cooper,Kent
Posted on 2015-09-01 10:11:48
I know it's just an example, but if someone wants to do that same task, I believe the macro is missing a backslash between the second semicolon and the SAVEAS, which would be the pause for the User to pick the opposite corner of the rectangle.
Comment by McSwain,R.K.
Posted on 2015-09-07 10:59:22
Good Catch Kent. There are actually 2 slashes missing. They are in Jerri's submittal, but must have been lost due to a formatting error somewhere along the line. The correct macro is: ^C^Crectang;0,0;saveas;2004; ew;
Comment by McSwain,R.K.
Posted on 2015-09-07 11:00:13
It did it again. Something is stripping out the slashes. I will alert the Cadalyst TIP team. Thanks.

Log In