<< Click to Display Table of Contents >> Complex color change |
![]() ![]() ![]() |
If your project contains several objects of the same type, then to speed up project development, it is advisable to use non-unambiguous names when binding tags, but tag names associated with keywords based on user-defined properties. Let's create several tags for our example:
Let's create Motor graphical object for our example:
Let's open Object properties window by double clicking on it:
And let's create user-defined property - Number and make it's equal 1:
Close Collection window and then confirm creation of user-defined property by clicking OK on Object properties window. Then reopen Object properties window and enable Fill color property on the tab:
Now we need to bind Tag to the tag with name depending on our property - Number. To do this click "..." and in Choose tag window enter State{Number} in the Tag name field where Number is our user-defined property:
Now Fill color property bind to State1 tag and we need to change color depending on this tag's value:
State1 |
Color |
0 |
RED |
1 |
GREEN |
2 |
YELLOW |
To do this change Type to Tag.PV in the range:
And fill Ranges:
Confirm changes and close Object properties window by clicking OK. Now we have Motor with setup Fill color property. To copy this Motor and bind Fill color property to tags - State2 and State3 you no need to setup Fill color property for every Motor you only have to duplicate Motor:
And change Number property of the new Motor in the Property sheet:
Click OK to confirm your changes and Run simulation to check your settings:
You can download this project here.