The Text object is used to show static or dynamic text in a model. Text objects are used for labelling various parts of the model and for monitoring the status of the model.
The output displayed by the Text object is determined primarily by its Format keyword. Dynamic text can be introduced by including a Java format code such as %s in the Format keyword and specifying the value to be displayed with the DataSource keyword. Some typical Java format codes are %s, which can display both text and numbers, %.6f, which displays a numeric value with six decimal places, and %n, which starts a new line.
If the variable text is a number with units, the value can be converted from SI to a specified unit through the Unit keyword.
The easiest way to modify the contents of a Text object is to edit it directly in the view window. Double-click on the object or press the F2 key to place it in edit mode. In this mode, text can be entered, deleted, inserted, and highlighted using the same conventions as a typical text editor. Text can be copied from and pasted to the clipboard using Ctrl-C and Ctrl-V. A new line can be started at any point in the text by pressing Ctrl-Enter. Press the Return key or click on another object to save the changes and return the Text object to its normal mode. Press the Escape key to terminate editing and restore the original text.
The appearance and style of the text is determined by the keywords under the Font tab, including FontName, FontColour, etc. If no inputs are provided to these keywords, the appearance of the text is determined by the TextModel entered for the DisplayModel keyword. The default TextModel is set to the black Verdana font.
TextModels can be used in the same way as the Text Styles in Microsoft Word. A new TextModel can be created through the following steps:
1. In the Object Selector, right‑click on the TextModelDefault object and select Duplicate.
2. Rename the new TextModel object by clicking on its name in the Object Selector, entering the new name.
3. With the new TextModel selected in the Object Selector, use the formatting buttons in the button bar to specify its characteristics such as font, font style, colour, etc.
The new TextModel can be applied to the Text object by clicking the object and using the 'DisplayModel' button in the button bar.
Text Inputs
Keyword |
Description |
Key Inputs |
|
Description |
A free-form string describing the object. |
TextHeight |
The height of the font as displayed in the view window. |
Format |
The fixed and variable text to be displayed, as specified by a Java format string. If variable text is to be displayed using the DataSource keyword, include the appropriate Java format in the text. For example, %s will display a text output and %.6f will display a number with six decimal digits of accuracy. A new line can be started by entering %n. Note that a % character is generated by entering %%. |
UnitType |
The unit type for the numerical value to be displayed as variable text. Set to DimensionlessUnit if the variable text is non-numeric such as the state of a Server. |
Unit |
The unit in which to express an expression that returns a numerical value. For example, if the UnitType input has been set to DistanceUnit, then the output value could be displayed in kilometres, instead of meters, by entering km to this keyword. |
DataSource |
An expression that returns the variable text to be displayed. The expression can return a number that will be formatted as text or it can return text directly, such as the state of a Server. |
FailText |
The text to display if there is any failure while formatting the variable text or while evaluating the expression. |
Options |
|
AttributeDefinitionList, CustomOutputList |
See Section 6.2. |
Font |
|
FontName |
The font to be used for the text. |
FontColour |
The colour of the text specified by a colour keyword or RGB values. |
FontStyle |
The font styles to be applied to the text, e.g. Bold, Italic. |
DropShadow |
If TRUE, then a drop shadow appears for the text. |
DropShadowColour |
The colour for the drop shadow specified by a colour keyword or RGB values. |
DropShadowOffset |
The x, y, z coordinates of the drop shadow's offset, expressed as a decimal fraction of the text height. |
Graphics |
|
Position, Alignment, Size, Orientation, Region, RelativeEntity, DisplayModel, Show, Movable, VisibleViews, DrawRange |
See Section 11.1. |
Text Outputs
Output Name |
Description |
Entity and DisplayEntity |
|
Name, ObjectType, SimTime, Parent, Position, Size, Orientation, Alignment, GraphicalLength, ObserverList, NextList, PreviousList, EntityReferenceList |
See Section 11.1. |
Text |
|
User-defined attributes and custom outputs |
As defined by the AttributeDefinitionList and CustomOutputList inputs. |