Numerical control device, numerical control system, control method, and program

The numerical control device addresses interference issues in machine tools by detecting and correcting rotational deviations, ensuring safe magazine rotation correction and preventing damage.

JP7885646B2Active Publication Date: 2026-07-07BROTHER KOGYO KK

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
BROTHER KOGYO KK
Filing Date
2022-09-29
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

In machine tools with turret-type magazines, rotation deviations can cause interference between the magazine and the spindle or tools during magazine rotation correction, potentially leading to damage.

Method used

A numerical control device that includes a rotation drive unit, storage unit, coordinate detection unit, deviation determination unit, position detection unit, and correction request unit to detect and correct rotational deviations by retracting the spindle from the magazine rotation region, thereby avoiding interference.

Benefits of technology

The solution effectively prevents interference and damage by ensuring safe and accurate magazine rotation correction, reducing the need for manual effort and minimizing risks to the magazine and spindle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007885646000001
    Figure 0007885646000001
  • Figure 0007885646000002
    Figure 0007885646000002
  • Figure 0007885646000003
    Figure 0007885646000003
Patent Text Reader

Abstract

To provide a numerical control device, a numerical control system, a control method, and a program for saving a main shaft to an appropriate position when performing a swiveling correction in a magazine.SOLUTION: A CPU determines whether a magazine has a swivel deviation so that a position of a main shaft can be restored to a processing region while the main shaft is stopped at a point M4 on a tool replacement route 52. If it is determined that there is a rotation deviation, the CPU detects a Z-axis of the main shaft and determines whether the detected position is in an ATC original point Z-axis. If it is not on the ATC original point Z-axis, the main shaft may be located within a magazine swiveling region. In this case, the CPU requests the main shaft to move back to the ATC original point Z-axis and then performs a swiveling correction to return the magazine to a reference position. After swiveling correction, the CPU moves the main shaft along the tool replacement routes 52 / 51 toward the processing region.SELECTED DRAWING: Figure 31
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a numerical control device, a numerical control system, a control method, and a program.

Background Art

[0002] A machine tool equipped with a turret-type magazine is known. The magazine can rotate around a rotation axis, and a plurality of gripping portions are provided along the circumferential direction on its outer peripheral portion. The gripping portion can grip a tool. The magazine can index any gripping portion to the indexing position by rotating. When exchanging the tool of the spindle, the machine tool moves the spindle along the tool exchange path and reciprocates between the tool exchange position and the tool exchange origin on the tool exchange path, thereby performing the transfer of the tool between the spindle and the gripping portion of the magazine. The tool exchange position corresponds to the indexing position of the magazine and is a position for transferring the tool between the spindle and the gripping portion. The tool exchange origin is a position where the tool held by the gripping portion does not interfere with the spindle and the magazine can rotate.

[0003] There may be a rotation deviation in the magazine during tool exchange. The rotation deviation is a phenomenon in which the magazine deviates in the circumferential direction from the reference position. The reference position of the magazine is the rotation position of the magazine in a state where the gripping portion is indexed to the indexing position. When a rotation deviation occurs in the magazine, depending on the magnitude of the rotation deviation, the position of the gripping portion deviates greatly with respect to the spindle, so that the tool cannot be transferred. Therefore, for example, it is necessary to determine whether it is necessary to perform a rotation correction to return the turret (magazine) to the reference position according to the rotation deviation of the turret (magazine), and when it is determined that rotation correction is necessary, a position correction system that requests an operation or work related to the rotation correction is known (see, for example, Patent Document 1).

Prior Art Documents

Patent Documents

[0004]

Patent Document 1

Summary of the Invention

[0005] However, when performing magazine rotation correction in the above-mentioned machine tool, if the spindle is close to the magazine, there is a possibility that the magazine mechanism or the tool held in the gripping part may interfere with the spindle or the tool mounted on the spindle during magazine rotation.

[0006] The object of the present invention is to provide a numerical control device, a numerical control system, a control method, and a program that can retract the spindle to an appropriate position when performing magazine rotation correction. [Means for solving the problem]

[0007] The numerical control device according to claim 1 comprises: a rotation drive unit that rotates a magazine, which has a plurality of gripping parts arranged circumferentially and capable of gripping a tool to be mounted on the spindle of a machine tool, and which rotates the magazine around a pivot axis to index any of the gripping parts; a storage unit that stores the rotation position coordinates of the magazine corresponding to the indexed position of the gripping parts as reference coordinates indicating the reference position of the magazine; a coordinate detection unit that detects the rotation position coordinates of the magazine; and the circumferential deviation of the pivot axis from the reference coordinates stored in the storage unit of the rotation position coordinates of the magazine detected by the coordinate detection unit. The numerical control device is characterized by comprising: a deviation determination unit that determines whether there is a certain rotational deviation; a position detection unit that detects the position of the main spindle; a determination unit that determines whether the position of the main spindle detected by the position detection unit is located within the magazine rotation region, which is the region in which the magazine rotates; and a correction request unit that, when the deviation determination unit determines that there is a rotational deviation and the determination unit determines that the position of the main spindle is located within the magazine rotation region, requests an action or operation to perform rotational correction by retracting the main spindle from the magazine rotation region and then returning the magazine to the reference position. When the numerical control device returns a magazine with rotational deviation to the reference position, if it determines that the position of the main spindle is within the magazine rotation region, it can retract the main spindle from the magazine rotation region and then return the magazine to the reference position. As a result, the numerical control device can avoid interference between the magazine and the tool held in the gripping part and the main spindle and the tool attached to the main spindle, thereby performing rotational correction appropriately and reducing the possibility of damage to the magazine, main spindle and tool.

[0008] The correction request unit of the numerical control device according to claim 2 may instruct the swivel drive unit to perform the swivel correction operation when the magnitude of the swivel misalignment is less than a threshold, and may notify the operator of the swivel correction operation when the magnitude of the swivel misalignment is equal to or greater than the threshold. Since swivel correction is performed automatically when the magnitude of the swivel misalignment is less than the threshold, the effort required is reduced compared to performing swivel correction manually. On the other hand, when the magnitude of the swivel misalignment is equal to or greater than the threshold, the numerical control device notifies the operator of the swivel correction operation, so that the operator can carefully swivel the magazine while checking the area around the magazine.

[0009] The numerical control device according to claim 3 further comprises a correction determination unit that determines that rotation correction is unnecessary when the magnitude of the rotational misalignment is less than a threshold, and determines that rotation correction is necessary when the magnitude of the rotational misalignment is equal to or greater than the threshold, and the correction request unit may request an action or operation to perform the rotational correction when the correction determination unit determines that rotational correction is necessary. If the magnitude of the rotational misalignment is less than the threshold, rotational correction is unnecessary because moving the spindle as is has little effect on tool transfer. On the other hand, if the magnitude of the rotational misalignment is equal to or greater than the threshold, the numerical control device notifies the operator of the rotational correction operation, so that the operator can carefully rotate the magazine while checking the area around the magazine.

[0010] The correction request unit of the numerical control device according to claim 4 may request an operation or task to retract the spindle in a direction away from the magazine rotation area along the tool exchange path, which is the path through which the spindle moves when a tool is exchanged between the gripping unit and the spindle, and then perform the rotation correction. When the numerical control device retracts the spindle from within the magazine rotation area, it can reduce the possibility of the spindle or the tool mounted on the spindle interfering with other members by moving the spindle along the tool exchange path.

[0011] The tool change path of the numerical control device according to claim 5 includes a predetermined path connecting a tool change position in which the spindle performs the tool change with the magazine and a tool change preparation position which is spaced apart from the tool change position in a direction perpendicular to the axial direction of the spindle and is the same position as the tool change position in the axial direction, and the correction request unit may request an operation or work to move the spindle back to the tool change preparation position along the predetermined path and then perform the rotation correction when the spindle is located in the predetermined path and within the magazine rotation area. When the spindle is in a stopped state and is located in the predetermined path of the tool change path and within the magazine rotation area, the numerical control device can safely perform magazine rotation correction by moving the spindle back to the tool change preparation position along the predetermined path.

[0012] In the numerical control device of claim 6, the machine tool performs tool changes of the spindle to and from the magazine by reciprocating the spindle between a tool change position on the tool change path and an origin position located away from the tool change position in the axial direction of the spindle, and the correction request unit may, when the spindle is located between the tool change position and the origin position and within the magazine rotation area, retract the spindle to the origin position and then perform the rotation correction and request an operation or work. When the spindle is in a stopped state and is located between the tool change position and the origin position and within the magazine rotation area, the numerical control device can safely perform magazine rotation correction by retracting the spindle to the origin position.

[0013] The deviation determination unit of the numerical control device according to claim 7 may determine whether there is a rotational deviation when the tool change is stopped midway. For example, if an alarm occurs and the tool change is stopped midway, the spindle is in a stopped state. In this case, the numerical control device determines the rotational deviation of the magazine, and if it determines that the stopped spindle position is within the magazine rotation area, it can move the spindle out of the magazine rotation area and then return the magazine to the reference position.

[0014] The deviation determination unit of the numerical control device according to claim 8 may determine whether there is a rotational deviation when the power to the machine tool is turned off during a tool change and then turned on again. When the power to the machine tool is turned off and then turned on during a tool change, the spindle is in a stopped state. In this case, the numerical control device determines the rotational deviation of the magazine, and if it determines that the stopped spindle is within the magazine rotational range, it can move the spindle out of the magazine rotational range and then return the magazine to the reference position.

[0015] In the numerical control device of claim 9, the axial direction of the spindle may be horizontal. The numerical control device of this embodiment can be applied to a horizontal machine tool in which the spindle extends horizontally.

[0016] The numerical control system of claim 10 is a numerical control system comprising a machine tool and a numerical control device, wherein the numerical control device includes a rotation drive unit that rotates a magazine, which has a plurality of gripping parts arranged circumferentially and capable of gripping a tool to be attached to the spindle of the machine tool, and which is rotatable around a rotation axis, to index any of the gripping parts; a storage unit that stores the rotation position coordinates of the magazine corresponding to the indexed position of the gripping parts as reference coordinates indicating the reference position of the magazine; a coordinate detection unit that detects the rotation position coordinates of the magazine; and the rotation position coordinates of the magazine detected by the coordinate detection unit stored in the storage unit. The numerical control system is characterized by comprising: a deviation determination unit that determines whether there is a rotational deviation, which is a circumferential deviation of the rotation axis with respect to a reference coordinate; a position detection unit that detects the position of the spindle; a determination unit that determines whether the position of the spindle detected by the position detection unit is located within the magazine rotation region, which is the region in which the magazine rotates; and a correction request unit that, when the deviation determination unit determines that there is a rotational deviation and the determination unit determines that the position of the spindle is located within the magazine rotation region, requests an operation or work to perform rotational correction, which involves moving the spindle out of the magazine rotation region and then returning the magazine to the reference position. As a result, the numerical control system can obtain the same effect as in claim 1. Note that although the numerical control device controls the operation of a machine tool, it may also control the operation of multiple machine tools.

[0017] The control method of claim 11 is a control method for a numerical control device that controls the operation of a machine tool, wherein a plurality of gripping parts capable of gripping a tool to be attached to the spindle of the machine tool are provided along the circumferential direction, and a magazine that rotates around a pivot axis is driven to rotate and index an arbitrary gripping part; a coordinate detection step for detecting the rotational position coordinates of the magazine; and the rotational position coordinates of the magazine that correspond to the indexed position of the gripping part of the rotational position coordinates of the magazine detected in the coordinate detection step are stored in a storage unit as reference coordinates indicating the reference position of the magazine. The numerical control device is characterized by comprising: a misalignment determination step for determining whether there is a rotational misalignment, which is a circumferential misalignment of the axis; a position detection step for detecting the position of the main axis; a determination step for determining whether the position of the main axis detected in the position detection step is located within the magazine rotation region, which is the region in which the magazine rotates; and a correction request step for requesting an operation or work to perform rotational correction, which involves moving the main axis out of the magazine rotation region and then returning the magazine to the reference position, if the misalignment determination step determines that there is a rotational misalignment and the determination step determines that the position of the main axis is located within the magazine rotation region. The numerical control device can obtain the effects described in claim 1 by performing each of these steps.

[0018] The program of claim 12 is a program for operating a numerical control device that controls the operation of a machine tool, wherein the program causes a computer to perform a rotation drive process to rotate a magazine which has a plurality of gripping parts provided along the circumferential direction capable of gripping a tool to be attached to the spindle of the machine tool and rotates around a pivot axis to identify any of the gripping parts; a coordinate detection process to detect the rotation position coordinates of the magazine; and the rotation position coordinates of the magazine that correspond to the identified gripping part position of the rotation position coordinates of the magazine detected in the coordinate detection process, and store the reference coordinates in a storage unit that stores the reference coordinates indicating the reference position of the magazine. The numerical control device is characterized by performing a misalignment determination process to determine whether there is a rotational misalignment, which is a circumferential misalignment of the rotation axis; a position detection process to detect the position of the main spindle; a determination process to determine whether the position of the main spindle detected in the position detection process is located within the magazine rotation region, which is the region in which the magazine rotates; and a correction request process that, if the misalignment determination process determines that there is a rotational misalignment and the determination process determines that the position of the main spindle is located within the magazine rotation region, requests an operation or work to perform rotational correction, which involves moving the main spindle out of the magazine rotation region and then returning the magazine to the reference position. By performing each of these processes, the computer of the numerical control device can obtain the effects described in claim 1.

[0019] The numerical control device according to claim 13 comprises a control unit and a storage unit for storing a program, wherein the control unit executes the program to realize the control method described in claim 11. This allows the numerical control device to achieve the effects described in claim 11.

[0020] A storage medium that can be read by a computer containing the above program is also novel and useful. [Brief explanation of the drawing]

[0021] [Figure 1] This is a perspective view of machine tool 1. [Figure 2] This is a perspective view of machine tool 1 (shutter 103: closed). [Figure 3] Perspective view of the machine tool 1 (shutter: open). [Figure 4] Perspective view of the machine tool 1 (magazine cover omitted). [Figure 5] Right side view of the machine tool 1 (magazine cover omitted). [Figure 6] View showing the machining area, ATC area, and each reference point. [Figure 7] Image diagram of the magazine swing area. [Figure 8] Block diagram showing the electrical configuration of the machine tool 1. [Figure 9] Flowchart of the NC control process. [Figure 10] Flowchart of the power-on process. [Figure 11] Flowchart of the process when an alarm is detected. [Figure 12] Flowchart of the application control process. [Figure 13] Flowchart of the ATC recovery process. [Figure 14] Flowchart showing the continuation of Figure 13. [Figure 15] Flowchart of the YM axis recovery process. [Figure 16] Flowchart of the YZM axis recovery process. [Figure 17] Flowchart of the axis return destination determination process. [Figure 18] View showing the recovery area W1. [Figure 19] View showing the recovery area W2. [Figure 20] View showing the recovery area W3. [Figure 21] View showing the recovery areas W4 and W5. [Figure 22] View showing the recovery area W6. [Figure 23] View showing the axis return screen 81. [Figure 24] Image diagram showing the movement path (1) from point M1 and the position of the magazine (2). [Figure 25] This figure shows the Y-axis recovery screen 82. [Figure 26] This is an illustrative diagram showing the movement path from point M2 (1) and the position of the magazine (2). [Figure 27] This figure shows the YM axis recovery screen 83 (when the rotational deviation is less than the threshold). [Figure 28] This figure shows the YM axis recovery screen 83 (when the rotational deviation exceeds the threshold). [Figure 29] This is an illustrative diagram showing the movement path from point M3 (1) and the position of the magazine (2). [Figure 30] This figure shows the YZ axis recovery screen 84. [Figure 31] This is an illustrative diagram showing the movement path from point M4 (1) and the position of the magazine (2). [Figure 32] This figure shows the YZM axis recovery screen 85 (when the rotational deviation is below the threshold). [Figure 33] This diagram shows the YZM axis recovery screen 85 (when the rotational deviation exceeds the threshold). [Figure 34] This is an illustrative diagram showing the movement path from the ATC origin (1) and the position of the magazine (2). [Figure 35] This is an illustrative diagram showing the movement path from point M6 (1) and the position of the magazine (2). [Figure 36] This figure shows the YZM axis recovery screen 86 (when the rotational deviation is below the threshold). [Figure 37] This diagram shows the YZM axis recovery screen 86 (when the rotational deviation exceeds the threshold). [Figure 38] This is an illustrative diagram showing the location of point M7. [Figure 39] This is a diagram showing the "Unrecoverable" screen 87. [Figure 40] This figure shows the indexing tool confirmation screen 88. [Figure 41] This is a diagram showing the ending screen 89. [Figure 42] This is a flowchart of the YM axis recovery process (modified version). [Figure 43]This diagram shows the configuration of a numerical control system 200 (modified example). [Modes for carrying out the invention]

[0022] One embodiment of the present invention will be described. The following description will use the left / right, up / down, and front / back directions indicated by arrows in the figures. The left / right direction, up / down direction, and front / back direction of the machine tool 1 are the X-axis direction, Y-axis direction, and Z-axis direction of the machine tool 1, respectively. The machine tool 1 shown in Figure 1 is a horizontal machining center in which the spindle 7 extends in the front / back direction (Z-axis direction). In this embodiment, "ATC" is an abbreviation for "Automatic Tool Changer". Also, in this embodiment, "NC" is an abbreviation for "Numerical Control".

[0023] The structure of machine tool 1 will be explained with reference to Figures 1 to 4. As shown in Figures 1 and 2, machine tool 1 includes a base 2, a column 5, a spindle head 6, a spindle 7, a control box 8, a rotary table 9, an X-axis movement mechanism 11, a Z-axis movement mechanism 12, a Y-axis movement mechanism 13, a tool changer 30 (see Figure 4, hereinafter referred to as "ATC device 30"), a magazine cover 10, etc. The base 2 is an iron base that is long in the Z-axis direction and is roughly rectangular in plan view. The X-axis movement mechanism 11 is provided on the rear of the upper surface of the base 2 and supports the carriage 15 so that it can move in the X-axis direction with the power of the X-axis motor 62 (see Figure 8). The Z-axis movement mechanism 12 is provided on the upper surface of the carriage 15 and supports the column 5 so that it can move in the Z-axis direction with the power of the Z-axis motor 64 (see Figure 8). The column 5 is an upright column that extends in the vertical direction. The Y-axis movement mechanism 13 is provided on the front surface 5B of the column 5 and supports the spindle head 6 so that it can move along the front surface 5B of the column 5 in the Y-axis direction by the power of the Y-axis motor 63 (see Figure 8). This allows the spindle head 6 to move in three axes: the X-axis, Y-axis, and Z-axis. The spindle head 6 extends in the Z-axis direction. The spindle 7 is provided inside the spindle head 6 and extends coaxially with the spindle head 6 in the Z-axis direction. The spindle head 6 provides forward support for the spindle 7 and allows it to rotate. The spindle head 6 is equipped with a spindle motor 61 (see Figure 8). The output shaft (not shown) of the spindle motor 61 is connected coaxially with the spindle 7 via a coupling (not shown). A tool holder 90 for holding a tool 91 is mounted on the tip of the spindle 7 (see Figure 7). Note that in the following description, for the sake of clarity, there are instances where it is stated that "a tool 91 is mounted on the tip of the spindle 7," but the meaning is the same.

[0024] As shown in Figure 4, a pair of support members 17 and 18 are provided at the rear of the base 2. The support members 17 and 18 are spaced apart from each other in the left-right direction and extend upward from the rear of the base 2, supporting the control box 8 from below. The control box 8 houses a numerical control device 40 (see Figure 8). The numerical control device 40 controls the operation of the machine tool 1. A fixed base 16 is provided on the front side of the upper surface of the base 2. The rotary table 9 is installed on the fixed base 16 and is positioned in front of the spindle head 6. A workpiece (not shown) is fixed to the upper surface of the rotary table 9 with a jig (not shown). The rotary table 9 can rotate and position 360° around a rotation axis parallel to the Y axis. The machine tool 1 cuts the workpiece fixed on the rotary table 9 by bringing a tool 91 mounted on the spindle 7 into contact with the workpiece from three axial directions: the X axis, Y axis, and Z axis.

[0025] A pair of support columns 21 and 22 are provided on the front upper surface of the base 2, on both the left and right sides. Support column 21 extends upward from the right side of the upper surface of the base 2, and its upper part is bent approximately 90° to the left. Support column 22 extends upward from the left side of the upper surface of the base 2, and its upper part is bent approximately 90° to the right. A connecting plate 23 is fixed between the opposing upper parts of support columns 21 and 22.

[0026] The ATC device 30 is fixed to the front of the connecting plate 23 and supported above the spindle head 6. The ATC device 30 includes a magazine 31, a reducer 32, a magazine motor 33, etc. The magazine 31 includes a magazine base 37 and a plurality of grip arms 38. The magazine base 37 is substantially disc-shaped and is rotatably supported on the front of the connecting plate 23 around a pivot axis 37A (see Figure 5). The pivot axis 37A is slightly inclined downward toward the front with respect to the Z-axis direction. The reducer 32 and the magazine motor 33 are attached to the magazine base 37. The output shaft (not shown) of the magazine motor 33 is connected to the pivot axis 37A via the reducer 32. As a result, the power of the magazine motor 33 is transmitted to the pivot axis 37A of the magazine base 37 via the reducer 32. The plurality of grip arms 38 are arranged along the outer circumference of the magazine base 37 and extend radially outward in the radial direction. The tip of the grip arm 38 grips the tool holder 90 from a direction perpendicular to the tool holder 90 when the tool holder 90 is lying horizontally. The lowest position of the magazine 31 is the tool transfer position (an example of the "indexing position" in this invention). The grip arm 38, indexed to the tool transfer position, transfers the tool between itself and the spindle 7.

[0027] The magazine cover 10 is fixed to the front of the upper part of each of the support columns 21 and 22. The magazine cover 10 is box-shaped and covers the perimeter of the magazine 31. The magazine cover 10 reduces the adhesion of chips and cutting fluid splashes to the magazine 31. A rectangular opening 102 is provided in the bottom wall 101 of the magazine cover 10. The opening 102 is located directly below the tool transfer position of the magazine 31. A magazine shutter 103 (hereinafter referred to as "shutter 103") is provided in the opening 102. The shutter 103 opens and closes the opening 102 under the control of the CPU 41 of the control panel.

[0028] A cover (not shown) is attached to the machine tool 1 described above. The cover surrounds the machine tool 1 to prevent chips and coolant splashes generated during cutting from scattering into the surrounding area. An opening (not shown) for loading and unloading workpieces and a door (not shown) for opening and closing the opening are provided on the front of the cover. An operation panel 25 (see Figure 8) is provided next to the opening. The user performs various inputs and operations of the machine tool 1 using the operation panel 25.

[0029] As shown in Figure 5, the machine tool 1 has a machining area and a tool change area (hereinafter referred to as the "ATC area") arranged side by side in the Y-axis direction. The machining area is located in the space below the base 2 side of the Y-axis origin. The Y-axis origin is the position where the machine coordinate of the Y-axis is 0 (Y=0mm). The machining area is the area where workpieces fixed to the upper surface of the rotary table 9 are machined. The ATC area is located in the space opposite to the machining area (above) the Y-axis origin, and is located in a position that overlaps with the machining area in the Z-axis direction. The ATC area is the area where the spindle 7 is changed by the ATC device 30. The machine tool 1 can move the spindle 7 between the machining area and the ATC area by moving the spindle head 6 up and down.

[0030] Referring to Figures 6 and 7, the machine origin and the multiple reference points set in the ATC area will be explained. In Figure 7, the spindle head 6 is omitted to show the orientation of the spindle 7, and the spindle 7, tool holder 90, and tool 91 are simplified in the illustration. The machine origin of the machine tool 1 is the position where the machine coordinates of the X and Y axes are 0 and the machine coordinate of the Z axis is the rear end position of the machining area, and is determined according to the structure of the machine tool 1. The machine origin of the X axis is the X axis origin (X=0mm), the machine origin of the Y axis is the Y axis origin (Y=0mm), and the machine origin of the Z axis is the Z axis origin (Z=rear end position). Note that the position of the machine origin changes depending on the structure of the machine tool 1, so the size of the machining area and ATC area set based on that machine origin also changes according to the structure of the machine tool 1.

[0031] The ATC area is defined by the tool change position (hereinafter referred to as "ATC position"), the ATC origin, and the ATC preparation position. These ATC position, ATC origin, and ATC preparation position are reference points for positioning the spindle 7 when performing a tool change operation (hereinafter referred to as "ATC operation"). The ATC position is the position where the tool is transferred between the grip arm 38, which is indexed to the tool transfer position of the magazine 31. The ATC origin is a position moved in the Z-axis+ direction (rearward) from the ATC position and is the rear end of the ATC area. The ATC origin is a position where the magazine 31 can rotate without interference between the tool held by the grip arm 38 and the spindle 7. The ATC preparation position is a position moved in the Y-axis- direction (downward) from the ATC position and is the boundary between the machining area and the ATC area. The ATC preparation position is the same coordinate as the ATC position in the Z-axis direction.

[0032] Based on the three reference points mentioned above, tool change paths 51 and 52 are set in the ATC area. The tool change paths 51 and 52 form an inverted L-shaped path. Tool change path 51 is a path that extends upward in the Y-axis direction from the ATC preparation position to the ATC position. Tool change path 52 is a path that extends backward in the Z-axis direction from the ATC position to the ATC origin. The tool change paths 51 and 52 are paths that move the spindle head 6 during ATC operation. In this embodiment, in principle, the spindle 7 can only move along the tool change paths 51 and 52 in the ATC area, and its movement is restricted so that it cannot move anywhere else.

[0033] As shown in Figure 7, a magazine rotation area is set around the ATC position. The magazine rotation area is the area in which the grip arm 38 of the magazine 31 rotates around the rotation axis 37A. The magazine rotation area may also include the tool holder 90 and tool 91 that are gripped by the grip arm 38. In the Z-axis direction, the coordinate position of the rear end of the magazine rotation area is located between the ATC position and the ATC origin. In the Y-axis direction, the coordinate position of the lower end of the magazine rotation area is located between the ATC position and the ATC preparation position. If at least a part of the spindle 7 is located within the magazine rotation area, the spindle 7 is likely to interfere with the grip arm 38, tool holder 90, and tool 91. In this embodiment, if the Z-axis of the spindle 7 is moved back to the ATC origin on the tool change path 52, the spindle 7 will move out of the magazine rotation area. Furthermore, by lowering the Y-axis of the spindle 7 to the ATC preparation position along the tool change path 51, the spindle 7 will move out of the magazine rotation area.

[0034] Referring to Figure 6, an example of the ATC operation of machine tool 1 will be explained. In this embodiment, in order to explain the position of the spindle 7 during ATC operation, the movement of the spindle head 6 will be described as "movement of the spindle 7". Furthermore, in the following explanation, the ATC position on the X axis will be called the ATC position X axis, the ATC position on the Y axis will be called the ATC position Y axis, and the ATC position on the Z axis will be called the ATC position Z axis.

[0035] During workpiece machining, the spindle 7 is positioned, for example, at point P0 within the machining area. At this time, the shutter 103 of the magazine cover 10 is closed (see Figure 2). A tool holder 90 that holds the tool 91 is mounted on the spindle 7 (see Figure 7). A clamping mechanism (not shown) provided inside the spindle 7 secures the tool holder 90 mounted on the spindle 7.

[0036] The machine tool 1 performs an orienting motion of the spindle 7, which is located at P0, while retracting the Z-axis toward the Z-axis origin (see arrow A1 in Figure 6). Orienting motion is the movement of returning the angle of the spindle 7 to the reference position (for example, 0 degrees). The spindle 7 reaches P1. Next, the shutter 103 of the magazine cover 100 is opened (see Figure 3), and the X-axis of the spindle 7, which is located at P1, is moved to the ATC position X-axis while the Y-axis is moved to the Y-axis origin (Y=0mm) (see arrow A2 in Figure 6). The spindle 7 reaches P2. Next, the Z-axis of the spindle 7, which is located at P2, is moved forward to the ATC position Z-axis (see arrow A3 in Figure 6). The spindle 7 reaches the ATC preparation position.

[0037] Next, the spindle 7 is raised from the ATC preparation position along the tool change path 51 (see arrow A4 in Figure 6). At this time, the grip arm 38, which has been indexed to the tool transfer position, is exposed downwards through the opening 102 of the magazine cover 100. As the spindle 7 rises, the tool holder 90 mounted on the spindle 7 passes through the opening 102 and is pushed against the grip arm 38 from below. When the spindle 7 reaches the ATC position, the tool holder 90 mounted on the spindle 7 engages with and grips the grip arm 38. Simultaneously, the clamping mechanism inside the spindle 7 releases the fixing of the tool holder 90. The tool holder 90 can now be removed from the spindle 7.

[0038] The machine tool 1 moves the spindle 7 backward from the ATC position along the tool change path 52 with the grip arm 38 gripping the tool holder 90 that is attached to the spindle 7 (see arrow A5 in Figure 6). When the spindle 7 reaches the ATC origin, the tool holder 90 is removed from the spindle 7. Next, the ATC device 30 rotates the magazine 31 to position the grip arm 38 that holds the tool holder of the next tool to be attached (hereinafter referred to as "next tool") at the tool transfer position (see rotating arrow A6 in Figure 6). As a result, the tool holder of the next tool is positioned in front of the spindle 7 in the Z-axis direction.

[0039] Next, the machine tool 1 advances the spindle 7 from the ATC origin along the tool change path 52 (see arrow A7 in Figure 6). This inserts the tool holder for the next tool into the spindle 7. As soon as it reaches the ATC position, the tool holder for the next tool is mounted on the spindle 7. The clamping mechanism inside the spindle 7 secures the tool holder mounted on the spindle 7.

[0040] Next, the machine tool 1 lowers the spindle 7, which has the tool holder for the next tool attached, from the ATC position along the tool change path 51 to the ATC preparation position (see arrow A8 in Figure 6). This completes the ATC operation of the spindle 7. In order to continue machining the workpiece, the machine tool 1 moves the spindle 7, which has the tool holder for the next tool attached, from the ATC preparation position toward the next command point within the machining area. The command point is the target position to which the spindle 7 will be moved after the completion of the ATC operation, and may be set, for example, by a control command in the NC program.

[0041] In the example above, the Z-axis of the spindle 7 located at P0 was moved back to the Z-axis origin. However, for example, a point R (return point) could be set where the tool 91 mounted on the spindle 7 does not come into contact with the workpiece and fixture on the rotary table 9, and the spindle could be moved back to that R point. In this case, the R point may be located in front of the Z-axis origin.

[0042] Referring to Figure 8, the electrical configuration of machine tool 1 will be described. Machine tool 1 includes a numerical control device 40, a spindle motor 61, an X-axis motor 62, a Y-axis motor 63, a Z-axis motor 64, a magazine motor 33, drive circuits 71-75, encoders 61A, 62A, 63A, 64A, 33A, an operation panel 25, and the like.

[0043] The numerical control device 40 includes a CPU 41, ROM 42, RAM 43, storage device 44, communication I / F 45, input / output interface 46, etc. The CPU 41 provides overall control over the operation of the machine tool 1. The ROM 42 stores various programs such as an NC control program, a power-on program, an alarm detection program, and an application control program. The NC control program executes the NC control processing described later (see Figure 9). The power-on program executes the power-on processing described later (see Figure 10). The alarm detection program executes the alarm detection processing described later (see Figure 11). The application control program executes the application control processing described later (see Figure 12). These programs may also be stored in other storage media besides the ROM 42, for example, in the storage device 44. The RAM 43 stores various data during the execution of various processes. The storage device 44 is a non-volatile memory and stores various data such as an NC program for machining a workpiece and a stop flag described later. The communication interface 45 can be connected to a terminal (not shown) by wire or wireless connection. The input / output interface 46 connects to the operation panel 25 and the drive circuits 71-75.

[0044] The memory device 44 stores a number indicating the indexing position of the grip arm 38 (hereinafter referred to as the indexing number) and the coordinates corresponding to the indexing position (hereinafter referred to as the pivot position coordinates). By referring to these indexing position and pivot position coordinates, the CPU 41 can determine the grip arm 38 that grips the tool holder 90 holding any tool 91.

[0045] The spindle motor 61, X-axis motor 62, Y-axis motor 63, Z-axis motor 64, and magazine motor 33 are servo motors. Drive circuit 71 controls the spindle motor 61 based on a control signal from the CPU 41. Drive circuit 72 controls the X-axis motor 62 based on a control signal from the CPU 41. Drive circuit 73 controls the Y-axis motor 63 based on a control signal from the CPU 41. Drive circuit 74 controls the Z-axis motor 64 based on a control signal from the CPU 41. Drive circuit 75 controls the magazine motor 33 based on a control signal from the CPU 41.

[0046] Encoder 61A detects the rotational position of the spindle motor 61 and transmits the detection signal to the drive circuit 71. The drive circuit 71 performs feedback control of the spindle motor 61 based on the detection signal. CPU 41 receives the detection signal from encoder 61A from drive circuit 71 and detects the rotational position of the spindle by converting the received detection signal into the rotational coordinates of the spindle 7. Encoder 62A detects the rotational position of the X-axis motor 62 and transmits the detection signal to drive circuit 72. The drive circuit 72 performs feedback control of the X-axis motor 62 based on the detection signal. CPU 41 receives the detection signal from encoder 62A from drive circuit 72 and detects the position of the X-axis by converting the received detection signal into the X-axis coordinate position of the spindle 7. Encoder 63A detects the rotational position of the Y-axis motor 63 and transmits the detection signal to drive circuit 73. The drive circuit 73 performs feedback control of the Y-axis motor 63 based on the detection signal. The CPU 41 receives a detection signal from the drive circuit 73 using the encoder 63A and detects the Y-axis position by converting the received detection signal into the Y-axis coordinate position of the main spindle 7. The encoder 64A detects the rotational position of the Z-axis motor 64 and transmits the detection signal to the drive circuit 74. The drive circuit 74 performs feedback control of the Z-axis motor 64 based on the detection signal. The CPU 41 receives a detection signal from the drive circuit 74 using the encoder 64A and detects the Z-axis position by converting the received detection signal into the Z-axis coordinate position of the main spindle 7. The encoder 33A detects the rotational position of the magazine motor 33 and transmits the detection signal to the drive circuit 75. The drive circuit 75 performs feedback control of the magazine motor 33 based on the detection signal. The CPU 41 detects the swivel position of the magazine 31 by converting the detection signal from the encoder 33A received from the drive circuit 75 into the swivel position coordinate of the magazine 31. The operation panel 25 includes a display unit 26 and an operation unit 27. The display unit 26 is a touch panel that displays various information based on control signals from the CPU 41 and accepts various inputs, which it then transmits to the CPU 41. The operation unit 27 includes, for example, multiple physical press keys (not shown) that accept various operations and transmit them to the CPU 41.

[0047] Referring to Figure 9, the NC control process will be explained. When the user selects an NC program using the operation panel 25, the CPU 41 reads the NC control program from the ROM 42 and executes this process. The CPU 41 reads the selected NC program from the storage device 44 (S1). The CPU 41 receives an operation from the user to execute the NC program via the operation unit 27 and decides whether or not to execute the read NC program (S2). Until an execution operation is received (S2: NO), the CPU 41 returns to S2 and waits. If an execution operation is received (S2: YES), the CPU 41 initializes the stop flag stored in the storage device 44 to 0 and turns it off (S3), and interprets the NC program from the beginning, one block at a time (S4).

[0048] The CPU 41 determines whether the interpreted block is a termination command or not (S5). If it is not a termination command (S5:NO), the CPU 41 generates a control command (internal command) based on the interpreted block (S6). The CPU 41 determines whether the generated control command is a tool change command or not (S7). If the generated control command is a control command such as a positioning command (S7:NO), the CPU 41 executes the generated control command (S8). After executing the control command, the CPU 41 moves to the next block and returns to S4 to repeat the above process.

[0049] If the generated control command is a tool change command (S7:YES), the CPU 41 starts the above ATC operation (S9). The CPU 41 determines whether the power was turned off during the ATC operation (S10). If the power was turned off during the ATC operation (S10:YES), the CPU 41 turns on the stop flag stored in the memory device 44 by setting it to 1 (S12), and terminates this process. If the power was not turned off during the ATC operation (S10:NO), the CPU 41 determines whether the ATC operation has ended (S11). Until the ATC operation is completed (S11:NO), the CPU 41 returns to S10 and continues to monitor the power supply. If the ATC operation is completed (S11:YES), the CPU 41 moves to the next block and returns to S4 to repeat the above process. If the interpreted block is a termination command (S5:YES), the CPU 41 terminates this process.

[0050] Referring to Figure 10, the power-on process will be explained. When the user turns on the power using the operation panel 25, the CPU 41 reads the power-on program from the ROM 42 and executes this process. The CPU 41 determines whether the power was turned off during ATC operation during the previous power-on (S21). The CPU 41 refers to the stop flag stored in the memory device 44. If the stop flag is 0, the power was not turned off during ATC operation (S21: NO), so the CPU 41 switches to manual operation mode (S23) and displays the manual conditions screen (not shown) on the display unit 26 of the operation panel 25 (S4). On the manual conditions screen, various conditions can be set when manually operating the movement and rotation of the spindle 7. For example, high-speed movement speed, high-speed rotation speed, constant-speed movement speed, low-speed rotation speed, step movement amount, step rotation amount, spindle rotation speed, etc. The CPU 41 then finishes this process.

[0051] If the stop flag is 1, the power is turned off during ATC operation (S21: NO). In this case, since the various servo motors are turned off during ATC operation, the spindle 7 is stopped within the ATC area. If an external force is applied to the spindle 7 while the servo motors are off, the position of the spindle 7 may shift from the tool change paths 51 and 52 in the X, Y, or Z directions. The rotational position of the magazine 31 may also shift in the circumferential direction. If an attempt is made to move the spindle 7 while such an abnormality is occurring, the positional relationship between the spindle 7 and the grip arm 38 will be misaligned. For example, the tool holder 90 attached to the spindle 7 may not engage with the grip arm 38, and the clamping mechanism inside the spindle 7 may release the tool holder 90, causing the tool holder 90 and tool 91 to fall from the spindle 7.

[0052] For this reason, the user needs to manually return the spindle 7 to the tool change paths 51 and 52 and return the magazine 31 to its normal position, but this recovery operation is difficult without skilled technique. The CPU 41 in this embodiment performs the ATC recovery process described later (see Figures 13 to 17) (S22) to provide the user with guidance on the recovery operation. After the ATC recovery process is completed, the CPU 41 terminates this process.

[0053] Referring to Figure 11, the alarm detection process will be explained. If an alarm such as an emergency stop occurs while the machine tool 1 is starting up, the CPU 41 reads the alarm detection program from the ROM 42 and executes this process. The CPU 41 displays the alarm on the display unit 26 (S31) to notify the user that an alarm has occurred. The CPU 41 determines whether the movement of the spindle 7 has stopped during ATC operation (S32). If the movement of the spindle 7 has not stopped during ATC operation (S32: NO), the CPU 41 terminates this process. If the movement of the spindle 7 has stopped during ATC operation (S32: YES), the CPU 41 executes the ATC recovery process described later (S33) and terminates this process.

[0054] Referring to Figure 12, the application control process will be explained. When the user selects a recovery support application using the operation unit 27 of the operation panel 25, the CPU 41 reads the application control program from the ROM 42 and executes this process. The CPU 41 displays a menu on the display unit 26 (S35). The menu includes various items such as synchronous tap return, spindle break-in operation, automatic door adjustment, position recovery, origin position adjustment, and ATC recovery. The CPU 41 accepts the selection of an item from the menu (S36). The CPU 41 determines whether the ATC recovery item has been selected (S37). If the ATC recovery item is selected (S37: YES), the CPU 41 executes the ATC recovery process described later (S38) and terminates this process. If an item other than ATC recovery is selected (S37: NO), the CPU 41 executes the selected item (S39) and terminates this process.

[0055] The ATC recovery process will be explained with reference to Figures 13 to 17. In this embodiment, the grip arm 38 grips the tool holder 90 to which the tool 91 is integrally attached, but for the sake of explanation, there are places where it is said that "the grip arm 38 grips the tool 91". As shown in Figure 13, the CPU 41 displays the shaft return screen 81 on the display unit 26 (S40).

[0056] <step1> As shown in Figure 23, the spindle return screen 81 is provided with display areas 81A to 81D. Display area 81A displays the recovery procedure for STEP 1. STEP 1 is the spindle return process. Spindle return is the operation of returning the spindle 7, which has stopped in the ATC area, to the tool change path 51, 52. Display area 81B displays coordinate information such as the machine coordinate position, ATC position, Y-axis origin, and ATC origin position. The machine coordinate position is the current position information of the spindle 7. Display area 81C displays the magazine number, magazine shutter position, and magazine swivel area. The magazine number column displays the magazine number corresponding to the grip arm 38 currently indexed to the tool transfer position of magazine 31. The magazine shutter position column displays the open / closed state of the shutter 103. The magazine swivel area column displays "Off" if the spindle 7 is within the magazine swivel area, and "On" if it is outside the magazine swivel area. Display area 81D displays manual conditions. The manual conditions are the same as the manual conditions items displayed on the manual conditions screen mentioned above.

[0057] The display area 81A shows the four steps required for shaft return. First, as step 1, switch to manual operation mode. As step 2, press the recovery operation enable key 811 to enable the recovery operation. The recovery operation enable key 811 is located in the lower right corner of the shaft return screen 81. As step 3, if the servo motor is off, press the [Release] key on the operation unit 27 while pressing the [Reset] key to execute shaft return when the servo motor is turned on. At this time, the alarm will be cleared. As step 4, if the servo motor is on, press the [Release] key on the operation unit 27 while pressing the [R] key to execute shaft return. Note that this step is also performed if shaft return was performed in step 3. The user should perform the operation according to the recovery procedure displayed in the display area 81A.

[0058] Returning to Figure 13, the CPU 41 determines whether or not to perform spindle return (S41). Since spindle return will not be performed until the operation in step 3 or step 4 is performed (S41: NO), the CPU 41 returns to S40 and waits. If the operation in step 3 or step 4 is performed (S41: YES), the spindle return destination determination process is executed to determine the spindle return destination of the spindle 7 (S42).

[0059] The spindle return destination determination process will be explained with reference to Figures 17 to 22. Note that in Figures 18 to 22, the border lines indicating the range of the ATC area have been omitted to make the recovery areas W1 to W6, which will be described later, easier to see. As shown in Figure 17, the CPU 41 detects the position of the spindle 7 (S81). The position of the spindle 7 is, for example, the position of the tip of the spindle 7, and is the coordinate position of the X, Y, and Z axes. The detected position of the spindle 7 is temporarily stored in the RAM 43. The CPU 41 determines whether the Y axis of the detected spindle 7 is above the Y axis origin or not (S82). If the Y axis is below the Y axis origin (S82: NO), the spindle 7 is within the machining area. In this case, even if the position of the spindle 7 is off from the commanded position, there is little need to correct the deviation, so the CPU 41 sets the return destinations of the X, Y, and Z axes of the spindle 7 to the current coordinate positions (S98). Alternatively, instead of performing the S98 process, the coordinate position of the spindle 7 immediately before the servo is turned off may be stored, and the return destinations for the X, Y, and Z axes of the spindle 7 may be set to that coordinate position. Servod-off means that the operation of the servo motors, such as the spindle motor 61, X-axis motor 62, Y-axis motor 63, Z-axis motor 64, and magazine motor 33, is turned off. After setting the coordinate position in S98, the CPU 41 terminates this process and proceeds to S43 in the flow chart of Figure 13.

[0060] If the Y-axis is above the Y-axis origin (S82: YES), the spindle 7 is within the ATC area, but there is a possibility that the spindle 7 is deviated from the tool change paths 51 and 52. Therefore, it is determined for each of the X, Y, and Z axes whether the current position of the spindle 7 is within the recovery distance from the tool change paths 51 and 52.

[0061] The CPU 41 determines whether the X-axis of the spindle 7 is within the ATC position X-axis ± recovery distance (S83). As shown in Figure 18, a recovery area W1 is provided in the ATC area. The recovery area W1 is a space defined within the range of the ATC position X-axis ± recovery distance. The recovery distance is a small distance such that moving the spindle 7 by that distance will not cause damage such as collision with other components, for example, about 2 mm. For example, if the spindle 7 is stopped at point K1, the X-axis at point K1 is located within the recovery area W1 (S83: YES). In this case, the CPU 41 sets the return destination of the spindle 7's X-axis to the ATC position X-axis (S84). The return destination of the X-axis should be temporarily stored in the RAM 43. If the X-axis of the spindle 7 is located outside the recovery area W1 (S83: NO), the CPU 41 sets the return destination of the X-axis to the current coordinate position (S85).

[0062] Next, the CPU 41 determines whether the Y-axis of the spindle 7 is below the Y-axis origin plus the recovery distance (S86). As shown in Figure 19, a recovery area W2 is further provided in the ATC area. The recovery area W2 is a space defined within the range of the Y-axis origin plus the recovery distance. For example, if the spindle 7 is stopped at point K2, the Y-axis at point K2 is located within the recovery area W2 (S86: YES). In this case, the CPU 41 sets the return destination of the Y-axis of the spindle 7 to the Y-axis origin (S88).

[0063] On the other hand, if the Y-axis of the spindle 7 is greater than or equal to the Y-axis origin + recovery distance (S86: NO), the CPU 41 determines whether the Y-axis of the spindle 7 is within the ATC position Y-axis ± recovery distance (S87). As shown in Figure 20, a recovery area W3 is further provided in the ATC area. The recovery area W3 is a space defined within the range of the ATC position Y-axis ± recovery distance. For example, if the spindle 7 is stopped at point K3, the Y-axis at point K3 is located within the recovery area W3 (S87: YES). In this case, the CPU 41 sets the return destination of the Y-axis of the spindle 7 to the ATC position Y-axis (S89). The return destination of the Y-axis should be temporarily stored in the RAM 43. If the Y-axis of the spindle 7 is located outside the recovery area W3 (S87: NO), the CPU 41 sets the return destination of the Y-axis to the current coordinate position (S90).

[0064] Next, the CPU 41 determines whether the Z-axis of the spindle 7 is within the range of ATC position Z-axis - recovery distance ≤ Z-axis < ATC position Z-axis (S91). As shown in FIG. 21, a recovery area W4 is further provided in the ATC area. The recovery area W4 is a space defined within the range of ATC position Z-axis - recovery distance ≤ Z-axis < ATC position Z-axis. For example, when the spindle 7 stops at point K4, the Z-axis of point K4 is located within the recovery area W4 (S91: YES). In this case, the CPU 41 sets the return position of the Z-axis of the spindle 7 to the ATC position Z-axis (S94). On the other hand, when the Z-axis of the spindle 7 is outside the recovery area W4 (S91: NO), the CPU 41 determines whether the Z-axis of the spindle 7 is within the range of ATC position Z-axis < Z-axis ≤ ATC position Z-axis + recovery distance and whether the magazine 31 is properly indexed (S92).

[0065] Here, regarding the determination of whether the magazine 31 in S92 is properly indexed, the CPU 41 may determine based on whether there is a turning deviation greater than or equal to the threshold value in the magazine 31. The turning deviation is the circumferential deviation centered on the turning axis 37A with respect to the reference coordinates of the magazine 31. The reference coordinates of the magazine 31 are the turning position coordinates of the magazine 31 corresponding to the indexing position of the grip arm 38 and are stored in the storage device 44. The CPU 41 converts the detection signal of the encoder 33A received from the drive circuit 75 into the turning position coordinates of the magazine 31 and compares them with the reference coordinates stored in the storage device 44 to determine whether there is a turning deviation greater than or equal to the threshold value in the magazine 31. If the turning deviation is less than the threshold value, the CPU 41 can determine that the magazine 31 is in a properly indexed state, and if the turning deviation is greater than or equal to the threshold value, the CPU 41 can determine that the magazine 31 is not in a properly indexed state.

[0066] As shown in FIG. 21, a recovery area W5 is further provided in the ATC area. The recovery area W5 is a space defined within the range of ATC position Z-axis < Z-axis ≤ ATC position Z-axis + recovery distance. For example, when the spindle 7 stops at point K5, the Z-axis of point K5 is located within the recovery area W5. In addition, when the magazine 31 is properly indexed (S92: YES), the CPU 41 sets the return position of the Z-axis of the spindle 7 to the ATC position Z-axis (S94).

[0067] Also, when the Z-axis position of the spindle 7 is outside the restoration area W5 (S92: NO), the CPU 41 determines whether the Z-axis of the spindle 7 is within the range of ATC origin < Z-axis ≤ ATC origin + restoration distance (S93). Also, even when the position of the Z-axis is within the restoration area W5 but the magazine 31 is not in a properly indexed state (S92: NO), the position of the grip arm 38 is displaced in the Y-axis direction. In this state, when the Z-axis of the spindle 7 is moved to the ATC position Z-axis, the spindle 7 may interfere with the tool holder 90 gripped by the grip arm 38. Therefore, in this case as well, the CPU 41 does not set the return position of the Z-axis to the ATC position Z-axis and determines whether the Z-axis of the spindle 7 is within the range of ATC origin < Z-axis ≤ ATC origin + restoration distance (S93).

[0068] As shown in FIG. 22, a restoration area W6 is further provided in the ATC area. The restoration area W6 is a space defined within the range of ATC origin < Z-axis ≤ ATC origin + restoration distance. For example, when the spindle 7 stops at point K6, the Z-axis of point K6 is located within the restoration area W6 (S93: YES). In this case, the CPU 41 sets the return position of the Z-axis of the spindle 7 to the ATC origin (S96). The return position of the Z-axis may be temporarily stored in the RAM 43. When the return position of the Z-axis is set (S94, S95, S96), the CPU 41 ends this process and proceeds to S43 in the flow of FIG. 13. When the Z-axis of the spindle 7 is outside the restoration area W6 (S93: NO), since it is not within any of the ranges of the restoration areas W4 to W6, the CPU 41 sets the return position of the Z-axis to the current coordinate position (S97), ends this process, and proceeds to S43 in the flow of FIG. 13.

[0069] Returning to the flow in Figure 13, the CPU 41 has finished the axis return destination determination process in S42, and will now execute axis return of the spindle 7 according to the respective return destinations for the X, Y, and Z axes set in the axis return destination determination process (S43). Note that the axis return of the X, Y, and Z axes may be performed one axis at a time in order, or two or three axes may be performed simultaneously. The order of execution is not specified. Also, if the return destination of the moving axis is set to the current coordinate position in processes S85, S90, and S97 of the axis return destination determination process in Figure 17, then in the axis return process in S43 of Figure 13, the CPU 41 will not move the spindle 7 on the moving axis for which the return destination is set to the current coordinate position. In other words, the CPU 41 restricts the movement of the spindle 7.

[0070] CPU 41 determines whether the spindle return is complete (S44). Until the spindle return is complete (S44: NO), CPU 41 returns to S43 and continues execution. If the spindle return is complete (S44: YES), CPU 41 determines whether the Y-axis of the spindle 7 is below the Y-axis origin (S45). If the Y-axis of the spindle 7 is below the Y-axis origin (S45: YES), the spindle 7 is already in the machining area, so CPU 41 proceeds to S54 described below without changing the position of the spindle 7. If the Y-axis is above the Y-axis origin (S45: NO), the spindle 7 is located on the tool change paths 51, 52 within the ATC area. Therefore, CPU 41 needs to safely move the spindle 7 toward the machining area according to its position on the tool change paths 51, 52.

[0071] Therefore, the CPU 41 determines whether or not the conditions of Z = ATC position Z-axis, Y < ATC position Y-axis, and X = ATC position X-axis are satisfied for the position of the spindle 7 (S46). For example, as shown in Fig. 24(1), the spindle 7 is located at point M1. Since point M1 is on the tool change path 51, it is presumed that the spindle 7 has stopped while ascending or descending on the tool change path 51. Since point M1 satisfies the conditions of Z = ATC position Z-axis, Y < ATC position Y-axis, and X = ATC position X-axis (S46: YES), the CPU 41 determines whether or not the position of the magazine 31 is normal (S47). The method for determining whether or not the position of the magazine 31 is normal is the same as the method for determining whether or not the magazine 31 has been normally indexed in the determination process of S92 in Fig. 17.

[0072] For example, as shown in Fig. 24(2), when the position of the magazine 31 is normal, the gripper arm 38 indexed to the tool delivery position is arranged in a direction parallel to the Y-axis direction. The tool holder 90 and the tool 91 mounted on the spindle 7 extend in the Z-axis direction. In this state, the gripper arm 38 is arranged in a positional relationship orthogonal to the tool holder 90. In this case, since the position of the magazine 31 is normal (S47: YES), the CPU 41 determines the recovery procedure of the spindle 7 to the operation pattern of STEP2-a described later, and displays the Y-axis recovery screen 82 corresponding to the operation pattern on the display unit 26 (S48).

[0073] <step2-a> As shown in Figure 25, the Y-axis recovery screen 82 is provided with display areas 82A to 82D. Display area 82A displays the recovery procedure for STEP 2-a. STEP 2-a is an operation pattern in which the spindle 7 on the tool change path 51 is lowered along the tool change path 51 to the machining area. Note that the display areas 82B to 82D are the same as the display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted.

[0074] The display area 81A indicates that the Y-axis position is abnormal, and also provides a (notice) warning that if an alarm occurs during operation, the user should press the [Release] key on the control unit 27 while pressing the [Reset] key to clear the alarm before proceeding. Below this, the four steps required for STEP 2-a are displayed as guidance. First, as step 1, close the cover door of the machine tool 1. As step 2, if the shutter 103 is closed, press the [Release] key on the control unit 27 while pressing the [P] key to open the shutter 103. In maintenance mode, the shutter 103 will not open automatically, so either open the shutter 103 manually or change to a mode other than maintenance mode (for example, automatic operation mode or setup mode) before opening the shutter 103. As step 3, press the [Release] key on the control unit 27 while pressing the [-Y] key to move the Y-axis below the Y-axis origin. As step 4, after completing the recovery operations in steps 1-3, press the next key 821. The Next key 821 is displayed in the lower right corner of the Y-axis recovery screen 82.

[0075] Returning to FIG. 13, the CPU 41 executes Y-axis recovery processing (S49) in accordance with the operations of steps 1 to 3 by the user. By the Y-axis recovery processing, the spindle 7 moves below the Y-axis origin. Thereby, the CPU 41 can safely and appropriately recover the spindle 7 stopped within the ATC area to the machining area along the tool change path 51. The CPU 41 determines whether the recovery operation has been completed (S50). Since the recovery operation has not been completed until the user presses the Next key 821 (S50: NO), the CPU 41 returns to S50 and waits. When the Next key 821 is pressed, since the recovery operation has been completed (S50: YES), the CPU 41 displays a tool identification confirmation screen 88 (see FIG. 40) described later on the display unit 26 (S54).

[0076] Also, regarding the position of the spindle 7, even if the conditions of Z = ATC position Z-axis, Y < ATC position Y-axis, and X = ATC position X-axis are satisfied (S46: YES), if the position of the magazine 31 is not normal (S47: NO), a rotational deviation has occurred. For example, as shown in FIG. 26(1), when the spindle 7 is located at the M2 point on the tool change path 51, the spindle 7 is below the ATC position. However, as shown in FIG. 26(2), if the position of the magazine 31 is deviated, the grip arm 38 indexed to the tool delivery position will be deviated in the circumferential direction with respect to the Y-axis. In this state, if the grip arm 38 is returned to the normal position, there is a possibility that the grip arm 38 will interfere with the tool holder 90 attached to the spindle 7. In such a case, it is preferable to move the spindle 7 in the direction away from the magazine 31 in the Y-axis direction with respect to the grip arm 38 and then return the magazine 31 to the normal position. Therefore, the CPU 41 determines the recovery procedure of the spindle 7 as the operation pattern of STEP2-b described later, displays a YM-axis recovery screen 83 corresponding to the operation pattern on the display unit 26 (S51), and executes YM-axis recovery processing (S52).

[0077] <step2-b> As shown in Figure 27, the YM axis recovery screen 83 is provided with display areas 83A to 83D. Display area 83A indicates that the position of the Y axis and magazine 31 is abnormal, that recovery should be performed according to the following procedure, and (notice) that if an alarm occurs during operation, the user should press the [Release] key while pressing the [Reset] key on the operation unit 27 to clear the alarm before proceeding with the procedure. Below this, the recovery procedure for STEP 2-b is displayed as guidance. STEP 2-b is an operation pattern in which the spindle 7, which is located on the tool change path 51, is lowered along the tool change path 51 to the machining area, and then the position of the magazine 31 is returned to normal. Note that the display areas 83B to 83D are the same as the display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted. In STEP 2-b, the position of the magazine 31 is misaligned, so the magazine number is not displayed in display area 83C.

[0078] Referring to Figure 15, the YM axis recovery process will be explained. As shown in Figure 27, the CPU 41 displays steps 1 to 3 of the five steps in the display area 83A (S101). Steps 1 to 3 are the same as steps 1 to 3 of STEP2-a displayed in the display area 82A of the Y axis recovery screen 82 shown in Figure 25. The user operates according to steps 1 to 3. In step 3, the user lowers the Y axis of the spindle 7 toward the Y axis origin. The CPU 41 detects the position of the Y axis of the spindle 7 (S102). The CPU 41 determines whether the detected Y axis is below the Y axis origin (S103). The CPU 41 returns to S102 and waits until the Y axis is below the Y axis origin. If the Y axis is below the Y axis origin (S103: YES), the spindle 7 is out of the magazine rotation area. Therefore, in this state, even if the magazine 31 is rotated, the grip arm 38 will not interfere with the spindle 7.

[0079] The CPU 41 then determines whether the rotational misalignment of the magazine 31 is below a threshold (S104). If the rotational misalignment is below the threshold (S104: YES), the CPU 41 further displays step 4 in the display area 83A, as shown in Figure 27 (S105). Step 4 involves pressing the [Release] key on the operation unit 27 while pressing the [Forward Magazine Rotation] key, which automatically returns the magazine 31 to the correct position. The CPU 41 then determines whether the operation in step 4 has been performed (S106). Until the operation in step 4 is performed (S106: NO), the CPU 41 returns to S106 and waits. If the operation in step 4 has been performed (S106: YES), the CPU 41 generates an automatic correction command for the magazine 31 and outputs it to the drive circuit 75, thereby performing automatic rotational correction of the magazine 31 (S107). Automatic rotational correction is a correction that rotates the magazine 31 back to the reference position. This automatically eliminates the rotational misalignment of the magazine 31. CPU41 further displays step 5 in display area 83A (S112).

[0080] On the other hand, if the rotational misalignment exceeds a threshold (S104:NO), an alarm is sounded indicating that correction is necessary because the misalignment is large (S108), and step 4 is further displayed in the display area 83A as shown in Figure 28 (S109). In this case, step 4 differs from step 4 in Figure 27 in that the user manually moves the grip arm 38, which does not have a tool attached, to the correct position by pressing the [Release] key on the operation unit 27 while pressing the [Magazine Forward Rotation] key or the [Magazine Reverse Rotation] key. The user operates according to step 4 and rotates the magazine 31 toward the reference position to eliminate the rotational misalignment.

[0081] The CPU 41 detects the position of the magazine 31 (S110) and determines whether the position of the magazine 31 has reached the reference position (S111). Until the position of the magazine 31 reaches the reference position (S111: NO), the CPU 41 returns to S110 and waits. When the position of the magazine 31 has returned to the reference position (S111: YES), since the gripper arm 38 to which no tool is attached has been allocated to the tool delivery position, the CPU 41 further displays step 5 in the display area 83A (S112). Step 5 is an operation of pressing the next key 831. The next key 831 is displayed at the lower right of the YM axis recovery screen 83. The CPU 41 ends this process and returns to S53 in FIG. 13 to proceed with the process.

[0082] As shown in FIG. 13, the CPU 41 determines whether the recovery operation has been completed (S53). Since the recovery operation has not been completed until the user presses the next key 831 (S53: NO), the CPU 41 returns to S53 and waits. When the next key 831 is pressed, since the recovery operation has been completed (S53: YES), the CPU 41 displays a tool allocation confirmation screen 88 (see FIG. 40) described later on the display unit 26 (S54).

[0083] Also, in the determination process of S46, regarding the position of the spindle 7, when the conditions of Z = ATC position Z axis and Y < ATC position Y axis and X = ATC position X axis are not satisfied (S46: NO), as shown in FIG. 14, the CPU 41 determines whether the conditions of ATC position Z axis ≤ Z ≤ ATC origin Z axis and Y = ATC position Y axis and X = ATC position X axis are satisfied for the position of the spindle 7 in S (S61). When the conditions of ATC position Z axis ≤ Z ≤ ATC origin and Y = ATC position Y axis and X = ATC position X axis are satisfied (S61: YES), for example, as shown in FIG. 29(1), the spindle 7 is located at the M3 point. Since the M3 point is on the tool exchange path 52, it is presumed that the spindle 7 has stopped while moving forward or backward on the tool exchange path 52.

[0084] Next, the CPU 41 determines whether the position of the magazine 31 is normal or not (S62). For example, as shown in Figure 29(2), if the position of the magazine 31 is normal, the grip arm 38 indexed to the tool transfer position is positioned parallel to the Y-axis direction while gripping the tool holder 90, so the tool holder 90 and the tool 91 are positioned parallel to the Z-axis direction. Therefore, the tool holder 90 is positioned coaxially with respect to the spindle 7 in the Z-axis direction. In this way, if the position of the magazine 31 is normal (S62: YES), the CPU 41 determines the spindle 7 recovery procedure to the operation pattern of STEP2-c described later, and displays the YZ axis recovery screen 84 corresponding to that operation pattern on the display unit 26 (S63).

[0085] <step2-c> As shown in Figure 30, the YZ axis recovery screen 84 is provided with display areas 84A to 84D. STEP 2-c is an operation pattern in which the spindle 7, located on the tool change path 52, is first moved back along the tool change path 52 to the ATC origin, then moved forward to the ATC position, then moved from the ATC position to the ATC preparation position, and finally the Z axis is returned to the ATC origin. Note that the display areas 84B to 84D are the same as the display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted.

[0086] The display area 84A indicates that the Y-axis and Z-axis positions are abnormal, that they should be restored using the following procedure, and (notice) that if an alarm occurs during the operation, the user should press the [Release] key and the [Reset] key on the control unit 27 to clear the alarm before continuing the procedure. Below this, the five steps required for STEP2-c are displayed as guidance. Steps 1 and 2 are the same as steps 1 and 2 of STEP2-a displayed in the display area 82A of the Y-axis restoration screen 82 shown in Figure 25. Step 3 is to press the [Release] key and the [+Z] key on the control unit 27 to align the Z-axis of the spindle 7 with the ATC origin. Step 4 is to press the [Tool Change Single Action] key on the control unit 27. Pressing the [Tool Change Single Action] key moves the Z-axis of the spindle 7 to the ATC position, the Y-axis to the Y-axis origin, and then the Z-axis back to the machine origin. Once the restoration operations in steps 1-4 are complete, step 5 is to press the Next key 841. The Next key 841 is displayed in the lower right corner of the YZ axis recovery screen 84. The user follows these five steps.

[0087] Returning to Figure 14, the CPU 41 executes the YZ axis recovery process according to the user's operations in steps 1 to 4 (S64). The Z axis recovery process moves the Y axis of the spindle 7 to the Y axis origin, and then the Z axis returns to the machine origin. This allows the CPU 41 to safely and appropriately recover the spindle 7, which has stopped in the ATC area, along the tool change paths 52 and 51 to the machining area. The CPU 41 determines whether the recovery operation is complete or not (S65). Since the recovery operation is not complete until the user presses the next key 841 (S65: NO), the CPU 41 returns to S65 and waits. If the next key 841 is pressed, the recovery operation is complete (S65: YES), so the CPU 41 returns to Figure 13 and displays the indexed tool confirmation screen 88 (see Figure 40), which will be described later, on the display unit 26 (S54).

[0088] Furthermore, in the judgment process of S61, even if the position of the spindle 7 satisfies the conditions ATC position Z axis ≤ Z ≤ ATC origin, Y = ATC position Y axis, and X = ATC position X axis (S61: YES), the position of the magazine 31 may not be normal (S62: NO), and a rotational misalignment may occur. For example, as shown in Figure 31(1), even if the spindle 7 is located at point M4 on the tool change path 52, as shown in Figure 31(2), if there is a rotational misalignment in the magazine 31, the positions of the tool holder 90 and tool 91 held by the grip arm 38 may shift relative to the spindle 7 in the Y-axis + direction, and further in the X-axis + or - direction. In this state, if the spindle 7 is moved back to the ATC origin along the tool change path 52 and then moved forward towards the ATC position, as in STEP2-c, the tool holder 90 held by the grip arm 38 may interfere with the tip of the spindle 7.

[0089] Therefore, as shown in Figure 14, the CPU 41 determines whether or not the Z-axis of the spindle 7 is at the ATC origin (S66). For example, as shown in Figure 31(1), when the spindle 7 is located at point M4 on the tool change path 52, the Z-axis is not at the ATC origin (S66: YES), so the CPU 41 determines the spindle 7 recovery procedure to be the operation pattern of STEP2-d described later, displays the YZM axis recovery screen 85 corresponding to that operation pattern on the display unit 26 (S67), and executes the YZM axis recovery process (S68).

[0090] <step2-d> As shown in Figure 32, the YZM axis recovery screen 85 is provided with display areas 85A to 85D. Display area 85A indicates that the positions of the Y axis, Z axis, and magazine are abnormal, and that recovery should be performed according to the following procedure. It also provides a warning that if an alarm occurs during operation, the user should press the [Release] key while pressing the [Reset] key on the operation unit 27 to clear the alarm before continuing the procedure. Below this, the recovery procedure for STEP 2-d is displayed. STEP 2-d is an operation pattern in which the spindle 7, located on the tool change path 52, is first moved back to the ATC origin along the tool change path 52, the magazine 31 is returned to its normal position, the Z axis is advanced to the ATC position, moved from the ATC position to the ATC preparation position, and then the Z axis is returned to the ATC origin. Note that the display areas 85B to 85D are the same as the display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted. In STEP2-d, the position of magazine 31 is misaligned, so the magazine number is not displayed in display area 85C. Also, since the M4 point of spindle 7 is within the magazine rotation area, "Off" is displayed in the magazine rotation area column of display area 81C.

[0091] Referring to Figure 16, the YZM axis recovery process will be explained. The CPU 41 displays steps 1 to 3 of the six steps in the display area 85A (S121). Steps 1 to 3 are the same as steps 1 to 3 of STEP2-c displayed in the display area 84A of the YZ axis recovery screen 84 shown in Figure 30. The user operates according to steps 1 to 3. Step 3 is the operation to move the Z axis of the spindle 7 toward the ATC origin. The CPU 41 detects the Z axis of the spindle 7 (S122). The CPU 41 determines whether the detected Z axis is at the ATC origin or not (S123). Until the Z axis reaches the ATC origin (S123: NO), the CPU 41 returns to S122 and monitors the Z axis. When the Z axis reaches the ATC origin (S123: YES), the spindle 7 has moved behind the magazine rotation area, so in this state, even if the magazine 31 is rotated, the grip arm 38 will not interfere with the spindle 7.

[0092] Next, the CPU 41 determines whether the rotational misalignment of the magazine 31 is below a threshold (S124). If the rotational misalignment is below the threshold (S124: YES), the CPU 41 further displays step 4 in the display area 83A, as shown in Figure 32 (S125). In step 4, the magazine 31 automatically returns to the correct position by pressing the [Release] key on the operation unit 27 while pressing the [Forward Magazine Rotation] key. The CPU 41 determines whether the operation in step 4 has been performed (S126). Until the operation in step 4 is performed (S126: NO), the CPU 41 returns to S126 and waits. If the operation in step 4 has been performed (S126: YES), the CPU 41 generates an automatic correction command for the magazine 31 and outputs it to the drive circuit 75, thereby performing automatic rotational correction of the magazine 31 (S127). As a result, the rotational misalignment of the magazine 31 is automatically resolved. If the rotation deviation is less than the threshold (S124: YES), the CPU 41 may proceed with automatic rotation correction of the magazine 31 without executing processes such as S125 and S126. The CPU 41 further displays step 5 in the display area 85A (S132).

[0093] On the other hand, if the rotational misalignment exceeds a threshold (S124: NO), an alarm is sounded indicating that correction is necessary because the misalignment is large (S128), and step 4 is further displayed in the display area 85A as shown in Figure 33 (S129). In this case, step 4 differs from step 4 in Figure 32 in that the user manually moves the grip arm 38, which does not have a tool attached, to the correct position by pressing the [Release] key on the operation unit 27 while pressing the [Magazine Forward Rotation] key or the [Magazine Reverse Rotation] key. The user operates according to step 4 and rotates the magazine 31 toward the reference position to eliminate the rotational misalignment.

[0094] The CPU 41 detects the position of the magazine 31 (S130) and determines whether the position of the magazine 31 has returned to the reference position (S131). The CPU 41 returns to S130 and waits until the position of the magazine 31 returns to the reference position (S131: NO). As shown in Figure 34(2), if the position of the magazine 31 has returned to the reference position (S131: YES), the grip arm 38 without a tool attached has been indexed to the tool transfer position, so the CPU 41 further displays step 5 in the display area 85A (S132).

[0095] Step 5 is the operation of pressing the [Tool Change Single Action] key on the control unit 27. By pressing the [Tool Change Single Action] key, as shown in Figure 34(1), the Z axis of the spindle 7 moves from the ATC origin to the ATC position, the Y axis moves to the Y axis origin, and then the Z axis returns to the machine origin. The CPU 41 detects the position of the spindle 7 (S133). The CPU 41 determines whether the detected position of the spindle 7 is within the machining area (S134). The CPU 41 returns to S133 and monitors the position of the spindle 7 until the spindle 7 reaches the machining area (S134: NO).

[0096] Once the tool change operation is complete, the spindle 7 is positioned in the machining area (S134: YES), so the CPU 41 displays step 6 in the display area 85A (S135). Step 6 is the operation of pressing the next key 851. The next key 851 is displayed in the lower right corner of the YZM axis recovery screen 85. This allows the CPU 41 to safely and appropriately recover the spindle 7, which has stopped in the ATC area, along the tool change paths 52 and 51 to the machining area. The CPU 41 finishes the YZM axis recovery process and proceeds to S69 in Figure 14.

[0097] As shown in Figure 14, the CPU 41 determines whether the recovery operation is complete or not (S69). Since the recovery operation is not complete until the user presses the next key 851 (S69: NO), the CPU 41 returns to S69 and waits. If the next key 851 is pressed, the recovery operation is complete (S69: YES), so the system returns to Figure 13, and the CPU 41 displays the indexing tool confirmation screen 88, described later, on the display unit 26 (S54).

[0098] Furthermore, as shown in Figure 14, when the magazine 31 is not in the normal position (S62:NO), the Z-axis of the spindle 7 may be located at the ATC origin on the tool change path 52 (S66:NO). For example, as shown in Figure 35(1), the spindle 7 is located at point M6, which is the ATC origin on the tool change path 52. In this state, as shown in Figure 35(2), because the position of the magazine 31 is misaligned, the position of the tool holder 90 gripped by the grip arm 38 is shifted relative to the spindle 7 in the Y-axis + direction, and further shifted in the X-axis + or - direction. In this case (S62:NO, S66:NO), the CPU 41 determines the spindle 7 recovery procedure to be the operation pattern of STEP2-e described later, and displays the YZM axis recovery screen 86 corresponding to that operation pattern on the display unit 26 (S70).

[0099] <step2-e> As shown in Figure 36, the YZM axis recovery screen 86 is provided with display areas 86A to 86D. Display area 86A indicates that the magazine position is abnormal, that it should be recovered using the following procedure, and (notice) that if an alarm occurs during the operation, the user should press the [Release] key while pressing the [Reset] key on the operation unit 27 to clear the alarm before continuing the procedure. Below this, the recovery procedure for STEP 2-e is displayed. STEP 2-e is an operation pattern in which, with the spindle 7 at the ATC origin, the position of the magazine 31 is returned to normal, the Z axis is advanced to the ATC position, moved from the ATC position to the ATC preparation position, and then the Z axis is returned to the ATC origin. Note that display areas 86B to 86D are the same as display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted. Note that in STEP 2-e, the position of the magazine 31 is shifted, so the magazine number is not displayed in display area 86C. Furthermore, since the M6 ​​point of the main spindle 7 is outside the magazine rotation area, "On" is displayed in the magazine rotation area column of the display area 81C.

[0100] The display area 86A shows the five steps required for STEP2-e. Steps 1 and 2 are the same as steps 1 and 2 of STEP2-d shown in the display area 85A of the YZM axis recovery screen 85 shown in Figure 32. Although not described in detail here, in STEP2-e, as with STEP2-c, if the swivel misalignment in the magazine 31 is below the threshold, step 3 displayed in the display area 83A, as shown in Figure 36, involves pressing the [Release] key on the operation unit 27 while pressing the [Magazine Forward Rotation] key to perform automatic swivel correction of the magazine 31. On the other hand, if the swivel misalignment in the magazine 31 is above the threshold, step 3 displayed in the display area 83A, as shown in Figure 37, involves manually moving the grip arm 38, which does not have a tool attached, to the correct position by pressing the [Release] key on the operation unit 27 while pressing the [Magazine Forward Rotation] key or the [Magazine Reverse Rotation] key.

[0101] By performing either step 3, the position of the tool holder 90, gripped by the grip arm 38, is opposite to the spindle 7 in the Z-axis direction. As shown in Figure 36 or Figure 37, step 4 is the operation of pressing the [Tool Change Single Action] key on the operation unit 27. By pressing the [Tool Change Single Action] key, as shown in Figure 35(1), the Z-axis of the spindle 7 moves from the ATC origin to the ATC position, the Y-axis moves to the Y-axis origin, and then the Z-axis returns to the machine origin. Once the recovery operations of steps 1 to 4 are completed, step 5 is to press the Next key 861. The Next key 861 is displayed in the lower right corner of the YZM axis recovery screen 86.

[0102] Returning to Figure 14, the CPU 41 executes the YZM axis recovery process according to the user's operations in steps 1 to 4 (S71). The YZM axis recovery process moves the Z axis of the spindle 7 from the ATC origin to the ATC position, the Y axis moves to the Y axis origin, and then the Z axis returns to the machine origin. This allows the CPU 41 to safely and appropriately recover the spindle 7, which has stopped in the ATC area, along the tool change paths 52 and 51 to the machining area. The CPU 41 determines whether the recovery operation is complete (S72). Since the recovery operation is not complete until the user presses the next key 861 (S72: NO), the CPU 41 returns to S72 and waits. If the next key 861 is pressed, the recovery operation is complete (S72: YES), so the CPU 41 returns to Figure 13 and displays the indexed tool confirmation screen 88, described later, on the display unit 26 (S54).

[0103] Furthermore, in the decision process of S61, there are cases where the position of the spindle 7 does not satisfy the conditions ATC position Z axis ≤ Z ≤ ATC origin, Y = ATC position Y axis, and X = ATC position X axis (S61: NO). For example, consider the case where the spindle 7 is located at point M7, as shown in Figure 38. Point M7 is within the ATC area, but it is not located on the tool change paths 51 and 52. In other words, the spindle 7 cannot return to the tool change paths 51 and 52 by spindle retraction, and it is difficult to recover it toward the machining area, making recovery operation by the user impossible. In this case, the CPU 41 displays the recovery impossible screen 87 on the display unit 26 (S73).

[0104] <step2-f> As shown in Figure 39, the unrecoverable screen 87 is provided with display areas 87A to 87D. Display area 87A displays the recovery procedure for STEP 2-f. STEP 2-f is the process of restricting the movement of the spindle 7 and ending the recovery operation. Note that display areas 87B to 87D are the same as the display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted. The next key 871 and the recovery operation enable key 872 are displayed in the lower right of the unrecoverable screen 87. The exit key 873 is displayed in the lower left of the unrecoverable screen 87.

[0105] Display area 87A displays a warning that ATC recovery is not possible, that recovery must be performed in ATC maintenance mode, and that in ATC maintenance mode, only trained operators can perform the operation. In ATC maintenance mode, the restrictions on the operation of the spindle 7 in the ATC area are removed, allowing recovery work to be performed by a trained operator. Below the warning, three steps required to complete the recovery operation are displayed. Step 1: Press the recovery operation enable key 872 to disable the recovery operation. Step 2: Press the [Reset] key on the operation unit 27. Step 3: Press the exit key 873.

[0106] Returning to Figure 14, CPU 41 executes the recovery invalidation process according to the user's steps 1-3 (S74). The recovery invalidation process invalidates the recovery operation. CPU 41 determines whether the recovery invalidation process is complete or not (S75). Since the recovery invalidation process is not complete until the user presses the exit key 873 (S75: NO), CPU 41 returns to S75 and waits. If the exit key 873 is pressed, the recovery invalidation process is complete (S75: YES), and CPU 41 terminates the ATC recovery process.

[0107] Furthermore, once the spindle 7 has recovered (S50:YES, S53:YES in Figure 13, S65:YES, S69:YES, S72:YES in Figure 14), the spindle 7 is positioned in the machining area. In this state, if a tool is attached to the grip arm 38 indexed to the tool transfer position of the magazine 31, there is a possibility that the spindle 7 will collide with the tool holder 90 and the tool 91 when the ATC operation is performed next, so it is necessary to remove the tool from the grip arm. Therefore, as shown in Figure 13, the CPU 41 displays the indexed tool confirmation screen 88 on the display unit 26 (S54).

[0108] <step3> As shown in Figure 40, the indexing tool confirmation screen 88 is provided with display areas 88A to 88D. Display area 88A displays the recovery procedure for STEP 3. STEP 3 is the process of confirming whether the tool has been removed from the grip arm 38 that has been indexed to the tool transfer position. Note that the display areas 87B to 87D are the same as the display areas 81B to 81D of the shaft return screen 81 shown in Figure 23, so their explanation is omitted. The next key 881 is displayed in the lower right corner of the indexing tool confirmation screen 88.

[0109] Display area 88A shows the two steps required for STEP 3. Step 1 is to remove the tool if it is attached to the grip arm 38 of the magazine number. Furthermore, a warning is issued that if the ATC operation is performed again with a tool attached, the machine and tool may be damaged. In step 2, after confirming that no tool is attached to the grip arm 38, press the next key 881.

[0110] Returning to Figure 13, the CPU 41 determines whether the user has completed the confirmation (S55). Since the confirmation is not complete until the user presses the Next key 881 (S55: NO), the CPU 41 returns to S54 and waits. If the Next key 881 is pressed, the user's confirmation is complete (S55: YES), so the CPU 41 displays the completion screen 89 on the display unit 26 (S56).

[0111] <step4> As shown in Figure 41, the termination screen 89 is provided with display areas 89A to 89D. The recovery procedure for STEP 4 is displayed. STEP 4 is the process of terminating the ATC recovery process. Note that the display areas 89B to 89D are the same as the display areas 81B to 81D of the axis return screen 81 shown in Figure 23, so their explanation is omitted. The next key 891 and the recovery operation enable key 892 are displayed in the lower right of the termination screen 89. The termination key 893 is displayed in the lower left of the termination screen 89.

[0112] The display area 89A indicates that ATC recovery is complete, and further, as a (notice), the user is alerted that there may be a discrepancy between the tool assignment on the ATC tool screen (not shown) and the tools attached to the magazine 31, and is instructed to check the tool assignment on the ATC tool screen. The ATC tool screen is displayed on the display unit 26 by operating the operation panel 25. The ATC tool screen displays the tool assignment, which is a table showing the types of tools assigned to each grip arm of the magazine 31. Below that, three steps necessary to complete the ATC recovery process are displayed. Step 1: Press the recovery operation enable key 892 to enable the recovery operation. Step 2: Press the [Reset] key on the operation unit 27. Step 3: After confirming the operations in Steps 1 and 2, press the exit key 893.

[0113] Returning to Figure 13, CPU 41 determines whether user confirmation is complete (S57). Confirmation is not complete until the user presses the exit key 893 (S57: NO), so CPU 41 returns to S56 and waits. If the exit key 893 is pressed, user confirmation is complete (S57: YES), so CPU 41 terminates the ATC recovery process.

[0114] In the above description, the grip arm 38 is an example of the "gripping unit" of the present invention. The magazine motor 33 is an example of the "swivel drive unit" of the present invention. The storage device 44 is an example of the "storage unit" of the present invention. The CPU 41 that executes the process in S47 in Figure 13 is an example of the "coordinate detection unit" and "shift determination unit" of the present invention. The CPU 41 that executes the process in S102 in Figure 15 is an example of the "position detection unit" of the present invention. The CPU 41 that executes the process in S103 is an example of the "determination unit" of the present invention. The CPU 41 that executes the processes in S101, S104, S105, S107, and S109 is an example of the "correction request unit" of the present invention. Also, the CPU 41 that executes the process in S62 in Figure 14 is an example of the "coordinate detection unit" and "shift determination unit" of the present invention. The CPU 41 that executes the process in S122 in Figure 15 is an example of the "position detection unit" of the present invention. The CPU 41 that executes the process in S123 is an example of the "determination unit" of the present invention. The CPU 41 that executes the processes S121, S124, S125, S127, and S129 is an example of the "correction request unit" of the present invention. The CPU 41 is an example of the "control unit" of the present invention. The storage device 44 is an example of the "storage unit" of the present invention.

[0115] As described above, the numerical control device 40 of this embodiment controls the operation of the machine tool 1. The machine tool 1 is equipped with a magazine 31 that can rotate around a pivot axis 37A. Multiple grip arms 38 are provided along the circumferential direction on the outer circumference of the magazine 31. The grip arms 38 are capable of gripping a tool 91 that is attached to the spindle 7 of the machine tool 1. The CPU 41 of the numerical control device 40 rotates the magazine 31 to identify any grip arm 38. The memory device 44 stores the rotational position coordinates of the magazine 31 corresponding to the indexing position of the grip arm 38 as reference coordinates indicating the reference position of the magazine 31. When the spindle 7 is stopped, in order to restore the position of the spindle 7, the CPU 41 detects the rotational position coordinates of the magazine 31 and compares them with the reference position stored in the memory device 44 to determine if there is a rotational misalignment in the magazine 31.

[0116] If a rotational misalignment is detected, the CPU 41 detects the position of the spindle 7 and determines whether the detected position is within the magazine rotation area. In the above embodiment, if the spindle 7 is on the tool change path 51 and not in the ATC preparation position, it is determined to be within the magazine rotation area; if it is in the ATC preparation position, it is determined to be outside the magazine rotation area. Also, if the spindle 7 is on the tool change path 52 and not at the ATC origin, it is determined to be within the magazine rotation area; if it is at the ATC origin, it is determined to be outside the rotation area.

[0117] If the CPU 41 determines, using this method, that the spindle 7 is located within the magazine swivel area, it moves the spindle 7 to the ATC preparation position if it is on the tool change path 51, or moves it to the ATC origin if it is on the tool change path 52, thereby moving the spindle 7 out of the magazine swivel area. After that, the CPU 41 requests an action or operation to perform a swivel correction to return the magazine 31 to its reference position. The action to perform a swivel correction is the action to have the magazine motor 33 perform a swivel correction. The operation to perform a swivel correction is the operation to have the operator perform a swivel correction. As a result, when the numerical control device 40 performs a swivel correction, it can avoid interference between the magazine 31 and the tool 91 held by the grip arm 38 and the spindle 7 and the tool 91 mounted on the spindle 7, thereby performing a proper swivel correction and reducing the possibility of damage to the magazine 31, spindle 7 and the tool 91.

[0118] The CPU 41 generates a rotation correction command when the magnitude of the rotational misalignment in the magazine 31 is less than a threshold, and instructs the magazine motor 33 to perform rotational correction. Since rotational correction is performed automatically when the magnitude of the rotational misalignment is less than the threshold, the numerical control device 40 can reduce the effort required compared to when the operator performs rotational correction manually. In addition, even if the magnitude of the rotational misalignment is small, the magazine 31 is returned to the reference position appropriately, further reducing the possibility of damage to the magazine 31, spindle 7, and tool 91. On the other hand, if the magnitude of the rotational misalignment is greater than or equal to the threshold, the distance the magazine 31 needs to rotate is long, so it is necessary to carefully rotate the magazine 31 to return it to the reference position. In this case, the CPU 41 notifies the operator of the rotational correction operation by displaying it on the display unit 26, so the operator can carefully rotate the magazine 31 while checking the area around it.

[0119] When the CPU 41 retracts the spindle 7 from within the magazine rotation area, it moves the spindle 7 along the tool change paths 51 and 52. The tool change paths 51 and 52 are the paths along which the spindle is moved during tool changes. This allows the CPU 41 to reduce the possibility of the spindle 7 or the tool 91 attached to the spindle 7 interfering with other components.

[0120] Of the inverted L-shaped tool change paths 51 and 52, tool change path 51 is a predetermined path that extends in the Y-axis direction between the ATC preparation position and the ATC position. When the spindle 7 is stopped and is on tool change path 51 but not in the ATC preparation position, the spindle 7 may be located within the magazine swivel area. In this case, the CPU 41 can move the spindle 7 out of the magazine swivel area by moving it along tool change path 51 to the ATC preparation position. This allows the CPU 41 to safely perform swivel correction of the magazine 31.

[0121] If the stopped spindle 7 is located between the ATC position and the ATC origin and within the magazine traverse range, the CPU 41 retracts the spindle 7 to the ATC origin. This allows the CPU 41 to safely perform traverse correction of the magazine 31.

[0122] For example, if an alarm occurs and tool change is stopped midway, the spindle 7 will be in a stopped state. In this case, the CPU 41 will determine the rotational displacement of the magazine 31, and if it determines that the stopped spindle 7 is within the magazine rotation area, it will move the spindle 7 out of the magazine rotation area and then return the magazine to its reference position.

[0123] If the power to the machine tool 1 is turned off during a tool change and then turned back on, the spindle 7 will be in a stopped state. In this case, the CPU 41 determines the rotational misalignment of the magazine 31. If it determines that there is a rotational misalignment and that the stopped spindle 7 is within the magazine rotational range, the rotational correction can be safely performed by moving the spindle 7 out of the magazine rotational range and then returning the magazine 31 to its reference position.

[0124] The present invention is not limited to the above embodiments and can be modified in various ways. The machine tool 1 is a horizontal machine tool, but it may also be a vertical machine tool in which the axial direction of the spindle extends in the vertical direction. The machine tool 1 is equipped with a mechanism that moves the tool 91 mounted on the spindle 7 relative to the workpiece in three axial directions: the X axis, Y axis, and Z axis, but it is not limited to three axes; it may be one axis, two axes, or three or more axes. Furthermore, the machine tool 1 has a structure in which the workpiece and the tool are moved relative to each other in three axial directions: the X axis and the Z axis, and the spindle head 6 (spindle 7) is moved along the front surface 5B of the column 5 in the Y axis, relative to the workpiece fixed on the rotary table 9 with a jig, but other structures are also possible. For example, the column 5 may be moved in the X axis direction, the spindle head 6 (spindle 7) in the Z axis direction, and the support base (not shown) that supports the column 5 and the spindle head 6 may be moved in the Y axis direction.

[0125] In the ATC recovery process of the above embodiment (see Figure 13), the spindle return destination determination process is performed, followed by spindle return (S40-S43). Then, in order to safely and appropriately move the spindle 7, which has been returned to the tool change paths 51 and 52, to the machining area along the tool change paths 51 and 52, recovery screens 82-86 corresponding to the stopping position of the spindle 7 are displayed on the display unit 26 (S45-S72). However, the process from S45 onwards may be omitted, and the process may be limited to spindle return only.

[0126] For example, if the spindle 7, which has stopped in the ATC area, is within the W2 area, but the X-axis is not within the W1 recovery area, or the Z-axis is not within any of the W4-W6 recovery areas, then by performing the axis return in S43, the Y-axis of the spindle 7 will move directly to the machining area. In this case, the CPU 41 does not need to perform any processing to return the spindle 7 to the machining area.

[0127] In the above embodiment, in the axis return destination determination process, the return destination is specified for all movement axes (X, Y, and Z axes) and then axis return is performed for all axes. However, axis return may also be performed sequentially while specifying the return destination for each movement axis.

[0128] In the S104 process of the YM axis recovery process in Figure 15, if the rotational misalignment is less than the threshold value (S104:YES), the CPU 41 performs automatic rotational correction of the magazine 31 (S105~S107). However, as shown in the modified example in Figure 42, if the rotational misalignment is less than the threshold value (S104:YES), moving the spindle 7 as is will have little effect on tool transfer, so the rotational misalignment of the magazine 31 may not be corrected. In this case, the CPU 41 may display guidance in the display area 82A of the YM axis recovery screen 83 in Figure 27, indicating the operation of pressing the next key 831 as step 4 after step 3 (S105). On the other hand, if the magnitude of the rotational misalignment is greater than or equal to the threshold value (S104:NO), the CPU 41 notifies the operator of the rotational correction operation (S108, S109), so the operator can carefully rotate the magazine 31 while checking the area around the magazine 31.

[0129] The layouts of the shaft return screen 81, recovery screens 82-86, recovery impossible screen 87, indexing tool confirmation screen 88, and exit screen 89, as well as the wording displayed in each display area, can be freely changed.

[0130] In the YM axis recovery process shown in Figure 15, if the rotational deviation of the magazine 31 is less than a threshold (S104: YES), automatic rotational correction of the magazine 31 is performed (S107). However, for example, regardless of the magnitude of the rotational deviation, the magazine 31 may be uniformly rotated back to the reference position by the user's operation panel 25 (S108~S111). The same applies to the YZM axis recovery process shown in Figure 16 and the YZM recovery process shown in Figure 14 (S71).

[0131] In step 2-d shown in Figure 31(1) of the above embodiment, the spindle 7 located at point M4 on the tool change path 52 is first moved back to the ATC origin along the tool change path 52, then the magazine 31 is returned to its normal position, and the spindle 7 is advanced to the ATC position Z axis by pressing the [Tool Change Single Movement] key. However, if point M4 is behind the magazine rotation area, for example, the magazine 31 may be returned to its normal position and then the spindle 7 may be advanced directly from point M4 along the tool change path 52. In this case, instead of pressing the [Tool Change Single Movement] key, the spindle 7 should be advanced to the ATC position axis by pressing the [Release] key while pressing the [-Z] key.

[0132] In the YZM axis recovery process shown in Figure 16, when the Z axis of the spindle 7 reaches the ATC origin (S123: YES), the CPU 41 considers that the spindle 7 has moved behind the magazine rotation area and performs rotation correction of the magazine 31 (S124~S127, S128~S131). Alternatively, the CPU 41 may detect the current machine coordinates of the spindle 7 and refer to the coordinate information of the magazine rotation area stored in the storage device 44 to determine whether the current Z axis of the spindle 7 is within the magazine rotation area. Similarly, in the YM axis recovery process shown in Figure 15, when the Y axis of the spindle 7 descends toward the Y axis origin (S101~S103), the CPU 41 may refer to the coordinate information of the magazine rotation area stored in the storage device 44 to determine whether the current Y axis of the spindle 7 is within the magazine rotation area.

[0133] This embodiment describes a numerical control device 40 installed on a machine tool 1, but it may also be a numerical control system 200 as shown in Figure 43. The numerical control system 200 comprises a numerical control device 201 and machine tools 1A, 1B, and 1C. The CPU of the numerical control device 201 controls and manages the operation of each of the machine tools 1A, 1B, and 1C, which are installed, for example, in a factory. In the case of such a numerical control system 200, the CPU of the numerical control device 201 may constitute the "detection unit," "determination unit," "movement control unit," "display control unit," etc. of the present invention. [Explanation of Symbols]

[0134] 1 Machine tools 7 Spindle 26 Display section 30 ATC device 31 Magazine 37A Swivel axis 38 Grip Arm 40 Numerical control devices 41 CPU 51, 52 Tool change route 90 Tool Holder 91 Tools 200 Numerical Control Systems 201 Numerical control device

Claims

1. Multiple gripping parts capable of gripping a tool to be attached to the spindle of a machine tool are provided along the circumferential direction, and a swivel drive unit rotates a magazine that can rotate around a swivel axis to select any of the gripping parts, A storage unit that stores the pivot position coordinates of the magazine corresponding to the indexing position of the gripping portion as reference coordinates indicating the reference position of the magazine, A coordinate detection unit for detecting the rotational position coordinates of the magazine, A deviation determination unit determines whether there is a rotational deviation, which is a circumferential deviation of the rotation axis of the magazine's rotational position coordinates detected by the coordinate detection unit, relative to the reference coordinates stored in the storage unit. A position detection unit for detecting the position of the main shaft, A determination unit determines whether the position of the main shaft detected by the position detection unit is located within the magazine rotation region, which is the region in which the magazine rotates. When the deviation determination unit determines that there is a rotational deviation, and the determination unit determines that the position of the main spindle is within the magazine rotational area, the correction request unit requests an action or operation to perform rotational correction, which involves moving the main spindle out of the magazine rotational area and then returning the magazine to the reference position. A numerical control device characterized by being equipped with

2. The correction request unit instructs the slewing drive unit to perform the slewing correction operation when the magnitude of the slewing misalignment is less than a threshold, and notifies the operator of the slewing correction operation when the magnitude of the slewing misalignment is equal to or greater than the threshold. A numerical control device according to claim 1, characterized by the following:

3. The system further includes a correction determination unit that determines that the rotation correction is unnecessary if the magnitude of the rotation deviation is less than a threshold, and determines that the rotation correction is necessary if the magnitude of the rotation deviation is equal to or greater than the threshold. The correction request unit requests an action or operation to perform the rotation correction when the correction determination unit determines that the rotation correction needs to be performed. A numerical control device according to claim 1, characterized by the following:

4. The correction request unit requests an action or operation to perform the rotation correction after retracting the spindle in a direction away from the magazine rotation area along the tool exchange path, which is the path through which the spindle moves when a tool is exchanged between the gripping unit and the spindle. A numerical control device according to claim 1, characterized by the following:

5. The tool change path includes a predetermined path connecting a tool change position in which the spindle performs the tool change with the magazine, and a tool change preparation position which is located away from the tool change position in a direction perpendicular to the axial direction of the spindle and is the same position as the tool change position in the axial direction. The correction request unit requests an action or operation to perform the rotation correction after retracting the spindle to the tool change preparation position along the predetermined path when the spindle is located along the predetermined path and within the magazine rotation area. The numerical control device according to claim 4, characterized by the above.

6. The machine tool performs tool changes on the spindle between the magazine and the tool changer by reciprocating the spindle between a tool changer position on the tool changer path and an origin position located away from the tool changer position in the axial direction of the spindle. The correction request unit, when the spindle is located between the tool change position and the origin position and within the magazine rotation area, retracts the spindle to the origin position, and then performs the rotation correction and requests an operation or work. The numerical control device according to claim 4, characterized by the above.

7. The misalignment determination unit determines whether there is a rotational misalignment when the tool change is stopped midway. The numerical control device according to claim 4, characterized by the above.

8. The misalignment determination unit determines whether there is a rotational misalignment when the power to the machine tool is turned off during the tool change and then turned on again. The numerical control device according to claim 4, characterized by the above.

9. The axial direction of the aforementioned main spindle is horizontal. A numerical control device according to any one of claims 1 to 3, characterized by the above.

10. A numerical control system comprising a machine tool and a numerical control device, The numerical control device is Multiple gripping portions capable of gripping a tool to be attached to the spindle of the machine tool are provided along the circumferential direction, and a swivel drive unit rotates a magazine that can rotate around a swivel axis to select any of the gripping portions, A storage unit that stores the pivot position coordinates of the magazine corresponding to the indexing position of the gripping portion as reference coordinates indicating the reference position of the magazine, A coordinate detection unit for detecting the rotational position coordinates of the magazine, A deviation determination unit determines whether there is a rotational deviation, which is a circumferential deviation of the rotation axis of the magazine's rotational position coordinates detected by the coordinate detection unit, relative to the reference coordinates stored in the storage unit. A position detection unit for detecting the position of the main shaft, A determination unit determines whether the position of the main shaft detected by the position detection unit is located within the magazine rotation region, which is the region in which the magazine rotates. When the deviation determination unit determines that there is a rotational deviation, and the determination unit determines that the position of the main spindle is within the magazine rotational area, the correction request unit requests an action or operation to perform rotational correction, which involves moving the main spindle out of the magazine rotational area and then returning the magazine to the reference position. A numerical control system characterized by having the following features.

11. In a control method for a numerical control device that controls the operation of a machine tool, Multiple gripping parts capable of gripping a tool to be attached to the spindle of the machine tool are provided along the circumferential direction, and a rotational drive step is performed to rotate a magazine that rotates around a pivot axis to identify any of the gripping parts, A coordinate detection step for detecting the rotational position coordinates of the magazine, A deviation determination step is performed to determine whether there is a rotational deviation, which is a circumferential deviation of the rotation axis with respect to the reference coordinates stored in a storage unit that stores the rotational position coordinates of the magazine, which correspond to the indexing position of the gripping part of the rotational position coordinates of the magazine detected in the coordinate detection step, as reference coordinates indicating the reference position of the magazine. A position detection step for detecting the position of the main shaft, A determination step to determine whether the position of the main shaft detected in the position detection step is located within the magazine rotation region, which is the region in which the magazine rotates, If the deviation determination step determines that there is a rotational deviation, and the judgment step determines that the position of the main spindle is within the magazine rotational area, then a correction request step is made to request an action or operation to perform rotational correction, which involves moving the main spindle out of the magazine rotational area and then returning the magazine to the reference position. A control method characterized by comprising:

12. In a program that operates a numerical control device that controls the movement of a machine tool, On the computer, Multiple gripping parts capable of gripping a tool to be attached to the spindle of the machine tool are provided along the circumferential direction, and a rotational drive process is performed to rotate a magazine that rotates around a pivot axis to identify any of the gripping parts, A coordinate detection process for detecting the rotational position coordinates of the aforementioned magazine, A deviation determination process determines whether there is a rotational deviation, which is a circumferential deviation of the rotation axis with respect to the reference coordinates stored in a storage unit that stores the rotational position coordinates of the magazine, which correspond to the indexing position of the gripping part of the rotational position coordinates of the magazine detected in the above coordinate detection process, as reference coordinates indicating the reference position of the magazine. A position detection process for detecting the position of the main spindle, A determination process to determine whether the position of the main shaft detected in the position detection process is located within the magazine rotation region, which is the region in which the magazine rotates, If the aforementioned deviation detection process determines that there is a rotational deviation, and the aforementioned judgment process determines that the position of the main spindle is within the magazine rotational area, a correction request process is made to request an action or operation to perform rotational correction, which involves moving the main spindle out of the magazine rotational area and then returning the magazine to the reference position. A program characterized by causing the execution of a specific action.

13. Control unit and A memory unit that stores programs and Equipped with, The control unit executes the program to realize the control method of claim 11. A numerical control device characterized by the following.