Simple multiple color change

<< Click to Display Table of Contents >>

Navigation:  Examples > Change the color of an object >

Simple multiple color change

Previous pageReturn to chapter overviewNext page

Suppose we have a certain object (let there be a valve) that has several operating modes (open, closed, mode1, mode2). We want to display an object on the screen with a different color depending on the operating mode.

1. Let's create a State tag, which is responsible for the operating mode of the valve (select the data type - Byte (8bit), and the default value is 0):

 

 

clip0025

 

2. Let's create an object - Valve ISA and set the "Fill Color" property depending on the tag value:

 

State

Color

0

RED

1

GREEN

2

BLUE

3

YELLOW

 

To do this, in the “Fill Color” tab, check the “Enable Property and select the “Tag.PV in Range” type, and then set the colors for each mode:

 

fillcolorvalveisa

fillcolorrangeex

 

3. Let's Run simulation to check the settings:

 

multiplyfillcolor

 

You can download this project here.