03.01.2013 Views

Customization Guide (.pdf) - Documentation & Online Help - Autodesk

Customization Guide (.pdf) - Documentation & Online Help - Autodesk

Customization Guide (.pdf) - Documentation & Online Help - Autodesk

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This menu item uses the DIESEL expression:<br />

^C^C^P$M=$(if,$(=,$(getvar,cvport),1),mspace,pspace)<br />

The next example is based on these assumptions:<br />

■ The CUI excerpt is included in the current customization file.<br />

■ The symbols to insert are one unit high by one unit wide.<br />

■ The DIMSCALE variable is set to the drawing's scale factor (that is, a drawing<br />

to be plotted at a scale of 1" = 10' would have a scale factor of 120, or a<br />

1/4" = 1' scale drawing would have a scale factor of 48).<br />

The DIESEL expressions in the following example multiply the current value<br />

of DIMSCALE by the specified value, and return an appropriate scale factor.<br />

$M=$(*,$(getvar,dimscale),0.375)<br />

$M=$(*,$(getvar,dimscale),0.5)<br />

$M=$(*,$(getvar,dimscale),0.625)<br />

DIESEL expressions can also return string values to pull-down menu item<br />

labels, so that you can make menus unavailable or otherwise alter the way<br />

they are displayed. To use a DIESEL expression in a pull-down menu label,<br />

make sure that the first character is the $ character.<br />

In the next example, the current layer is set to BASE and the following DIESEL<br />

expression is used as the label.<br />

$(eval,"Current layer: " $(getvar,clayer))<br />

The result is that the appropriate pull-down menu is displayed and updated<br />

whenever the current layer changes.<br />

Current Layer: BASE<br />

NOTE The width of pull-down and shortcut menus is determined when the<br />

customization file is being loaded. Menu labels generated or changed by DIESEL<br />

expressions after a menu is loaded are truncated to fit within the existing menu<br />

width.<br />

If you anticipate that a DIESEL-generated menu label will be too wide, you<br />

can use the following example to ensure that the menu width will<br />

accommodate your labels. This example displays the first 10 characters of the<br />

current value of the USERNAME system variable.<br />

$(eval,"Current value: " $(getvar,username))+<br />

$(if, $(eq,$(getvar,username),""), 10 spaces )^C^Cusername<br />

DIESEL Expressions in Macros | 329

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!