METHOD OF CORRECTING NC PROGRAM FOR FOUR-SPINDLE LATHE

Abstract: In checking the interference of blade plates, the interpola­ tion simulation is executed by interpolation simulators (103, 104) block by block successively based on first and second NC programs (101,102). When the blade plates are interfered by one another, the interpolation simulation is stopped, and the two blade plates are moved backwardly up to the block that developed such interference. While the interplation simula­ tion by one NC program is being stopped, the interpolation simulation by the other NC program is executed to move the other blade plate along a path in the interfering block. When no interference develops with the other blade plate being moved alone, the sequence numbers N and M of the first and second NC programs in the interfering block are stored in a memory region (301a), and then the interference is checked similarly. After the interference is checked, a wait instruction is inserted before the block of sequence number M of the NC program in which the interpolation simulation is stopped, and wait instruction is inserted after the block of sequence number N of the NC program which has executed the interpolation simulation, in order to correct the first and second NC pro­ grams (101 and 201).

Description: This invention relates to a method of revising NC programs for a four-axis lathe having two tool rests. More particularly, the invention relates to an NC program revision method in which, if the tool rests are going to interfere with each other, the NC programs are revised in such a manner that the interference will not occur. An NC four-axis lathe is provided with first and second NC programs having wait commands corresponding to respective ones of first and second tool rests. While synchronization is achieved by the wait commands, movement of the corresponding tool rests is controlled independently by the first and second NC programs to subject a workpiece to machining. Fig. 5 shows an example of first and second NC programs 1, 2 in an NC four-axis lathe. The programs respectively include program numbers 1a, 2a, program portions 1b, 2b for executing a first machining operation, first wait commands 1c, 2c, program portions 1d, 2d for executing a second machining operation, second wait commands 1e, 2e, program portions 1f, 2f for executing a third machining operation, third wait commands 1g, 2g, program portions 1h, 2h for executing a fourth machining operation, fourth wait commands 1i, 2i, program portions 1j, 2j for executing a fifth machining operation, and tape end commands 1k, 2k. In accordance with the first and second NC programs 1, 2, the first and second tool rests machine a workpiece simultaneously (simultaneous independent operation) according to the program portions 1b, 2b, and, in response to the first wait command "M100", the tool rest which finishes the machining operation first waits until the other NC controller reads in the first wait command "M100". When the other NC controller reads in "M100", the simultaneous independent operation is performed according to the program portions 1d, 2d. In response to the second wait command "M200", the tool rest which finishes the machining operation first waits until the other NC controller reads in the second wait command "M200". When the other NC controller reads in "M200", the simultaneous independent operation is performed according to the program portions 1f, 2f. Note that since the program portion 1f is blank, the first tool rest immediately assumes a waiting state in response to the third wait command "M300", and only the second tool rest performs machining according to the program portion 2f. When machining by the second tool rest ends and the third wait command "M300" is read in, the simultaneous independent operation starts in accordance with the program portions 1h, 2h. Thereafter, this four-axis lathe control is performed in a similar manner, with simultaneous four-axis machining being ended in response to the tape end commands M30. Thus, with a four-axis lathe having two tool rests, the tool rests can be controlled and moved independently. Such a lathe is advantageous in that e.g. the outer diameter of a workpiece 13 (see Fig. 6) can be cut by a tool 12 mounted on one tool rest 11 and the inner diameter of the workpiece can be cut by a tool 22 mounted on the other tool rest 21. This enables machining time to be curtailed. However, in a case where the two tool rests 11, 21 carry out machining simultaneously, a situation can arise, due to a program command error, in which the two tool rests (inclusive of their tools) collide. Since such a collision must be avoided at all costs, the conventional practice is to check prior to actual machining whether or not the two tool rests will collide (this is referred to as an "interference check"), and revising the first and second NC programs corresponding to the tool rests if a collision occurs. The interference check for determining whether the two tool rests will collide is performed as follows in the prior art: As shown by the dashed lines in Fig. 7, the shapes of the tools 12, 22 and tool rests 11, 21 are defined (approximated) as rectangular regions, whether these two rectangles will overlap is checked, and it is deemed that interference will take place if overlapping occurs. This operation is performed with regard to all tools mounted on the tool rests. The only reason for thus defining the shapes as rectangles is that checking for the overlapping of rectangles involves comparatively simple calculations. Preferably, figures conforming to the actual shapes should be checked for overlapping, but this is not realistic owing to the complicated calculations involved. Recently, however, it has become possible to input a figure conforming to an actual shape into an NC unit with regard to every tool, and to check these figures for overlapping. In other words, since a CRT capable of displaying color graphics may now be installed in an NC unit, each tool is displayed in a separate color and an interference check can readily be formed based on whether or not the two color displays overlap. If tool interference is going to occur, the NC programs must be revised in such a manner that the interference will not be allowed to happen. In the prior art, however, an NC program cannot be revised automatically. As a result, the revision operation is a troublesome one and requires an extended period of time. Accordingly, it is desirable to provide an NC program revision method through which NC programs for a four-axis lathe can be revised automatically in such a manner that interference will not occur. GB-A-2 117 929 discloses prevention of tool collision when numerically controlling a machine tool having two tool rests controlled by respective programs. The paths of movement of the two tool rests are simulated and displayed in advance of an actual machining process. When, observing the display, an operator judges that there is a risk of interference, he can select one of the tool rests and cause that tool rest to be temporarily stopped, whilst the other tool rest continues to move in the simulation. A waiting command is written into the program controlling the tool rest which is stopped. When the operator judges, from the display, that the possibility of interference has been cleared he can release the stopped tool rest. A waiting dismissal command is then written into the program controlling the tool rest which was stopped. EP-A-0 269 738 by the present applicant is prior art under Article 54(3) EPC. This document discloses a method of automatically revising first and second NC programs which operate respective tool rests in a four-axis lathe to machine a workpiece by controlling simultaneous movement of the tool rests; the NC programs each having a sequence of blocks of operation commands and wait commands between the blocks for synchronising the operation of the two tool rests, each block and wait command having a sequence number; wherein for the purpose of checking interference between the two tool rests the method comprises:- (i) executing interpolative simulations of the movements of the two tool rests in accordance with successive blocks of the first and second NC programs; (ii) checking during said simulations whether the tool rests and/or tools mounted thereon interfere with each other by logically processing image data representing the tool rests and tools; (iii) if an interference occurs in step (ii), halting the simulation of the tool rest having a lower priority and automatically inserting a wait command into the NC program of the halted tool rest; (iv) executing the simulation according to the other NC program to simulate movement solely of the other tool rest along a path as defined in the block in which the interference occurred; and (v) inserting a wait command in the NC program for the tool of higher priority after the block commanding said interpolative simulation which was executed while the other tool rest was halted, whereby synchronism is maintained between the two NC programs. According to the present invention, there is provided a method of automatically revising first and second NC programs which operate respective tool rests in a four-axis lathe to machine a workpiece by controlling simultaneous movement of the tool rests; the NC programs each having a sequence of blocks of operation commands and wait commands between the blocks for synchronising the operation of the two tool rests, each block and wait command having a sequence number; wherein for the purpose of checking interference between the two tool rests the method comprises:- (i) executing interpolative simulations of the movements of the two tool rests in accordance with successive blocks of the first and second NC programs; (ii) checking during said simulations whether the tool rests and/or tools mounted thereon interfere with each other by logically processing image data representing the tool rests and tools; (iii) if an interference occurs in step (ii), halting the simulations and returning to the beginning of the blocks in which the interference occurred; (iv) holding the simulation according to one of the NC programs in the halted state and executing the simulation according to the other NC program to simulate movement solely of the other tool rest along a path as defined in the block in which the interference occurred; (v) if no interference occurs in step (iv), storing the sequence numbers of the blocks of the first and second NC programs which prevailed when the original interference occurred; and (vi) revising the NC programs after the interference check by inserting a wait command ahead of the block having said sequence number of the NC program for which said interpolative simulation was halted, and inserting a wait command after the block having said sequence number of the NC program for which said interpolative simulation was executed. Revision of NC programs for a four-axis lathe according to the present invention is thus performed in the following manner: in an interference check, interpolative simulations are executed one block at a time in successive fashion based on first and second NC programs. If an interference occurs, the interpolative simulations are halted and the simulated movements of both tool rests are moved backward to the beginning of the blocks in which the interference occurred. Thereafter, with the interpolative simulation based on one NC program being kept in the halted state, the interpolative simulation based on the other NC program is executed to simulate movement of the other tool rest separately along a path in the interfering block. If interference does not occur during this separate movement, sequence numbers N, M of the first and second NC programs in the aforementioned blocks in which the interference occurred are stored. Thereafter, and in a similar manner, the interpolative simulations are resumed based on the first and second NC programs. After the interference check, the NC programs are revised by inserting a wait command ahead of the block of sequence number M in the NC program for which the interpolative simulation was halted, and inserting a wait command after the block of sequence number N in the NC program for which the interpolative simulation was executed. Reference is made, by way of example, to the accompanying drawings, in which:- Fig. 1 is a functional block diagram of an embodiment of the present invention; Fig. 2 is a block diagram of a graphic display unit for performing an interference check; Fig. 3 is a flowchart of processing in an embodiment of the invention; Fig. 4 is a view for describing program revision in case of interference; Fig. 5 shows an example of NC programs for a four-axis lathe; Fig. 6 is a view for describing a four-axis lathe; and Fig. 7 shows views for describing an interference check. In Fig. 1, numerals 101, 201 respectively denote first and second NC programs provided for corresponding first and second tool rests. Numeral 301 denotes a computerized NC unit, and number 401 represents a graphic display unit equipped with an interference check function. Numerals 102, 202 denote decoding/execution data creation units for reading and decoding the NC programs one block at a time and for creating execution-format data. Numerals 103, 203 represent interpolation simulators, and numerals 104, 204 designate storage areas each of which stores the latest path data of a plurality of blocks along with the block numbers (sequence numbers). Numeral 301a denotes an interfering block storage area for storing the sequence numbers of interfering blocks. It should be noted that the elements numbered in the 100's are for controlling the movement of the first tool rest, and the elements numbered in the 200's are for controlling the movement of the second tool rest. The graphic display unit 401 displays two tools in different colors so that overlapping of first and second tools may be distinguished. For example, if the first tool rest and its tool are shown on the display in blue and the second tool rest and its tool are shown in green, then overlapping of the two tools is deemed to occur when a "1" is read out of a frame memory (video RAM) for blue and a video RAM for green simultaneously. Fig. 2 is a block diagram of this graphic display unit. Numeral 41 denotes a display processor, 42a - 42c represent RAMs for blue, green and red beams, respectively, numerals 43a - 43c denote read controllers, 44 a luminance control circuit, 45 a CRT and 46 an interference check circuit. When the display processor 41 receives an input of interpolation data from the NC unit, the stored positions of the first and second tool rests (the painted pictures thereof) in the video RAMs 42a, 42b are moved on the basis of the interpolation data. It should be noted that a picture of the stationary portion of the machinery is stored in the video RAM 42c. Meanwhile, the read controllers 43a - 43c read the pictures out of the video RAMs and apply them to the luminance control circuit 44 in synchronism with the raster scanning of the CRT. On the basis of the picture data read out of the video RAMs, the luminance control circuit subjects the blue, green and red grids to luminance control and paints the pictures of the tool rests and stationary portion of the machinery on the CRT 45. In concurrence with the foregoing, the interference check circuit 46 checks whether "1" has been read out of the video RAMs 42a, 42b simultaneously. If this is the case, it is construed that the tool rests will interfere with each other; hence, an interference signal IFS is outputted by the interference check circuit. Fig. 3 is a processing flowchart illustrating a method of revising NC programs for a four-axis lathe according to the present invention. The overall operation of Fig. 1 will now be described in accordance with this flowchart. (1) When the interference check is started by operating a switch on an operator's panel, not shown, the NC programs of the respective tool rests are read, decoded and converted into execution-format data one block at a time by the decoding/execution data creating units 102, 202. In the interference check, the tool rests are mechanically locked so as not to move. The tools rests move only on the screen of the CRT. If an item of NC data is indicative of program end MO2 or tape end M30, the interference check processing is ended and revision processing, described below, is executed. (2) The execution format data are stored in the storage areas 104, 204, which are referred to as a program data memory. Sequence numbers are also stored in these storage areas together with the execution format data. (3) The interpolation simulators 103, 203 execute interpolative simulation using the execution format data, and the results are delivered to the graphic display unit 401. (4) On the basis of the interpolated data, the graphic display unit 401 moves the stored positions of the tools in the video RAMs and displays this. In addition, the graphic display unit checks whether the two tools interfere with each other. (5) If the tools do not interfere with each other, a check is performed to determine if one block of an interpolative simulation has ended. If it has not ended, processing is executed from step (3) onward; if it has, processing is repeated from step (1) onward based on the next block of NC data. (6) If the tools interfere with each other in step (4), the interpolation simulators 103, 203 stop interpolating. Let N represent the sequence number of the first NC program at the moment of interference, and let M represent the sequence number of the second NC program at the moment of interference. Thereafter, the simulated positions of the tool rests are moved backward to the starting positions of the interfering blocks using the respective tool positions that prevailed when interpolation was stopped and the starting positions of the interfering blocks (these positions having been stored in the storage areas 104, 204). (7) When the simulated backward movement is completed, only the interpolation simulator 103 (or the interpolation simulator 203) performs an interpolative simulation based on path data in the interfering block, whereby solely the the first tool rest is moved along the path of the interfering block. (8) The graphic display unit 401 checks whether interference occurs with regard to this movement solely of the first tool rest. (9) If interference does not occur, it is checked whether this sole movement along the path of the interfering block is completed. If the sole movement is not completed, processing is resumed from step (7) onward. (10) If the movement solely of the first tool rest is completed without the occurrence of interference, then N, M are stored in the interfering block storage area 301a, after which simultaneous movement control is resumed. Note that the first tool rest is subjected to path control based on the next item of NC data, and that the second tool rest is subjected to path control based on the latest path data stored in the storage area 204. (11) If interference occurs at step (8), then the operation I + 1 → I is performed (where I is the number of times interference occurs and is cleared to zero by a wait command). (12) A check is performed to determine whether I ≧ I s holds, where I s represents the number of times interference is allowed to occur from one wait command to the next. (13) If I ≧ I s holds, control of the four-axis lathe by the first and second NC programs is construed to be unsuitable, a display is made to this effect and processing is ended. (14) If I < I s holds, the operations N - 1 → N, M - 1 → M are performed, whereby the blocks that are one block before the blocks in which the interference actually occurred are regarded as the interfering blocks. This is followed by repeating processing from block (6) onward. When the interference check is thus completed, processing for revising the first and second NC programs is executed using the sequence numbers stored in the interfering block storage area 301a. Specifically, the NC programs are revised by: (a) inserting a wait command ahead of the block whose sequence number is M in the second NC program for which interpolative simulation was stopped. (b) inserting a wait command after the block whose sequence number is N in the NC program for which interpolative simulation was executed. For example, assume that the first and second NC programs are as follows: First NC Program Second NC Program ............... ................ N1100M100; N2100M100; N1101G00X_Z_S_M03; N2101G00X_Z_; N1102G01X_F_; N2102G01Z_F_; N1103G00Z_; N2103G00X_; N1104X_; N2104Z_; N1105G01Z_; N2105G01X_; N1106X_; N2106Z_; ....... ....... N1200M200; N2200M200; (where M100, M200 are wait commands). Further, assume that interference occurs with regard to movement associated with sequence number N1102 of the first NC program and sequence number N2102 of the second NC program, as shown in Fig. 4. In such case, N = 1102, M = 2102 (where it is assumed that interference does not occur when only one tool rest is moved), and the first and second NC programs are revised as follows: First NC Program Second NC Program ............... ................ N1100M100; N2100M100; N1101G00X_Z_S_M03; N2101G00X_Z_; N1102G01X_F_; N2102M300; N1103M300 N2103G01Z_F_; N1104G00Z_; N2104G00X_; N1105X_; N2105Z_; N1106G01Z_; N2106G01X_; N1107X_; N2107Z_; ....... ....... N1200M200; N2200M200; In the foregoing case, sole movement of one tool rest upon completion of backward movement is performed by one of the NC programs decided in advance unconditionally. However, which of the interpolative simulations is to be executed can be decided upon taking into consideration the type of machining performed by the tool rests. For example, the NC program for which the interpolative simulation is halted may be decided upon considering a requirement that inner diameter cutting is to have priority over end face cutting and outer diameter cutting. Thus, according to the invention, when it is found that interference will occur in a tool rest interference check, the NC programs for the four-axis lathe can be revised automatically in such a manner that the interference will not take place. This makes it possible to execute revision processing simply in a short period of time.

Claims: A method of automatically revising first and second NC programs which operate respective tool rests in a four-axis lathe to machine a workpiece by controlling simultaneous movement of the tool rests; the NC programs each having a sequence of blocks of operation commands and wait commands between the blocks for synchronising the operation of the two tool rests, each block and wait command having a sequence number; wherein for the purpose of checking interference between the two tool rests the method comprises:- (i) executing interpolative simulations of the movements of the two tool rests in accordance with successive blocks of the first and second NC programs; (ii) checking during said simulations whether the tool rests and/or tools mounted thereon interfere with each other by logically processing image data representing the tool rests and tools; (iii) if an interference occurs in step (ii), halting the simulations and returning to the beginning of the blocks in which the interference occurred; (iv) holding the simulation according to one of the NC programs in the halted state and executing the simulation according to the other NC program to simulate movement solely of the other tool rest along a path as defined in the block in which the interference occurred; (v) if no interference occurs in step (iv), storing the sequence numbers of the blocks of the first and second NC programs which prevailed when the original interference occurred; and (vi) revising the NC programs after the interference check by inserting a wait command ahead of the block having said sequence number of the NC program for which said interpolative simulation was halted, and inserting a wait command after the block having said sequence number of the NC program for which said interpolative simulation was executed. A method according to claim 1, wherein interpolation data obtained by said interpolative simulations are inputted to a graphic display unit, and said graphic display unit performs the interference check of step (ii) by forming a digital image of each tool rest including its tool and storing the resulting image data in separate video RAMs, reading successive items of image data out of both video RAMs in synchronism with raster scanning of a CRT, and logically processing the items of image data to determine an interference whenever both items of image data simultaneously represent part of a tool rest. A method according to claim 1 or 2, wherein several items of latest NC data in the first and second NC programs for which the interpolative simulations are executed are stored in a memory in said first step, and starting positions of the blocks in which interference occurred are read out of said memory and the simulated movements of the tool rests return to the starting points of the blocks. A method according to claim 1, 2 or 3, further comprising a step of:- (vii) when interference still occurs when simulating movement of only one tool rest in step (iv), treating the blocks preceding the blocks in which the original interference occurred as the interfering blocks, returning the simulations to starting points of said preceding blocks, and repeating step (iv).

Inventors: KAWAMURA, HIDEAKI, MATSUMURA, TERUYUKI, SASAKI, TAKAO
Applicants: FANUC LTD.
Application year: 1986
Main classification: B23Q15
IPC codes: G05B19, B23Q15, B23Q11