vcBoolSignal
vcBoolSignal is a signal that can send a Boolean value.
Inherits: vcBehaviour, vcSignal
Properties
Name | Type | Access | Description |
Value | Boolean | RW | Defines the value of signal.
Setting this value does not trigger the OnSignal event unless you use the signal() method. |
Methods
Name | Return Type | Parameters | Description |
signal | None | [Boolean value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event.
An optional value argument can be given to set the Value property of the signal. |
Examples
Example. Use a signal and its value to turn on/off the path of a conveyor
from vcScript import* comp = getComponent() sensorSignal = comp.findBehaviour("SensorBooleanSignal") path = comp.findBehaviour("MyPathWayBehaviour") # set path behavior ON path.Enabled = True # next line blocks execution until the 'sensorSignal' is trigged to value 'True' # (i.e. component arrives on sensor) # the trigger, in this case, is specific as is its value triggerCondition(lambda : getTrigger() == sensorSignal and sensorSignal.Value == True) # set path behavior OFF (i.e. stop conveyor) path.Enabled = False |
Example. Connect a signal to a port in a different component
from vcScript import * app = getApplication() comp = getComponent() signal1 = comp.findBehaviour("BooleanSignal") signal2 = app.findComponent("Example").findBehaviour("SignalMap") #A connection between a signal and signal map port is established signal2.connect(0,signal1) |