My Favorite AutoCAD Macros

As promised, here are a few of my macros that I use on a daily basis. Steal these ones, or devise your own for yourself!

  • Horizontal Construction Line:  ^C^C_XLINE;H;

Creates a horizontal extension line at infinite length for construction.

  • Vertical Construction Line: ^C^C_XLINE;V;

Creates a vertical extension line at infinite length for construction.

  • Create Polyline: ^C^C_PE;\;J;

Enters polyline edit command and automatically enters the join option.

  • Lock Viewports: ^C^C_-VPORTS;LOCK;ON;ALL;;

Locks all viewports on the current layout tab.

  • Un-Lock Viewports:  ^C^C_-VPORTS;LOCK;OFF;ALL;;

Un-locks all viewports on the current layout tab.

I use a layer called “Construction” where I make a lot of chicken scratch, notes and model space dimensions. Usually when I’m done I like to freeze this layer; or when I need this layer on and off quickly for visualization, this is the button I use:

  • Freeze Constructions: ^C^C_-LAYER;SET;0;FREEZE;CONSTRUCTION;;

Freezes the construction layer and sets the current layer as “0”.

  • Thaw Constructions: ^C^C_-LAYER;SET;0;THAW;CONSTRUCTION;;

Thaws the construction layer and sets the current layer as “0”.

I continually need to insert blocks from a common network directory throughout my day. The following button lets me simply type the name of the block into the command line and it will insert. If you are to make a button like this, you will need to add the folder directory in which the block comes from to your “Support File Search Path” and “Working Support File Search Path”. To do this, follow these instructions:

  1. Click “File” then “Options” or simply type options into the command line.
  2. Click the “Files” tab and click the small + sign next to the top two items so your window looks like this:

  1. Click on the text of “Support File Search Path” so that it is highlighted and click the ”Add…” button on the right.
  2. Now, you will need to browse to the folder of your intended block directory.
  3. Click on the text of “Working File Search Path” and follow the same process.
  4. Click Apply and Close.

My code reflects a “B” that automatically enters due to the fact that the name of every block in this directory starts with “B”. I don’t want to have to type it every time.

  • Insert Shape: ^C^C_-INSERT;B\;\;1;1;0;

Definitions of symbols:

; – I defined the semi-colon in the last post as being equivalent to hitting enter or the space bar.

– – A dash was also defined in the last post as the indicator that prevents a window from appearing for a command that would normally launch one.

\ – backslash is a new one. This is a “pause for user input” signifier. In my last example, you see two of them used. The first is to let me type in my extrusion number (block name), and the second lets me place it where I need to on screen with a click.

Some of the examples here, as you can probably tell, are pretty specialized. This is how you should be using this method! My examples are to simply show you how the tool works, now you need to think about what your daily time wasters are and create something that can help you through it.

I also wanted to note that when making an image for your button you can browse to an image that you have downloaded or pulled from somewhere else.  I know that I am not an artist and have trouble concocting a suitable image that will convey the intent of the command activated by the button, so this is what I do!


Anger clouds the mind. – Master Splinter

…. and your AutoCAD drawings.

Enjoy the day.


One comment

  1. JTCAD

    Is it possible to mix or join two different macros into one? and then use it separately. So total will be 3 macros. with separate keys.Amazing post anyhow. I learned a lot. Thanks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s