PURPOSE: To reduce the memory quantity necessary for the locus memory and correctly retreat the device along the working locus by memorizing the working locus for each vector and retreating the working locus by carrying out the interpolation on the basis of the vector on retreat.
CONSTITUTION: An NC program 1 consisting of the rectilinear and circular shift is interpolation-processed through a forecalculation processing part 2 by an interpolation processing part 3, and the vector components 4aW4h in the shift axis direction are obtained, and the transfer speed is obtained from the between-electrode voltage 5 in a calculation processing part 6. In the advance working, an advance/retreat selecting part 7 outputs each axis vector, and interpolation is carried out with the transfer speed in an output pulse calculation part 9, and output into the motor circuit processing parts 10aW10c is performed, and memory into a plurality of locus memory 8 is performed. In case of retreat, a plurality of final vectors of the memory 8 are taken out successively in the advance/retreat processing part 7, and interpolation calculation is carried out similarly in an output pulse calculation part 9, and output into the motor revolution control parts 10aW10c is performed. Therefore, the quantity of the necessary memory can be reduced, and retreat at a necessary speed can be executed.