A continuous toolpath strategy from offset contours for robotic additive manufacturing

Toolpath planning is an essential component of robotic additive manufacturing. An efficient toolpath strategy allows parts to be made that are geometrically accurate, free of defects, have good mechanical properties and have low residual stress. Toolpaths for cold spray additive manufacturing have some technical constraints that need to be considered compared to their counterpart designed for conventional 3D printing machines. This study presents an automated toolpath planning method based on offset contours. The generated toolpath is globally continuous, layer-wise setting, making it suitable for robotic cold spray additive manufacturing. The toolpath algorithm was tested on a variety of geometries to demonstrate its robustness. One model was selected for printing using a commercial high-pressure cold spray system. The experimental results show that our method is applicable to cold spray robotic additive manufacturing for near-net shape construction. The method is particularly good for web-rib structures.


Introduction
In the era of automated digital manufacturing, additive manufacturing technologies are often combined with six degrees of freedom (6-DoF) robotic systems to upscale the printing process and to increase productivity [1,2].The choice of toolpaths plays an important role in determining the geometrical accuracy and mechanical properties of the printed parts [3,4].In the past few decades, many methods to generate toolpaths for 3-dimensional (3D) printers have been developed and commercialized [5][6][7].However, most of these toolpath strategies are for conventional polymer 3D printers where the material extrusion can be interrupted.In some additive manufacturing techniques, switching the nozzle on and off during the printing process is impractical or entails considerable lag.In some processes, such as wirearc additive manufacturing (WAAM), frequently starting and stopping the printing process may leave defects at these locations [8].In 3D printing of viscous fluids, such as concrete, it is difficult to cease flow once extrusion has started [9].This paper focuses on cold spray additive manufacturing (CSAM), which is a solid-state material deposition method that leverages kinetic energy instead of melting to deposit metal powders [3,10].Recently, CSAM has been gaining popularity due to its ability to build large components at rates of kilograms per hour.The process does not produce solidification defects and generally has low thermal stresses and oxide content [11].Frequent interruptions to the feed are problematic because the powder is conveyed through a tube or hose under high pressure from the feeder to the spray gun, where gas at a high flow rate and temperature is forced through a supersonic nozzle [3].Stopping the powder feeder entails some lag at the gun and may result in jet instabilities.Besides, a fully continuous toolpath without any non-printing moves means that printing time and material waste are minimized, which highlights the importance of continuous toolpaths in 3D printing [12,13].In the latter section, we will discuss in more detail about the existing method to generate continuous toolpaths for robotic additive manufacturing.
In CSAM, the resolution of the nozzle in cold spray systems and the processing conditions constrain the spatial resolution to several millimetres producing near-net shape 622 Page 2 of 10 parts.The shadow effect and non-Gaussian profile with a large standard deviation of the deposited track are some challenges making it hard to make high accurate geometrical components [14,15].A few studies proposed adjusting the nozzle angle, especially in the boundary of the building part, to tackle that issue [16,17].This technique helps improve the geometrical accuracy and the mechanical properties and manage porosity formation at the edge of walls [3,18].However, these studies only focused on the spray trajectory and the influence of nozzle orientation, but not developing a general solution to produce continuous toolpaths.A further consideration to diminish thermal stress is to avoid making the toolpaths of consecutive layers identical, especially at turning points.Therefore, it is necessary to develop a toolpath planning technique that considers the manufacturing constraints of cold spray additive manufacturing.This paper presents a simple and fast method to generate a continuous robotic toolpath from offset contours.The generated toolpaths suit the technical requirement of cold spray additive manufacturing.
The remainder of this letter is organized as follows: Sect. 2 reviews some relevant research works.Section 3 explains the methodologies in detail, including re-ordering of offset contours, finding breakpoints, forming sub-paths and generating continuous toolpaths.Section 4 shows experimental results and discussion about limitation and future works, followed by a conclusion in Sect. 5.

Related works
Generating toolpaths from computer-aided drawing (CAD) models for additive manufacturing has been an active research topic for decades [19].Most of the existing methods in the literature are designed for conventional polymer 3D printers, and very few of them are for robotic metal additive manufacturing.The most common approach to generate a continuous toolpath to fill a given 2D polygon is to decompose it into sub-polygons and then fill each subpolygon with zigzag or raster patterns, and finally connect these patterns.There are several ways of decomposing a polygon into sub-polygons.For instance, Jin et al. partition an input polygon into smaller monotone polygons based on the scan direction [6].Their work has been applied to material extrusion-based additive manufacturing technology.Shen et al. proposed a similar method for wire and arc additive remanufacturing technology [20].Also, Ding et al. proposed a polygon decomposition method for wire and arc additive manufacturing that introduces more points into the input polygon to decompose it into convex sub-polygons [21].Another approach to finding a continuous path uses of multiple layers, the tool transitioning up and down multiple times between layers rather than completing each layer sequentially [22].Whatever the precise method, the advantage of zigzag patterns is that they can fill most polygon shapes.However, they also result in a high number of turning points.This becomes worst in narrow polygons like a rib-web structure [23].For high traverse speeds, a robot arm may need to decelerate and accelerate markedly, which for a continuous deposition process results in excess material being deposited at these locations.
Another approach that can result in fewer turning points is to use spiral patterns.In [24], Zhao et al. proposed a method called connected Fermat spirals to obtain a continuous toolpath to fill polygons.They first decompose an input polygon into a set of sub-polygons.Each polygon is filled by a continuous Fermat spiral, and then, these spirals are connected to form a global continuous toolpath.However, as declared by the authors, not every polygon is "spirallable."Another method that also results in a smaller number of turning points is the offset contours method.In [25], Jian et al. proposed a continuous toolpath planning technique based on offset contours for extrusion-based additive manufacturing.They also start by decomposing an input polygon into smaller polygons.Each polygon was filled with a continuous sub-path from offset contours, and then, these sub-paths were connected to form a single continuous path.However, the authors also stated that the problem of selecting the breakpoints to connect those offset contours was not solved.They also acknowledged that these breakpoints were repeatedly selected in other layers.Nguyen et al. presented a continuous Eulerian toolpath strategy for wire-arc additive manufacturing of rib-web structures [23].From the contours of a given CAD model, they generated offset contours and then connected these contours to form a continuous toolpath as an Eulerian path.However, they only considered the case when the number of offset contours is exactly two to form an Eulerian path.They also did not clarify how two offset contours can be connected.In [12], Bi et al. combined offset contours and zigzag patterns to generate a continuous path.To connect offset contours, the breakpoint was always selected at the middle point of the longest segment in a contour.
Although some of the works above aim for metal additive manufacturing, they only provide one solution to generate continuous toolpaths to fill a polygon.When the 3D model is a straight wall object, the polygons obtained after slicing may be identical.As a result, the turning points may be identical for every layer, resulting in geometry defects, high residual stresses and distortion in those areas.This problem is significant in cold spray additive manufacturing [3,26].This paper proposes a method to generate more than one continuous toolpath solutions for an input polygon.It avoids repeating breakpoints of consecutive slices at the same position and helps 3D print objects more consistently.
The performance of this task contributes to the success of automated digital manufacturing in Industry 4.0 [2].

Methodology
Throughout this paper, a segment is a line connecting two points.A contour is a series of connected line segments forming a closed loop.Outer contours are formed by the intersection of the slicing plane with the external surfaces of the model.Hole contours are formed by the intersection of the slicing plane with internal surfaces in the model.Offset contours are formed by offsetting either outer contours or hole contours.A path or a sub-path is also a series of continuously connected line segments, but it does not need to be a closed loop.Figure 1 shows the flow diagram of the proposed method.Given a CAD model of an object, the first step is to slice it into flat or planar layers, regularly spaced along the z-direction.Each slice contains a polygon made of outer contours and hole contours.These contours are fed to an offsetting algorithm, which results in a list of offset contours to fill the polygon.Noticeably, these contours are separated and do not yet connect to form a continuous trajectory.The rest of our method breaks those contours into open paths with opening and closing points.We then connect those open paths to obtain a global continuous robotic toolpath to build the expected model.To be more intuitive, a CAD model was adopted to convey the proposed method.Figure 2a shows an example of a CAD model and one of its slices when cut normal to the z-direction.In this section, we will take this slice to intuitively show the output of each step in the proposed method.Planar slicing of a 3D model has been thoroughly investigated in many studies [27,28] and, therefore, will not be discussed in depth here.We assume that the polygon's contours have been identified as outer or inner.In Fig. 2b, a red contour is an outer contour, and a green contour is a hole contour.

Contour offsetting
Given a slice consisting consists of identified outer and hole contours, the second step of the proposed method is obtaining offset contours.A regular offset distance or linespacing d is used.The contour offsetting algorithm from the Clipper library was adopted to offset input contours [29].The library implements Vatti's clipping algorithm [30].The offsetting algorithm takes the set of outer and hole contours as an input.By convention, the segments of an outer contour are ordered in the counterclockwise direction, while those of a hole contour follow a clockwise order.The Clipper library does one iteration offsetting and outputs a list of isolated offset contours.To fill a polygon with offset contours, we iteratively apply the offsetting function until no space remains to implement any further offsets.Figure 2c shows the result after iteratively applying Vatti's clipping algorithm to the polygon shown in Fig. 2b.In this example, the outer contour has two offsets, as does the hole contour.The outer contour and the hole contour are at level 0. The offset contours obtained by one iteration of offsetting are in level 1 and so on.
The third step of the proposed method is to reorder all contours obtained from the offsetting algorithm using Algorithm 1.The contours will be ordered incrementally inward, with the inner-most one having the highest level.

Return All_contours
After applying algorithm 1 to the input shown in Fig. 2c, we obtain the contour set shown in Fig. 2d.The levels of these contours have been renumbered to increase inwardly, which facilitates the breakpoint searching algorithm.

Finding breakpoints
The next step is to identify breakpoints in each contour that will be used to connect one contour to another.This procedure is described in Algorithm 2. Within each contour, we find a pair of breakpoints p1 and p2 with the distance from p1 to p2 equal to the line spacing, d.The projected points p1' and p2' of p1 and p2 onto a candidate neighbouring contour are also identified using Algorithm 2. p0 is the first point in a contour.A segment for p1 is selected based on the accumulated length from p0.After selecting an appropriate segment, p1 is the first point of that segment.Two new segments will be added to connect p1 with p1', and p2 with p2'.The breakpoint selection will be repeated every n layers.Figure 2e shows the result after identifying breakpoints and their projection.

Forming sub-paths
After adding connecting line segments to join adjacent contours at each breakpoint, Algorithm 3 forms sub-paths.The idea is to loop through each contour in the counterclockwise direction and find continuous sections.Sub-paths are displayed in different colours in Fig. 2f.Each colour represents a sub-path.

Generating continuous path
This step connects all sub-paths to form a continuous global toolpath.The global toolpath starts from the first sub-path in the list, and all points in that sub-path are added to the global toolpath.Each sub-path added to the global path is removed from the sub-path list.The current end point of the global toolpath will be connected to the next sub-path which shares an identical start point or end point.If the next subpath has its starting point identical to the ending point of the global toolpath, all points of that sub-path will be added to Fig. 2 Steps of the proposed method on an object with two holes the global toolpath in incremental order.We loop until the list of sub-paths is empty.
Pattison et al. showed that a multi-layer cold spray deposit develops a natural taper, becoming thinner as it grows taller [17].However, this could be compensated for by tilting the nozzle inwards at the edges.The technique has since been used to build vertical features [26,31].Paths along the original outer and hole contours are separated from the infill path.By adjusting the nozzle angle and speed for contour movements vertical or overhanging edges can be produced with greater geometrical accuracy.Given an outer contour ABC, shown in Fig. 3, the orientation of the nozzle corresponding to a tilting angle x is calculated as follows.With ⃗ n is the normal vector of the planar slice, ⃗ v is a vector lied on that slice and be the bisector of −⃗ t ÂBC .The vector of the nozzle when moving from point A to point B is calculated from two equations: Figure 2g shows the final continuous toolpath to print the polygon shown in Fig. 2b.The blue curves are infill paths in which the nozzle is perpendicular to the substrate.The red curves are outer and hole paths in which the nozzle is tilted at an angle x.

Results and discussion
The proposed method was implemented using Visual C++.The generated toolpath was further converted to a robot programming language.To demonstrate the applicability of the presented algorithm, we tested it on various 3D CAD models.Figure 4 shows some examples of continuous toolpaths generated using the proposed method.The red curves are the original outer and hole contours, while the blue ones are infilled contours.Polygons in Fig. 4b and c are identical, but two different toolpath solutions were generated.The continuous toolpath algorithm was tested using a Plasma Giken PCS-1000L high pressure cold spray system to deposit a square grid pattern onto an aluminium plate.In this setup, the cold spray gun was stationary, and an ABB IRB 4600 robot held and moved the plate substrate in front of the nozzle exit, as shown in Fig. 5.The plastic nozzle had a 6.8 mm outlet diameter, making it difficult to achieve high geometric fidelity on very fine features.The standoff distance between the deposit and the nozzle was maintained at 30 mm.Gas-atomized aluminium alloy AA6061 powder was sourced from Valimet Inc., USA.The cold spray process was carried out with nitrogen gas at a stagnation pressure of 40 bar and a temperature of 500 °C.
Figure 6 shows the 3D CAD model, generated toolpaths, and the printed object.The CAD model in Fig. 6a is an object with a straight wall, so when it is sliced normal in the z-direction, contours in each slice are identical.As shown in Fig. 6b and c, the breakpoints occur in different locations despite contours in all layers being identical.The latter prevents periodic and repetitive accumulation of excess material and thermal stress at turning points.Also, robot deceleration can result in an excess deposition at turning points.If the turning points occur at the same location in every layer, the additional thickness will accumulate, resulting in an overbuild.The nozzle was kept perpendicular to the substrate for offset contours (infill).The nozzle was tilted by 30° for the outer and hole contours.Tilting the nozzle helps build the straight wall and sharp features on the edges [3]. Figure 6d shows the printed part on an aluminium plate.The surface geometry of the printed part is represented by a point cloud obtained by a hand-held 3D scanner.Figure 6e and f shows an intuitive comparison of the 3D CAD model and its printed counterpart in different angle views.The green scanned point cloud represents the printed part, and the 3D CAD model is displayed in the blue colour.Due to the low resolution of the used nozzle and low deposition efficiency of the process, the sharp edges were not perfectly achieved.In Fig. 6f, we can clearly see the underbuilt on the edge regions.The printed part has a trapezoidal profile rather than an expected rectangular shape.However, the near-net shape was successfully achieved.The general geometry and the object's height are acceptably close to that of the CAD model in Fig. 6a.The actual averaged thickness of the printed part is 12% higher than the design.More experimental results of other 3D objects and an execution file can be The presented method has some limitations that will require future work.The algorithm relies on the results from the offsetting algorithm, which is highly sensitive to the line spacing value, d.Depending on d, the offsetting algorithm can output contours that are too close or far apart from each other.When the width of the polygon is not uniform, there is also a risk of having void regions.The possible empty areas can be diminished by applying an adaptive offset contour method proposed by Xiong et al. [32].Another possible solution is to identify the void regions and fill them with zigzag patterns.The proposed method can only apply for planar additive manufacturing.We are aware of many industrial applications that may require to print on a nonplanar substrate.Future work will focus on diminishing the limitations of the proposed method.

Conclusion
The effectiveness and eligibility of a path planning algorithm for robotic cold spray additive manufacturing are crucial in achieving good geometrical accuracy and mechanical properties.In this paper, we present a novel algorithm to automatically generate continuous toolpaths from 3D CAD models for robotic cold spray metal additive manufacturing.Experiments show that our proposed method can quickly generate globally continuous toolpath for various 3D models.Within a planar slice, the generated toolpaths follow the natural contours of the polygon, minimize the number of robots turns, adjust nozzle orientation and ultimately improve geometrical accuracy.In addition, the proposed algorithm can generate more than one continuous toolpath solution for an input polygon, which can help to distribute heat more evenly and avoid immoderate thermal stress at specific regions.Experimental results on a commercial high pressure cold spray system suggest that the 3D part built by the continuous toolpath generated from the proposed method has a near-net shape with a small deviation compared with the 3D CAD model.Apart from CSAM, the proposed method can also be used for other metal additive manufacturing techniques.The algorithm is particularly well suited with web-rib structures.Future work will investigate the mechanical properties of the parts printed by the proposed continuous toolpaths and improve the algorithm to avoid under-built or overbuilt structures.

Fig. 1
Fig. 1 Flow diagram of the proposed method

Algorithm 1 :
Re-level the offset contours Algorithm 2: Finding breakpoints 622 Page 6 of 10