Hello,
I’m writing a Python Script to control a bucket conveyor where every bucket is independent.
After some testing I managed to detach the bucket from my path and attach it to the 3D world, but I cannot attach it back to my path and I don’t know what I’m doing wrong.
from vcScript import *
comp = getComponent()
app = getApplication()
sim = getSimulation()
toppath = comp.getBehaviour(“TopPath”)
sensor = comp.findBehaviour(“ComponentPathSensor”)
world_container = sim.World.getBehavioursByType(VC_CONTAINER)[0]
bucket = comp.ChildComponents[0]
def OnRun():
toppath.grab(bucket)
while app.Simulation.IsRunning == True:
triggerCondition(lambda: sensor.BoolSignal.Value==True)
part=sensor.ComponentSignal.Value
world_container.grab(part)
sim.update()
delay(1)
toppath.grab(bucket)
sim.update()
I did not wanted do use part.stopMovement() and path.Enabled because the ideal would be to use just one path and sometimes I need to stop just a bucket while the rest is moving and down the line I would have to stop many at a time.