2012

Table Of Contents
DIESEL Expressions in Macros
You can use DIESEL string expressions in customization (CUI) files as an
additional method of creating macros.
These expressions can return string values (text strings) in response to standard
AutoCAD commands, AutoLISP and ObjectARX
®
routines, and other macros.
They can also return string values to the menu itself, thereby altering the
appearance or content of a menu label.
A DIESEL expression that you use in a menu item must follow the
$section=submenu format where the section name is M and the submenu is
the DIESEL expression you want. Frequently, you can implement a macro
more easily with AutoLISP.
The following examples show two menu items that produce the same result;
one uses DIESEL, and the other uses AutoLISP.
This menu item uses the DIESEL expression:
^C^C^P$M=$(if,$(=,$(getvar,cvport),1),mspace,pspace)
This menu item uses the AutoLISP expression:
^C^C^P(if (= (getvar "cvport") 1)(command "mspace")+
(command "pspace"))(princ) ^P
Both menu items provide a way to switch between paper space and model
space (if TILEMODE is set to 0), but the DIESEL expression is shorter and is
evaluated transparently, not requiring the call to the AutoLISP princ function.
If the special character ^P (which switches MENUECHO on and off) is omitted
in both cases, the DIESEL expression displays only the issued command,
whereas the AutoLISP expression displays the entire line of code.
Because the value returned by a DIESEL expression is a text string, it can be
used in response to an AutoLISP getxxx function call. This functionality
enables menu items to evaluate current drawing conditions and to return a
value to an AutoLISP routine.
The next example is based on these assumptions:
The AutoLISP routine is loaded into memory.
The CUI excerpt is included in the current customization file.
The symbols to insert are one unit high by one unit wide.
DIESEL Expressions in Macros | 393