Automate it!

by Michael Beall

I'm sure I've forgotten more than I remember at my age, so coming up with one-click solutions is always at the top of my list. After training the daylights out of something, I usually try to figure out how we can automate it.

And although I'm not presenting at Autodesk University this year, I hope those of you who are able to attend are having (or had) a wonderful and educational experience, as it always is.

So here are a few things you may be interested in as the year winds down or as you're looking forward to the surprises in store this new year!

…Automating the Settings feature for Select Similar
…Restoring a Layer State from the Quick Access Toolbar
…Accessing commands from another Workspace
…Restoring the original value of a Dimension

Wishing one and all a very Merry Christmas and a Happy New Year! Make a snow man — or a sand castle if that's more in keeping with your part of the world — and smile often… it'll make people wonder what you're up to!

Select Similar Drop-down on the Quick Access Toolbar

I was hoping A2016 would have fixed this oversight, but the Select Similar command [Selectsimilar] has a SEttings option that can ONLY be accessed if you type(!) the command. [See Michael's Corner from August 2012 for a review of this feature]. In other words, there's no flyout shortcut menu. So I figured we could just put something up on the Quick Access Toolbar to cover both bases.

How to Create a Drop-down for ‘Select Similar’

Type CUI, then press [Enter] to open the Customize User Interface.

Under Customization in All Files, expand Quick Access Toolbars.

Right-click on Quick Access Toolbar 1, then click New Drop-down. Enter a name for the drop-down. Mine is Select Similar.

Right-click on the Select Similar command, then click Duplicate. The copy is now highlighted thereby retaining the integrity of the original command. This will be the one we edit to run the Settings option.

Modify the Name, Description, and Macro as shown in the figure. The macro reads (not case-sensitive):

^C^C_SELECTSIMILAR;SE

To change the look of the button, under Button Image, click Edit to open the Button Editor. Turn on the Grid and make a few changes to distinguish this one from the default Select Similar button.

After editing your button, click Save and enter a name for the button, then Close the Button Editor.

At this point, you now have two commands in the command list; Select Similar, and Select Similar — Settings.

To add these commands to your new Drop-down menu, drag each command from the Command List, up to the Quick Access Toolbar list and release each one next to the NAME of your new drop-down (Select Similar), not Primary Command.

After you release the command next to the name of the drop-down, the command will appear below Primary Command. I know, very curious.

Click OK to save your edits and close the CUI.

Now, next time you get ‘unexpected results’ from the Select Similar command, simply go up and change the Settings!

Power Tool

Layer State on the Quick Access Toolbar

The Layer States pulldown menu was moved to the expanded Layers panel beginning in AutoCAD 2015, so that means an extra click to get to the list in a timely manner. Sounds like we need a button!

Prerequisite: Thaw, turn On, and Unlock all the layers in the drawing, then create a layer state called "ALL LAYERS". [For more on Layer State fundamentals, see Michael's Corner February 2007]

How to Restore the ALL_LAYERS Layer State from the QAT

Launch the CUI, then expand Quick Access Toolbars, then Quick Access Toolbars 1 to display the current content of the QAT.

Under the Command List, navigate to Layer State Manager, then right-click on it and click Duplicate. The highlighted command is the copy, so we can edit that one.

Under Properties, give the button a Name and a Description similar to that shown. The description is essentially the ‘Tool tip’.

In the Macro, delete what's there, then enter the following:

^C^C-LA;A;R;"ALL LAYERS";;;

Here's what the Command String means:

^C^C

Cancel; essentially hits the ESC key

-LA

Launches the command line version of the Layer command.

;

Press <Enter>

A

The Layer StAte option of the Layer command

R

The Restore option

Note: Since pressing the spacebar is the equivalent of pressing [Enter] on the keyboard, if your layer state name has a space in it — as in our example of ALL LAYERS — the quotes will force AutoCAD to read the entire name of the layer state.

To modify the button image, click Edit to open the Button Editor.

After making the desired edits, click Save, then name this button image All Layers Button, then OK. Click Close to close the Button Editor. In the Command list, you will see your new command Layer State: All layers.

To add it to the Quick Access Toolbar, drag your command up into the list of commands under the Quick Access Toolbar 1 header, as shown in the figure.

Click OK to apply your changes and close the CUI.

To test your button, you may want to turn some layers On/Off or restore a different layer state, then try it.

However…

What if you don't have a layer state named All Layers but you want to turn see all the layers of your drawing?

Replace the above button Macro with the following:

-LA;T;*;ON*;;

This routine will Thaw any layers that are Frozen, then turn ON any layers that are OFF. Hopefully you're seeing a pattern here and may have some ideas on other buttons you can make to automate those pesky layer tasks!

Left Field

All Things Autodesk®: December is all about Autodesk University in Las Vegas, so I thought it would be fun to post a few trivia sites that you can go to while you sit on the floor, waiting outside your venue at the Venetian. (Yep, been there, did that).

Shaan Hurley's Autodesk History (Just about anything on Shaan's site is good stuff; bookmark it)

…play safe!!

Donate to CADTutor

If you found this article useful, you might like to consider making a donation. All content on this site is provided free of charge and we hope to keep it that way. However, running a site like CADTutor does cost money and you can help to improve the service and to guarantee its future by donating a small amount. We guess that you probably wouldn't miss $5.00 but it would make all the difference to us.

Note from Michael: I want to thank all of my customers for continuing to retain my training services (some for over two decades!) and let you know your donations do not go to me personally, but to the ongoing maintenance of the CADTutor ship as a whole and to support the yeoman efforts of my friend and CADTutor captain, David Watson, to whom I am grateful for this monthly opportunity to share a few AutoCAD insights.