# Filling Path Planning and Polygon Operations for Wire Arc Additive Manufacturing Process

Authors: Jiansheng Zhang; Qiuyun Wang; Guiqian Xiao; Jie Zhou
Journal: Mathematical Problems in Engineering
 (2021)

---

## Abstract

To improve the service life of hot forging die, the additive manufacturing algorithm and additive manufacturing device for die remanufacturing are developed. Firstly, a compound filling algorithm in which the inner zone is filled by linear scanning and the outer contour is filled by offsetting is developed in order to solve the problems encountered in filling path planning for wire arc additive manufacturing (WAAM) like staircase effect at marginal division, degenerated edge at outer contour, programming difficulty, and so forth. Meanwhile, the attitude control algorithm of welding gun is proposed to control the angle between welding gun and welding path so as to improve the welding forming quality. Secondly, the high-temperature and low-temperature wear resistances of Fe-based and Ni-based alloy are tested. The results show that Ni-based alloy has higher high-temperature wear resistance. Finally, a disabled crankshaft hot forging die is selected for application test and the results show that, using the techniques discussed in this paper, welding materials can be saved by more than 50% and machining cost can be saved by more than 60%. In addition, the surface of automatic-repaired die is smooth without oxidation, collapse, and other defects after forging 3000 times, which is much better than that of manual-repaired die.


---

## Body

## 1. Introduction

The complex cavity structure and harsh working environment often result in serious collapse deformation, wear, cracking, and other failures during the service cycle of a hot forging die. In addition, the manufacturing cost of hot forging dies is very high and therefore the daily remanufacturing of forging dies plays key roles [1, 2].In recent years, automatic WAAM technology has replaced the traditional manual welding method gradually because of its higher accuracy and better economic efficiency, which will be a development trend in hot forging die remanufacturing field [3–5]. Different from conventional powder-based 3D printing, the WAAM process needs to satisfy some welding requirements such as reducing repetitive filling or underfilling, air travel, and arc breaking [6, 7]. In WAAM system, due to the complexity and randomness of the object model, the cross sections after slicing may be very complicated and a filling algorithm that can adapt to any complex cross-sectional shape is needed [8, 9].The filling path planning will affect the efficiency and accuracy of the WAAM process directly. If the filling path planning is unreasonable, it may lead to defects such as cracks, obvious step effect at the edge, poor heat dissipation, and internal porosity in the forming parts [10, 11]. Thus, more and more scholars have realized the importance of filling path planning and devoted themselves to the study of path planning for WAAM process. For example, Shassere et al. [12] developed the Metal Big Area Additive Manufacturing (MBAAM) process, which is used to fabricate simple thin-walled specimens. Lei [13] proposed a novel multidirectional WAAM process and the positioning ball model, multidirectional slicing, and deposition process optimization were emphatically discussed for metal parts without supporting structures. Diourt’e [14] proposed the continuous three-dimensional path planning (CTPP) technology, which generated spiral-continuous path in path planning of WAAM process to ensure the ongoing supply of energy and materials. Ding et al. [7, 15] proposed a more adaptive medial axis transformation method in 2015 to eliminate internal vacancies and to improve the forming quality of formed parts. Furthermore, they proposed a nonparallel offsetting path in 2016, which can change the path spacing adaptively according to the cross-sectional shape, so as to realize variable-spacing path planning and to improve the forming accuracy of section contour. Jin et al. [16] proposed a filling strategy with local-micro adjustment that can effectively solve the overfilling or underfilling problem caused by uneven path spacing and too small corner. Based on the topological optimization results, Ponche et al. [17] designed a simplified filling path for blade, which can satisfy the working conditions. Yang [18] proposed an intelligent subregion path planning algorithm based on genetic algorithm, which has improvement in all aspects compared to traditional algorithm. Feng [19] optimized the filling path by using the advantage of Hilbert curve and a compound path is proposed. Preissler [20] developed a special transformation format that can realize the conversion between Cartesian coordinate system and code generated after path planning.The above researches have improved the forming efficiency and surface quality of WAAM process in different aspects. However, for hot forging die and other components that have complex cross sections, internal cavity, or thin-walled structure, the existing path planning methods, which are time-consuming and complicated to program [15, 21], are prone to step effect at the edges and degenerate edges of the offset polygon. Therefore, a compound filling algorithm that combined the linear scanning algorithm and contour offset algorithm is developed. Meanwhile, a solution that solves the intersection of inner and outer contours when offsetting is proposed and the polygon operation method of intersecting contours is emphatically discussed. In addition, the additive manufacturing device and the algorithms developed in this paper are tested in application.


## 2. Additive Manufacturing System

### 2.1. Additive Manufacturing Algorithm

In WAAM technology, the additive model is vertically discretized into several profiles. The flatness of each profile’s filling will affect the shape accuracy of additive manufacturing components. Therefore, this section focuses on the filling algorithms and welding torch attitude control method. There are three algorithms for profile filling discussed in this paper, namely, linear scanning filling, offset filling, and compound filling.


### 2.2. Linear Scanning Filling Algorithm

In the process of linear scanning filling, a set of parallel lines expressed as equation (1) are used to scan the contour:(1)y=kx+b,where k = tanθ and θ is the scanning angle between the scanning line and the x-axis. By changing θ, the scanning direction can be flexibly controlled.The maximum interceptbmax and the minimum intercept bmin can be obtained by calculating the line intercept b with slope k. Assuming that the width of the filling line is w, the line number N can be calculated using the following equation:(2)N=bmax−bminw1+k2,where bmax−bmin/w1+k^2 represents the perpendicular distance between the scanning lines that have the largest and smallest intercepts. This value is not necessarily an integer, so rounding error will occur when filling and the absolute value of the rounding error increases with the growth of the filling line spacing. Therefore, from the perspective of precision control, the smaller the filling line width is, the higher the precision is.As shown in Figure1, if points i and i+1 meet yi−kxi−bjyi+1−kxi+1−bj<0, these two points are on different sides of the line and equation (3) can be constructed to solve the intersection point:(3)y=kx+bj,y=yi+1−yixi+1−xix−xi+yi,where xi,xi+1,yi,yi+1 satisfies the constraint condition yi−kxi−bjyi+1−kxi+1−bj<0. Iterating over all the point coordinates on the contour and solving equation (3) if the above conditions are met, at the end of the iterative process, all intersection points on the contour can be solved. These endpoints are connected by an algorithm to form a continuous filling path. Since the interface shape has inner and outer contour boundary, the algorithm should eliminate the outer region and fill only the inner region automatically when constructing the filling path. In linear scanning filling, the intersection points between each scanning line and the contour are sorted incrementally according to the abscissa firstly, and then a tags array is established to do access record. After sorting, each scanning line will be traversed and two intersection points on this scanning line are taken to generate the filling path, which will be add to the path array. Then, the nearest intersection point on next scanning line will be found. If the distance is greater than a threshold value, this path generation ends and a new path generation process is started. If the distance is less than the threshold value, the traversal continues until all intersection points are accessed.Figure 1
Cross-sectional linear scanning filling.


### 2.3. Contour Offset Filling Algorithm

Considering that the hot forging die after WAAM needs to do finish machining, the 2D contour profile obtained by slicing needs to be offset to reserve allowance. In addition, if all cross sections are filled by the linear scanning method, jagged convex and concave defects on the boundary are inevitable and the bonding strength will be insufficient. Therefore, it is necessary to fill along the contour with offset filling algorithm and corresponding polygon offset algorithm must be developed.


#### 2.3.1. Simple Convex Polygon Offset Algorithm

Among all polygons, simple convex polygons are the easiest because they have neither concave nor self-intersecting points. These polygons are composed of a series of vertexes and to offset the polygon is to offset the vertexes.As shown in Figure2, a⟶ is a unit vector of PiPi+1 and b⟶ is a unit vector of Pi−1Pi. By adding a⟶ to b⟶, vertex Pi’s vector in the offset direction can be obtained. According to the vector operation rule, the calculation formula of the included angle θ is θ=1/2arccosa⟶×b⟶/a⟶b⟶, and the offset distance of vertex can be calculated as d/sinθ. Therefore, the new coordinates of the vertexes can be easily calculated.Figure 2
The offset of simple convex contour.


#### 2.3.2. Complex Polygon Offset Algorithm

For complex polygons, the above contour offset algorithm probably leads to self-intersection and the polygon with the same orientation as the original one should be retained after splitting.As shown in Figure3, more polygons are generated after a polygon is offset and the determining factors are geometric shape of the original polygon and the offset distance. If offset distance is fixed, the more corners the original polygon has, the more polygons it will produce. When the shape of the filled polygon is settled, the greater the distance is, the more polygons may result from the offset. Meanwhile, for many complex parts, the inner and outer contours often intersect when offsetting, and therefore the polygon operation methods are very important, which is emphatically discussed in the next section.Figure 3
Offset of polygons with four and six convexes: (a) four-convex polygon with large-distance offset; (b) four-convex polygon with small-distance offset; (c) six-convex polygon with large-distance offset; (d) six-convex polygon with small-distance offset.
(a)(b)(c)(d)The join and subtract operations of polygons.


#### 2.3.3. Self-Intersection of Polygons

Many parts have thin-walled structures and the boundary distance between their inner boundary and outer boundary is small, which results in intersections when offsetting despite the small offset distance.As shown in Figure4, the inner and outer contours intersect after offsetting. The solution to this situation is as follows: Firstly, all inner contours and all outer contours are joined; then, if the inner and outer contours intersect, the subtract operation is conducted; finally, the filling algorithm is applied to the contour after subtract operation to get the filling path. It can be seen that the join and subtract operations of polygon are very important to solve the intersection of inner and outer contours. Next, we focus on the geometric operation between polygons.Figure 4
The diagram of self-intersection filling path planning: (a) contour offset, (b) join operation, (c) subtract operation, and (d) filling.
(a)(b)(c)(d)


#### 2.3.4. Multiple Intersection Points

As shown in Figure5, two polygons intersect and become one polygon after join operation. The calculation process is as follows: starting from intersection point B of R polygon, the concavity and convexity of point B are judged by the cross product of the vector in R whose terminal point is B and the vector in S whose starting point is B. If Point B is a concave point, then it traverses S polygon; if point B is a convex point, then it continues to traverse R polygon. When a concave point is traversed, this process turns to another polygon, otherwise continuing to traverse the current polygon until returning to the starting point. If there is an untraversed intersection point when returning to the starting point, an intersection point should be selected as the starting point, and repeat the above process.Figure 5
The diagram of join and subtract operations with multiple intersection points: (a) original polygon, (b)R∪S, and (c) R–S.
(a)(b)(c)Using this algorithm, we can get the heavy-line polygon afterR∪S in Figure 5(b). According to the geometric relationship, R−S=R∩S¯, where S¯ is a polygon in the opposite direction of S, and the subtract operation can be transformed to intersection operation. The intersection operation is slightly different from the join operation where the traversed polygon is opposite to the join operation after judging the convexity of intersection point.


#### 2.3.5. One Intersection Point

There are two situations in which two polygons have one intersection point. One is thatR does not contain S, and the other is that R contains S.As shown in Figure6, R does not contain S. In this case, to judge whether S and R are in the same direction is needed firstly for the join operation. If their direction is the same, the S boundary is added to the R boundary at the intersection point; if it is reversed, the direction of S should be changed into R’s direction, and then insert S to the outline chain list of R. For the subtract operation, since there is only one intersection point, the result of subtract operation is still R.Figure 6
The join and subtract operations ofR (do not contain S): (a) original polygon, (b) R∪S, and (c) R–S.
(a)(b)(c)Figure7 shows the case in which R contains S and the result of the join operation is still R. The steps of the subtract operation are as follows: first, judge whether the direction of S and R are the same; then, if they are in the same direction, turn the direction of S and insert its contour chain list into R at the intersection point; if S and R are not in the same direction, insert the S contour chain list directly into R at the intersection point.Figure 7
The join and subtract operations ofR (contains S): (a) original polygon, (b) R∪S, and (c) R–S.
(a)(b)(c)


### 2.4. Compound Filling Algorithm

In the contour offset filling algorithm, the filling boundary is smooth. However, if the offset distance is too large or the contour shape is complex, the polygon will have degenerated edges after offsetting, which will result in underfilling. As shown in Figure8(a), the size of the red area (empty space after offsetting) may be much larger or smaller than the weld width, which will be underfilling or overfilling defects.Figure 8
Filling effect of (a) contour offset filling algorithm and (b) linear scanning filling algorithm.
(a)(b)In Figure8(b), the internal area filled by linear scanning filling algorithm is very uniform, but many zigzag crosses occur at the boundary area. If a large filling gap is used, serious defects such as material shortage may appear in the contour area, and the machining allowance of the parts is difficult to control. By filling the inner zone with linear scanning algorithm and filling the outer contour with contour offset filling algorithm, both advantages of these two algorithms can be taken and the object model can be filled uniformly inside and smoothly at the margin area.


### 2.5. Attitude Control for Welding Gun

The previous section describes the filling path planning of the vertically discreted cross section, which is the moving path of the welding gun. In addition to the moving path of the welding gun, the attitude of the welding gun also has an important effect on the welding quality. Therefore, this section focuses on the attitude control algorithm of the welding gun. In WAAM technology, the Tool Centre Point (TCP) of the joint robot represents the end of the welding gun. The TCP attitude is usually described by the Quaternion method, which is convenient for the calculation of velocity and acceleration but abstract for attitude design. Therefore, Euler angles are introduced to describe the attitude of TCP in the design process, which are then converted into the quaternion for calculation in the robot system. From Figure9, we can see that Euler angles are composed of three angles: yaw angle φ, pitch angle θ, and roll angle Φ, which are rotation angles around the Z-axis, Y-axis, and X-axis, respectively. The rotation order must follow the rotation sequence of Z-, Y-, and X-axes.Figure 9
Euler angles description of rigid body attitude: (a) yaw angle; (b) pitch angle; (c) roll angle.
(a)(b)(c)When a rigid body in a local coordinate system is rotated by three Euler angles, the coordinates before and after rotation satisfy the following coordinate transformation relations:(4)x0y0z0=cosφ−sinφ0sinφcosφ0001cosθ0sinθ010−sinθ0cosθ1000cosΦ−sinΦ0sinΦcosΦx′y′z′,where, x0, y0, and z0 are the original coordinates and x′, y′, and z′ are the coordinates after rotation. The transformation relationship between Euler angles and four elements is as follows:(5)q0=cosφ2cosθ2cosΦ2−sinφ2sinθ2sinΦ2q1=cosφ2cosθ2sinΦ2+sinφ2sinθ2cosΦ2q2=cosφ2sinθ2cosΦ2−sinφ2cosθ2sinΦ2q3=sinφ2cosθ2cosΦ2+cosφ2sinθ2sinΦ2..For WAAM process, the robot’s TCP is the welding gun and the posture of the welding torch is very important to the welding quality and fusion performance.As shown in Figure10, the projection of the welding gun on the plane of the contour must always be perpendicular to the tangent direction of the welding path. The yaw angle φ remains zero and the attitude of the welding torch is controlled by changing the pitch angle θ and rolling angle Φ. The angle between the welding gun and the plane of the contour is defined as the plane inclination angle γ, which affects the fusion performance significantly. In Figure 10, OT⟶ represents the tangent vector of the welding path at the welding point, and OF⟶ is the normal vector that is perpendicular to the tangent vector. x−O−y vector is the global coordinate system and x'−O−y' is the coordinate system of the new posture. It can be seen that(6)OF⟶=−dy,dx,0OT⟶=dx,dy,0FG⟶=0,0,tanγHG⟶=0,dx,0OH⟶=OF⟶+FG⟶−HG⟶,where dx and dy represent the increment of abscissa and ordinate from the welding point to the next point. According to the vector relation, we can get the Euler angles for the welding torch attitude control:(7)φ=0θ=arccosOH⟶⋅FG⟶OH⟶FG⟶Φ=arccosOH⟶⋅FG⟶OH⟶FG⟶,Figure 10
Schematic diagram of welding gun attitude control.For a certain trajectory, all parameters and data in the above formula can be determined exceptγ. The value of γ is an external input parameter related to the welding fusion effect, usually 60 degrees. Simulation of a certain trajectory is implemented with the attitude control algorithm given above, and the results are shown in Figure 11.Figure 11
Robot attitudes in different positions: (a) back region; (b) front region; (c) right region.
(a)(b)(c)As shown in Figure11, the projection of the welding gun on track plane is always perpendicular to the tangent direction of the curve, and the welding gun is always at a fixed angle to the plane.


### 2.6. Additive Manufacturing Device

ABB-IRB2600 is selected as the welding robot. It has 6 axes, which makes it flexible to realize attitude control. In addition, its fourth axis has a range of 800 degrees and therefore it is not easy to reach the dead point in the welding process.As shown in Figure12, the hardware of the WAAM system includes welding, hammering, heating vehicle, and other subsystems. The ABB-IRB2600 robot is used as a welding actuator and the triaxial trestle robot is used for hammer actuators. The heating vehicle is used to keep the die at 450℃ in the process of additive manufacturing.Figure 12
Additive manufacturing robot.


## 2.1. Additive Manufacturing Algorithm

In WAAM technology, the additive model is vertically discretized into several profiles. The flatness of each profile’s filling will affect the shape accuracy of additive manufacturing components. Therefore, this section focuses on the filling algorithms and welding torch attitude control method. There are three algorithms for profile filling discussed in this paper, namely, linear scanning filling, offset filling, and compound filling.


## 2.2. Linear Scanning Filling Algorithm

In the process of linear scanning filling, a set of parallel lines expressed as equation (1) are used to scan the contour:(1)y=kx+b,where k = tanθ and θ is the scanning angle between the scanning line and the x-axis. By changing θ, the scanning direction can be flexibly controlled.The maximum interceptbmax and the minimum intercept bmin can be obtained by calculating the line intercept b with slope k. Assuming that the width of the filling line is w, the line number N can be calculated using the following equation:(2)N=bmax−bminw1+k2,where bmax−bmin/w1+k^2 represents the perpendicular distance between the scanning lines that have the largest and smallest intercepts. This value is not necessarily an integer, so rounding error will occur when filling and the absolute value of the rounding error increases with the growth of the filling line spacing. Therefore, from the perspective of precision control, the smaller the filling line width is, the higher the precision is.As shown in Figure1, if points i and i+1 meet yi−kxi−bjyi+1−kxi+1−bj<0, these two points are on different sides of the line and equation (3) can be constructed to solve the intersection point:(3)y=kx+bj,y=yi+1−yixi+1−xix−xi+yi,where xi,xi+1,yi,yi+1 satisfies the constraint condition yi−kxi−bjyi+1−kxi+1−bj<0. Iterating over all the point coordinates on the contour and solving equation (3) if the above conditions are met, at the end of the iterative process, all intersection points on the contour can be solved. These endpoints are connected by an algorithm to form a continuous filling path. Since the interface shape has inner and outer contour boundary, the algorithm should eliminate the outer region and fill only the inner region automatically when constructing the filling path. In linear scanning filling, the intersection points between each scanning line and the contour are sorted incrementally according to the abscissa firstly, and then a tags array is established to do access record. After sorting, each scanning line will be traversed and two intersection points on this scanning line are taken to generate the filling path, which will be add to the path array. Then, the nearest intersection point on next scanning line will be found. If the distance is greater than a threshold value, this path generation ends and a new path generation process is started. If the distance is less than the threshold value, the traversal continues until all intersection points are accessed.Figure 1
Cross-sectional linear scanning filling.


## 2.3. Contour Offset Filling Algorithm

Considering that the hot forging die after WAAM needs to do finish machining, the 2D contour profile obtained by slicing needs to be offset to reserve allowance. In addition, if all cross sections are filled by the linear scanning method, jagged convex and concave defects on the boundary are inevitable and the bonding strength will be insufficient. Therefore, it is necessary to fill along the contour with offset filling algorithm and corresponding polygon offset algorithm must be developed.


### 2.3.1. Simple Convex Polygon Offset Algorithm

Among all polygons, simple convex polygons are the easiest because they have neither concave nor self-intersecting points. These polygons are composed of a series of vertexes and to offset the polygon is to offset the vertexes.As shown in Figure2, a⟶ is a unit vector of PiPi+1 and b⟶ is a unit vector of Pi−1Pi. By adding a⟶ to b⟶, vertex Pi’s vector in the offset direction can be obtained. According to the vector operation rule, the calculation formula of the included angle θ is θ=1/2arccosa⟶×b⟶/a⟶b⟶, and the offset distance of vertex can be calculated as d/sinθ. Therefore, the new coordinates of the vertexes can be easily calculated.Figure 2
The offset of simple convex contour.


### 2.3.2. Complex Polygon Offset Algorithm

For complex polygons, the above contour offset algorithm probably leads to self-intersection and the polygon with the same orientation as the original one should be retained after splitting.As shown in Figure3, more polygons are generated after a polygon is offset and the determining factors are geometric shape of the original polygon and the offset distance. If offset distance is fixed, the more corners the original polygon has, the more polygons it will produce. When the shape of the filled polygon is settled, the greater the distance is, the more polygons may result from the offset. Meanwhile, for many complex parts, the inner and outer contours often intersect when offsetting, and therefore the polygon operation methods are very important, which is emphatically discussed in the next section.Figure 3
Offset of polygons with four and six convexes: (a) four-convex polygon with large-distance offset; (b) four-convex polygon with small-distance offset; (c) six-convex polygon with large-distance offset; (d) six-convex polygon with small-distance offset.
(a)(b)(c)(d)The join and subtract operations of polygons.


### 2.3.3. Self-Intersection of Polygons

Many parts have thin-walled structures and the boundary distance between their inner boundary and outer boundary is small, which results in intersections when offsetting despite the small offset distance.As shown in Figure4, the inner and outer contours intersect after offsetting. The solution to this situation is as follows: Firstly, all inner contours and all outer contours are joined; then, if the inner and outer contours intersect, the subtract operation is conducted; finally, the filling algorithm is applied to the contour after subtract operation to get the filling path. It can be seen that the join and subtract operations of polygon are very important to solve the intersection of inner and outer contours. Next, we focus on the geometric operation between polygons.Figure 4
The diagram of self-intersection filling path planning: (a) contour offset, (b) join operation, (c) subtract operation, and (d) filling.
(a)(b)(c)(d)


### 2.3.4. Multiple Intersection Points

As shown in Figure5, two polygons intersect and become one polygon after join operation. The calculation process is as follows: starting from intersection point B of R polygon, the concavity and convexity of point B are judged by the cross product of the vector in R whose terminal point is B and the vector in S whose starting point is B. If Point B is a concave point, then it traverses S polygon; if point B is a convex point, then it continues to traverse R polygon. When a concave point is traversed, this process turns to another polygon, otherwise continuing to traverse the current polygon until returning to the starting point. If there is an untraversed intersection point when returning to the starting point, an intersection point should be selected as the starting point, and repeat the above process.Figure 5
The diagram of join and subtract operations with multiple intersection points: (a) original polygon, (b)R∪S, and (c) R–S.
(a)(b)(c)Using this algorithm, we can get the heavy-line polygon afterR∪S in Figure 5(b). According to the geometric relationship, R−S=R∩S¯, where S¯ is a polygon in the opposite direction of S, and the subtract operation can be transformed to intersection operation. The intersection operation is slightly different from the join operation where the traversed polygon is opposite to the join operation after judging the convexity of intersection point.


### 2.3.5. One Intersection Point

There are two situations in which two polygons have one intersection point. One is thatR does not contain S, and the other is that R contains S.As shown in Figure6, R does not contain S. In this case, to judge whether S and R are in the same direction is needed firstly for the join operation. If their direction is the same, the S boundary is added to the R boundary at the intersection point; if it is reversed, the direction of S should be changed into R’s direction, and then insert S to the outline chain list of R. For the subtract operation, since there is only one intersection point, the result of subtract operation is still R.Figure 6
The join and subtract operations ofR (do not contain S): (a) original polygon, (b) R∪S, and (c) R–S.
(a)(b)(c)Figure7 shows the case in which R contains S and the result of the join operation is still R. The steps of the subtract operation are as follows: first, judge whether the direction of S and R are the same; then, if they are in the same direction, turn the direction of S and insert its contour chain list into R at the intersection point; if S and R are not in the same direction, insert the S contour chain list directly into R at the intersection point.Figure 7
The join and subtract operations ofR (contains S): (a) original polygon, (b) R∪S, and (c) R–S.
(a)(b)(c)


## 2.3.1. Simple Convex Polygon Offset Algorithm

Among all polygons, simple convex polygons are the easiest because they have neither concave nor self-intersecting points. These polygons are composed of a series of vertexes and to offset the polygon is to offset the vertexes.As shown in Figure2, a⟶ is a unit vector of PiPi+1 and b⟶ is a unit vector of Pi−1Pi. By adding a⟶ to b⟶, vertex Pi’s vector in the offset direction can be obtained. According to the vector operation rule, the calculation formula of the included angle θ is θ=1/2arccosa⟶×b⟶/a⟶b⟶, and the offset distance of vertex can be calculated as d/sinθ. Therefore, the new coordinates of the vertexes can be easily calculated.Figure 2
The offset of simple convex contour.


## 2.3.2. Complex Polygon Offset Algorithm

For complex polygons, the above contour offset algorithm probably leads to self-intersection and the polygon with the same orientation as the original one should be retained after splitting.As shown in Figure3, more polygons are generated after a polygon is offset and the determining factors are geometric shape of the original polygon and the offset distance. If offset distance is fixed, the more corners the original polygon has, the more polygons it will produce. When the shape of the filled polygon is settled, the greater the distance is, the more polygons may result from the offset. Meanwhile, for many complex parts, the inner and outer contours often intersect when offsetting, and therefore the polygon operation methods are very important, which is emphatically discussed in the next section.Figure 3
Offset of polygons with four and six convexes: (a) four-convex polygon with large-distance offset; (b) four-convex polygon with small-distance offset; (c) six-convex polygon with large-distance offset; (d) six-convex polygon with small-distance offset.
(a)(b)(c)(d)The join and subtract operations of polygons.


## 2.3.3. Self-Intersection of Polygons

Many parts have thin-walled structures and the boundary distance between their inner boundary and outer boundary is small, which results in intersections when offsetting despite the small offset distance.As shown in Figure4, the inner and outer contours intersect after offsetting. The solution to this situation is as follows: Firstly, all inner contours and all outer contours are joined; then, if the inner and outer contours intersect, the subtract operation is conducted; finally, the filling algorithm is applied to the contour after subtract operation to get the filling path. It can be seen that the join and subtract operations of polygon are very important to solve the intersection of inner and outer contours. Next, we focus on the geometric operation between polygons.Figure 4
The diagram of self-intersection filling path planning: (a) contour offset, (b) join operation, (c) subtract operation, and (d) filling.
(a)(b)(c)(d)


## 2.3.4. Multiple Intersection Points

As shown in Figure5, two polygons intersect and become one polygon after join operation. The calculation process is as follows: starting from intersection point B of R polygon, the concavity and convexity of point B are judged by the cross product of the vector in R whose terminal point is B and the vector in S whose starting point is B. If Point B is a concave point, then it traverses S polygon; if point B is a convex point, then it continues to traverse R polygon. When a concave point is traversed, this process turns to another polygon, otherwise continuing to traverse the current polygon until returning to the starting point. If there is an untraversed intersection point when returning to the starting point, an intersection point should be selected as the starting point, and repeat the above process.Figure 5
The diagram of join and subtract operations with multiple intersection points: (a) original polygon, (b)R∪S, and (c) R–S.
(a)(b)(c)Using this algorithm, we can get the heavy-line polygon afterR∪S in Figure 5(b). According to the geometric relationship, R−S=R∩S¯, where S¯ is a polygon in the opposite direction of S, and the subtract operation can be transformed to intersection operation. The intersection operation is slightly different from the join operation where the traversed polygon is opposite to the join operation after judging the convexity of intersection point.


## 2.3.5. One Intersection Point

There are two situations in which two polygons have one intersection point. One is thatR does not contain S, and the other is that R contains S.As shown in Figure6, R does not contain S. In this case, to judge whether S and R are in the same direction is needed firstly for the join operation. If their direction is the same, the S boundary is added to the R boundary at the intersection point; if it is reversed, the direction of S should be changed into R’s direction, and then insert S to the outline chain list of R. For the subtract operation, since there is only one intersection point, the result of subtract operation is still R.Figure 6
The join and subtract operations ofR (do not contain S): (a) original polygon, (b) R∪S, and (c) R–S.
(a)(b)(c)Figure7 shows the case in which R contains S and the result of the join operation is still R. The steps of the subtract operation are as follows: first, judge whether the direction of S and R are the same; then, if they are in the same direction, turn the direction of S and insert its contour chain list into R at the intersection point; if S and R are not in the same direction, insert the S contour chain list directly into R at the intersection point.Figure 7
The join and subtract operations ofR (contains S): (a) original polygon, (b) R∪S, and (c) R–S.
(a)(b)(c)


## 2.4. Compound Filling Algorithm

In the contour offset filling algorithm, the filling boundary is smooth. However, if the offset distance is too large or the contour shape is complex, the polygon will have degenerated edges after offsetting, which will result in underfilling. As shown in Figure8(a), the size of the red area (empty space after offsetting) may be much larger or smaller than the weld width, which will be underfilling or overfilling defects.Figure 8
Filling effect of (a) contour offset filling algorithm and (b) linear scanning filling algorithm.
(a)(b)In Figure8(b), the internal area filled by linear scanning filling algorithm is very uniform, but many zigzag crosses occur at the boundary area. If a large filling gap is used, serious defects such as material shortage may appear in the contour area, and the machining allowance of the parts is difficult to control. By filling the inner zone with linear scanning algorithm and filling the outer contour with contour offset filling algorithm, both advantages of these two algorithms can be taken and the object model can be filled uniformly inside and smoothly at the margin area.


## 2.5. Attitude Control for Welding Gun

The previous section describes the filling path planning of the vertically discreted cross section, which is the moving path of the welding gun. In addition to the moving path of the welding gun, the attitude of the welding gun also has an important effect on the welding quality. Therefore, this section focuses on the attitude control algorithm of the welding gun. In WAAM technology, the Tool Centre Point (TCP) of the joint robot represents the end of the welding gun. The TCP attitude is usually described by the Quaternion method, which is convenient for the calculation of velocity and acceleration but abstract for attitude design. Therefore, Euler angles are introduced to describe the attitude of TCP in the design process, which are then converted into the quaternion for calculation in the robot system. From Figure9, we can see that Euler angles are composed of three angles: yaw angle φ, pitch angle θ, and roll angle Φ, which are rotation angles around the Z-axis, Y-axis, and X-axis, respectively. The rotation order must follow the rotation sequence of Z-, Y-, and X-axes.Figure 9
Euler angles description of rigid body attitude: (a) yaw angle; (b) pitch angle; (c) roll angle.
(a)(b)(c)When a rigid body in a local coordinate system is rotated by three Euler angles, the coordinates before and after rotation satisfy the following coordinate transformation relations:(4)x0y0z0=cosφ−sinφ0sinφcosφ0001cosθ0sinθ010−sinθ0cosθ1000cosΦ−sinΦ0sinΦcosΦx′y′z′,where, x0, y0, and z0 are the original coordinates and x′, y′, and z′ are the coordinates after rotation. The transformation relationship between Euler angles and four elements is as follows:(5)q0=cosφ2cosθ2cosΦ2−sinφ2sinθ2sinΦ2q1=cosφ2cosθ2sinΦ2+sinφ2sinθ2cosΦ2q2=cosφ2sinθ2cosΦ2−sinφ2cosθ2sinΦ2q3=sinφ2cosθ2cosΦ2+cosφ2sinθ2sinΦ2..For WAAM process, the robot’s TCP is the welding gun and the posture of the welding torch is very important to the welding quality and fusion performance.As shown in Figure10, the projection of the welding gun on the plane of the contour must always be perpendicular to the tangent direction of the welding path. The yaw angle φ remains zero and the attitude of the welding torch is controlled by changing the pitch angle θ and rolling angle Φ. The angle between the welding gun and the plane of the contour is defined as the plane inclination angle γ, which affects the fusion performance significantly. In Figure 10, OT⟶ represents the tangent vector of the welding path at the welding point, and OF⟶ is the normal vector that is perpendicular to the tangent vector. x−O−y vector is the global coordinate system and x'−O−y' is the coordinate system of the new posture. It can be seen that(6)OF⟶=−dy,dx,0OT⟶=dx,dy,0FG⟶=0,0,tanγHG⟶=0,dx,0OH⟶=OF⟶+FG⟶−HG⟶,where dx and dy represent the increment of abscissa and ordinate from the welding point to the next point. According to the vector relation, we can get the Euler angles for the welding torch attitude control:(7)φ=0θ=arccosOH⟶⋅FG⟶OH⟶FG⟶Φ=arccosOH⟶⋅FG⟶OH⟶FG⟶,Figure 10
Schematic diagram of welding gun attitude control.For a certain trajectory, all parameters and data in the above formula can be determined exceptγ. The value of γ is an external input parameter related to the welding fusion effect, usually 60 degrees. Simulation of a certain trajectory is implemented with the attitude control algorithm given above, and the results are shown in Figure 11.Figure 11
Robot attitudes in different positions: (a) back region; (b) front region; (c) right region.
(a)(b)(c)As shown in Figure11, the projection of the welding gun on track plane is always perpendicular to the tangent direction of the curve, and the welding gun is always at a fixed angle to the plane.


## 2.6. Additive Manufacturing Device

ABB-IRB2600 is selected as the welding robot. It has 6 axes, which makes it flexible to realize attitude control. In addition, its fourth axis has a range of 800 degrees and therefore it is not easy to reach the dead point in the welding process.As shown in Figure12, the hardware of the WAAM system includes welding, hammering, heating vehicle, and other subsystems. The ABB-IRB2600 robot is used as a welding actuator and the triaxial trestle robot is used for hammer actuators. The heating vehicle is used to keep the die at 450℃ in the process of additive manufacturing.Figure 12
Additive manufacturing robot.


## 3. Application

### 3.1. Material

An important application area of WAAM technology is the repair of failed forging dies. The service conditions of hot forging die are harsh and the high-temperature wear resistance of welding materials has great influence on the service life of hot forging die. Thus, the Ni-based alloy with good high-temperature wear resistance is used as the additive material in this paper. This section will analyze the high-temperature friction properties of Fe-based alloy and Ni-based alloy.The high-temperature wear tests of Fe-based alloy and Ni-based alloy were carried out on a high-speed linear reciprocating friction tester. The maximum heating temperature is 600°C and the accuracy is 1°C. The sample size is Φ25 mm × 3 mm. In order to avoid the influence of sample surface roughness on the wear test, 1200# sandpaper was used to polish the surface of Ni-based and Fe-based alloy samples before the test began. The composition of the experimental materials is shown in Table1.Table 1
Chemical compositions (wt. %).
MaterialsCSiMnCrMoWVNiCoFeNi-based0.0350.362.6515.881.33——Bal.—7.75Fe-based0.240.751.005.432.421.790.35——Bal.Considering the service temperature of the hot forging die, the friction test was carried out at 25°C and 500°C. After 60 minutes of friction, the sample was cut from the middle to observe the cross-sectional profile of the friction sample, as shown in Figure13.Figure 13
Worn track width and depth comparison for Fe-based and Ni-based alloy at low and high temperature. (a) 25°C; (b) 500°C.
(a)(b)At low temperature, the wear resistance of Fe-based alloy is greater than that of Ni-based alloy, and the wear volume is relatively small. However, under high temperature, the wear resistance of Ni-based alloy is better than that of Fe-based alloy. The wear resistance of Ni-based alloy is significantly improved, and the wear resistance of Fe-based alloy is significantly reduced. Therefore, the Ni-based alloy has better wear resistance at high temperature and can improve the wear resistance of hot forging die. The process parameters of Ni-based alloy are as shown in Table2.Table 2
Process parameters.
Wire diameterWelding voltage (V)Welding current (A)Wire feed speedWelding speedWeld width (mm)Weld height (mm)∅1.6mm323006000 mm/min450 mm/min11.43.1


### 3.2. Remanufacturing Experiment

#### 3.2.1. Filling Path Generation

Taking the filling path planning of hot forging die as an example, after obtaining the target model and slicing it into 2D layers, the filling path is calculated in the self-developed filling path planning software and the results are shown in Figure14. Although the cross sections after slicing are complex, the filling path obtained in this paper works excellently. The welding track of each layer is composed of several colours and the same colour means that no arc breaking exists in filling. According to the results of filling path planning, the filling process is stable and the filling quality is good.Figure 14
The filling path of some typical layers.


#### 3.2.2. Simulation and Application Test

After obtaining the filling path, the planned path should be transferred to the actuator for the WAAM process. Because the actuator has its unique instruction set, it is necessary to convert the filling path into the machine code that the actuator can recognize. After completing the above conversion operation, WAAM process is simulated, as shown in Figure15.Figure 15
Simulation of automatic WAAM process for hot forging die.The simulation results in Figure15 show that the movement of the welding torch in WAAM process is reasonable and there is no abnormal situation. In addition, the inner cavity area of the crankshaft hot forging die can also be clearly displayed in simulation.After simulation test, the application test is carried out. As shown in Figure16(a), the internal surface of the die after crack removal is extremely irregular, and the internal cavity has been almost completely removed. After WAAM process, the internal cavity of the die has been formed and the whole process as well as the filling quality is good. In addition, from the machining process, it can be seen that there is very little machining allowance (the theoretical allowance is 2 mm), and the efficiency is also improved.Figure 16
(a) After crack removing; (b) after automatic WAAM; (c) during machining; (d) qualified product.As shown in Figure17, compared with manual repair method using full-length welding, the automatic repair is profile-followed, which can greatly save material and machining cost significantly. The results show that, using the techniques discussed in this paper, welding materials can be saved by more than 50% and machining cost can be saved by more than 60%. In addition, the Ni-based alloy has been used in the remanufacturing of hot forge die, and the high-temperature wear resistance as well as the service life of hot forge die is greatly improved. The surface of the automatic-repaired die is smooth without oxidation, collapse, and other defects after forging 3000 times, which is much better than that of manual-repaired die.Figure 17
Comparison before and after service: (a) automatic repair before service, (b) manual repair before service, (c) automatic repair after service, and (d) manual repair after service.


## 3.1. Material

An important application area of WAAM technology is the repair of failed forging dies. The service conditions of hot forging die are harsh and the high-temperature wear resistance of welding materials has great influence on the service life of hot forging die. Thus, the Ni-based alloy with good high-temperature wear resistance is used as the additive material in this paper. This section will analyze the high-temperature friction properties of Fe-based alloy and Ni-based alloy.The high-temperature wear tests of Fe-based alloy and Ni-based alloy were carried out on a high-speed linear reciprocating friction tester. The maximum heating temperature is 600°C and the accuracy is 1°C. The sample size is Φ25 mm × 3 mm. In order to avoid the influence of sample surface roughness on the wear test, 1200# sandpaper was used to polish the surface of Ni-based and Fe-based alloy samples before the test began. The composition of the experimental materials is shown in Table1.Table 1
Chemical compositions (wt. %).
MaterialsCSiMnCrMoWVNiCoFeNi-based0.0350.362.6515.881.33——Bal.—7.75Fe-based0.240.751.005.432.421.790.35——Bal.Considering the service temperature of the hot forging die, the friction test was carried out at 25°C and 500°C. After 60 minutes of friction, the sample was cut from the middle to observe the cross-sectional profile of the friction sample, as shown in Figure13.Figure 13
Worn track width and depth comparison for Fe-based and Ni-based alloy at low and high temperature. (a) 25°C; (b) 500°C.
(a)(b)At low temperature, the wear resistance of Fe-based alloy is greater than that of Ni-based alloy, and the wear volume is relatively small. However, under high temperature, the wear resistance of Ni-based alloy is better than that of Fe-based alloy. The wear resistance of Ni-based alloy is significantly improved, and the wear resistance of Fe-based alloy is significantly reduced. Therefore, the Ni-based alloy has better wear resistance at high temperature and can improve the wear resistance of hot forging die. The process parameters of Ni-based alloy are as shown in Table2.Table 2
Process parameters.
Wire diameterWelding voltage (V)Welding current (A)Wire feed speedWelding speedWeld width (mm)Weld height (mm)∅1.6mm323006000 mm/min450 mm/min11.43.1


## 3.2. Remanufacturing Experiment

### 3.2.1. Filling Path Generation

Taking the filling path planning of hot forging die as an example, after obtaining the target model and slicing it into 2D layers, the filling path is calculated in the self-developed filling path planning software and the results are shown in Figure14. Although the cross sections after slicing are complex, the filling path obtained in this paper works excellently. The welding track of each layer is composed of several colours and the same colour means that no arc breaking exists in filling. According to the results of filling path planning, the filling process is stable and the filling quality is good.Figure 14
The filling path of some typical layers.


### 3.2.2. Simulation and Application Test

After obtaining the filling path, the planned path should be transferred to the actuator for the WAAM process. Because the actuator has its unique instruction set, it is necessary to convert the filling path into the machine code that the actuator can recognize. After completing the above conversion operation, WAAM process is simulated, as shown in Figure15.Figure 15
Simulation of automatic WAAM process for hot forging die.The simulation results in Figure15 show that the movement of the welding torch in WAAM process is reasonable and there is no abnormal situation. In addition, the inner cavity area of the crankshaft hot forging die can also be clearly displayed in simulation.After simulation test, the application test is carried out. As shown in Figure16(a), the internal surface of the die after crack removal is extremely irregular, and the internal cavity has been almost completely removed. After WAAM process, the internal cavity of the die has been formed and the whole process as well as the filling quality is good. In addition, from the machining process, it can be seen that there is very little machining allowance (the theoretical allowance is 2 mm), and the efficiency is also improved.Figure 16
(a) After crack removing; (b) after automatic WAAM; (c) during machining; (d) qualified product.As shown in Figure17, compared with manual repair method using full-length welding, the automatic repair is profile-followed, which can greatly save material and machining cost significantly. The results show that, using the techniques discussed in this paper, welding materials can be saved by more than 50% and machining cost can be saved by more than 60%. In addition, the Ni-based alloy has been used in the remanufacturing of hot forge die, and the high-temperature wear resistance as well as the service life of hot forge die is greatly improved. The surface of the automatic-repaired die is smooth without oxidation, collapse, and other defects after forging 3000 times, which is much better than that of manual-repaired die.Figure 17
Comparison before and after service: (a) automatic repair before service, (b) manual repair before service, (c) automatic repair after service, and (d) manual repair after service.


## 3.2.1. Filling Path Generation

Taking the filling path planning of hot forging die as an example, after obtaining the target model and slicing it into 2D layers, the filling path is calculated in the self-developed filling path planning software and the results are shown in Figure14. Although the cross sections after slicing are complex, the filling path obtained in this paper works excellently. The welding track of each layer is composed of several colours and the same colour means that no arc breaking exists in filling. According to the results of filling path planning, the filling process is stable and the filling quality is good.Figure 14
The filling path of some typical layers.


## 3.2.2. Simulation and Application Test

After obtaining the filling path, the planned path should be transferred to the actuator for the WAAM process. Because the actuator has its unique instruction set, it is necessary to convert the filling path into the machine code that the actuator can recognize. After completing the above conversion operation, WAAM process is simulated, as shown in Figure15.Figure 15
Simulation of automatic WAAM process for hot forging die.The simulation results in Figure15 show that the movement of the welding torch in WAAM process is reasonable and there is no abnormal situation. In addition, the inner cavity area of the crankshaft hot forging die can also be clearly displayed in simulation.After simulation test, the application test is carried out. As shown in Figure16(a), the internal surface of the die after crack removal is extremely irregular, and the internal cavity has been almost completely removed. After WAAM process, the internal cavity of the die has been formed and the whole process as well as the filling quality is good. In addition, from the machining process, it can be seen that there is very little machining allowance (the theoretical allowance is 2 mm), and the efficiency is also improved.Figure 16
(a) After crack removing; (b) after automatic WAAM; (c) during machining; (d) qualified product.As shown in Figure17, compared with manual repair method using full-length welding, the automatic repair is profile-followed, which can greatly save material and machining cost significantly. The results show that, using the techniques discussed in this paper, welding materials can be saved by more than 50% and machining cost can be saved by more than 60%. In addition, the Ni-based alloy has been used in the remanufacturing of hot forge die, and the high-temperature wear resistance as well as the service life of hot forge die is greatly improved. The surface of the automatic-repaired die is smooth without oxidation, collapse, and other defects after forging 3000 times, which is much better than that of manual-repaired die.Figure 17
Comparison before and after service: (a) automatic repair before service, (b) manual repair before service, (c) automatic repair after service, and (d) manual repair after service.


## 4. Conclusions

For the filling path planning of complex cross sections, a compound filling method that uses linear scanning filling algorithm internally and contour offset filling algorithm externally is proposed and these two filling algorithms are analyzed, respectively. The inner and outer contours may intersect in the filling path planning of WAAM. Therefore, the following solutions are proposed: firstly, all the inner and outer contours are joined; secondly, if the inner and outer contours are intersected, the subtract operation is performed; finally, the filling algorithm is applied to the contour after the subtract operation. In addition, the polygon operation method is emphatically discussed.The WAAM process based on joint robot is studied and successfully applied to the automatic repair of hot forging die. The robotic WAAM system has the ability of profile-followed additive manufacturing, which can control the welding allowance and forming shape accurately. Compared with manual repair, the welding material and labor cost are saved significantly.The automatic-repaired die and the manual-repaired die show different surface condition and deformation. The surface of the automatic-repaired die is smooth and the surface of the manual-repaired die is oxidized seriously. In addition, the cavity of automatic-repaired die has no collapse failure, but the manual-repaired die is seriously collapsed. Similarly, the wear of manual-repaired die is more serious. Compared with the manual-repaired die, the service life of the automatic-repaired die has markedly improved.



---

*Source: 6683319-2021-04-14.xml*