Hi there experts!
I am creating a layout in which depending on a boolean signal, the crossing conveyor should change the routing rule from always Rigth to cyclic rule of Back and Rigth. I tried with boolean table rule and also programming in python but both failed. Could you give me a hand?
Thanks in advance.
If you change the routing rule RuleComponent from Processed to Owner, the script must also be altered to use the owner component instead of the processed part.
I have now updated the script to be more robust, so when taking a new crossing conveyor in VC 4.3 or later version this should work.
Updated crossing conveyor attached.
TwoWayCrossingConveyor_new.vcmx (132.5 KB)
Thanks for your answer. Once I change the RuleComponents to Owner, what should I do next? I didn’t plan to programm all the code but only introduce some conditions to change the rule when needed.
Thanks in advance,
You should be able to copy-paste the python script from the updated model to the one that you are using.
Basically, when using the Owner mode, you need to switch the second parameter in processRoute method to be the owner component (comp), instead of the processed part (part).
And what about using a “boolean table rule” and a new python script just to attribute the boolean signal value to the boolean variable. I thought it could be a simpler option but in the routing rule, when I set the False value as cyclic rule, I can’t define the cyclic rule, as shown in the image.
Thanks in advance.
I’m pretty sure that the Variable in the routing rule can only be a property and not a signal.
Thus, you will need to add a new boolean property to your component, and then modify the property value based on the signal value.
The property value can be set from the OnSignal event as such:
my_property = comp.getProperty('My Property Name')
if signal.Name == 'BooleanSignal':
my_property.Value = signal.Value