You’re Typing Way Too Much… Use Macros! (Creating Custom Toolbars & Buttons)

This one is a twofer. First will be a quick lesson on creating a custom toolbar with buttons along with a shnazy image (so you remember what it does), as well as a “how to” on creating a macro to save steps whilst going through your commands.

I sit next a very loud typist. He’s a designer and uses AutoCAD daily. Some days (most days) it sounds like he is working on his next best selling novel that will hit bookstore shelves in two weeks and he’s struggling to meet his publisher’s deadline. He’s really just using AutoCAD, and killing his keyboard in the process. Save your keyboard! Save your mouse! Save your neighbors, for goodness sake! Exaggeration intended…

Many commands have a lengthy string of additional options inside the initial command which must either be typed into the command line, or clicked through in menus. A lot of times you’re repeating the commands you use throughout the day and many of these commands are multi-entry commands. Case and point – Fillet. Most of us don’t just fillet one item at a time. So, we enter the fillet command, then type the command for MULTIPLE. (It’s a different key in different releases. From here on, I will be using “M” for multiple in this example.) This is really an extra step in your day and a button could be created for this operation. The macro you would assign to your “Fillet Multiple” button would be ^C^C_FILLET;M;. This is a very simple and minor example and I’ll dissect this code later on in the post, but the operation would be one click of a button from now on.

Just to simplify my statement above and give it a definition; A macro is the equivalent of typing commands into the command line, Which, coincidentally, is the best way to preliminarily construct and troubleshoot your custom macros.

First, we’ll create a new toolbar. (Please note that this method will be for releases of AutoCAD 2006 and later using the .cui file.)

  1. Simply type “CUI” into the command line. It should look like this:

  1. In the top left pane (Customizations in All CUI Files), click the plus sign to expand “Toolbars”.
  2. Right Click on the text that says “Toolbars” and then click “New Toolbar”. Congrats. You have just created your very own toolbar.
  3. In the right pane (Properties), you will see all of the data about your new toolbar. Click in the “Name” section under “General” and call it what you will. You can also add a description here if you like, but most of the other properties I don’t typically mess with.

Next we’ll create the custom button.

  1. From the CUI window, Check out the bottom left pane (Command List).
  2. Click the button that looks like a shiny star. (The “star” button on the right.) If you hover over this one, it will say “Create a new command”. This is what we want to do.
  3. “Command1” has now appeared in the “Command List” area and your “Properties” on the right have changed as well. We’re going to start simple and create the Fillet Multiple command.
  4. Click in the name section and type “Fillet Multiple”.
  5. Click in the description section and type “Enters Fillet Command for Multiple Instances” You can make this whatever you want. It’s just to remind you of what the command is if you have a large amount of custom buttons.
  6. Lastly, click in the macro section. After the ^C^C, add: _FILLET;M; So the entire macro should read: ^C^C_FILLET;M;
  7. In the top right pane (Button Image), scroll through the images to find the image for Fillet and click on it.
  8. Next, click the edit button and scribe an “M” in the empty space using the line or pencil tool. This will differentiate your modified fillet from the standard fillet. Click “Save” when you’re done.
  9. Click “Apply” at the bottom of the window. Then click “OK”.

If your new toolbar is not floating in space, right click on any button you like and find your toolbar in the list. Click it and now it will be floating in front of your face and you can drag it and dock it wherever you like. Be sure that each time you add a new toolbar or modify an existing toolbar, afterwards export your template. This will update it with your current interface.

Here is what some of the general functions of the macros are:

“-“ – A dash before any command will eliminate a window opening. You can then navigate using text commands instead of click. This is the way to make macros for certain commands. For example, PURGE or XREF.

“;” – Semicolon is the equivalent of hitting enter or the spacebar.

“^C” – Carrot and “C” is “CANCEL”, or the equivalent of hitting Escape. It’s a good idea to place this at the beginning of all macros just to clear the command line.

Remind me to outline the process of exporting your toolbars in case you’re re-formatting or something similar where AutoCAD gets uninstalled. It’s a little lengthy and not really applicable quite yet.

Have fun with these, experiment and don’t hesitate to leave feedback or ask questions in the comment thread below. I will respond! My next post will be a list of my favorite, time saving macros that I use on a daily basis and one’s I have created in an effort to reduce my department’s redundant tasks.

Anger clouds the mind.

…. and your AutoCAD drawings.

Enjoy the day.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s