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 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:
<F8> |
Insert Variable |
Additionally, this command is available in the contextual menu (Insert 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 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:
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).
To call the expression constructor for an expression already inserted into the text, use the 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 Edit Variables command. This command can be called outside of the text content editing mode in two ways:
•by clicking on the text and selecting Edit Variables in the contextual menu;
•just by clicking on the value of the variable if transparent editing of 2D elements is enabled.
Enabling the 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 Edit Variables command. To select a value from the list, a button is displayed next to the variable. The size of the button is determined by the font size of the text.
The position of the button 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
•Left of text border
•Right of text border
•None
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 , then, upon launching the Edit Variables command, you can enable/disable the display of the button by activating/deactivating the automenu option:
<Ctrl>+<F3> |
Show "Select from List" buttons |
This option is also available in the contextual menu called by pressing on the button .
If you enable the Highlight when edited checkbox, when inserting an expression into the text, then the expression will be highlighted upon launching the 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.
The Edit Variables command provides automenu options for working with the clipboard:
<Ctrl>+<X> |
Cut selected text |
|
<Ctrl>+<C> |
Copy selected text to clipboard |
|
<Ctrl>+<V> |
Paste text from clipboard |
These options are also available in the contextual menu called by clicking on the value of the variable or on the button .
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:
<F6> |
||
<Alt>+<F12> |
||
<Ctrl>+<F12> |
||
<Alt>+<F2> |
Insert Diameter |
|
<Alt>+<F3> |
Insert Degree |
|
<Alt>+<F4> |
Insert Plus-Minus |
|
<Alt>+<F9> |
||
<Alt>+<F5> |
||
<Ctrl>+<F11> |
These options are also available in the contextual menu called by clicking on the value of the variable or on the button . In addition, inserting a radical is available in the same menu: Insert 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:
<Ctrl>+<F2> |
This option is also available in the contextual menu called by clicking on the button .
You can quit the command using the following options:
<Ctrl>+<Enter> |
Confirm change of variables |
|
<Esc> |
Undo variable change |
These options are also available in the contextual menu called by clicking on the button .
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.
See also: