Hi,
I have to do pipes animation for my customer, the problem is that the colour of the pipe have to change following the flow in the pipe. For example the pipe has to be blue when the valve XX is open and it has to be pink whe the valve YY is open.
I don't know how to make it simple without getting an expression with a lot of or...
Thanks,
Valentin
If there are many colors, consider using the lookup()
expression function. If a small number, the case()
expression function is probably the easiest to use.
I've already do this. I dont know if there is a better way to do it but here's what I do and it works:
I've link a script to the STROKE PAINT property of the objet (piping, in your case):
//black color
if (({Tags/[put the link of your tag here]} && ! {[your tag here]}),
color(0,0,0),
//other color (the color is the same of an other piping)
if ({Tags/_0909_PLC_111/TEST/_0909_FAS_tag_/Sts/InStatus/PosB},
{[put your window name here].[put the name of the objet with the color you want].strokePaint}))
Uh, if()
≠ case()
Consider showing a complete real example (without placeholders).
I did'nt see your comment before I write the message. I did a script with the fonction ''if'', as I write it below, and it work's. But as I said, it's probably not the greates way to do it. I will look for more information about the CASE command.
Be careful distinguishing between scripts (jython) and expressions (Ignition-specific). Very different behavior.
If it helps you, think of expression functions as being like Excel formulas.
You write an expression that returns one value as a function of none, one or more input values.
You can't write a script or program in expression language.