Untitled

(Steven Felgate) #1

This menu item uses the DIESEL expression:


^C^C^P$M=$(if,$(=,$(getvar,cvport),1),mspace,pspace)

The next example is based on these assumptions:


■ The CUI excerpt is included in the current customization file.


■ The symbols to insert are one unit high by one unit wide.


■ The DIMSCALE variable is set to the drawing's scale factor (that is, a drawing
to be plotted at a scale of 1" = 10' would have a scale factor of 120, or a
1/4" = 1' scale drawing would have a scale factor of 48).


The DIESEL expressions in the following example multiply the current value
of DIMSCALE by the specified value, and return an appropriate scale factor.


$M=$(*,$(getvar,dimscale),0.375)
$M=$(*,$(getvar,dimscale),0.5)
$M=$(*,$(getvar,dimscale),0.625)

DIESEL expressions can also return string values to pull-down menu item
labels, so that you can make menus unavailable or otherwise alter the way
they are displayed. To use a DIESEL expression in a pull-down menu label,
make sure that the first character is the $ character.


In the next example, the current layer is set to BASE and the following DIESEL
expression is used as the label.


$(eval,"Currentlayer:" $(getvar,clayer))

The result is that the appropriate pull-down menu is displayed and updated
whenever the current layer changes.


Current Layer: BASE


NOTEThe width of pull-down and shortcut menus is determined when the
customization file is being loaded. Menu labels generated or changed by DIESEL
expressions after a menu is loaded are truncated to fit within the existing menu
width.


If you anticipate that a DIESEL-generated menu label will be too wide, you
can use the following example to ensure that the menu width will
accommodate your labels. This example displays the first 10 characters of the
current value of the USERNAME system variable.


$(eval,"Currentvalue:" $(getvar,username))+
$(if,$(eq,$(getvar,username),""),10 spaces)^C^Cusername

DIESEL Expressions in Macros | 329

Free download pdf