Now that we’ve covered the basics of macros let’s get into some useful applications were macros can further increase your efficiency.
To summarize the steps in the previous post:
- We created a new central customization menu on the server
- We added a toolbar
- We created a new Command macro
- We added our macro to the new toolbar
- We took a step towards being more efficient
As I said in the previous post Macros can be used for a variety of tasks from auto answering prompts in commands and automating drawing processes to performing CAD management tasks. In this post we will cover some of each. Note that you will see “CTS” used throughout these macros which follows the previous initials setup in our first post on Macros. These initials can be set to something that fits your organization’s naming convention.
A nuisance that I see on a regular basis when working with consultants and clients drawings is finding symbols and linework on the wrong layers. It’s very hard to automate a cleanup process if the person who created the original drawings doesn’t put their items on consistent layers. Worse yet are the those that put stuff on the wrong layers then just change the color to the color that it was supposed to be. Although this type of user needs a serious talking to, most of the time when stuff gets on the wrong layer it’s accidental. This accidental step is often caused because clients use a limited number of colors, and when an item is inserted on a layer that happens to be the same color that the symbol is supposed to end up, they assume that they are on the right layer. Some basic macros on their end would easilly fix this issue. Of course these are also ways to increase your efficiency as well.
Defining layers and line-work :
Macro to create a 4-segment conduit run on a specific layer:
Macro to set the appropriate layer, and insert a 2×4 light fixture (which is a dynamic block). Since it is real scale, the scaling prompts are defaulted and it only asks for rotation.
Yet another annoying trend is the use of AutoCAD’s “Standard” styles for use as company standards. The “Standard” styles, just like Layer “0” are in all drawings, and cannot be renamed. The built-in standards should be used as a template to create your own standards. Note although you cannot rename the “Standard” style in the style dialogue, you can with the rename command, which is used in this Macro.
Architect adapts the “Standard” style as their default text style and just changes the font to “Hand1.shx” and sets the width to .8. Our default Standard style uses the “txt.shx” font with a width of “1”. When we block in room names from an Architect’s drawing (so that we can move them around), they change to the standard ugly TXT font. We don;’t use “Standard” styles, we leave them as is. You might think that changing them to the architects font would be a quick fix, and it would if we only worked with one architect that does this common mistake.
The Standard Style Fix: (Do this in their drawing prior to import)
Some other useful Macros to save Keyboard and mouse clicks.
Import all company standard layers via a master drawing and set all settings for a specific scale (this one is 1/4″ scale) and assumes you are not using annotative scales for everything (this all one line – copy and modify for other scales):
^C^C-INSERT;F:/STANDARDS/CTS.DWG;0,0;^C^C-DIMSTYLE;R;CTS-48; _fillet;r;4.5;^C^Cdimscale;48; ltscale;.5;psltscale;1;msltscale;1;DIMASSOC;2;-STYLE;NOTES;;4.5″;;;;;VISRETAIN;1;
Note: the above also sets some commonly changed variables as well as being useful when working on an existing drawing setup by someone not following your standards. (Say it isn’t so!!)
On the CADD management side another use for a macro is updating your template files and your standard layer states. Many people use template files to start their projects because it allows them to get their standards in place as soon as they start a new drawing. This is good but sometimes you need your standards brought in after your drawing is already in the works or because of purging you need to get your layers back to where they were. Regardless of the reasons, you need to keep various master files up to date, especially early in your standards setup.
To keep these Master files into their Proper locations takes a series of steps. The following macro uses your master drawing to update your master template, master CADD standards file and export out your master layer states. Speaking of layer states, this is another very efficient tool that can be used to automate and control your drawing files. We will talk about this in a future post on efficiency.
If your company has a set of standards that you want implemented in your drawings, macros make typical processes a lot faster and maintain consistency and accuracy. Time is money so faster is more efficient. Keep in mind that efficiency is not just about speed – accuracy is an essential factor. With good accuracy you have less to revise or fix.
If you get a lot of background updates on a project from an architect and he/she uses a consistent Layering scheme macros are a great way to clean up the drawing to meet your needs. It is not uncommon for myself and I’m sure some of you to take 10 to 30 minutes on a background cleanup process. You can whittle that process down to a couple minutes or even seconds with a macro. For instance, the following macro reduced a thirty minute typical cleanup time for a co-worker on a repeat client’s work from 30 minutes to less than a minute – including visual checking. And since it seems like were getting background updates every other day – some last minute, this has become a huge time saver.
The following routine sets our preferred units, sets all changeable items to color by layer, erases what we do not need, purges and prompts for a SAVEAS. NOTE: “WX-D” is the name of the Layer state that we are restoring. This routine took about 30 minutes to write, tweak and test. (This routine can vary greatly by the type of background you are cleaning up).
When writing macros be sure to draft them out on paper before you jump into the CUI editor. No matter how fast your machine as it takes time for the CUI editor to launch modify save and get you back to your editing session. The more corrections you have to make the MoreTime your CUI editor takes away on your productivity. Use the F2 key to watch your commands in the text window to verify what your prompts are and what your answers need to be.
Call External Scripts:
Another trick you can use to save time and also make your updates instantly available to others without requiring them to reload their menu, is to create a short macro that calls an external script. You can quickly edit the script on the fly and changes are available as quickly as you select “Save”.
The following macro string calls an external script file called “setvars”.
If you’ve written some really cool macros that you would like to share or need help with a macro you’re stumbling with, email me.
In upcoming posts, we are going to get a firmer Grip on efficiency by performing common actions in AutoCAD without actually typing any commands and we’ll look at dynamic blocks as a way to reduce our workload.