Rotate a component based on a value

Hello,

I am a beginner on Ignition and I’m stuck on my project.

I have a switch on my PLC which returns me a signal at 1 or 0.
If it sends me back 1, my switch is in “remote” mode.
Otherwise it is in “local” mode.

On a perspective I display the switch, and I want to rotate direction when the value = 1, so that it points to “remote” or “local” when the value = 0.

If you can give me clues to unlock me

Symbol factory switches were designed with visibility-swapping in mind - rather than actual rotation.

You will note in symbol factory that you are using “Selector switch 4 (right)”. There is also a “Selector switch 4 (left)” symbol that is a rotated version of the symbol you are using.

You should add both symbols to the view, and then setup bindings on the “display” property for each symbol. The display property will show the component if true, or hide the component if false. If the value of the PLC tag is actually swapping between 0 and 1 you can setup a tag binding.

For example, if you want the right facing switch to be visible when the value is 0. You can setup an expression binding that returns !{myTag} for the “display” property. This will cause the right facing switch to automatically hide itself when the tag value switches to 1. Then, if you setup a direct tag binding for the left facing switch on the “display” property, it can automatically un-hide itself when the tag value switches to 1.

3 Likes

Thank you for the answer

I manage to make it disappear depending on the input value or vice versa!

But in perspective, I can’t superimpose two symbols, can we do it?

Hi,

You can but only in coordinate view.

Regards

1 Like

IMHO, you should be using an SVG, then you wouldn’t need to do any superimposing, and you could rotate it with just an expression.

The parent container also becomes a non-issue at that point.

Several posts on the forum about how to use, create, modify SVG’s

2 Likes

I turned directly the component that points.

By adding a value “transform:rotate(…)” and binding.

The system works perfectly for me.

thanks for your answers

It sounds like @lrose 's method for rotating worked for you.

But in perspective, I can’t superimpose two symbols, can we do it?

In a flex container you cannot superimpose components. The “display” property works around this and my previous response was specifically for a Flex Container like the one in your screenshot. Superimposing is not required for this and not possible.

2 Likes