A computer-readable storage medium having stored therein a program for causing a computer to function as a tool path generation apparatus for generating a tool path, for a tool, for moving the rotating tool on a plane orthogonal to a rotation axis of the rotating tool to continuously cut a cut part of a work piece at a predetermined pitch along the plane, the program causing the computer to function as:
- tool movement limit line setting means for inwardly offsetting a machining range based on shape data of the cut part by at least a radius of the tool to set a tool movement limit line;
- contour line setting means for setting a contour line of a portion that is to be cut by the tool;
- machining path generation means for offsetting the contour line by a difference between the radius of the tool and the pitch and extracting a portion located at an offset contour line and within an interior of the tool movement limit line to generate a cutting path, and imparting return paths having a circular arc shape to both ends of the cutting path, to generate a machining path;
- unmachined portion update means for removing a tool movement region formed by the tool moving according to the machining path, from an unmachined portion in the machining range to update the unmachined portion;
- and
- connection path generation means for generating a connection path that connects the machining path to an immediately previously generated machining path, wherein
- until it becomes impossible to generate the machining path within the interior of the tool movement limit line,
- the unmachined portion update means updates the unmachined portion on the basis of the machining path, the contour line setting means newly sets the contour line in the updated unmachined portion, the machining path generation means generates a next machining path on the basis of the newly set contour line, and the connection path generation means generates a connection path that connects the generated next machining path and the machining path.