Edit and Create Shortcuts in AutoCAD for MAC? YES it is possible! Part two (advanced)

In my previous post, dedicated to creating and editing keyboard shortcuts in AutoCAD for MAC I told how this can be done by using the capabilities of the operating system. In fact, there is another way. True, it requires from user special attention and perseverance, as it related to the direct editing of files within an application. So – as we say – “Seven times measure – cut once.” Therefore I strongly advised to use this method only if you are “advanced” user.

In the old days when there was AutoCAD r.12 for DOS (and other platforms) customization of the program was almost always associated with editing text files that “create” user interface. It is interesting that now, in the first version of AutoCAD for MAC, this possibility is also present (as long as the developers have not implemented the program all the necessary tools for customization, I mean the improvement of CUI Editor).

Let’s begin. For work you’ll need a text editor that allows you to save text files without formatting. You can use TextEdit, but I use the free Smultron App, which can be downloaded bought now ($4.99) from App Store.† Its advantage is that it has many functions of the programmer’s editor (including color highlighting of code). I use it, for example, for editing and creating AutoLISP files. I also strongly recommend you to make a backup of all files you wish to edit.

All the keyboard shortcuts defined in AutoCAD for MAC are stored in a file AcceleratorRoot.cui, which is located inside the package AutoCAD.app, in the folder /Applications/Autodesk/AutoCAD 2011/AutoCAD.app/Contents/Resources/. AcceleratorRoot.cui file is a plain text file containing information in XML format – this is hierarchical structure, described in text format, and it used to store any data. You can easily edit files of this format in the CUI Editor in AutoCAD (at this moment only files containing information about the customization of Commands, Tool Sets Palette and Pulldown menus). We have to make changes manually, using a simple text editor (Smultron).

AcceleratorRoot.cui file consists of sections that describes the keyboard shortcuts and commands assigned to this shortcuts. Section for each of the keyboard shortcut starts with <MenuAccelerator UID=….> and ends with :

<MenuAccelerator UID="MA_0004"> <ModifiedRev MajorVersion="16" MinorVersion="2" UserVersion="0" /> <Accelerator> <KeyCombo accKeys="CMD" AccelChar="A" bUseVirtual="false" /> <MenuItem> <MacroRef MenuMacroID="ID_SelAll" /> </MenuItem> </Accelerator> <!--MenuAccelerator> 

In the above example, the keyboard combination “CMD + A” is assigned the menu macro (or command) “ID_SelAll”. Thus, each keyboard combination is bound to the macro described in the file MenuGroup.cui, which is located in
~/Library/Application Support/Autodesk/roaming/AutoCAD 2011/R18.1/enu/Support/. If you open this file in a text editor, then you can find the following code in it:

<MenuMacro UID="ID_SelAll"> <Macro type="Edit"> <Revision MajorVersion="16" MinorVersion="2" UserVersion="0"></Revision> <ModifiedRev MajorVersion="17" MinorVersion="2" UserVersion="0"> <Name xlate="true" UID="ACAD_2435">Select All</Name> <Command>^C^C_ai_selall</Command> <HelpString xlate="true" UID="ACAD_2436">Selects all objects in either model space or the current layout, except those objects on frozen or on locked layers <SmallImage Name="RCDATA_16_SELECT"> <LargeImage Name="RCDATA_32_SELECT"> <CLICommand xlate="true" UID="XLS_CLICMD_ID_SelAll"> </Macro> <!--MenuMacro> 

which shows that the macro “ID_SelAll” is actually – command AI_SELALL.

In some cases, the macro name is encoded in the format “MM_XXXX”, where XXXX – a four-digit number. Macros (commands) are stored exact in this format when user adds it in AutoCAD for Mac in the CUI Editor during program customization. Here’s an example section AcceleratorRoot.cui:

<MenuAccelerator UID="MA_0217"> <ModifiedRev MajorVersion="18" MinorVersion="1" UserVersion="0" /> <Accelerator> <KeyCombo accKeys="CMD" AccelChar="." bUseVirtual="false" /> <MenuItem> <MacroRef MenuMacroID="MM_1937" /> </MenuItem> </Accelerator> </MenuAccelerator> 

which assigned keyboard combination “CMD + .” to the macro “MM_1937” from MenuGroup.cui:

UID="MM_1937"> <Macro type="Any"> <Revision MajorVersion="18" MinorVersion="1" UserVersion="0"></Revision> <Name xlate="true" UID="XLS_00021943">Documents and Layouts</Name> <Command>^C^C_qview</Command> </Macro> </MenuMacro> <MacroRef MenuMacroID="MM_1937" /> </MenuItem> </Accelerator> </MenuAccelerator> 

and it executes command QVIEW.

Another note: if the combination of hot keys consist of three (or more) auxiliary keys, such as “SHIFT + CMD + H” to toggle the palette state, then in the file AcceleratorRoot.cui is written:

<MenuAccelerator UID="MA_0034"> <ModifiedRev MajorVersion="17" MinorVersion="2" UserVersion="0" /> <Accelerator> <KeyCombo accKeys="SHIFT+CMD" AccelChar="H" bUseVirtual="false" /> <MenuItem> <MacroRef MenuMacroID="MM_1904" /> </MenuItem> </Accelerator> </MenuAccelerator> <MacroRef MenuMacroID="MM_1937" /> </MenuItem> </Accelerator> </MenuAccelerator> 

So, now you can edit existing or add new shortcuts in AutoCAD for Mac. And even for your own macros (commands) that you created using the CUI Editor. In order to avoid conflicts with certain default keyboard shortcuts, I recommend you to refer to my post Default Keyboard Shortcuts in AutoCAD for Mac for the reference.
And just in case if something goes wrong – you can download original AcceleratorRoot.cui here.

The next time if you are wondering, I will talk about customizing Double Click Actions in AutoCAD for MAC.

Happy SHORTCUTING!

Oh yeah, if you will have difficulties – feel free to contact me for help!

EDIT.

Appendix.
Aliases auxiliary keys in the file AcceleratorRoot.cui

(KeyCombo accKeys)

SHIFT

CTRL

ALT

CMD

†Free alternative still exists – Fraise. It is a free text editor for Mac OS X Leopard 10.6, based on Smultron code, which is both easy to use and powerful.

Advertisements

3 Responses to “Edit and Create Shortcuts in AutoCAD for MAC? YES it is possible! Part two (advanced)”

  1. Hey anyone!!! All the tools icons disappeared from tools sets!!!! when I click on the bar, it closes!
    There`s just the box appearing. I tried reseting, but nothing works.
    CAN SOMEONE PLEASE HELP ME?

  2. […] my previous posts “Creating shortcuts for custom commands in AutoCAD for MAC” or “Edit and Create Shortcuts in AutoCAD for MAC? YES it is possible! Part two (advanced)” […]

Comments are closed.

%d bloggers like this: