1 Introduction

Five-axis NC machines are extensively adopted in machining sophisticated mechanical parts because the cutting tools of such machines have more degrees of freedom than those of three-axis NC machines. However, the advantages of five-axis machining are undermined by unpredictability of the cutting tool motion. The most common solution is to inspect any interference between the cutting tool and the to-be-machined surface at each CC point, and to adjust the orientation of the tool to prevent any collision [1, 2, 3]. The discovery of regions prone to collision has been recommended before the tool orientation is adjusted [4, 5, 6, 7, 8]. Researchers also used scattered points to approximate the contact region between the cutting tool and the workpiece. The points are used for checking interference. If any interference occurs, the orientation of the tool is revised according to the direction determined by summing all vectors between the cutting tool and the checking points [9].

Determining tool orientation traditionally involves highly complex geometric calculations and is therefore very time-consuming. Treating the problem of collision interference confronted during five-axis machining of a cavity that possesses undercut areas, this study extends the concept of open regions and vector fields to develop a simple method for adjusting the orientation of the cutting tool. The first step is the conversion of the cavity surface into discrete data points. The surface is then sliced into 2D layers to identify the occurrence of the undercut area, which is defined as the open region. Next, the tool path of NC machining is planned and CC data are generated according to the requirements of step length and path interval. For each CC point to be machined, an appropriate tool orientation must be determined to prevent collision between the cutting tool and the cavity surface. The geometric relationship between the CC point and the contour of the open region is first considered to obtain an initial orientation of the tool. With this initial orientation, collisions are inspected to ensure that the orientation can feasibly prevent interference between the cutting tool and the cavity surface. If any collision is detected, then the tool is reoriented so that it becomes tangent to the interference volume. The final tool orientation is the one that an offset distance is maintained between the cutting tool and the most-convex point of the interference volume.

The following sections address the concepts and algorithms including determination of the location of open regions, generation of the NC tool path, setup of the initial tool orientation, and adjustment of the tool orientation.

2 Determining the location of open regions

The open region of a cavity surface to be machined is defined as the maximum area into which the cutting tool can travel, as depicted in Fig. 1. The orientation of the cutting tool can be regulated within the desired region of material removal, by determining the open region. Accordingly, not only is the tool orientation easily determined, but collisions are also avoided as long as the tool moves within the area of the open region.

Fig. 1. a
figure 1

Part to be machined and its sectional view. b Illustration of open region

The open region is at the entrance of the cavity or the location at which the undercut occurs. Figure 1b presents the positions of three open regions inside a cavity. Three separate areas of the cavity are machined accordingly. The first area is confined by open regions #1 and #2, and is shown as "I" in Fig. 1b. Open regions #2 and #3 confine the second area, and the third area is between open region #3 and the bottom of the cavity. An open region limits the tool movement during the machining of the cavity. Considering area II in Fig. 2a as an example, movement of the cutting tool is limited to within open regions #1 and #2, successfully preventing interference. However, interference occurs if the cutting tool crosses either of the borders of the two open regions, as shown in Fig. 2b. Figure 2 shows that open regions can directly and effectively limit the movement of a cutting tool in cavity machining.

Fig. 2. a
figure 2

Cutting tool penetrates open regions #1 and #2. b Cutting tool crosses the border of open region #2

The open regions of a cavity are found by slicing the removal volume of the cavity, and applying Boolean operator "−" (subtraction) to the sliced data. The result of the subtraction operation can then be used to determine if an undercut is present; open regions are located at the beginning of every undercut. Figure 3 depicts this method. The area of slice a exceeds that of slice b. Figure 3b shows the result of the Boolean operation. This region is thus determined to include no undercut. However, the area of slice c is smaller than that of slice d. The subtraction result in Fig. 3c reveals that slice c represents the beginning of an open region. The method can thus be stated as follows: when two adjacent slices are selected to implement a subtraction Boolean operation and the result is null, no undercut is present at the slicing position; otherwise, an undercut occurs on the upper slice.

Fig. 3. a
figure 3

Removal volume and its slicing. b Boolean operation on the first two slices. c Boolean operation on another two slices

3 Generating the NC tool path

In generating CC points for the NC tool path, step length and path interval are the primary concerns in meeting the requirement of path interpolation [10, 11, 12]. These factors are discussed below.

(1) Step length

During the motion of a cutting tool along a curve, a minimum number of CC points should be maintained while fulfilling the requirement of making the maximum chord deviation less than the required machining tolerance, as shown in Fig. 4. Both convex and concave curves require the same formula for calculating the step length. For example, as shown in Fig. 5a, when the cutting tool moves from point CC 1 to point CC 2, gouging occurs in the gray zone. When θ is very small, the line segment \(\overline {OE} \) can be approximated by the following equation:

Fig. 4.
figure 4

Illustration of step length

Fig. 5.
figure 5

Calculation of step length for convex and concave surfaces

$${\overline{{OE}} = \rho \cos \theta }$$
(1)

where ρ is the radius of curvature of the convex (or concave) surface profile, θ=0.5×cos−1(n1·n2), and n1 and n2 are normal vectors of CC1 and CC2, respectively. The maximum chord deviation, δ, can thus be calculated as

$${\delta = \overline{{DE}} = \overline{{OD}} - \overline{{OE}} = \rho - \rho \cos \theta = \rho {\left( {1 - \cos \theta } \right)}.}$$
(2)

Equation 2 can be used to calculate angle θ from the value of δ, which is one of the known parameters in planning a tool's path. The step length from CC1 to CC2 can then be determined.

(2) Path interval

Path interval is defined as the step-over between two neighboring tool paths. The formula for calculating scallop height, h, and path interval, d, depends on which of the following three conditions is satisfied by the curvature of the surface profile.

Case 1:

Curvature=0, such that the surface to be machined is flat (Fig. 6).

Fig. 6.
figure 6

Calculation of path interval for surface with curvature=0

The scallop height, h, can be calculated as

$$ {h = \overline{{AB}} - \overline{{AX}} = r - {\sqrt {r^{2} - {\left( {L/2} \right)}^{2} } }} $$
(3)

From the above equation, the tool movement, L, can be written as

$${L = 2{\sqrt {r^{2} - {\left( {r - h} \right)}^{2} } }}$$
(4)

The path interval, d, is thus found as

$${d = L}$$
(5)

Case 2:

Curvature<0

Figure 7 shows the machining of a surface profile with curvature<0. From the figure, \(\overline {OA} \) can be calculated by

Fig. 7.
figure 7

Calculation of path interval for surface with curvature <0

$$ {\overline{{OA}} = {\sqrt {\overline{{D_{2} O}} ^{2} - \overline{{D_{2} A}} ^{2} } } = {\sqrt {{\left( {r + R_{c} } \right)}^{2} - {\left( {L/2} \right)}^{2} } }} $$
(6)

where D 2 is the tool's center, r is the tool's radius, L is the distance between centers of the tools, and R c is the radius of curvature. The equation for \(\overline {AX} \) is

$$ {\overline{{AX}} = {\sqrt {\overline{{D_{2} X}} ^{2} - \overline{{D_{2} A}} ^{2} } } = {\sqrt {r^{2} - {\left( {L/2} \right)}^{2} } }} $$
(7)

Line segment \(\overline {OX} \) can be written as

$${\overline{{OX}} = \overline{{OA}} - \overline{{AX}} = R_{c} + h}$$
(8)

From the equations above, the scallop height, h, can be obtained.

$$ {h = {\sqrt {{\left( {r + R_{c} } \right)}^{2} - {\left( {L/2} \right)}^{2} } } - {\sqrt {r^{2} - {\left( {L/2} \right)}^{2} } } - R_{c} } $$
(9)

The displacement of the tool, L, can be written as

$$ {L = 2{\sqrt {r^{2} - {\left( {{\sqrt {{\left( {R_{c} + r} \right)}^{2} - {\left( {L/2} \right)}^{2} } } - R_{c} - h} \right)}^{2} } }} $$
(10)

The path interval, d, is

$$ {d = {{4L} \over {{\left( {1 + r/R_{c} } \right)}}}} $$
(11)

Case 3:

Curvature>0

Figure 8 presents the machining of a surface profile with curvature>0. In the figure, \(\overline {OA} \) can be calculated by

Fig. 8.
figure 8

Calculation of path interval for surface with curvature >0

$$ {\overline{{OA}} = {\sqrt {\overline{{D_{2} O}} ^{2} - \overline{{D_{2} A}} ^{2} } } = {\sqrt {{\left( {r - R_{c} } \right)}^{2} - {\left( {L/2} \right)}^{2} } }.} $$
(12)

The equation for \(\overline {AX} \) is

$$ {\overline{{AX}} = {\sqrt {\overline{{D_{2} X}} ^{2} - \overline{{D_{2} A}} ^{2} } } = {\sqrt {r^{2} - {\left( {L/2} \right)}^{2} } }} $$
(13)

Line segment \(\overline {OX} \) can be written as

$${\overline{{OX}} = \overline{{OB}} - \overline{{XB}} = R_{c} - h}$$
(14)

The above equations yield the scallop height, h, where

$$ {h = R_{c} - {\sqrt {{\left( {R_{c} - r} \right)}^{2} - {\left( {L/2} \right)}^{2} } } - {\sqrt {r^{2} - {\left( {L/2} \right)}^{2} } }} $$
(15)

The displacement of the tool, L, can be written as

$$ {L = 2{\sqrt {r^{2} - {\left( {{\sqrt {{\left( {R_{c} - r} \right)}^{2} - {\left( {L/2} \right)}^{2} } } - R_{c} + h} \right)}^{2} } }} $$
(16)

And the formula for the tool path interval, d, is

$$ {d = {{4L} \over {{\left( {1 - r/R_{c} } \right)}}}} $$
(17)

Of the above formulae, Eqs. 10 and 16 are iterative equations, with an initial value of L found from Eq. 4.

The CC points needed for NC machining are determined following the iso-parametric method [10, 11, 12] once the equations for step length and path interval have been determined. Figure 9 illustrates the basic procedure.

Fig. 9.
figure 9

Procedure of NC tool path generation

4 Determining tool orientation

The information concerning open regions and CC points obtained in the previous steps is used in this stage to generate the data needed for five-axis NC machining, including cutter location (CL) points and tool orientations. A two-stage approach is proposed to determine the appropriate orientation of the tool. The first stage determines the initial tool orientation based primarily on constraints imposed by open regions, and the second involves checking interference and correcting the tool's orientation. The two stages are detailed below.

4.1 Determination of initial tool orientation

An initial tool orientation is set for each CC point to be machined. If the point is labeled P i and is located between open regions #1 and #2 (where i is the point number, 1≤in and n is the total number of CC points), then the orientation is determined based on angle θ between VRu1 and Vcheck, as shown in Fig. 10. Here, VRu1 is a vector from point P i to point R u1 on the open region contour, and Vcheck is the projected vector of Vcn along the horizontal axis (Vcn is a normal vector of P i from the surface). The following two cases can apply:

Fig. 10.
figure 10

Determination of initial tool orientation for a CC point that lies in between open regions #1 and #2

  1. 1.

    θ≥90° (Fig. 10a): No undercut is present for machining P i . Its CL point can easily be found by offsetting point P i by a distance equal to the tool's radius, along vector Vcn, and the initial tool orientation is the vertical direction.

  2. 2.

    θ<90° (Fig. 10b): An undercut exists. Its CL point is also obtained by offsetting point P i by a distance equal to the tool radius, along vector Vcn, while setting the tool axis VA parallel to vector VRu1.

If CC point, P i , is located below open region #2, four vectors must be formed to determine the initial orientation of the tool. As shown in Fig. 11, the four vectors include the above-mentioned three, VRu1, Vcheck and Vcn, plus vector VRu2 targeting from point P i to point R u2 on open region #2. Following this rule, if point P i lies below open region #j, where 2≤jm and m is the total number of open regions, then vector VRuj must be found, which targets from point P i to point R uj on open region #j. In such a case, determining the initial tool orientation depends on angle θ 1 of vectors VRu1 and Vcheck, and angle θ j of vectors VRuj and Vcheck. One of four conditions may be satisfied:

Fig. 11.
figure 11

Determination of initial tool orientation for CC points that lie below open region #2

  1. 1.

    θ 1≥90° and θ j ≥90° (Fig. 11a, where j=2): No undercut is found at point P i . Its CL point can easily be found by offsetting P i by a distance equal to the tool's radius, along vector Vcn, and the initial tool orientation is the vertical direction.

  2. 2.

    θ 1<90° and θ j ≥90° (Fig. 11b): Undercut exists. Tool axis VA is set parallel to vector VRu1. Its CL point can be found using the method described in case 1.

  3. 3.

    θ 1 ≥90° and θ j <90° (Fig. 11c): Undercut exists. Tool axis VA is parallel to vector VRuj. Its CL point can be found the same way as described in case 1.

  4. 4.

    θ 1<90° and θ j <90° (Fig. 11d): Same as case 3.

4.2 Correction of tool orientation

The aforementioned method for determining the initial tool orientation considers merely the tool's spindle axis, whose geometry is a straight line, to fulfill the geometrical constraints imposed by open regions. Interference must be checked in the second stage to ensure that the tool's volume does not collide with the workpiece. The method is explained below.

(1) Determine checking points

The iso-parametric method is applied to convert the cavity surface to be machined into discrete data points [10, 11, 12]. The following two types of error that affect the distribution of the points are taken into account—one is produced in the area of contact between the tool's tip and the surface for machining, and the other in the area of contact between the tool's spindle and the to-be-machined surface, as illustrated in Fig. 12. Both errors take the following form [12]:

Fig. 12a–b.
figure 12

Two types of error that affect the distribution of checking points. a Error at the area of contact between tool tip and surface. b Error at the area of contact between tool spindle and surface

$${d \approx {\sqrt {8re_{p} } }}$$
(18)

where d is the maximum allowable distance between two checking points, r is the tool's radius, and e p is the maximum allowable error. Parameters r and e p are given, and d can be found accordingly.

The area where the cutting tool will collide with the surface for machining is limited to the neighborhood of the tool's volume. Consequently, although the whole surface for machining is converted into discrete points for a specific tool orientation, only the checking points that fall within the bounding box depicted in Fig. 13, in which interference is likely to occur, are chosen as candidates in checking for interference. The time taken by interface checking is therefore significantly reduced.

Fig. 13.
figure 13

Bounding box for a specific tool orientation

(2) Check interference and correct tool orientation

For a specific tool orientation and checking point, CP k , where 1≤kl and l is the total number of checking points, the distance between the tool's axis and the checking point is used to determine whether the cutting tool collides with the surface for machining. If the distance, d k , is smaller than the tool radius, R, as shown in Fig. 14b, then the checking point lies inside the tool's volume and the tool collides with the cavity's surface. The following steps are proposed to correct the tool's orientation and thus prevent collision.

Fig. 14. a
figure 14

Checking points lie outside the tool volume. b Checking points lie inside the tool volume

Step 1.:

Find the region where collision is most severe. As shown in Fig. 15, the region with maximum collision volume is in the surrounding area of the checking point at which the distance from every checking point, CP k , to the tool's axis is the minimum.

Fig. 15.
figure 15

Distance between checking points and tool axis

Step 2.:

Determine the offset direction and offset distance: The vector formed by connecting the checking point, CP cm, at which the collision is most severe, to its projected point on the tool axis, determines the direction of offset as depicted in Fig. 16. The offset distance, d offset, can be obtained by subtracting the perpendicular distance, d cm, between CP cm and the tool axis from the tool's radius, R, that is, d offset=Rd cm.

Fig. 16.
figure 16

Direction and distance of offset for tool orientation correction

Step 3.:

Correct tool orientation: Tool orientation is corrected with respect to every CL point. As shown in Fig. 17, the projected point, PP i, of checking point CP i onto the tool axis is displaced by distance d offset to point OP i , and the vector from the CL point to OP i becomes the new orientation of the tool.

Fig. 17.
figure 17

Illustration of tool orientation correction

The above process of interference checking and tool-orientation correction must be repeated until all interference is excluded.

5 System implementation and examples

The methodology and algorithms discussed in the previous sections were implemented using Microsoft Visual C++ as the system development tool, and ACIS, a geometric kernel developed by Spatial Technology, Inc., as the 3D solid modeler for parts to be machined. System operation involves the following tasks:

  1. 1.

    Import the ACIS solid model and use as the part for machining.

  2. 2.

    Specify process parameters such as checking error, e p , machining tolerance, ε, and scallop height, h; input the tooling data including tool length, l, and tool radius, r.

  3. 3.

    Select the surface to be machined.

  4. 4.

    Generate CC points: Use parameters ε and h, and Eqs. 2, 5, 11 and 17 to determine the maximum allowable chord deviation, δ, and the path interval, d. Then implement the algorithm to obtain CC points.

  5. 5.

    Determine locations of open regions: Use Boolean functions in ACIS to locate the open regions. The method was elucidated in Sect. 2.

  6. 6.

    Generate the points from the to-be-machined surface for interference checking: Obtain the maximum distance between two checking points using parameter e p and Eq. 18. Then implement the algorithm to obtain checking points.

  7. 7.

    Calculate collision-free tool orientations: Use CC points, open regions and checking points to generate appropriate tool orientations according to the methods described in Sect. 4.

The 3D part in Fig. 18a is one of the examples of implementation. It has the following dimensions: x=50 mm, y=30 mm, z=35 mm. Tooling data and machining parameters are set as follows: tool radius=1 mm, tool length=50 mm, scallop height=0.01 mm, maximum chord deviation=0.01 mm, and maximum allowable checking error=0.05 mm. Open regions are determined as shown in Fig. 18b. Figure 18, parts c and d, respectively presents the checking points and CC points. Figure 18e shows tool orientations generated for the machining of CC points. The total computation time spent in calculating tool orientations is 15 seconds.

Fig. 18a–e.
figure 18

First implementation example. a Part for machining. b Open regions. c Checking points. d CC points. e Collision-free tool path and tool orientation

Figure 19 shows the machining of an impeller as another example part used for implementation. The cutting tool applied has a radius of 3 mm and length of 50 mm. Figure 19a shows a tip point with coordinates (20.247, −49.632, 34.742) to be cut; the initial tool orientation and corresponding CL point are found as illustrated. No interference is observed and thus the initial tool orientation is used as the final orientation for machining. Figure 19c illustrates the machining of a point (11.491, −51.508, 20.499) located in the middle of the pressure surface. The initial tool orientation and the corresponding CL point are determined as shown in the figure. At this orientation, the cutting tool will collide with the workpiece. The procedure discussed in Sect. 4.2 yields a new tool orientation and updated CL point, as shown in Fig. 19e. The total time taken to calculate the tool path and the orientations for machining the entire pressure surface and suction surface is 124 s.

Fig. 19a–f.
figure 19

Second implementation example. a CC point, CL point and spindle axis of initial tool orientation for a tip point. b Solid model of initial tool orientation for a tip point. c CC point, CL point and spindle axis of initial tool orientation for a point on the pressure surface. d Solid model of initial tool orientation for a point on the pressure surface. e CC point, CL point and spindle axis of final tool orientation. f Solid model of final tool orientation

6 Conclusions

Five-axis NC machining is crucial to producing complex components in the aerospace and automotive industries. The main challenge of the machining process is to determine appropriate orientation of the cutting tool, so that the tool does not collide with the to-be-machined part as the tool moves. The conventional way to determine the orientation of the tool involves highly complex geometric calculation, and therefore is very time-consuming. This study attempts to solve the problem by using the concept of open regions and vector fields to find rapidly the cutter path and tool orientations for a part that possesses a cavity area for machining. An open region can be viewed as the entrance into the area of machining as well as the beginning of the undercut area. Geometric constraints imposed by the open regions are used in this work to obtain an initial orientation of the cutting tool for each CC point. Interference of the tool's orientation is checked to ensure that the cutter path is collision-free, by selecting only some likely points for calculation. If interference is found, then some vectors from the tool's spindle axis and volume of the collision are formed to find the appropriate offset direction and offset distance so that the tool is moved away from the collision volume. The complexity of calculation is greatly reduced in that no complex conversion of coordinates and angles is involved. A Windows-based prototype system, using ACIS as the geometric kernel, was also developed here to validate the proposed ideas and methods; the machining of example parts, such as the hub and shroud surfaces of an impeller, was tested. The short system computation time reflects the high efficiency of the proposed method.