Link a Process Node delay to a Python script reading a CSV?

Hi everyone,

Basicaly trie to add custom instruction.

I am trying to apply a custom delay inside a Process Node based on real datasets. I have a CSV file containing processing times, and I want to randomly pick one of these values for each part that enters the node.

I wrote a Python script to read the CSV file and extract the random value. However, I am struggling to cleanly link this Python script to the Process Node execution.

What I tried: I attempted to use Boolean Signals as a “handshake” between the Process Node and the script. I used a SendSignal statement in the Process routine to trigger the Python script, and tried both OnSignal(signal) and yield waitSignal() in the Python code to update a component property (which is then used as the Delay time).

The issue: It doesn’t seem to work reliably at all. My simulation either gets stuck in an infinite loop, or the simulation time completely freezes (e.g., at 15 seconds) right at the signal statement. The flow just stops.

Does anyone know the cleanest and most standard way to achieve this? Is there a better approach than using signals to link a Python script (reading an external file) to a Process Node delay?

Thanks in advance for your help!

I would suggest trying to use the “PythonProcessHandler” behavior as a starting point for the script:

from vcPythonProcessHandler import *

def OnSignal( signal ):
pass

def OnStatementExecute(executor, statement):
pass

If you use that to write to a property in the process node each time the script runs you could simply update that “Delay” property with the value from your csv file. You could probably also write directly to the variable in the process executer, but I’ve never tried that.

There’s also the ability to import a table of values for the product creator behavior. It’s a bit “hacky” but you could also use that as your delay if you want to avoid using python. Though it wouldn’t be random in that case, it would always follow the same sequence.