Setting signal during simulation

hello,
I’m following tutorials in order to make component visible/invisible during a simulation.
I created this python script for my component and if I declare my boolean “hide” as true inside the python script the component is not visible. If I declare my boolean as false then the component is visible so I assume my script is working fine.


Inside the simulation tab I linked one of the output of my robot to the boolean of my component and set the output as true or false during the simulation but the component does not change at all.

Any ideas?

Thank in advance

Hi @ben21,

When dealing with signals I recommend using the OnSignal method.
Here is an example for hiding the component.

from vcScript import *

def OnSignal( signal ):
  if signal.Name == 'MY_SIGNAL_NAME':
    if signal.Value:
      comp.Visible = False
    else:
      comp.Visible = True

comp = getComponent()

Check this Academy tutorial to learn more: https://academy.visualcomponents.com/lessons/conditions-and-signals/

Excellent !
work as expected ! thank you Este