Pieces are falling into place.
About setting Pod var, is this somehow going into a register or will Mach remember this var when promting it during next tool change?
Would it possible to set pod var to 1, during the home/reference action so that the variable always have a number during the first tool change?
Well, lots of ways it could be done. You could just create a register and write to it when you move and read it to determine how far to move. Or, one of the slicker ways to do it would be to have the plc script monitor the position of the OB axis. For every so many steps in this direction add one to the current pod #, for every so many steps in the other direction subtract one pod from the current pod #. In between positions it could read pod 0 or "No Pod". This way if say an estop was activated while the pods are rotating you still know where it is or you know you need to reference it to continue. Endless ways to make it work. Even more ways to make it work very well.
It's a logic puzzle. Enjoy solving it. Map out every single step and all the possible ways to do each, what could go wrong during that step to make it fail and what happens if it does fail. Do you throw an estop and pop up a message box? Does it just automagicly reference and start over from there. Endless possibilities. It makes you think but that is the fun part.