Re: Wanting to understand why my code is acting like this.
I think you need to understand what G98 and G99 actually do in the case of a lathe.
Assuming a Fanuc or Haas controller, I'm not sure about others. But I assume they are similar.
G98, sets feed to IPM or mm/min
G99, sets feed to IPR or mm/rev
G00, rapid move, axes move independently at the assigned rapid feed rate. The sequence of the axis moves would be hard coded into the controller firmware.
G01, coordinated axes move. The tool tip arrives at the new assigned position in all axes at the same time, and the move is accomplished at the assigned feed rate.
G98 or G99 would have no effect on a G00 move, the axes would move at the rapid feed rate set in the parameters, IPM or mm/min.
G00, G01, G98, and G99 commands are all modal, in other words, once issued they stay in memory until the opposing command is issued. So any following commands would be affected by those commands.
There is a little more going on than I described above, but that is the basics. I hope this helps.
Jim Dawson
Sandy, Oregon, USA