Trigger an event when moving a component

Hi there,

I was wondering if it possible to trigger an event when moving a component over the y-axis with the move action.
something like:

def UpdatePosition:
updateConnectedComponents()

pos = comp.wordPositionMatrix.P.Y
pos.OnChanged = UpdatePosition

thanks in advance,

A de Wit

from vcScript import *

def OnStart():
  global oldY
  oldY = comp.WorldPositionMatrix.P.Y

def OnMove(arg):
  global oldY  
  if abs(comp.WorldPositionMatrix.P.Y - oldY) > 1e-6:
    print "Do something not time-consuming"
    print "-"
    oldY = comp.WorldPositionMatrix.P.Y

comp = getComponent()
comp.OnNodeTransform = OnMove

I have looked at your code and I could use this!

thanks a lot.

Cool idea, so when there are many connected conveyors, you want to move only one of them to move all of them?

When I have a conveyor 1 with a pusher, there is a conveyor 2 with orientation 90 degrees to the other conveyor. When I move conveyor 1 more to the right, I want conveyor 2 to move automatically with it and extend the conveyorlength so the end of conveyor 2 will remain on the same location

1 Like