NC-postprocessing and NC-simulation for five-axis milling operations with automatic collision avoidance
Prof. dr. ir. J.P. Kruth, dr. ir. B. Lauwers, ir. P. Klewais, ir. P. Dejonghe
K.U.Leuven, Division PMA, Celestijnenlaan 300 B, B-3001
Leuven (Belgium)
Tel: + 32 16 32 25 52 Fax: + 32 16 32 29 87
http://www.mech.kuleuven.ac.be/pma/pma.html
Abstract: The off-line generation of collision free NC-programs for 4 and 5-axis milling is still time consuming and not optimal. Commercial CAD/CAM systems ignore the geometry and the kinematics of the NC-milling machine during tool path generation. Therefore machine test runs are essential to check the machinability of a tool path on a given five-axis milling machine. Real test runs can be avoided by using a NC-simulation program, however, most of these programs limit themselves to identifying collisions. In both cases, the CAM operator has to solve the collisions himself and this normally requires a number of iterations (tool path generation, postprocessing, NC-simulation, test runs.
This paper describes developments carried out at the K.U.Leuven, in which a generalised five-axis NC-postprocessor and a NC-simulation package have been integrated. This integration makes it possible to exploit fully the capabilities of the NC-postprocessor, the NC-simulation package and the five-axis milling machine. During NC-postprocessing, the NC-simulation package checks each tool position for collision and if this latter occurs, the NC-postprocessor immediately looks for alternatives without any operator interventions. The implemented automatic collision avoidance methods are searching for alternative combinations of machine axes positions yielding the same tool orientation, alternative clamping positions on rotary tables and tool lengths.
Keywords: CAM, NC-postprocessing, NC-simulation, Five-axis milling
Introduction
Five-axis milling machines, used for many years in the aerospace industry, also prove their advantages in the accurate and fast machining of smaller sized and complex workpieces such as propellers, impellers, moulds, EDM electrodes and others [1]. At the moment, the generation of an NC-program for multi-axis milling machines proceeds in several stages [2,3,4,5] (Figure 1)

Figure 1: Classical way of the NC-program generation for multi-axis milling machines
This paper describes the integration of a NC-postprocessor and a NC-simulation module. Implemented automatic collision avoidance methods such as defining the optimal clamping position and tool length reduce the number of iterations.
2. kinematics of five axis milling machines
A five-axis milling machine normally has three translational and two rotary degrees of freedom. These configurations allow to program any arbitrary tool axis orientation. Usually both rotary axes are perpendicular to each other and their orientation equals the direction of the linear axes. The primary rotary axes have a constant orientation, while the orientation of a secondary axis changes due to a rotation around the primary axis.
One rotary axis has a fixed inclination with respect to the tool axis. The second rotary axis has a fixed orientation with respect to the clamping table. To simplify the formulae in this section the rotary axis which orientation remains fixed with respect to the tool axis will be defined as the principal rotary axis.

Figure 2: Five-axis milling machine with a principal B axis and a secondary C axis both on the clamping table
If the conventional kinematics of a five axis milling machine is considered, the conclusion follows that each orientation of the tool-axis (i,j,k) can be achieved at two different positions of the rotary axes. However a limited range of the rotary axes often eliminates one of these solutions. If the principal B-axis is zero ( i=0, j=0, k=1) then any value for the second axis is satisfactory. This is called a degenerated position : the C-axis is parallel to the tool axis and therefore has no influence on the orientation of the tool axis with respect to the clamping plane.
If the tool axis is moved from the first solution space (B > 0) into the other solution space (B < 0) then the tool axis goes through the degenerated position (B = 0 and i=0, j= 0, k=1).
3. The integration of a NC-postprocessor and a nc-simulation module
In order to avoid the often huge number of iterations in the generation of collision free NC-programs, an integration of a NC-postprocessor and a NC-simulation package has been worked out at the K.U.Leuven. As NC-postprocessor, a generalised five-axis NC-postprocessor also developed at the K.U.Leuven is used. The simulation package is based on the simulation program IGRIP, mainly used for robot simulation and off-line robot programming.
Fig. 3 shows the information flow through the NC-generation and NC-simulation software.
The ‘CONTROL’ module starts both the NC-postprocessor and the NC-simulation program. The NC-postprocessor reads a tool path record form the CLDATA-file (i.e. tool position X,Y,Z,I,J,K) and calculates the machine axes positions (X,Y,Z,A,B). The machine axes positions are then checked by the NC-simulation program for collision.
To perform an accurate simulation, the simulation program should know the geometrical description of the machine tool, of the workpiece and of all the cutters used during the execution of the NC-program.
The NC-simulation program visualises the machine movements and responds with a status message to the NC-postprocessor as soon as a collision occurs.

Figure 3: Information flow of the
NC-postprocessing
and simulation software
The NC-postprocessor tries to solve the collision by calculating new machine axes positions (X,Y,Z,A,B) giving the same CL-file tool position (x,y,z,i,j,k). As explained before, the mapping of CLDATA cutter locations onto machine axes positions of a five-axis machine is not unique. Most cutter locations can be reached at two different positions of the rotary axes of the milling machine. Suppose, a workpiece with a cylindrical shape has to be milled on a five-axis milling machine as shown on Figure 4.

Figure 4: Workpiece with a cylindrical shape to be milled by five-axis milling
The axis of the cylinder of the first part is parallel with the B-axis of the milling machine. There are two possibilities to move from point 1 to point 3. The one solution (Figure 5.a) moves the B-axis from +20 to -20 degrees while the C-axis remains unchanged. The other solution (Figure 5.b) moves the B-axis from +20 to zero degrees then rotate the C-axis 180 degrees while the cutter is at position 2 of the tool path and finally move the B-axis back to +20 degrees. Both solutions move the cutter along the same trajectory in the workpiece co-ordinate system. It is clear that the first solution is preferable as the machining time will be shorter and the accuracy probably the best. However if a collision occurs when the B-axis is moved to -20 degrees then the second solution has to be chosen in order avoid this collision.

Figure 5.a: First solution (B-axis from +20 to -20 degrees)

Figure 5.b: Second solution
(B-axis: +20 to 0 degrees, 180 degrees C-axis rotation, B-axis: 0 to +20
degrees)
Things get more serious when a section of a cylinder is milled whose axis is slightly inclined with respect to the clamping plane (Figure 6). Now both the B and the C axis will move simultaneously. There are still two solutions:

Figure 6: Section of cylinder with inclined shape
The NC-postprocessor automatically decides which solution is most favourable considering the cutter geometry, the machining time, the accuracy of the resulting tool path and the tolerance specified in the CLDATA-file. In the previous example, the postprocessor will choose the second solution. But, as soon as a collision is detected, the NC-postprocessor back tracks the tool path until it finds the machine axes positions where it can switch from the one solution to the other within a permissible surface error on the workpiece. It erases the back tracked portion of the tool path and restarts the tool path postprocessing from that position.
If the alternative solution still gives a collision, the control is given back to the CONTROL module. Dependent on the type of collision, the CONTROL module tries to apply other specific collision avoidance methods. These collision avoidance methods are based on the change on both, the clamping position and the tool extension length. As explained later, the developed NC-postprocessor is able to define an optimal clamping position and tool extension length.
4. Example of machining an industrial part
Figure 7 shows an industrial cast-iron workpiece on which three helical surfaces were to be milled (generating a triple thread). A five axis Maho 600C milling machine has been used to perform this task. As the surfaces are highly twisted the radius of the cutter must be limited to avoid strong undercutting of the surface. Due to the geometrical constraints a woodruff cutter with diameter equal to 45.5 mm is used to finish mill the surface.

Figure 7: Industrial example: the machining of a cast-iron workpiece
A NC-simulation run of the tool path was indispensable to prove in advance that the workpiece could be machined on the five-axis milling machine. Special difficulties occurred during the execution of the tool path. As explained before, each tool position can be reached at two different positions of the rotary axes (Figure 8). In this case often one of these solutions provokes a collision. Therefore the NC-postprocessor selects the right solution for the rotary axes when machining the helical surfaces. This is especially difficult here since the rotary axes can not change from one solution to the other solution during the machining of a single helical surface. The integration of the NC-postprocessor within the simulation software made it fairly easy to solve this problem. If the NC-postprocessor is informed of a collision or an axis limit violation, then it automatically looks for an alternative solution of the rotary axes. If the NC-postprocessor finds an alternative solution then it back tracks the tool path until the cutter location from where the new solution can be reached without provoking any collision. In this practical case this cutter location appeared to be the approach point to the helical surface where the cutter does not yet touch the workpiece (rapid movement).
Figure 9 shows an image of the computer screen of the NC-simulation program and a look on the five-axis milling machine making the required part.

Figure 8: Different solutions of rotary axes giving the same tool orientation

Figure 9: Image of the
NC-simulation program (left) and
the machining of the workpiece (right)
5. Automatic determination of the clamping position and the tool extension length
A lot of collisions can be avoided by looking for the optimal clamping position and tool extension length. Therefore, the developed software has been extended to automatically determine the optimal clamping position and the minimal tool length.
Several criteria must be considered to determine the optimal clamping position [6] [7]:
Therefore the operator specifies a feasible distance between the clamping table and the workpiece. The optimal clamping position in the plane parallel to the clamping table must bring the centre of the tool path near to the rotary axes of the table.
Table 1 shows the different collisions that may occur during the execution of a tool path and the methods to remedy them. Some of the collisions are clarified with an example (figure 10). Each avoidance method gets a different priority. The simulation software can implement both methods, A and B: i.e. the program determines a new clamping position or changes the tool length and restarts the NC-postprocessor with this modified input data. Method C and D on the contrary always require the intervention of the operator and are not implemented in the simulation software.
|
Colliding elements |
Possible avoidance methods |
|||
|
B |
D |
||
|
B |
C |
D |
|
|
A |
B |
D |
|
|
B |
D |
||
|
B |
C |
D |
|
|
A |
B |
D |
|
|
D |
|||
|
C |
D |
||
|
A |
D |
||
|
A |
D |
||
|
A |
B- |
D |
|
|
D |
|||
|
A |
D |
||
|
A |
D |
||
|
Avoidance methods: |
|
A. Change clamping position |
|
B. Extend length of cutter (or reduce B-) |
|
C. Change set-up |
|
D. Change tool path on CAD/CAM system or other action |
Table 1: General collision avoidance methods

Collision between milling head and machine Structure

Collision between workpiece and machine structure
|
Collision between milling head and table
Collision between milling head and workpiece |
|
|
One of the axes exceeds its limit switch |
|
Figure 10 : Different examples of collisions on a five-axis milling machine
If a collision occurs with a clamping element, the operator must decide whether or not to change the set-up (method C). The operator can use the build-in solid modeller of the simulation program to modify the geometry and the position of the clamping devices. The operator is responsible to make the necessary changes and to restart the simulation process.
Modification of the tool path (method D) can
eliminate most collisions. However the calculation or the recalculation of the tool path may require several hours. The method strongly relies on the skills of the operator. He has to modify the tool path generation and/or select another type of cutter in order to avoid the collision reported during the simulation run. Automation of this process is complex and would demand the implementation of avoidance methods in the CAM system, for instance to modify the inclination of the tool w.r.t. the surface (i.e. tool lead, lag or tilt angle) in order to avoid collisions. This is problem will be investigated in the future.
It often happens that several methods can remedy a collision situation. In this case, method A gets a higher priority then method B, since extending the tool length badly influences the cutting conditions.
A general algorithm that is applicable for all possible configurations of five-axis milling machines appeared to be very time consuming. Therefore the algorithm for the automatic determination of the clamping was tuned for a specific five-axis milling machines with two rotary axes on the table (Figure 2).
Initially the program positions the workpiece close to the axis of the rotary table C at a height (offset) above the table close to the axis B. A grid of possible clamping positions is generated in this offset clamping plane. Often this grid is related to the positioning holes or slots of the clamping table. To fasten the optimisation process, the number of possible clamping positions is reduced by eliminating these positions which do not allow a full rotation of the rotary table without collision.
The CONTROL module (fig 3) starts the NC-postprocessor with the initial clamping position. If a collision occurs or if a linear axis exceeds its limit switch, the NC-postprocessor tries any alternative solution. If this fails the NC-postprocessor exits and returns control to the CONTROL module. The CONTROL module invalidates the actual grid point and executes the appropriate collision avoidance method (table 2).
|
NC-postprocessor collision avoidance method |
|||
|
Workpiece |
with |
Rotating arm B |
Translate clamping position |
|
Milling head Tool holder Cutter |
with |
Rotating table C Rotating arm B |
Translate clamping position |
|
Milling head Tool holder |
with |
Workpiece |
Extend tool length |
|
Cutter |
with |
Workpiece |
No solution at NC-postprocessor level |
|
Limit switch of linear axis exceeded |
Translate clamping position |
||
|
Limit switch of rotary axis exceeded |
No solution at NC-postprocessor level |
||
Table 2: Collision avoidance methods for five axis milling with two rotary tables
At the end of the NC-program generation, the best clamping position is defined. As mentioned before the clamping position has a strong influence on the amplitude of the movements of the machine slides when the tool inclination changes with respect to the workpiece co-ordinate system. The integrated NC-postprocessor and NC-simulation program allows to determine the optimal clamping position with respect to the sum of all movements made by the slides of the milling machine. Applying this clamping position shortens the execution time and/or improves the workpiece accuracy. An optimised search algorithm avoids unneeded simulation runs and limits the execution time of the process.
6. Limitations of the integrated postprocessing and simulation program
The actual simulation program does not simulate the material removal process yet. Consequently the workpiece geometry is not updated during the execution of the milling path. As a result the simulation program can only perform a collision test on the geometry of either the blank part or the final workpiece. For most applications this will be sufficient. Simulation using the blank part is safe and the absence of small details in this geometry fastens the execution of the simulation run. However if a lot off the material is cut to produce the final shape, the program could report collisions of the tool holder or the machine structure with bulk material already cut by the preceding part of the tool path.
Presently it is impossible to inform the CAD/CAM system about a collision in order to force the CAM module to automatically correct the cutter inclination (e.g. lead angle) and to eliminate the collision. To achieve this goal one could integrate the CAM module, the NC-postprocessor and the simulation program. However generating and verifying the NC program depends on the knowledge of the clamping position and the tool length. Therefore combining the tool path generation, the post-processing and the simulation is only useful if both the clamping position and the length of all cutters are known in advance.
The CAM module could send each cutter location to the NC-postprocessor. The NC-postprocessor calculates the movement made by the NC machine. The simulation software automatically verifies this movement. If a collision occurs which the NC-postprocessor can not avoid, then the CAM module becomes informed. The CAM system in its turn applies collision avoidance methods considering the type of collision. Again implementing a general solution able to handle all situations would be very complex. However for certain groups of workpieces, machined on a specific milling machine, one could specify a number of collision avoidance rules that give the CAM module the ability to avoid most collisions.
Conclusions
Applying NC-simulation reduces the risk of damage caused by collisions and eliminates time consuming test runs. This is important as the machine cost pro hour can be very high for five axis machines. The simulation of critical parts of the tool path allows verifying the machinability of a workpiece in advance.
The integration of a NC-postprocessor and a NC-simulation module provides an additional advantage as the NC-postprocessor can immediately adapt the NC program to avoid a collision detected by the simulation software. This seemed to be especially useful for machines with rotary tables. Some tool paths for industrial parts could only be machined with the aid of this technique.
A further extension of the simulation program allows to automatically determine a valid clamping position or to optimise the clamping position with respect to the amplitude of machine movements. However a time efficient implementation forced the authors to implement a number of machine dependent rules that exclude some solutions rarely leading to a valid clamping direction.
References
[1] Kruth J.P., Klewais P., Optimisation and dynamic adaptation of the cutter inclination during five axis milling of sculptured surfaces, Annals of the CIRP, Vol. 43/1/1994,
[2] Hirsch B., Shen X, Müller H, Realistische Simulation mehrachsiger NC-Bearbeitungsvorgänge, Zeitschrift für wirtschaftliche Fertigung und Automatisierung 85, 1990
[3] Suk-Hwan, Kee-Sang Lee, Avoiding tool interference in four-axis NC-machining of rotationally free surfaces, IEE: transaction on robotics and automation, vol. 8 no. 6, December 1992.
[4] Yoshimi Takeuchi, Takahiro Watanabe, Generation of 5-axis control collision free tool path for NC-data, Annals of the CIRP, Vol. 41/1/1992.
[5] Yuan-Shin Lee, Tien-Chien Chang, 2-Phase approach to global tool interference avoidance in 5-axis machining, Computer-Aided Design, vol. 27, no. 10, October 1995.
[6] Perremans P., Feature based description of modular fixturing elements : the key to an expert system for the automatic design of the physical fixture, Computers in Engineering, vol. 1, ASME 1994.
[7] Trappey J.C., Methodology for automatic fixture design in a computer integrated environment, PhD thesis, Purdue University.
ACKNOWLEDGEMENTS
This research is funding by the program on Inter-University Attraction Poles (IUAP-50) initiated by the Belgian State, Prime Minister’s Office, Science Policy Programming.
The scientific responsibility is assumed by its authors.