Issues menu commands, or sets and retrieves menu item status
menucmd function can switch between subpages in an AutoCAD menu. This function can also force the display of menus. This allows AutoLISP programs to use image tile menus and to display other menus from which the user can make selections. AutoLISP programs can also enable, disable, and place marks in menu items.The
A string that specifies a menu area and the value to assign to that menu area. The string argument has the following parameters:
The allowed values of menu_area, shown in the following list, are the same as they are in menu file submenu references. For more information, see âOverview of Pull-Down and Shortcut Menusâ in the Customization Guide.
B1-B4âBUTTONS menus 1 through 4.
A1-A4âAUX menus 1 through 4.
P0-P16âPull-down (POP) menus 0 through 16.
IâImage tile menus.
T1-T4âTABLET menus 1 through 4.
MâDIESEL string expressions.
Gmenugroup.nametagâA menugroup and name tag.
MOREICONS:The following code displays the image tile menu
(menucmd "I=moreicons") Loads the MOREICONS image tile menu
(menucmd "I=*") Displays the menu
POP11. If the menu item is currently enabled, the menucmd function disables it.The following code checks the status of the third menu item in the pull-down menu
(setq s (menucmd "P11.3=?")) Gets the status of the menu item
(if (= s "") If the status is an empty string,
(menucmd "P11.3=~") disable the menu item
(menucmd "P11.3=?") could return "!.", indicating that the menu item is currently checked. This code would assume that the menu item is disabled and continue without disabling it. If the code included a call to the wcmatch function, it could check the status for an occurrence of the tilde (~) character and then take appropriate action.The previous code is not foolproof. In addition to being enabled or disabled, menu items can also receive marks. The code
menucmd function also allows AutoLISP programs to take advantage of the DIESEL string expression language. Some things can be done more easily with DIESEL than with the equivalent AutoLISP code. The following code returns a string containing the current day and date:The
(menucmd "M=$(edtime,$(getvar,date),DDDD\",\" D MONTH YYYY)")
returns "Sunday, 16 July 1995"
The Customization Guide for more information on using AutoLISP to access menu label status, and for information on using DIESEL.