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: %sfor 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
- Drag a Rectangle element from the ToolBox view (Basic label) to the visualization. 
- Set the color “Red” for the property and the color “Gray” for the property . 
- Declare in program code arrays with which you can configure the following properties regardless of element: , , and Input configuration. - ⇒
 
- Configure the template element Rectangle with an array by specifying the array name in . 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 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. 
 
- Perform step 4 as for the property by specifying the array - PLC_PRG.strArr2DimTt[$FIRSTDIM$, $SECONDDIM$].- Configure the property 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. 
 
- Configure the template element with an array by specifying the name of an array ( - BOOL) in , 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. 
 
- Click . - ⇒
- The Multiply visu element dialog box opens. The values in Total number of elements are already selected according to the configured array. 
 
- Click OK to confirm the selection. - ⇒
 
See also
