## 1 Introduction

Is a new industrial revolution coming? Many people think so: 3D printers are able to create almost any solid object one can image and replicate existing ones. Nowadays, the price of a 3D printer is small enough to allow many people to have one at home, and create their own plastic objects. Within a decade, some products may be downloaded from the Internet for printing at home, causing a revolution in the market of such a small objects. Most important, the number of printable materials is growing and it is already possible printing an object mixing different materials. We leave to futurists the comments about the time when 3D printers will be able to fully replicate themselves.

While the computer science literature about 3D printing is already rich in algorithms, optimization techniques and applications, the mathematical literature is basically null. This means that advanced mathematical tools based on PDEs, optimal control theory and variational methods are, so far, little explored. In order to fill the gap and make a further step towards the solution of the engineering issues related to CAD 3D printer software, in the next section we propose a bird-eye view over typical open problems encountered by practitioners who use 3D printers based on Fused Decomposition Modeling (FDM).

Main goal. The core of the paper is devoted to the solution to a particular problem, namely fixing the overhangs. When FDM technology is employed, the solid object is created layer by layer, starting from the lowest one. As a consequence, each layer can only be deposited on top of an existing surface, otherwise the print material falls and solidifies “in the air”. In doing this, little exceptions can handled, i.e. the upper layer can protrude over the lower layer within a certain limit. The more the material cools down rapidly and the extruder moves slowly, the more the limit can be increased. If the overhang exceeds the hardware limit, an additional support must be necessarily added, in order to make the object be printable. Note that the support structures are meant to be removed at the end of the process, and thus they represent wasted material (to be minimized). Even more important, they represent an additional source of printing time.

Related work. The overhang problem was already investigated in the computer science and engineering literature, and some solutions were proposed [barnett2015AM, dumas2014TOG, huang2009IJAMT, qiu2015proc, strano2013IJAMT, vanek2014CGF]. In most cases, support structures fill either densely or sparsely the free space encountered when a part is projected downward in its build orientation, see left object in Fig. 1(b).
The difference between the methods is in how much material is used, the reliability of the supports, and the type of material which can be used.
The paper [barnett2015AM] proposes two support geometry algorithms particularly suitable for weak support materials. The paper [dumas2014TOG] proposes an algorithm for the automatic generation of horizontal bridges and vertical pillars, connected in such a way to create a hierarchical structure.
The paper [qiu2015proc] uses a cone-based scan to detect the closest points which can serve as a support base (upon the model itself or the build plate) for any overhanging point.
The paper [huang2009IJAMT] uses instead slant hourglass-like pillars.
The paper [strano2013IJAMT] proposes to create cellular supports, riddling dense structures with holes.
The paper [vanek2014CGF] proposes an algorithm which creates thin tree-like hierarchical support structures, similar (but more efficient) to the ones generated by the software Autodesk® Meshmixer® v2.9^{1}^{1}1http://www.meshmixer.com/.

In this paper we propose to “enlarge” the object in such a way that supports are no longer needed. In particular, we avoid the creation of pillars which touch the build plate by means of optimally shaped chamfers, suitably placed below hanging parts, see right object in Fig. 1(b).

## 2 What every mathematician should know about 3D printing

In the context of 3D printers there exist several open problems and modelling needs. Generally speaking, the main issues come from the fact that software solutions are not object-dependent, and not change during the printing time, whereas each object (and each layer!) has its own peculiarities. An exhaustive bibliography is out of the scope of the paper, therefore for each problem we point out just a few significant references.

Infill. Printing fully solid objects is often not convenient because of the large quantity of material to be used. Shape optimization tools can give the optimal way to hollow out the object, reducing the overall material volume and keeping at the same time the desired rigidity and printable features. The problem reduces to finding the optimal inner structure supporting the whole object from the inside [wang2013TOG].

Orientation & supports. In some cases the object is not 3D-printable due to the presence of hanging parts. In this case one should find the orientation of the solid which minimizes the hanging parts [ezair2015CeG] and then the minimal amount of additional material needed to support the hanging parts. The latter problem is the one we consider in this paper.

Balancing. It is important to ensure that during the printing process (and once it is finished), the object can lie in equilibrium without falling down. This problem can be solved by trying to balancing in an appropriate way the mass of the object and by creating cavities in the inner structure so that it stands in its natural pose without requiring any glue or pedestal [christiansen2015CAD, prevost2013ACM].

Partitioning. Sometimes it is necessary to divide a 3D model into multiple printable pieces, so as to save the space, to reduce the printing time, or to make a large model printable by small printers. This problem was attacked by means of a level-set-based approach similar to the one proposed here in [yao2015TOG].

Slicing & toolpath generation. Creating layers from a 3D model is a crucial step in 3D printing. Usually one computes the intersection curves between the model represented by polygonal meshes and a sequence of parallel planes. However, this procedure is not trivial in case of very complicated (self-intersecting, overlapped) objects. Moreover, once the layers are created, the exact trajectory of the nozzle must be defined. The infill pattern must be travelled in the shortest way, continuously, without halting the manufacturing process, and minimizing the jump from the end of one sub-path to the starting point of another sub-path. Interestingly, this problem can be seen as a generalized travelling salesman problem [castelino2003JMS, dhanik2010IJAMT, hildebrand2013CeG, huang2013JCISE, jin2014AM].

Shape or shading? 3D-printed objects replicating real objects are usually made of a different (and cheaper) material with respect to the original one. As a consequence, it is expected that the replicated object reflects light in a different manner (different albedo, different degree of Lambertianity), thus resulting in an unsatisfactory product. In some cases it can be better creating an object *with different shape but which appears as the original one*. In other words, one aims at replicating the reflectance properties of an object, not its original shape [lan2013TOG].

Oozing. It can happen that the machine deposits too much material in some parts of the object, or the material oozes, especially when the nozzle changes direction or stays on the same point for a long time. This issue is mainly related to the temperature of the nozzle’s hot end and the pressure drop because of the filament. The nozzle’s temperature, the retraction of the filament and the speed of the extruder should be related to each other and optimized with respect to the printing and travelling time (i.e. extruder movements with and without emission of material, respectively).

Multi-material printing. Let us also mention the possibility to print objects with different materials simultaneously, alternating them while printing. Materials can have different reflectance properties and transparency, and, consequently, endless combinations are possible, as well as related optimization processes. Similarly, one can coat the surface with paint, thus altering the reflectance properties [vidimce2013TOG].

## 3 The level-set method

The level-set method was introduced in [osher1988JCP] and since then it was successfully applied in many contexts, see e.g., [osherbook, sethianbook]. It allows to track Eulerianly the evolution of a -dimensional surface embedded in

transported by a given velocity vector field

. Let us briefly recall the method in the case of which is of interest for our problem.It is given a bounded closed surface at initial time . We denote by its (unknown) evolution under the action of at time and let be the 3D domain strictly contained in so that , for all . The main idea of the level-set method stems on the definition of a level-set function such that

(1) |

In this way the surface is recovered as the level-set of at any time. Initially, the function is chosen in such a way that

(2) |

A common choice for is the signed distance function from , although this choice does not lead to a smooth function. It is easy to prove [sethianbook] that the level-set function at any later time satisfies the following Hamilton-Jacobi equation

(3) |

with a suitable initial condition satisfying (2). Here denotes the gradient with respect to the space variables. One of the most appealing features of the level-set method is that several geometrical properties of the evolving surface can be described by means of its level-set function . For example, it possible to write the unit exterior normal to the surface and the (mean) curvature of in terms of and its derivatives. More precisely, we have

If the vector field has the form for some scalar function , the equation (3) turns into

(4) |

## 4 Fixing overhangs

In this section we propose a solution for fixing the overhang issue in 3D printing and, in most cases, getting rid of long support structures extended until the build plate. We want to use the level-set method by considering the domain as the object to be printed and its surface as an evolving front. Therefore, the idea is to modify the initial unprintable object letting it evolve by an *ad hoc* vector field until it becomes fully printable, meaning that there are no more unprintable hanging parts. The final object is then actually printed and the difference is finally removed. Note that the difference can be easily identified by standard techniques and consequently printed with a different material (e.g., a soluble filament) or with a different printing resolution.

It is useful to divide the surface of the object in three subsets, on the basis of their *printability*. To this end, we denote by the unit gravity vector, and again by the exterior unit normal to the surface of the object at the point . Moreover, let

(5) |

be the angle between and .

###### Definition 4.1.

*A point of the surface is said to be*

unprintable | if , |
---|---|

safe | if , |

modifiable | otherwise. |

*where is a given limit angle ^{2}^{2}2Typically , because of the so-called degree rule, though it actually depends on the 3D printer settings, print material, cooling, etc.*, see Fig. 1(a).

(a) | (b) |

While the first two definitions are immediately clear, it is worth to spend some words on the third one. Modifiable points are indeed printable since the overhang is sufficiently small. On the other hand, it could be convenient to move those points as well in order to make printable the unprintable ones. This guarantees a sufficient flexibility to shape the object conveniently and not to create long supports like the one depicted on the left of Fig. 1(b). We can extend Definition 4.1 by saying that the set of both modifiable and safe point constitute the overall printable points.

The rest of the section will be devoted to the construction of the vector field . A suitable choice is the one used in equation (4) where depends on both and according to some scalar function . In the following we denote by and the positive and negative part respectively.

Positivity and build plate. We need to be guaranteed that , for all , since once the object is printed we can remove material but not add new one. This is why we need , i.e. the movement of each point of the surface has to be along the normal exterior direction . Furthermore, the object cannot move under the build plate, supposed at a fixed . Then we impose if .

Movement of unprintable points. We introduce the term

(6) |

which make unprintable points move outward. The speed is higher whether is close to , which represents the (worst) case of a horizontal hanging part.

Rotation. It is convenient introducing a rotational effect in the evolution which avoids the unprintable regions to evolve “as it is” until they touch the build plate. To this end we introduce the term , where is the maximal height reached by the object. This term simply increases the speed of lower points with respect to higher ones. This makes the lower parts be resolved (or eventually touch the built plate) before the higher parts, thus saving material.

Movement of modifiable points. Modifiable points are moved, if necessary, by means of the following term in the vector field

(7) |

It only moves outward the points with negative curvature until it becomes , i.e. the surface is locally flat. In particular, it moves concave corners and let modifiable points become a suitable support for the still unprintable points above.

Block of safe points. Finally, it is necessary to exclude from the optimization the overall safe points of the object. In order to identify them, we use the sign of the third component of the unit exterior normal vector .

By putting together the hypothesis we end up with , where the velocity normal function reads as

(8) |

with positive constants (model parameters). The result we expect from a such vector field is an evolution similar to the one depicted on the right in Fig. 1(b), corresponding to a support whereby the angle in each of its point is less or equal to .

The surface evolution relative to equation (4) must be stopped at some final time . Rather than waiting that the velocity field vanishes completely, it is convenient to check directly (at every time ) whether the overall surface is printable or not, according to Definition 4.1. More precisely, we stop the evolution when all the points belonging to the level-set are safe or modifiable, i.e., printable.

## 5 Numerical tests

We solve equation (4) with velocity (8) by using a monotone upwind scheme based on finite differences as described in [sethianbook, Sect. 6.4], with an adaptive time step in order to satisfy strictly the CFL condition.

As a preliminary test, we solved a dimension-reduced problem by considering a 2D interface with two hanging parts as the level-set of a specific level-set function .
The computational domain is , divided in regular grid nodes. Parameters are and . Initial and final shapes of the interface are shown in Fig. 2(a). Moreover, by “extruding” the 2D domain , as it was a section of a real 3D object, we printed it out with the supports created from our method (Fig. 2(b)), and keeping the scaffolding structure created by the commercial software Cura v15.04.2^{3}^{3}3https://software.ultimaker.com(Fig. 2(c)).
Figure 2(d) shows instead the support structure generated by the commercial software Autodesk® Meshmixer® v2.9.

Then, we solved three 3D problems. In all cases the computational domain is divided in regular grid nodes. Figure 3 shows the evolution of a sphere (, ), Figure 4 shows the evolution of a cross (, ), and Figure 5 shows the evolution of a dog-like object (, ). The size of the small gap below the dog’s snout is comparable to the space step, which should ideally chosen as fine as the printer’s layer height.

## Conclusions and future work

We have introduced a level-set-based method to create optimal chamfers in additive manufacturing, avoiding the use of classical vertical support structures. Let us stress that some additional effort should be dedicated to make chamfers fully and easily detachable from the object. This can be done with classical methods already largely used in the low-cost 3D printing. Let us also mention that the proposed algorithm can be easily parallelized, although the CPU time spent in the creation of the optimized model is largely rewarded in terms of printing time.

We hope that this study can pave the way to fully shape optimization based on the coupling of the level-set method and the shape derivatives [burger2005EJAM]. In this context one could minimize directly the printing time and at the same time penalize the contact between the desired object and the removable parts, in order to simplify the final detaching operations.

(a) | (b) | (c) | (d) |

(a) | (b) |

(a) | (b) |

(a) | (b) |