Templates
Templates are used to set the same properties and binding parameters to many controls or equipment.
Templates can be accessed from the Project Explorer Panel.
Create a new Template by using Right click over the Template group and select the Type of template to create, either Equipment or Control. Select the Target Type for this Template (Equipment or Control group).
Concept
A template can be defined with any number of properties and any number of bindings. By using a Template in the Equipment or Control properties, it allows the user to apply those properties and bindings on all equipment or controls of that Target Type.
At a later date, should those properties or binding need to change then a single change to the Template allows the changes to be applied quickly.
Control (2D) templates
A Control Target Type Template allows the user to select one of the 2D Control objects:
- 3D View
- Button
- Clock
- Image Box
- Label
- Numeric Display
- Panel
- Text Display
- User
Equipment (3D) templates
An Equipment Target Type Template allows the user to select one of the 3D Equipment objects;
- Barcode Scanner
- Basic Shape
- Cam Pusher
- Chute
- Conveyor
- Cross Belt Sorter
- Diverter
- EStop
- High Speed Diverter
- Label
- PE Sensor
- Polyline
- Rack
- Shoe Sorter
- Tilt Tray Sorter
- Vertical Sorter
- X-Ray Machine
When the Property Editor Panel for a Template is opened it is divided into two sections;
- Static: The Static section contains all the properties and values that this Template controls for the selected Target Type. When the user selects Add to add another property they are able to select from a list of all the properties for the object, excluding the properties already selected.
- Binding: The Binding section contains all the bound properties for the selected Target Type. When the user selects Add to add another property they are able to select from a list of all the properties for the object, excluding the ones already selected.
Use of %this.Name% and %this.Alias% in templates
Whenever the variable %this.Name% is used in tag expressions, at runtime it is expanded to the Name of the equipment or control.
The variable %this.Alias% can also be used to expand to the Alias of the equipment or control.
Worked example
Many Basic Shapes can be animated with their colors using matching tags. An example of this is:
-
Create four Basic Shape cubes named Shape1, Shape2, Shape3, Shape4
-
Create a template for Basic Shapes adding a Static property of height = 1 and Model = Cone
-
Add the Binding property of Color, expression = %this.Name%.Color and mappings of:
- 0 = Sym3 Black
- 1 = Sym3 Yellow
- 2 = Sym3 Blue
- 3 = Sym3 Transparent
-
For each of the Basic Shapes, assign the Template. All the Shapes should change to a Cone, 1 metre high.
-
Open the Tag Manager and create a new tags of type Long for each Basic Shape with names of Shape1.Color, Shape2.Color, Shape3.Color, Shape4.Color. Ensure the property Simulate Tag is ticked on each.
-
Create a Window and place 4 Numeric Display controls
-
For each Numeric Display, untick read only, create a Value binding with an Expression of %this.Name%.Color on all. Set the Alias for each as Shape1, Shape2, Shape3, Shape4 respectively.
When the Project is published and launched, entering a value into each Numeric Display will cause the Basic Shapes bound to the Numeric Display (through the Alias) to change the color to the color mapped in the template.