Set MODEMACRO Values
 
 
 

You can use text strings and DIESEL to display messages in the user-defined section of the status line.

The value of MODEMACRO determines what is displayed in the mode status line. The simplest (and least useful) MODEMACRO consists of constant text. For example, to display a company name in the status line, you enter the following:

Command: modemacro

New value for MODEMACRO, or . for none <"">: Greg's Bank and Grill

This MODEMACRO value always displays the same text; the status line does not reflect changes to the AutoCAD internal state. It doesn't change until you change MODEMACRO.

To make the status line reflect the AutoCAD current state, enter macro expressions using the DIESEL language in the following format:

$(somefun, arg1, arg2, ...) 

In the macro expression, somefun is the name of the DIESEL function (similar to an AutoLISP function name) and arg1, arg2, and so on, are arguments to the function, interpreted according to the function's definition. Unlike AutoLISP, DIESEL macro expressions have only one data type: strings. Macros that operate on numbers express the numbers as strings and convert back and forth as required.

For descriptions of the DIESEL functions, see Catalog of DIESEL Functions.

Now define a more interesting status line (for example, one that shows the current text style name):

Command: modemacro

New value for MODEMACRO, or . for none <"">: Style: $(getvar, textstyle)

NoteThe examples in this topic may show the MODEMACRO string as more than one line of text. You enter it as one long string at the prompt.

You can retrieve any system variable by entering $(getvar, varname). The current setting of the system variable replaces the macro expression on the status line. Then, when you switch text styles, for example, MODEMACRO is reevaluated. If it changes, the new text style name is displayed on the status line.

Expressions can be nested, and they can be as complex as you want. The example that follows displays the current snap value and angle (in degrees) in the status line. It uses nested expressions to convert the snap angle from radians to degrees and truncates the value to an integer.

Command: modemacro

New value for MODEMACRO, or . for none <"">: Snap: $(getvar, snapunit) $(fix,$(*,$(getvar,snapang),$(/,180,3.14159)))

You can also display the values in the current linear and angular units modes.

Command: modemacro

New value for MODEMACRO, or . for none <"">: Snap: $(rtos,$(index,0,

$(getvar,snapunit))),$(rtos,$(index,1,$(getvar,snapunit))) $(angtos,

$(getvar,snapang))

DIESEL copies its input directly to the output until it comes to the dollar sign character ($) or a quoted string. You can use quoted strings to suppress evaluation of character sequences that would otherwise be interpreted as DIESEL functions. You can include quotation marks in quoted strings by using two adjacent quotation marks. In the following example, the current layer is set to LAYOUT, and MODEMACRO is set to the string.

Command: modemacro

New value for MODEMACRO, or . for none <"">: "$(getvar,clayer)= """$(getvar,clayer)""""

The status line displays the following:

$(getvar,clayer)="LAYOUT"

Quick Reference
Commands
System Variables