Inserting Variables and Expressions into Text

Предыдущая страницаВ началоСледующая страница

You can insert an expression into the text. An expression can consist of a single variable, or use multiple variables and/or constants in various mathematical functions. As a result, the value of the expression will always be displayed outside of the text content editing mode. In the text content editing mode (except string text), you can switch between displaying the value of the expression, and displaying the body of the expression with the names of variables and the designations of the functions used. To switch the display, use the VariableNames20x20 Variable Names command.

There are the following ways to insert expressions into text:

Using the Expression Constructor
This method is available for all types of text.

By typing in an expression body from the keyboard without calling additional commands
This method is only available for string text.

The values of variables inserted into the text (except string text) can be edited directly in the text in the drawing.

Inserting using the Expression Constructor

When editing the text content in a 2D or 3D view window, variables and expressions are inserted into the text using the automenu:

clip0430

<F8>

Insert Variable

Additionally, this command is available in the contextual menu (Insert Unfold10x10White VAR20x20 Variable... <F8>).

When editing the contents of string text in the parameters dialog, this command is available in contextual menu of the input box (Expression Constructor... <F8>).

When editing the text content in the editor, this command is available in the Standard toolbar, as well as in the drop-down menu (Insert > Variable...).

After calling the command, the ExpressionConstructor20x20 Expression Constructor dialog window opens. Enter the required expression and click OK. If only existing variables are used in the expression, then the insertion will be completed. If new variables are used in the expression, then, after clicking OK in the constructor, the Variable value windows will open sequentially for each of the new variables. After setting the values of all variables, the insertion will be completed.

 

In addition to the features that are standard for the expression constructor when inserting a variable into text (except for string text), additional controls are available in the constructor that allow you to configure the ability to edit a variable in the text after insertion:

Editable as field;

Value List;

Highlight when edited.

In addition, the Precision parameter is available at the bottom of the constructor, which determines the number of decimal places displayed in the text (for real expressions).

10_TextVarExpression1

To call the expression constructor for an expression already inserted into the text, use the Parameters20x20 Parameters... command in the contextual menu.

Editing values of variables in the text

Editing variables in the text is not available for string text.

If, when inserting an expression consisting of a single variable into the text, the Editable as field checkbox is enabled, then later it will be possible to edit the value of this variable directly in the text using the TextEditVariable20x20 Edit Variables command. This command can be called outside of the text content editing mode in two ways:

by clicking mouse right on the text and selecting TextEditVariable20x20 Edit Variables in the contextual menu;

just by clicking mouse left on the value of the variable if transparent editing of 2D elements is enabled.

Enabling the TextEditVariable20x20 Editable as field checkbox and then calling the Edit Variables command is also possible for expressions consisting of several variables, but the values of the variables will not be edited.

If a list of values has been created for a variable, then this list can also be used in the TextEditVariable20x20 Edit Variables command. To select a value from the list, a button Dropdown15x19 is displayed next to the variable. The size of the button is determined by the font size of the text.

10S_TextVarList0

The position of the button Dropdown15x19 relative to the value of the variable is determined by the option selected in the Value List drop-down list, when inserting the variable:

Right of text
10S_TextVarList

Left of text border
10S_TextVarList2

Right of text border
10S_TextVarList3

None
10S_TextVarList4

If there is some other content after the variable in the text, then the Right of text option is used instead of the options Left of text border and Right of text border.

If the selected option assumes the presence of the button Dropdown15x19, then, upon launching the TextEditVariable20x20 Edit Variables command, you can enable/disable the display of the button Dropdown15x19 by activating/deactivating the automenu option:

VariableDropdown30x30

<Ctrl>+<F3>

Show "Select from List" buttons

This option is also available in the contextual menu called by pressing mouse right on the button Dropdown15x19.

If you enable the Highlight when edited checkbox, when inserting an expression into the text, then the expression will be highlighted upon launching the TextEditVariable20x20 Edit Variables command. The highlighting color can be selected to the right of this checkbox. Color selection is carried out in the same way as described in the Color section.

10S_TextVarList5

The TextEditVariable20x20 Edit Variables command provides automenu options for working with the clipboard:

clip0419

<Ctrl>+<X>

Cut selected text

CopySmall

<Ctrl>+<C>

Copy selected text to clipboard

PasteSmall

<Ctrl>+<V>

Paste text from clipboard

These options are also available in the contextual menu called by clicking mouse right on the value of the variable or on the button Dropdown15x19.

When pasting text from the clipboard, the system keeps track of the correspondence between the buffer content types and the current variable, i.e. it is not possible to insert textual information into the field of a numeric variable.

Additionally, following options are available for inserting text from a dictionary, indexes, fractions, symbols and spell check:

Dictionary

<F6>

Insert text from Dictionary

clip0433

<Alt>+<F12>

Insert Index

clip0434

<Ctrl>+<F12>

Insert Fraction

TextDiameter

<Alt>+<F2>

Insert Diameter

TextGradus

<Alt>+<F3>

Insert Degree

clip0444

<Alt>+<F4>

Insert Plus-Minus

clip0445

<Alt>+<F9>

Insert Special

TextTable

<Alt>+<F5>

Open Character Map

SpellCheck

<Ctrl>+<F11>

Check Spell

These options are also available in the contextual menu called by clicking mouse right on the value of the variable or on the button Dropdown15x19. In addition, inserting a radical is available in the same menu: Insert Unfold10x10White Radical20x20 Radical.

These options are intended to work with text variables. Using these options, when editing real variables, can lead to incorrect results.

The options mentioned above are used in the same way as in the text content editing mode.

The display of non-printable characters can be enabled/disabled using the option:

NonPrintableChars30x30

<Ctrl>+<F2>

Non-printing symbols

This option is also available in the contextual menu called by clicking mouse right on the button Dropdown15x19.

You can quit the command using the following options:

AutomenuOk1

<Ctrl>+<Enter>

Confirm change of variables

CancelSelection30x30

<Esc>

Undo variable change

These options are also available in the contextual menu called by clicking mouse right on the button Dropdown15x19.

Inserting expressions into string text by typing in the expression body from the keyboard without invoking additional commands

When entering string text content, you can enter expressions by enclosing them in curly brackets. As a result, the value of the entered expression will be displayed in the drawing instead of the contents of curly brackets. If the expressions use names of non-existent variables, then after clicking OK in the text parameters dialog, the Variable Value windows will be opened sequentially for each of the new variables. After setting the values of all variables, the insertion will be completed and the system will calculate the value of the expression.

For example, if you create text with the following content:

Cylinder diameter - {D} millimeters

and assign the value 10 to the variable D, then the text in the drawing will look as follows:

Cylinder diameter - 10 millimeters

When entering expressions in the contents of string text, the same rules, operations and functions are used as in the variable editor.

If the expressions entered in the current line of text do not use non-existent variables, then their values are calculated immediately after entering. At the same time, the content of the current line is displayed above the text content input field, taking into account the value of the expression. To display the contents of another line, move the text cursor to it.

10_TextVarLegacy

See also:

Parametrization

Expression Constructor