What Goes Before, II

(Discuss this Article! in AUGI's new Discussion Forums.)
AU is done. My feet are healing. My kids are thrilled with their new bouncy, flashing balls that make annoying noises. (Thanks a lot, HP.) My wife is thrilled with my expanded wardrobe of fashionable t-shirts. She simply doesn’t appreciate what I had to go through to get them. Now, to digest, and put into practice, all that new (or reinforced) information.
Let’s continue our discussion of the prefixes that you can use in AutoCAD.
Pseudo-prefix
I haven’t found a real use for this, but it’s interesting to know about. I’m talking about the MULTIPLE command. Perhaps you have used it and can share some ideas with us in the Forums. It’s sort of like a prefix, because you type it in first. The MULTIPLE command prompts you for the name of the command that you want to have repeated multiple times. For example, if you use the MULTIPLE with the LINE command, as soon as you are done with the first series of lines, it immediately prompts you to pick the first point of the next line. Probably has the most potential when used within macros.
Block prefixes (and one suffix)<br>
Last month, we discussed using a dash as a prefix. I gave a few examples, but did not mention the INSERT command. Using the –INSERT command allows you to specify the desired blockname on the command line. At the command line, if you prefix the block’s name with an asterisk, it will be inserted pre-exploded.
You can add an equal sign (=) as a suffix to the block name. The equal suffix forces AutoCAD to update the block definition from an external source. In other words, you have a block in your drawing named “ELEV-TAG” and a drawing file named “ELEV-TAG.DWG”, from which the block was originally inserted. If you make changes to the source drawing, you can update all the blocks in the drawing by typing “ELEV-TAG=” when the –INSERT command asks for a block name. Note: for this to work, the drawing must be in a folder that is listed in AutoCAD’s search path.
I understand that you probably don’t make a habit of typing commands and block names, but this information is essential for creating macros for toolbar, palettes, menus, and scripts.
Macro prefixes
In creating macros for menus and macros, there are some useful prefixes. Now don’t start stressing about customizing your menus. It’s a little intimidating at first, but the effort has a great ROI! I don’t want to get too sidetracked on the whole topic of menu customization. There are plenty of good tutorials on the web and in past HotNews issues that will cover the basics in more detail.
Just so you can follow along, let’s look at the macro for the LINE command. Go to Customize on the Tools menu and pick Toolbars. Pick on the LINE button on your screen (it’s on the Draw toolbar) and it will take you to the Button Properties tab. The macro looks like this:
^C^C_line
The macro starts with a “^C”. This code cancels any commands that may be running when you pick the LINE command from the toolbar. So, why are there two ^C’s?
In the old days, dimension commands were performed in a “dimension mode”. You had to type DIM, the command prompt would change to “Dim: “, then you could use a dimension command (HORizontal, VERtical, etc.). If you were in one of these commands, and hit a cancel, it would return you to the “Dim: “ prompt. To return to the “Command: “ prompt, you would have to hit another cancel. So, most macros were prefixed with two cancels just in case you happened to be in a dimension command at the time you pick the icon. Two cancels are no longer necessary (since most dimension commands can be executed from the “Command: “ prompt), but it don’t hurt to use them anyway.
You won’t always see this code in you macros. Why? Because you don’t always want the current command to be cancelled. Remember last month’s article where we discussed “transparent” commands? If I am in the middle of a ROTATE and I pick the Zoom icon, I don’t want the ZOOM command to cancel my ROTATE command. So, you will not see any ^c’s in the Zoom functions:
'_zoom _p
While we’re digging around in the menus, here’s a couple other prefixes. The ^P toggles the macro’s “echo mode”, making them “silent” or “verbose.” Silent mode gives your macros a nice, clean look, not showing all the activity on the command line. Sometimes, though, the user needs to see a prompt to know what AutoCAD is waiting for. In the following macro, I use this code a few times to make it clean, but clear:
^c^c^P-INSERT;ELEV-TAG;^P\^P1;;0;
In this example, the first ^P toggles echo mode off. I don’t see anything on the screen until after the INSERT command has started and the block name is provided. The next ^P toggles echo mode on, so that I see AutoCAD prompt me for an insertion point. After picking a point, I turn echo mode back off to finish the macro. So, while ^P is usually a prefix, it can be sprinkled throughout your macros as needed.
To make a menu macro repeat, prefix it with an asterisk (*). In the example used above, this would allow me to insert multiple elevation tags without picking the button each time.
*^c^c^P-INSERT;ELEV-TAG;^P\^P1;;0;
To be continued…
Well, I fully intended to wrap up this series on prefixes this month, but I keep remembering, and discovering, more. So, rather than dump it all on you this month, we’ll hit it one more time next year! Have a safe & happy holiday season.

(Discuss this Article! in AUGI's new Discussion Forums.)
Submitted by Chris Lindner, a veteran AutoCAD user, consultant, trainer, and former AUGI Director.