A numerically controlled machine tool, comprising:
- a spindle head for supporting a spindle such that the spindle is rotatable about a first axis;
- a tool detachably attached to the spindle such that the tool rotates with the spindle about the first axis;
- a table for supporting a work piece such that the tool may contact the work piece;
- a frame for supporting the spindle head and table such that the spindle head moves relative to the table along the first axis;
- work piece indexing means mounted on the table for holding the work piece and rotating the work piece about a fourth axis orthogonal to a plane including the first axis;
- index control means for controlling the work piece indexing means to rotate the work piece from a last position where the tool machined a last surface of the work piece to a next position where the tool will machine a next surface of the work piece by rotating the work piece a rotation angle .theta..sub.r in a rotation direction;
- selecting means for selecting the rotation direction and the rotation angle .theta..sub.r, where
- the selecting means calculates a change angle .theta. representing an angular difference between a last angle at which the tool machined the last surface and a next angle at which the tool may machine the next surface,
- the selecting means selects a rotation direction the same as that represented by the change angle .theta. when an absolute value of the change angle .vertline..theta..vertline. is less than .pi. and selects a rotation direction opposite to that represented by the change angle .theta. when .vertline..theta..vertline. is greater than .pi., and
- the selecting means selects a rotation angle .theta..sub.r equal to .theta. when .vertline..theta..vertline. is less than .pi. and selects a rotation angle equal to 2.pi.-.vertline..theta..vertline. when .vertline..theta..vertline. is greater than .pi.;
- and
- maximum interference amount determination means for determining a maximum interference amount between the spindle head and the table for the rotation angle .theta..sub.r and the rotation direction, where the maximum interference amount is a minimum safe distance from the tool in the spindle to the work piece such that contact between the tool in the spindle and the work piece does not occur during rotation of the work piece by the work piece indexing means through the rotation angle in the rotation direction;
- and
- drive means for moving the spindle head along the first axis relative to the table such that the spindle head is the maximum interference amount away from the work piece before the work piece indexing means rotates the work piece about the fourth axis.