Hello,
Is there an easy a way to read the product ID and the simulation time when a product enters a process? I created a simple script triggered by a signal sent by a process node. But I’m having trouble reading the product id.
from vcScript import *
comp = getComponent()
sim = getSimulation()
app = getApplication()
ws0Signal = comp.findBehaviour("WS0")
def OnRun():
while True:
triggerCondition(lambda : getTrigger() == ws0Signal and ws0Signal.Value == True)
print("Part entered {} at -> {}".format(comp.Parent.Name, sim.SimTime))
I did not like how this script turned out, because I wish I could trigger an event when a product enters a process node and another one when in leaves. I am a begginer in Python, so am I missing something?
Thanks in advance