Configuring and Multiplying Visualization Elements as Templates

You can configure an visualization element as a template to be multiplied.

When you configure an element as a template:

  • You must define an array variable in at least one element property and use the index placeholder :code:`$FIRSTDIM$`\ , and optionally :code:`$SECONDDDIM$`\ .
  • Assign a fixed value to a property that is the same for all elements. (For example, a specific frame color that all multiplied elements should have.)
  • In the text of the template element, you can use placeholders as usual for displaying the values of variable (example: %s for the output text).

In special cases, you can define an array available across several dimensions by means of the index access placeholder.

Example

PROGRAM Main
VAR
 strArra4Dim[1..10, 0..5, 5..10, 1..10] OF STIRNG;
END_VAR

Configured: Main.strArr4Dim[5, $FIRSTDIM$, $SECONDDIM$, 10]

In addition, you can configure an element with any number of arrays that all need to have the same structure. The same structure means the same declaration of index ranges.

Visualization elements that can be multiplied

  • Rectangle
  • Round Rectangle
  • Ellipse
  • Line
  • Polygon
  • Polyline
  • Bézier curve
  • Image
  • Frame
  • Button
  • Pie
  • Spin
  • Text field
  • Check box
  • Image switcher
  • Lamp
  • Dip switch
  • Power switch
  • Push switch
  • Push switch LED
  • Rocker switch
  • Rotary switch

Configuring and multiplying visualization elements as templates

  1. Drag a Rectangle element from the ToolBox view (Basic label) to the visualization.

  2. Set the color “Red” for the property Colors ‣ Frame color and the color “Gray” for the property Colors ‣ Fill color.

  3. Declare in program code arrays with which you can configure the following properties regardless of element: Text variables ‣ Text variable, Text variables ‣ Tooltip variable , and Input configuration.

    ../_images/041cd8a5e82c2e25c0a8640e00db5413
  4. Configure the template element Rectangle with an array by specifying the array name in Text variables ‣ Text variable. Replace the first dimension with the placeholder $FIRSTDIM$ and the second dimension with the placeholder $SECONDDIM$. Example: PLC_PRG.strArr2Dim[$FIRSTDIM$, $SECONDDIM$].

    Configure the property Texts ‣ Text with the placeholder %s.

    The output text of the template element is now configured with an array. The visualization will generate text at runtime depending on the index.

  5. Perform step 4 as for the property Text variables ‣ Tooltip by specifying the array PLC_PRG.strArr2DimTt[$FIRSTDIM$, $SECONDDIM$].

    Configure the property Texts ‣ Tooltip with the placeholder %s.

    The tooltip of the template element is now configured with an array. The visualization will generate text at runtime depending on the index.

  6. Configure the template element with an array by specifying the name of an array (BOOL) in Input configuration ‣ OnMouseClick, type Toggle variable (example: PLC_PRG.boolArr2Dim[$FIRSTDIM$, $SECONDDIM$]).

    The input configuration of the rectangle is now configured. At runtime you can click every rectangle.

  7. Click Visualization ‣ Multiply visu element.

    The Multiply visu element dialog box opens. The values in Total number of elements are already selected according to the configured array.

  8. Click OK to confirm the selection.

    ../_images/37ee410ae84b6430c0a8640e01b074a4

See also