I've made this happen on several machines.
Your solution can very greatly from machine control to machine control. If you told us the machine tool make and model, we MAY still have to GUESS as to what control is installed on the machine. If you told us what control you were dealing with, we still MAY have to GUESS as to what machine you were using (lathe? mill? laser? waterjet? etc).
If I asked you what size tire my vehicle takes, you'd need more details to give a reasonable answer, eh?