Aiming to enhance the degree of freedom of hole shapes which can be realized by machining methods, our research group has developed a new device that can fabricate curved holes by means of electrical discharge machining. The previous studies have shown that the device has the ability of fabricating curved holes and have developed the manner for fabricating curved holes with desired shapes by use of the device. This manner is built on the basis of the teaching playback method. So, the manner contains the teaching process for generating the operating commands that can make the device fabricate desired curved holes. However, the teaching process just built needed troublesome manual works. Not to need such works, the last study has devised the manner for automatizing the teaching process. Contrary to our expectation, however, the operating command generated by the automatized teaching process could not fabricate a desired curved hole due to the lack of the consideration to the motion capacity of the device and so on. To overcome this problem, this study has improved the algorithm to generate the operation command. The machining experiment employing the operating command generated by using the improved algorithm can fabricate the desired curved hole. This proves that the improved algorithm is effective to the fabrication of desired curved holes by means of the device.