Two Way Path

Hi
how to change the direction of a 2-way-path with python script ?
Thanks in advance

Hi,
I have shared simple script to change direction of Two way path by using boolean signal

DirectionFwd → Boolean signal
conveyor_full - > Boolean signal
" conveyor_full let you detect when the part is left from the path . " If you don’t need to monitor parts on conveyor you can delete OnPhysicalTransition event

from vcScript import *

def OnSignal( signal ):

global path,conv_direction

if signal.Name == “DirectionFwd” and signal.Value == True:

path.Enabled = False

path.Direction = VC_PATH_FORWARD

path.Enabled = True

elif signal.Name ==“DirectionFwd” and signal.Value == False:

path.Enabled = False

path.Direction = VC_PATH_BACKWARD

path.Enabled = True

pass

def OnStart():

global path

path.Direction = VC_PATH_FORWARD_AUTO

def trans(cont, _part, arrive):

global part, conv_full

if arrive:

part= _part

conv_full.signal(True)

elif arrive ==False:

part = None 

conv_full.signal(False)

comp= getComponent()

path = comp.findBehaviour(“TwoWayPath”)

conv_full= comp.findBehaviour(“conveyor_full”)

path.OnPhysicalTransition = trans

1 Like

Thank you very much !!!