I have a Fanuc 6M control, and when I start working I set my machine zero, then move the tool to where the origin of my piece is and then set those zeros (hopefully you can understand, don´t know yet the right names). Then when my machine starts reading the program the Z axis doesn´t work how it should.

X and Y work perfectly, but the Z axis keeps working with the machine zero instead of the piece zero. I set the machine zero at the highest (to allow tool change) but the piece zero is right on the surface of my stock, yet when I run the program the Z axis wants to keep using the machine zero. Already tried to set the machine zero at top of my stock but also didn´t work.

Does anyone have any idea on what am I missing? Should I specify with a G54 where the Z0 should be? My machine is very old and doesn´t work 100% but that is my only source of income right now and I really have to get it to work.