Tailoring AutoCAD CUI
Tailoring AutoCAD CUI
tailoring
R . H.
[Link]
a u t o c a d
t a i l o r i n g
2006 series
Grabowski
Publishing
autocad cui
Copyright & Payment Information
This book is covered by copyright. As the owner of the copyright, [Link] Publishing, Ltd. does not give you
permission to make electronic or print copies. You may not claim authorship or ownership of the text or figures
herein. Do not make copies. To support the work of the author, make a payment of:
PayPal
• To the account of editor@[Link] at [Link]. You can copy and paste the following URL into
your browser: [Link]
PayPal accepts funds in US, Euro, Yen, Canadian, and many other currencies.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
1 — introduction to cui /7
About CUI /7
About Cui Files /8
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
6 — mouse buttons / 52
Stage 1: Add Buttons / 53
Stage 2: Modify Properties / 54
Stage 3: Test and Debug / 54
7 — lisp files / 55
Stage 1: Select .lsp Files / 55
8 — workspaces / 57
Stage 1: Create New Workspaces / 58
Workspace Properties / 59
General Properties / 59
Display Properties / 59
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
9 — legacy customization / 62
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
a utoCAD 2006 centralizes many of its customization options within a single command:
Cui. What was formerly located in the Customize command’s dialog box, or edited with text
editors, is now in a single dialog box. Instead of storing menu and toolbar data in ASCII-format
.mn* files, AutoCAD now uses XML-format .cui files to store user interface customizations.
About CUI
There is an advantage to this new approach by Autodesk: a single command accesses (almost)
all customization, and (nearly) the same steps customize each area of the user interface. Learn
one, and then you pretty much know them all.
There are drawbacks, however. Cui doesn’t centralize all user interface customizations. If you
already know how to customize menus, toolbars, and so on, from earlier releases of AutoCAD,
you now need to learn a different system, which adapts only a little of the old ways. And there
have been stability and immaturity problems reported, some of which will have to be fixed by
Autodesk through patches.
The Cui command customizes the following areas of AutoCAD’s user interface:
Menus — menus on the menu bar accesses commands and macros.
Toolbars — bars of buttons execute commands and macros.
Mouse Buttons — macros execute when mouse buttons are pressed.
Shortcut Menus — context-sensitive menus display when the right mouse button is
pressed.
Shortcut Keystrokes — macros execute when keystrokes are pressed (Ctrl, Alt, Shift,
and function keys).
Temporary Override Keys — drawing modes are temporarily overridden. 2006
Workspaces — the state of the user interface is saved and restored. 2006
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
It also does not handle customization of items unrelated to the user interface, such as hatch
patterns, linetypes, fonts, scripts, and AutoLISP routines.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
The Toolbar, TbConfig , and Workspace Edit commands are hard-wired aliases for Cui.
The Menu command prompts you to select .cui customization and .mnu menu files to load
into AutoCAD. You can also drag .cui files from the Windows Explorer into AutoCAD. Caution!
This action removes all other toolbars, menus, and other user interface elements. To recover
use the U command or drag the [Link] file into AutoCAD.
The CuiLoad and CuiUnload commands both display the Load/Unload Customization dia-
log box; again, two commands doing the work of one. The old MenuLoad and MenuUnload
commands are now aliases for them. All four of them could be replaced by the Load Partial
Customization File button in Cui’s dialog box.
The CuiExport and CuiImport commands export and import customization data from the
[Link] file to other .cui files, such as [Link]. Two commands are superfluous, because
they do the same thing: display the Customize User Interface dialog box with the Transfer tab
open. They could be replaced by the Cui command using the +1 option.
Some customization functions that affect the look of toolbars are moved to the Options
command’s dialog box.
(The PartialCui command, found in the beta version, was removed from the shipping version
of AutoCAD 2006. Autodesk forgot to rename the Customize command, because it now only
handles Tool Palette groups and their import/export.)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
The LockUi system variable selectively locks the position of toolbars and windows. Some
users find that they accidently move them, and this keeps them in place. The system variable
accepts the following bit values:
LockUI Meaning
0 No elements locked.
1 Docked toolbars locked.
2 Docked windows locked.
4 Floating toolbars locked.
8 Floating windows locked.
A user-friendly version of this system variable can be found in the Window | Lock Loca-
tion menu, as well as in the tray of the status bar.
The TbCustomize system variable prevents tampering of the user interface. In a bug that I
hope will be fixed, this variable disables the Customize and Toolbar commands, as well as
removing the Customize item from menus — but fails to disable the Cui command and the
Customize | Interface menu item!
Command: tbcustomize
Enter new value for TBCUSTOMIZE <1>:
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
t he Cui command displays the Customize User Interface dialog box. As illustrated below,
the dialog box consists of two tabs and three panes (areas).
The tabs separate the dialog box into two tasks:
Customize — creates and modifies customizations.
Transfer — transfers customizations between .cui files.
The panes perform much of the customization through drag’n drop: drag commands into and
out of groupings.
The left-hand panes are static. They provide access to types of customization (top pane) and
lists of commands (bottom pane). The right-hand pane changes according to the needs of the
customization task, often splitting into additional panes.
Some of the customization commands are located on the short toolbars found in the dialog box,
but most commands are stored in shortcut menus that are accessed by right-clicking items.
In some cases, direct editing is possible. For instance, to delete a customization item, select it
and then press the Del key. To rename an item, click it twice slowly, and then type in the new
name. (Double-clicking has no effect in this dialog box.)
TIP If you make a mistake, click the Cancel button. Alternatively, you can use the U
command after exiting this dialog box.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Customizations
Pane
Properties Pane
Command List
Pane
Description of
Selected Property
Customizations Pane
The Customizations pane displays an Explorer-like tree of user interface elements that can be
customized. (Click + boxes to open elements; click - to close trees.) Toolbars and shortcut
menus provide access to options.
To find a specific command or macro sequence, use the Find option, which, curiously enough,
is stored in shortcut menus. Right-click any pane, and then select Find from the shortcut
menu.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Properties Pane
The Properties pane is a chameleon, changing itself as you select different elements to custom-
ize, as listed below. Autodesk calls it the “dynamic pane.”
The following panes come and go, depending on what you select elsewhere in the dialog box:
Information — provides brief descriptions of major customization groups, such as
menus and workspaces.
Properties — displays the properties of the selected item.
Button Image — displays the icon associated with the selected command, and accesses
the button editor.
Preview — shows a nonoperating prototype of the selected toolbar.
Shortcuts — lists the currently defined keyboard shortcuts.
Workspace Contents — allows customization of workspaces.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Most properties can be edited directly; some have droplists, from which you select an option.
Others have a button, which opens a dialog box for accessing options or entering long mac-
ros.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
t he purpose of the Cui command is to customize many aspects of AutoCAD’s user interface.
Fortunately, the customization process is roughly similar, whether you are working with menus,
toolbars, shortcuts, and so on.
AutoCAD provides “Custom,” a partial .cui file meant for playing about with customization, as
we do in this e-book.
Toolbars are collections of related commands accessed by clicking buttons. The Cui command
creates new toolbars, adds and removes buttons and droplists to and from toolbars, and in-
serts flyouts. Buttons have icons, which you can edit or create new ones with the Button Editor
in Cui. (Icon comes from the Greek work eikon, meaning “to be like.”)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
TIP To make the toolbar buttons twice as large, use the Options command, and then
chose the Display tab. Select Use Large Buttons for Toolbars, and then click Apply.
3. Right click Toolbars, and then select New | Toolbar from the shortcut menu.
4. Notice that a new toolbar is created with a generic name, “Toolbar1”. You can change the
name right now, or wait until the next step.
5. The Properties pane lists the properties of new toolbars. Change the values of the follow-
ing properties:
Name Tailoring AutoCAD
Description Toolbar customization examples
Aliases (click the button and then enter:) TAcad
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Toolbar Properties
The following toolbar properties can be modified in the Properties pane. Most of them can be
ignored by you.
General Properties
Name — names the toolbar; appears on the toolbar’s title bar, as well as in Cui and menu
lists of toolbar names.
Description — describes the purpose of the toolbar.
Appearance Properties
It appears that some properties, such as Orientation and Default Location, have no effect on
the toolbar; perhaps this limitation will be fixed in a future release.
Rows: 2
On By Default — toggles the default display state of the toolbar: Hide or Show.
Orientation — positions the toolbar when AutoCAD starts, or when the toolbar is first
shown: Floating, or else attached to the Top, Bottom, Right, or Left edges of the
window.
Default X, Y Location — specifies the x,y coordinates of the toolbar’s upper left corner;
measured in pixels.
Rows — specifies the number of rows; meaningful for floating toolbars only.
Advanced Properties
Aliases — specifies the name used by macros and programs that need to access this
toolbar; more than one alias can be assigned.
ElementID — assigned automatically by AutoCAD; cannot be changed by you.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
1. In the Command List, scroll to Display Viewports Dialog — Cui’s name for the VPorts
command. (The fast way to get there is to press the D key, which takes you to dbConnect,
and then scroll further to Display Viewports Dialog.)
2. Drag the command up to Toolbars | Tailoring AutoCAD.
3. When you see the arrowhead facing Tailoring AutoCAD, let go of the mouse button.
Notice the changes in the right pane of the dialog box: the Button Image pane displays the
command’s icon, and the Properties pane now lists the properties of the command and its
icon.
4. In previous releases of AutoCAD, you could click the Apply button to see the new toolbar
and its single button. This doesn’t work in AutoCAD 2006, yet.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
d. Return to the Customize User Interface dialog box with the Cui command.
General Properties
Name — a brief description of the button’s function. The text is displayed by the button’s
tooltip.
Description — the longer description of the button’s function is displayed on the status
bar when the cursor is paused over the button.
Macros
The Macro section is your main focus, because this is where commands and macros are speci-
fied.
Macro — one or more commands executed by clicking the button. Most macros consist
simply of the command’s name, preceded by the Cancel metacharacter (described later).
Macro: ^C^C_vports
Images
Many button images are stored in AutoCAD as resources, but you can also create your own
images, as well as import them through the Button Editor, as described later.
Small Image — specifies the name of the 16x16-pixel image used by the button.
Large Image — specifies the name of the 24x24-pixel image; size is changed in the
Options command’s Display tab.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Unfortunately, the Description pane is not terribly useful. For instance, the description of the
toolbar button’s Name is “Displays the name of the menu [sic] item” — no mention that the
name is displayed by the button’s tooltip.
Creating Flyouts
Toolbars can contain other toolbars. These secondary toolbars are called “flyouts,” because
they appear to fly out from the primary toolbar. Flyouts are indicated by a small black triangle
( ) in the lower right corner of a master button, small enough to miss seeing.
For example, the Zoom button on the Standard toolbar contains a flyout with buttons for many
of the Zoom command’s options.
Flyout
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
3. Notice that AutoCAD creates a new toolbar named “Toolbar1.” Check the tree to ensure
Toolbar1 is part of Tailoring AutoCAD. If you wish, rename the flyout.
Examine the Properties of the flyout. The significant properties are described below.
TIP Any toolbar can become the flyout of another: drag one toolbar into another.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
1. Bring back the Customize User Interface by one of the following methods:
• Right-click the toolbar, and then select Customize.
• From the Tools menu, select Customize | Interface.
• From the View menu, select Toolbars.
• From the Windows menu, select Workspaces | Customize.
• Enter the Cui command.
• If Cui was the last command entered, press the Spacebar to repeat the command.
Basic Macros
Basic macros consist of one AutoCAD command, prefixed by several unusual-looking letters
called “metacharacters” (shown in color below). Metacharacters are not interpreted literally
by AutoCAD, but mean something different. (Meta is a Greek word meaning “beside.”)
Let’s take a look at the macro that operates behind the Display Viewport Dialog button.
^C^C_vports
^C — cancels the command currently in progress; imitates pressing Esc on the keyboard.
The carat ( ^ ) alerts AutoCAD that this is a control character, and not a command.
When a command is transparent (starts with the ' apostrophe), then you don’t prefix
macros with ^C.
What does C have to do with the Esc key? In versions of AutoCAD older than Release 13,
you would press Ctrl+C to cancel a command; the C was short for “cancel.”
(Going back even further in history, Ctrl+C comes from ASCII code 003, which repre-
sented “ETX” — end-transmission — in the days of telegraphs and teletypes. More than a
hundred years later the same ASCII codes are still in use, because the earliest computers
used teletype terminals to communicate with humans — and some things never change.
This leads to some clashes: since Release 13, Ctrl+C means “copy to Clipboard,” but
continues to mean “cancel” in AutoCAD macros for compatibility reasons.)
TIP Most macros start with two ^C because some AutoCAD commands are two levels
deep. I recommend three of ’em — ^C^C^C — because some commands, like PEdit, are
three levels deep, and so need three Cancels to get back to the ‘Command:’ prompt.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Nothing is needed at the end of the macro to terminate it. AutoCAD automatically does the
“pressing ENTER” for you. If you need to suppress the automatic Enter for some reason, hang
a ^Z at the end of the macro, like this:
^C^Cvports^z
Including Options
Toolbar button macros can include command options. There is a limit, however: you can only
include options that can be typed at the command line; options found in dialog boxes and
windows won’t work. Thus, a macro can open a dialog box, as with the ^C^C_vports macro,
but cannot go any further.
To go further into commands, you have to use command-line equivalents to dialog boxes. For
example, use the -vports command in the macro, instead of vports. A macro that splits the
current viewport into four would look like this:
^C^C_-vports _4
This macro does the following: cancels the previous command, if any; executes the -vports
command, and then specifies the 4 option. Notice that the 4 also gets the underscore ( _ )
prefix.
There is a space between -vports and _4: a space in a macro is like pressing the Enter key (or
spacebar) on the keyboard. Sometimes it can be hard to make out two or more spaces, so you
can also use the semicolon (;) instead.
The macro is the equivalent of typing the following at the command line:
Command: -vports (Press Enter.)
Enter an option [Save/Restore/Delete/Join/SIngle/?/2/3/4] <3>: 4 (Press Enter.)
Regenerating model.
Macros can have multiple options. A good example is setting up a new layer with its name and
color. At the command line, it looks like this:
Command: -layer (Press Enter.)
Current layer: "0"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]: m (Press Enter.)
Enter name for new layer (becomes the current layer) <0>: walls (Press Enter.)
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]: c (Press Enter.)
New color [Truecolor/COlorbook] : 12 (Press Enter.)
Enter name list of layer(s) for color 12 <walls>: walls (Press Enter.)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Don’t forget the extra Enter (;) at the end of the macro to exit the -Layer command.
Options can be used on their own in macros, without the mothering command name. For ex-
ample, you might have a series of toolbar buttons that provide commonly-used inputs, such as
angles and distances. Instead of typing 25' (don’t forget the apostrophe to indicate feet!), you
could have a macro that looks like this:
25'
In AutoCAD, start a command, and then click the appropriate toolbar button when the com-
mand prompts for a distance or coordinates.
3. Move your gaze to the Properties pane, where the properties are partially filled out for
you. Make the following changes:
Name 25 Feet
Description Specifies a distance of 25 feet.
Macro 25' (erase the ^C^C)
The other options can be ignored for now.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
c. In response to the next prompt, click the 25 Feet button on the toolbar.
Specify radius of circle or [Diameter] <25'-0">: (Click the 25 Feet button.) 25'
Notice that AutoCAD inserts the distance, and then draws the circle.
System variables can be used in toolbar macros just like commands. For example, to change
the size of the crosshair cursor, it’s easier to use the CursorSize system variable than it is to
fumble through the massive Options dialog box — in any case, dialog boxes are inaccessible to
macros.
The macro that changes the size of the crosshairs to 100% of the screen size would look like
this:
^C^C_cursorsize 100
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Some commands have options not documented by Autodesk, but are useful in macros. An
important one is the + option, which specifies which tab to display in tabbed dialog boxes. The
tab numbering starts with 0, which means the first tab is referred to as +0.
For example, to open the Drafting tab of the Options dialog box, the macro looks like this:
^C^C_options +6
Additional Metacharacters
Earlier I introduced the ^C and ^Z metacharacters. Toolbar macros recognize more than a
dozen metacharacters, most of which are toggles that mimic clicking buttons on the status bar,
such as SNAP and ORTHO.
Metacharacter Meaning
Toggles:
^A Toggles group mode, like pressing Ctrl+A1.
^B Toggles snap mode between on and off, like Ctrl+B.
^D Changes coordinate display mode, like Ctrl+D.
^E Switches to next isometric plane, like Ctrl+E.
^G Toggles grid display, like Ctrl+G.
^O Toggles ortho mode, like Ctrl+O.
^P Toggles the value of the MenuEcho system variable.
^V Switches to next viewport, like Ctrl+R.
^U Toggles polar mode, like Ctrl+U1.
^W Toggles object snap tracking, like Ctrl+W1.
1
Not documented by Autodesk.
Advanced Macros
You may string together more than one command in toolbar macros, which allows you to cre-
ate more powerful expressions. For even greater power, you can include Diesel expressions
and AutoLISP routines.
For example, Autodesk wrote the following macro for the RefSet button.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Yikes! Ugly, isn’t it? I’ve parsed the code in colors so that you can see the structure:
Red Macro control characters.
Green AutoCAD commands, AutoLISP functions, and system variables.
Black Diesel expressions.
$M=
$(if,
$(eq,
$(getvar,refeditname),
""),
^C^C^P(ai_refedit_alert);^P,
$(if,
$(and,
$(=,
$(getvar,tilemode),
0),
$(=,
$(getvar,cvport),
1)
),
^C^C_refset;,^C^C_refset _add;
)
)
^Z
$M= — signals the start of a Diesel macro. I’m not sure why this is needed, because all
Diesel macros uniquely start with the $( metacharacter.
($ — start of the if Diesel expression.
^C^C — cancels any other command in progress.
^P — toggles menu echoing to suppress the display of this macro on the command line.
(ai_refedit_alert) — executes an AutoLISP routine, identified by the parentheses.
; — presses Enter.
^Z — suppresses the automatic Enter at the end of the macro.
Separator lines are thin gray line that can be added between toolbar buttons. They are useful
for segregating similar groups of buttons, as illustrated between the Save and Plot buttons in
the figure below.
Separator line
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
For these, AutoCAD displays a generic ?-cloud icon, as illustrated below. (The ?-cloud is
an improvement over earlier releases of AutoCAD, which displayed a uninformative but yellow
happy face.)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Image is missing
(no icon assigned to
button) Select an icon
from this list.
2. Scroll through the list, looking for a likely image. A good one for this command is the icon
for the Dist command.
3. Click it.
Notice that a large version of it appears above the Edit button, and that the Images
section of the Property pane is filled in with “RCDATA_16_DIST”. (This is AutoCAD’s
internal name for the image.)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
1. In the Properties pane of the 25 Foot command, select Small image in the Images
section.
2. Click the button. Notice the Select Image File dialog box.
3. Navigate to a folder with .bmp files. The \windows folder contains several images that are
used for the Desktop background.
You can select any size of .bmp file; AutoCAD resizes it down to fit an area of 16x16 pixels.
Be aware that this process tends to make the image fuzzy, so it’s best to pick a small, clear
image.
4. Select a .bmp file, and then click Open.
5. Curiously, AutoCAD does not immediately assign it to the command. You need to scroll to
the end of the of list of image samples, and then select it.
Be forewarned that AutoCAD remembers every Bitmap file you load, and there is no way
to erase unneeded ones.
AutoCAD has a built-in icon editor that lets you modify existing icons. Curiously, you cannot
start with a blank icon; you need to select one, and then modify it.
1. Select an image from the Button Image pane, and then click the Edit button. Notice the
Button Editor, which is nearly unchanged from earlier releases of AutoCAD.
Notice the Button Editor.
Drawing tools
(freehand, line, circle, erase)
Windows' 16
Real-size preview standard colors
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
• If the button contains a flyout, hold down the mouse button. Does the flyout appear?
• Do the buttons on the flyout appear and operate correctly?
• When you release the flyout, does the correct button appear on the flyout button?
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
t ustomizing menus is very much like toolbars, but involves a larger number of options,
because menus have more features than do toolbars, as illustrated below.
Menu bar
Underline character
accessed through Alt key
Menu
Shortcut keystroke
Icon
Separator bar
Toggle indicator
Highlight
Submenus
Dialog box indicator
Start the Cui command, and then select Menu in the Customization pane. Notice the similar-
ity between the menu structure (above) and the tree structure (below).
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Menu
Menu item
Separator bar
Submenu indicator
Submenus
Shortcut keystroke
1. Right click Menus, and select New | Menu from the shortcut menu.
2. Notice that a new menu is created with a generic name, “Menu1”. You can change the
name right now, or wait until the next step.
3. The Properties pane lists the properties of the new menu. Change the values of the follow-
ing properties:
Name Tailoring AutoCAD
Description Menu customization example
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Menu Properties
The following menu properties can be specified in the Properties pane.
General Properties
Advanced Properties
Aliases — specifies the name used by macros and programs that need to access this
menu; more than one alias can be assigned. Generally, menus are named POP followed by
a number, such a POP1.
The following aliases are reserved for use by AutoCAD:
Alias Comment
GRIPS Defines hot grip shortcut menu (right-click a hot, red grip).
CMDEFAULT Defines default shortcut menu (right-click blank area in the drawing).
CMEDIT Defines Edit shortcut menu (right-click an object).
OBJECT(S)_obj Defines shortcut menu specific to the object (obj = DXF name).
CMCOMMAND Defines Command shortcut menu (right-click while a command is active).
COMMAND_cmd Defines shortcut menu specific to a command (cmd = any AutoCAD
command).
TIPS AutoCAD can have up to 499 defined menus; i.e., POP1 through POP499. POP0 is
reserved for the default shortcut menu, while POP500 through POP 999 are for other
shortcut menus.
“POP” comes from the early days of Windows menus, when they were known as
“popdown menus.” This was to differentiate them from Macintosh menus, which were
called “pulldown menus,” because you had to pull them down with the cursor. Windows
menus popped down, because you only needed to click once with the cursor.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
1. In the Command List, scroll to the Display Viewports Dialog command — Cui’s name
of the VPorts command.
2. Drag the command up to Menus | Tailoring AutoCAD. When you see the arrowhead
facing Tailoring AutoCAD, let go of the mouse button.
d. Return to the Customize User Interface dialog box with the Cui command.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Macro Properties
The Macro section is the most important one, because commands and macros are specified
here.
Macro — one or more commands executed by clicking the button. Most macros are
simple, consisting of the command’s name, proceeded by the Cancel metacharacters:
Macro: ^C^C_vports
Images Properties
Several hundred images are stored in AutoCAD as resources, and you can create images or
import them with the Button Editor, described earlier.
Small Image — specifies the name of the 16x16-pixel image used by the button.
Large Image — specifies the name of the 24x24-pixel image, which isn’t used by menus.
(Unlike toolbar buttons, the change in size by the Options’ command’s Display tab does
not affect icons in menus.)
Basic macros consists of one AutoCAD command, prefixed by the “metacharacters” shown in
color. The format is identical to that of toolbar macros:
^C^C_vports
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Menu macros can include command options. As with toolbar macros, only options that can be
typed on the keyboard can be included; options in dialog boxes and windows don’t work. The
macro looks the same as shown earlier in the section on toolbars:
^C^C_-layer;_m;walls;_c;12;walls;;
Metacharacters - ^ and $
AutoCAD menus use special characters to indicate actions equivalent to pressing keys on the
keyboard. These special characters are called “metacharacters,” and sometimes “control char-
acters.”
For example, after entering commands at the keyboard, you press Enter; in menu macros,
you can’t press Enter, so the macros use the semicolon ( ; ) to represent the Enter key. An-
other metacharacter, the carat ( ^ ) represents the Ctrl key. There are no metacharacters in
AutoCAD for the Alt or Shift keys.
Here are the metacharacters used by menu macros:
Character Meaning
Menu Controls
$ Loads menu sections.
=* Returns to top-level menu.
$I= Displays an image menu.
$M=$( Starts a DIESEL macro.
Command Prefixes
' Indicates transparent command.
_ Translates AutoCAD commands and options as English.
*^C^C Repeats the macro until you press the Esc key.
^C^C^C Cancels the current command before starting macro.
Command Postfixes
; Equivalent to pressing Enter or the spacebar; can also use ^M.
space Equivalent to pressing the spacebar; can be used within macros to
separate commands from options, but ; is preferred.
\ Wait for input from user.
+ Macro continues on the next line, when the last character.
Labels
~ Unavailable menu item (grayed out).
!. Prefixes menu item with the check mark.
& Menu accelerator key character; can also use / .
\t Right justifies text following.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
When a menu item calls a dialog box, the convention is to include the ellipsis ( ... ) as a
suffix, like this:
Open...
The alternative is to pause the macro so that the user can input values or pick points in the
drawing. Use the backslash ( \ ) metacharacter to pause macros. When the user picks the point,
the macro continues automatically. The following macro draws arcs using the Center and Angle
options:
^C^C_arc \_c \_a
The macro waits twice for the user to input a value before continuing on. You can have more than
one \ in a row, if required by the command. No \ is needed at the end of the macro.
The exception to the single-\ rule is the Select command, which waits for the user to press
Enter to finish selecting one or more objects. (You then use the Previous option to obtain the
selection set.) Here is sample code that changes selected objects back to the Continuous line-
type:
^C^C_select \change;p;;properties;lt;continuous;;
Notice there is no semicolon ( ; ) after select \ because the user has to press Enter to signal
the end of object selection.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
You can write macros that let the user select values from menus, such as the following set of
standard drafting angles:
[30 Degrees]30a^H
[60 Degrees]60a^H
[90 Degrees]90a^H
The ^H is needed at the end of the macro to prevent the automatic Enter that AutoCAD
otherwise adds. The “a” is a dummy character that AutoCAD backspaces over.
Submenus
Submenus are like toolbar flyouts: they contain related groups of commands and options. The
figure below shows two submenus. One groups together object modification commands, and
the second groups together attribute modification commands.
As the figure illustrates, menus can have multiple submenus. When submenus reach the edge
of the screen, Windows automatically folds them back.
To create submenus, follow these steps:
1. Right-click the menu item that’s to receive the submenu. For this tutorial, right-click
Tailoring AutoCAD.
2. From the shortcut menu, select New | Sub-menu.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
TIP Any menu can become the submenu of another: drag one menu into another.
Separator Lines: --
Separator lines help group similar commands visually, as illustrated by the Insert menu:
Separator
line
The -- symbol indicates the location of the separator line in the tree.
3. Click Apply to apply the line to the menu.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Menu items can be accessed through the keyboard. For example, to open a new drawing through
the menu, use the following keystrokes: Alt+F, N.
1. To access the File menu: Hold down the Alt key, and then press F.
2. To access the New command: press N. Notice that AutoCAD opens the dialog box.
Shortcut keys are underlined. Look closely to see that every item on the menu bar and in each
menu has one letter underlined.
To specify the underlined letter, prefix it with the & metacharacter in the Name property. For
the File menu:
&File Displayed as File
The & does not need to be at the beginning of the name; it can be anywhere. Here, pressing “w”
accesses the command:
Ne&w Sheet Set Displayed as New Sheet Set
Shortcut Keystrokes - \t
You can indicate shortcut keystrokes for commands on menus. An example is the F1 next to
Help on the Help menu.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
The same pattern holds for other F and Ctrl keys: Flipscreen (F2) requires it, but New
(Ctrl+N) doesn’t — and I have no idea why.
Grayed-out Text - ~
Menu text can be made to look gray, which indicates the command is unavailable. In the figure
below, Plot Style is grayed out because plot styles have not been enabled.
Displaying gray text is easy: prefix the Name property with the tilde ( ~ ) metacharacter. (In
math, the tilde represents “not.”) Switching menu text between normal (black) and gray is not
as easy, because it requires that AutoCAD check the current state of plot styles.
This is done using the following Diesel code in the Name property:
$(if,$(eq,$(getvar,pstylemode),1),~,)Plot St&yle...
Recall that the Name property is the one displayed in the menu. Let’s parse this code, keeping
in mind the color coding:
Red Macro control characters.
Green AutoCAD commands, AutoLISP functions, and system variables.
Black Diesel expressions.
$(if, If...
$(eq, equals...
$(getvar,pstylemode), value of PStyleMode system variable...
1), is 1 (off),
~, then grayout the text (prefix with ~).
) Otherwise, don’t add the ~ prefix.
Plot St&yle...
Some menu items are toggles, such as View | Display | Attributes. AutoCAD displays a
check mark when they are turned on, and no check mark when off. The figure below illustrates
the check mark switching from Normal to On.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Parents of submenus
display no icons
Items without
icons display blanks
Similarly, parents of submenus don’t display icons, unlike the parent button of flyouts. To
remove icons from menus, delete entries for their Small Image property.
The process of creating and editing shortcut menus is nearly identical to that of menus.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
t he Keyboard Shortcuts section customizes two groups of keystrokes: shortcut keys (also
named “accelerators”) and temporary override keys, which are new to AutoCAD 2006. These
shortcuts can be faster to use than any other form of user input.
TIP You can create a printed list keyboard shortcuts by clicking the Copy to Clipboard
button, pasting the text into a document, and then printing it. (The Print button crashes
AutoCAD.)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Shortcut Keystrokes
All shortcut keystrokes begin with Ctrl, Alt, Shift, and/or F:
Function keys — press keys with the F prefix, such as F1 and F10.
Control keys — hold down the Ctrl key and press a function, number, or letter key, such
as Ctrl+F1, Ctrl+5, and Ctrl+B.
Shifted function keys — hold down the Shift key and press a function key, such as
Shift+F4.
Shifted control keys — hold down the Shift and Ctrl keys at the same time, and then
press a function, number, or letter key.
Control + alternate keys — hold down both the Ctrl and Alt keys and press a number
or letter key.
Shifted control + alternate keys — hold down the Shift, Ctrl, and Alt keys at the
same time, then press a number or letter key.
Earlier releases of AutoCAD were restricted to assigning only commands to keyboard short-
cuts; no options or macros. As of AutoCAD 2006, the restriction has been lifted.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
(You would think that you would be able to right-click Shortcut Keys, and then select New.
But it doesn’t work, because this creates only new temporary overrides. A bug?)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Notice that you can assign more than one shortcut to each command.
7. Click OK to exit the dialog box.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Customizing overrides is almost identical to shortcut keys; the primary difference is that you
can define two macros: Macro 1 (Key Down) and Macro 2 (Key Down).
When working with modes, such as Snap, it is not necessary to have a corresponding snap-off
statement in Macro 2. When Macro 2 is left blank, AutoCAD automatically restores the setting
to that before the override was applied.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
The point of the code is to change the value of the OrthoMode system variable, which con-
trols orthographic mode. If the value is 0, it is changed to 1; if 1, then it is changed to 0. You can
see that similar code is used to toggle Polar mode:
^P'_.autosnap $M=$(if,$(and,$(getvar,autosnap ),8),$(-,$(getvar,autosnap ),8),$(+,$(getvar,autosnap ),8))
The only difference is that the code changes the value of the AutoSnap system variable be-
tween 0 (off) and 8 (polar tracking).
A far simpler macro is used to turn off all modes:
^P'_.orthomode 0 '_.osmode 0 '_.snapmode 0 '_.autosnap 0
• Click the button to display the Long String Editor dialog box. (String is a
computer person’s jargon for “text.”) You can edit the text; right-click for a shortcut menu.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
e very button on your mouse can be given a job to do — with the exception of the first (or
left) button: it is always defined as “pick.” Unlike menus and toolbars, where you could define
hundreds of them, you are limited to defining a maximum of 15 buttons in AutoCAD. Actually,
fewer: as many buttons as your mouse has, typically three.
Well, maybe more than three. You can also use the Shift, Ctrl, and Shift+Ctrl keys with
mouse buttons, giving you a total of 12 functions for three-button mice. The default settings
are listed below:
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
(These instructions also apply to the buttons found on the pens and pucks used with digitizing
tablets.)
I suppose the official method should be the following: Right-click any item below Mouse But-
tons, such as Click or Button 2. From the shortcut menu, select New Button. Notice that
AutoCAD creates a new button with the next available number.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
CAREFUL! When you drag a command onto a button, the button’s definition is replaced
by that of the dragged command — erasing the old one. Command replacement occurs
when you see the black triangle illustrated below:
There is no undo button in this dialog box, so you need to click Cancel, and then restart
the Cui command.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
t he LISP Files section contains a list of AutoLISP .lsp files that load each time AutoCAD
starts. This duplicates the function of the AppLoad command. (Cui does not edit AutoLISP
files; you need to use a text editor, such as NotePad, for the task.)
This is perhaps the easiest customizing job:
Stage 1 — Select .lsp files.
Stage 2 — You’re done!
2. Notice the Load Lisp Files dialog box. Select one or more .lsp files, and then click Open.
(To select more than one file, hold down the Ctrl key. You can find lots of LISP files in
AutoCAD’s \express folder.)
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Autodesk reports that .mnl files of the same name and folder as the [Link],
[Link], and partial .cui files are loaded automatically.
3. Notice that the file names are added to the list under LISP Files. Click Apply and then OK
to exit the dialog box.
The next time AutoCAD starts, these AutoLISP routines are loaded. To remove LISP files, right-
click them, and then select Delete. The Unload option removes the .lsp file from memory so
that it does not run in the current session of AutoCAD; it will be reloaded the next time AutoCAD
starts.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
w orkspaces save and restore the state of the user interface (new to AutoCAD 2006).
They remember the visibility settings of menus, toolbars, and dockable windows. (Dockable
windows are windows like Properties, Sheet Set Manager, and Quick Calc.) Unlike profiles,
workspaces do not change file paths, selection options, and so on .
Workspaces are saved and restored by name using the Cui or Workspace commands. The
difference is that Cui displays the Customize User Interface dialog box, while Workspace
operates at the command line:
Command: workspace
Enter workspace option [setCurrent/SAveas/Edit/Rename/Delete/SEttings/?] <setCurrent>:
Workspace Meaning
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
The Toolbars and Menus items are empty, meaning none are displayed. That’s right: applying
this workspace results in an empty looking user interface, as shown below.
The Dockable Windows are all set to Do Not Change, meaning that if they are not displayed,
they stay hidden, and vice versa.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
General Properties
Display Properties
All but the Start On option can also be set in the Display tab of the Options dialog box.
Start On — starts AutoCAD in one of three modes:
• Model brings up AutoCAD in model space.
• Layout brings up AutoCAD in layout mode.
• Do Not Change brings up AutoCAD in the same state as it last exited.
Model/Layout tabs — toggles the visibility of model and layout tabs.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
1. Click the Customize Workspace button. Notice that the workspace tree turns blue.
This button is only needed for the next step; if you do not click it, then when you attempt
to select a toolbar or menu, AutoCAD thinks you want to customize them (instead of the
workspace), and the panes change.
2. In the Customization pane, click the box next to each toolbar and menus you wish added
to the workspace.
For this tutorial, select the Dimension and Inquiry toolbars and the Dimension
menu. As you select them, a green check mark appears, and the items appear in the appro-
priate location in the workspace tree.
Item appears in
workspace here
Select item here
(green check mark appears)
3. Modify the properties of toolbars; menus in workspaces don’t have properties. In any case,
these properties appear to have no effect on the toolbars.
Orientation — docks the toolbar at the Top, Bottom, Left, or Right edges of the window;
Floating floats the toolbar in the window.
Default X, Y Location — specifies the pixel coordinates of the toolbar’s upper left
corner.
Rows — specifies the number of rows the toolbar should display; applies only to floating
toolbars.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
2. Click Apply. Wait a moment while AutoCAD applies the changes to the user interface.
3. Click OK to exit the dialog box.
You can now access the workspace from the Windows | Workspaces menu.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
t he Legacy section consists of older user interface elements that are rarely used today.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
This book is covered by copyright. As the owner of the copyright, [Link] Publishing, Ltd. does not give you
permission to make electronic or print copies. You may not claim authorship or ownership of the text or figures
herein. Do not make copies. Contact editor@[Link] to purchase additional copies.
Feedback
I welcome your feedback for correcting and improving the text. Send your email to editor@[Link].
Visit the Tailoring AutoCAD CUI e-book Web site at [Link]/tca.
For more of our technical e-books, visit the [Link] Web site at [Link]/ebooks.
○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○