Create a Shortcut Menu (Concept)

AutoCAD

 
Create a Shortcut Menu
Concept Procedure Quick Reference
 
 
 

Shortcut menus are displayed at or near the location of your cursor when you right-click on the pointing device. The shortcut menu and the options it provides depend on the location of the cursor and other conditions, such as whether an object is selected or a command is in progress. You can also use scripts to display shortcut menus.

Context-sensitive shortcut menus display menu options that are relative to the current command or the selected object when you right-click.

Shortcut Menu Aliases

Shortcut menus are referenced by their aliases and are used in specific situations. In the Customize User Interface (CUI) Editor, the alias names must follow the proper naming conventions. For example, the shortcut menu named “Default Menu” displays the following information in the Aliases section of the Properties pane:

POP501, CMDEFAULT

CMDEFAULT is one of the reserved aliases that the program looks for in specific situations. In this case, the shortcut menu assigned the alias CMDEFAULT is displayed if no objects are selected and no command is in progress when you right-click over the drawing window.

Aliases for context-sensitive shortcut menus must be numbered between POP500 and POP999, with the exception of the Object Snap menu which uses an alias of POP0. The following aliases are reserved for use by the program:

Program aliases for shortcut menus

Alias

Description

GRIPS

Defines the Hot Grip shortcut menu. (Right-click the drawing area while a grip on an object is selected.)

CMDEFAULT

Defines the Default mode shortcut menu. (Right-click the drawing area while no command is active and no objects are selected.)

CMEDIT

Defines the Edit mode shortcut menu. (Right-click the drawing area while one or more objects are selected, no grips are selected, and no command is active.)

CMCOMMAND

Defines the Command mode menu. (Right-click the drawing area while a command is active.) In addition to the content of the CMCOMMAND menu, the command’s options (keywords within the square brackets) are inserted into this menu.

SNAP

Defines the Object Snap menu. (SHIFT+right-click the drawing area.)

The CMEDIT and CMCOMMAND shortcut menus can be made context-sensitive. In addition to the content of the CMEDIT menu, the appropriate object menu (if it exists) is inserted into this menu when one or more of a specific object type are selected. Object menus use either of the following naming conventions: OBJECT_objectname

OBJECTS_ objectname

If a single object is selected, the OBJECT_objectname menu is used, and if more than one of the same object type is selected, the OBJECTS_objectname menu is used. If no OBJECT_objectname is available, the program uses the OBJECTS_objectname menu (if it exists).

The object name used for the alias is the drawing interchange format (DXF) name of the object in all cases except for inserted objects. The following table shows the object names that are specific to inserted objects (blocks, dynamic blocks, and xrefs).

Object names specific to inserted objects

Object Name

Description

BLOCKREF

Block reference without attributes

ATTBLOCKREF

Block reference with attributes

DYNBLOCKREF

Dynamic block reference without attributes

ATTDYNBLOCKREF

Dynamic block reference with attributes

XREF

External reference (xref)

For example, to support an object-specific shortcut menu for one or more selected block references, you would create or modify a shortcut menu and change its properties to those in the following table. The important property to change is Aliases, which would need to modified to include the alias OBJECT_BLOCKREF.

Properties for the Block Reference Objects shortcut menu

Properties pane item

Description

Example

Name

String that is only used in the CUI Editor and is not displayed in the user interface.

Block Objects Menu

Description

Text used to describe the element; does not appear in the user interface.

Shortcut menu for block objects

Aliases

Specifies the aliases for the shortcut menu. Click the [] button to open the Aliases dialog box. Each alias in the CUI file should be unique and it is used to reference the shortcut menu programmatically.

POP512,OBJECTS_BLOCKREF

Element ID

Tag that uniquely identifies a shortcut menu.

PM_0021

Like the CMEDIT menu, the CMCOMMAND menu can contain context-sensitive information. Any menu named COMMAND_commandname is appended to the CMCOMMAND menu. The text of commandname can be any valid AutoCAD command, including custom-defined or third-party commands.

In many cases, you can enter a hyphen before a command to suppress the display of a dialog box and display prompts for the command instead. To create a context-sensitive menu for a command that displays prompts instead of a dialog box (such as -INSERT), you need to name the menu COMMAND_-INSERT.