Improving additive manufacturing performance by build orientation optimization

Additive manufacturing (AM) is an emerging type of production technology to create three-dimensional objects layer-by-layer directly from a 3D CAD model. AM is being extensively used in several areas by engineers and designers. Build orientation is a critical issue in AM since it is associated with the part accuracy, the number of supports required and the processing time to produce the object. This paper presents an optimization approach to solve the part build orientation problem taking into account some characteristics or measures that can affect the accuracy of the part, namely the volumetric error, the support area, the staircase effect, the build time, the surface roughness and the surface quality. A global optimization method, the Electromagnetism-like algorithm, is used to solve the part build orientation problem.


Introduction
Rapid prototyping (RP) is a current technology that manufactures models in less time than any other current method. This technology has grown over the years and has been implemented in many model manufacturing companies due to its effectiveness in reducing the building time and used material [1].
The RP can be divided into two types of manufacture processes, the additive manufacturing (AM) and the subtractive manufacturing. The AM consists of a set of technologies intended for the manufacture of 3D objects by depositing material layer-by-layer while the subtractive manufacturing builds the 3D objects by successively cutting a solid block of material. The AM has the ability to produce parts with complex shapes using different materials in the composition of the part when compared with the subtractive manufacturing technique [2]. Furthermore, AM is a sustainable and environmentally friendly technology, currently widely used [3].
The AM, also known as 3D printing or layered manufacturing, started in the years 80 in Japan. Stereolithography (SLA) is an AM process, which uses a liquid and a photosensitive polymer, and provides accurate models embracing fine details and a smooth surface finish. The first commercially available SLA printer was patented in 1986 by Charles W. Hull, who founded 3D Systems Inc. whose aim was to facilitate rapid prototyping of plastic parts [4]. Over the last two decades, several processes have been introduced in the layered manufacturing, in addition to SLA, based on powder, solids and liquids [5], such as fused deposition modeling (FDM), selective laser sintering, laser cladding, laminated object manufacturing and laser vapour deposition [6]. The type of additive manufacturing technology involved in this work is the FDM, which is defined as a process that creates a three-dimensional object using a thermoplastic filament, which is heated to its melting point and then extruded, layer by layer.
Currently, additive manufacturing processes are being used in several areas such as medical sciences (e.g. dental restorations and medical implants), jewellery, footwear industry, automotive industry and aircraft industry [7,8].
With this type of technology, it is possible to build very complex geometry parts without requiring much postprocessing. Typically, the AM is characterized by four processing stages: model orientation, creation of supports, slicing and path planning [9]. The definition and study of the build orientation of a given part through additive manufacturing technology can improve many aspects such as the build time, the surface roughness or the surface accuracy of the model, refining the quality of the final model [10].
The automatic selection of the orientation manages to reduce or eliminate errors involved throughout the model construction process [11]. The selection of the best build orientation is a very important factor because affects the printing time and object quality, amount of supporting material, shrinkage, distortion, resin flow, material cost, support volume, and support area, among others [10,12,13], as can be seen in Fig. 1.
In the literature, a number of studies have been carried out in order to select the optimal build orientation for a 3D CAD model. Alexander et al. [14] used different criteria like stair step error, build height, volume of supports and stability of object to determine the optimal part build orientation and they concluded that the build direction has a significant effect on many key characteristics, such as the final cost, accuracy and surface roughness of the model. Brika et al. [15] used a genetic algorithm and considered mechanical properties, support structures, surface roughness, build time and cost to optimize the build orientation. An optimization model developed to improve the build orientation based on the minimization of support structures can be found in [16]. Frank and Fadel [17] proposed an expert system tool that considers the quality of the surface finish, the build time and the amount of support structures as the most important factors that affect the production of the part and interacts with the user to recommend the best direction to build. A criterion for evaluating good build orientations for SLA process based on factors such as the build height, number of supports and build area was used by [18]. Masood et al. [19] suggested an approach to select the best part build orientation for the FDM process based on minimizing the volumetric staircase error of the CAD model. The work of Zhang et al. [20] presented a demonstration to obtain the best orientation considering the minimum volume value of the part supports. They used specific restrictions and characteristics by applying different materials to the construction of the part. This method aims to increase quality by reducing production time and cost.
This work aims to determine the optimal build orientation of 3D CAD models in order to improve the surface finish accuracy, reducing the number of supports generated and the build time, and consequently decreasing the final costs. In this study, the characteristics of the model accuracy will be evaluated using six different measures: the volumetric error, the support area, the staircase effect, the build time, the surface roughness and the surface quality of the model. The Electromagnetism-like (EM) optimization method will be used to solve the build orientation problem. The EM algorithm is a population-based stochastic search method for global optimization that mimics the behaviour of electrically charged particles [21].
Numerical experiments showing the effectiveness of the proposed approach on six 3D CAD models are presented. Firstly, for a given model, an experiment to define the suitable number of points in the population and the number of function evaluations to be used in the stopping criterion was developed. Then, the computational experiments considering the build orientation optimization of all models are presented. The best solutions obtained for each function, and in each model, are also presented and discussed in terms of printing time and amount of deposited material.
This paper is organized as follows. Section 2 presents the part orientation optimization problem. It begins with the formulation of the problem, followed by the specification of each of the measures used to optimize the build orientation, and finally the description of the EM method that will be used. The information for each 3D model used in this paper is sketched in Section 3 In Section 4, the results obtained for each function and for each model are illustrated and a final discussion of the results is made in Section 5. Finally, Section 6 concludes the paper and some possible future approaches are enumerated.

Part orientation optimization
In this section, the part orientation problem is presented. First, cusp height and other variables to define the optimization problem are introduced. Then, the optimization problem is formulated and the description of the six measures, or objective functions, used in the part orientation problem is explained. The objective functions used in this study are as follows: the volumetric error, the support area, the staircase effect, the build time, the surface roughness and the surface quality. In the end of this section, the Electromagnetismlike algorithm used to solve the part orientation problem is presented.

Cusp height
A major source of structure inaccuracy is due to the staircase effect. The staircase effect can arise when the thickness of the layers is uniform on curved surfaces, when the layers shrink, since the material of the layers is deposited from the bottom up and the upper layers change the shape of the inferiors, and also when the laser angle of the printer is not correct. This effect causes dimensional errors and roughens the surface of the object. The error associated with the staircase effect occurs due to the layer thickness and the slope of the part surface [22]. The maximum deviation between part surface and printed object caused by the staircase effect is described as the cusp height (CH), which is calculated by the maximum deviation from the layered part to the CAD surface measured in the normal direction to CAD surface, as can be seen in Fig. 2.
The cusp height depends on the angle α formed by the slicing direction d and the model surface normal, and on the layer thickness, t. Thicker layers and/or higher values of cos(α) will produce larger values for cusp height and consequently a more inaccurate surface will appear [14]. The cusp height is given by CH = t cos(α).

Problem formulation
The optimization problem aiming to solve the build orientation problem of a 3D CAD model is related to the computation of the optimal slicing direction d, which is a normalized vector (i.e. d = 1). An equivalent mathematical formulation is to compute the rotation along the x-axis and y-axis, since the base platform (z-axis) is fixed. In this study, the direction d = (0, 0, 1) T was considered as the slicing direction after a rotation along θ = (θ x , θ y ) angles, where each angle is between 0 and 180 • .
The general build orientation optimization problem is given by: where f (θ x , θ y ) is the objective function to be minimized and θ x and θ y are the rotation angles along the x-axis and the y-axis, respectively.

Objective functions
The surface finish of an object obtained through additive manufacturing process is highly important. Different measures to determine the best build orientation for an improvement of the surface finish can be considered taking into account factors such as the part accuracy, building time, structure support, roughness and part stability. In the following, six measures are described, each of which will be an objective function to be minimized in Eq. 1.

Volumetric error
One of the problems affecting the surface finish of a part is the staircase effect. The layer thickness has an impact on the staircase effect, since the smaller the layer thickness of the model the staircase effect will also be smaller, resulting in a better surface finish. This effect is related to the cusp height that is based on the maximum distance between the part surface and the model surface [23]. By using the cusp height to measure the part accuracy, the surface quality can be determined from the object geometry, build direction and layer thickness. When the normal model surface is close to be collinear with the slicing direction, the volumetric difference (difference between CAD model and the slice volume) is very high, giving a low surface smoothness. However, if the normal of the model surface is close to be perpendicular to the slicing direction, the volumetric difference is very low, giving a high surface smoothness. In this context, an algorithm that slices the model along the slicing direction d can use the volumetric error to maximize the part smoothness.
The volumetric error in a rapid prototyping process is the difference between the volume of material used in the construction of the part and the volume of the CAD model [19,24,25]. Masood et al. [26] studied the volumetric error in a cylinder model. Several authors used the volumetric error as an part accuracy measure. The volumetric error has a different value for different orientations of the part, due to the process of building in layers.
The volumetric error, V E, to be minimized in each layer stem from staircase effect is given by where t is the slicing height of the layer, i is the triangular facet, d is the unit vector of the direction of construction of the triangular facet, n i is the unit normal vector of the triangular facet and A i is the area of each triangular facet [24].

Support area
The amount of supports affects the construction time of the part as well as the surface accuracy. This can be measured by the support area or support volume. The support volume is the volume of the region that is between the layer under construction and the platform of the 3D printer, and is computationally very complex to calculated.
The support area mostly affects postprocessing and superficial finish. This is defined as the total area of the downward-facing facets, that is, the quantity of supports to be used in the construction of the part, measured through the total contact area of the external supports with the object. Computationally, the support area is simpler and more important than the support volume when it comes to part accuracy [24,25].
Thus, the support area, SA, can be mathematically formulated as where i is the triangular facet, A i is the area of each triangular facet, d is the unit vector of the direction of construction of the triangular facet, n i is the normal unit vector of each triangular facet and δ is the initial function [24] given by

Staircase effect
In [27], the authors studied the staircase effect of a model based on the deviation between the actual and desired surfaces. That is, the greater the deviation between the two surfaces (actual and desired), the greater the length of the step and the lower the orientation of the construction of the part. The length of the step for each triangle i is given by where t is the layer thickness and α i is the angle between triangle facet i of model surface and the direction d.
The staircase effect, SE, is defined by

Build time
Canellidis et al. [1] considered that the build time includes the time required to construct the object as well as the time required for support removal and surface finishing. The major structure of the overall build time is the creation time of a designed object, whereas the time required for removal of supports and surface finishing is only a minor fraction of build time.
Jibin [24] considered the build time as the scanning time and the preparation time. The scanning time includes solid scanning time, contour scanning time and support scanning time, where the solid and contour scanning times are independent of the part building direction and the support scanning time depends on the volume of supports. The preparation time of the object encompasses the precise time for the platform to move downwards during the construction of each layer, the scraping time of this and other times of preparation of the part. This time depends on the total number of slices of the solid, the number of slices dependent on the height of the construction direction of a particular part of the object. Therefore, minimizing this height and the number of layers can decrease the build time of the solid [24,25].
The build time, BT , is given by where d is the direction vector and v 1 i , v 2 i , v 3 i are the vertex triangle facets i (see [24] for details).

Surface roughness
The build orientation, layer thickness and the support structures are the most important factors that affect the surface roughness [22,27,28]. The surface roughness is the main variable of the surface quality of 3D objects, in additive manufacturing.
Several authors have presented different approaches to define the surface roughness [29][30][31][32][33]. Pandey et al. [34,35] concluded that for the same build orientation, the surface roughness of the supported faces is approximately 1.2 times facing upward. They formalized one of the most accepted strategies for the calculation of surface roughness in the FDM processes, concluding that the roughness can be calculated by different formulas, given a certain range of angles. Behnam [36] proposed a combination of strategies to evaluate the surface roughness value, which will be used in this study.
The surface roughness, RA, is defined by the angle that each normal surface makes with the vertical direction, for a given layer thickness, and is given by where t is the thickness of the layer, α i is the angle between the unit vector of the direction and the normal unit vector for each triangle facet i, RA 70 i and RA 90 i are the values of RA i for the angle 70 • and 90 • , respectively. The w is a dimensionless adjustment parameter for supported facets, φ is a phase shift in the range of 5 • ≤ φ ≤ 15 • depending on the layer thickness. The value 70.82 in the first equation of Eq. 7 refers to a value inside the confidence interval (69.28 ∼ 72.36) as proposed in [37], w equals to 0.2 as in [35] and φ is equal to 5 • , as in [36]. The average surface roughness can be calculated by Eq. 8 and the lower your value is the better the surface quality of the object where RA i is the roughness (in μm) of each triangular surface i and A i is the area of triangular facet (see [36] for details).

Surface quality
The surface quality of the parts is one of the most studied characteristics in 3D printing processes that can be affected by the part orientation [14,17,38]. Several studies improved the surface quality, when optimizing the building time, accuracy and stability of the part [11,26] and focused their work on the surface finish of the part (roughness, cost and volumetric error).
The build orientation of a given part determines which faces are subjected to the staircase effect and which are in contact with the supports. These factors deteriorate the surface quality of the part. Thus, according to [14], the surface quality for each each triangle i, is given by where t is the layer thickness and A i is the area of each triangle i. Thus, the total surface quality, SQ, is given by

Electromagnetism-like algorithm
The Electromagnetism-like algorithm, developed by Birbil and Fang [21], is a population-based stochastic search method for bound constrained global optimization problems that mimics the behaviour of electrically charged particles. The method uses an attraction-repulsion mechanism to move a population of points towards optimality. The EM algorithm simulates the electromagnetism theory of physics by considering each point in the population as an electrical charge that is released to the space. The charge of each point is related to the objective function value and determines the magnitude of attraction of the point over the others in the population. The better the objective function value, the higher the magnitude of attraction. The charges are used to find a direction for the movement of each point. The regions that have higher attraction will signal other points to move towards them. In addition, a repulsion mechanism is also introduced to explore new regions for even better solutions [21].
The EM algorithm comprises three main procedures: "Initialization", "Compute Force" and "Move Points". The main steps of the EM algorithm for bound constrained optimization are presented in the Algorithm 1.

Algorithm 1 EM algorithm.
"Initialization": Randomly generate the population Evaluate the population and select the best point while maximum number of function evaluations is not reached do "Compute Force": Compute the charges Compute the total forces "Move Points": Move the points except the best point Evaluate the new population and select the best point end The "Initialization" procedure starts by randomly generating a sample of P OP points. Each coordinate of a point θ i = (θ i x , θ i y ) (i = 1, . . . , P OP ) is uniformly distributed between the lower and upper bounds, i.e., θ i x = l x +λ(u x − l k ) and θ i y = l y + λ(u y − l y ) where l x = l y = 0 • , u x = u y = 180 • and λ ∼ U(0, 1). Then, the objective function value for each point is calculated and the best point of the population, θ best = (θ best x , θ best y ), is identified as well as its corresponding objective function value, f (θ best ).
In the "Compute Force" procedure, each particle charge that determines the power of attraction or repulsion for each point is calculated by , i = 1, . . . , P OP .
In this way, the points that have better objective function values possess higher charges. After the charge calculation, the total force vector F i exerted on each point is then calculated by adding the individual component forces between any pair of points The "Move Points" procedure uses the total force vector to move each point, θ i , in the direction of the force by a random step length λ assumed to be uniformly distributed in [0, 1]. The best point, θ best , is not moved and is carried out to the subsequent iteration. To maintain feasibility, the force exerted on each point is normalized and scaled by the allowed range of movement towards the lower bound or the upper bound, for each coordinate. Thus, for each point i = 1, 2, . . . , P OP and i = best A fully description of the EM algorithm can be found in [39] as well as the used code implemented in the MATLAB ® software.

Models description
In this section, we present the 3D CAD models that will be used in this study: Dryer, Excavator Head, Fin, Keychain, Lego Curved and Rod. Initially, the original design was drafted in a CAD program (generating the CAD model), where it is then converted to a STL (Standard Tessellation Language) file, since this is the type of file used in 3D printing. The STL file format, developed by Hull at 3D systems, has been accepted as the gold standard for data transfer between the CAD software and a 3D printer [4]. The STL file format approximates the surfaces of a solid model by a polyhedral representation of a 3D object using triangular facets, where the coordinates of the vertices are defined in a text file. The STL files describe only the surface geometry, not representing colour, texture or other common attributes of the CAD model. Thus, the STL file represents the 3D solid object using triangular facets. The more complex the model is, the greater the number of triangular facets. Figure 3 depicts the models studied in this paper. As can be seen, some of the models are symmetrical, so different orientations of the model on the x-axis and y-axis (keeping the z-axis fixed) can give the same build orientation.  The characteristics of each model are presented in Table 1. The "Size" (in mm) gives the measures, width × height × depth, of the model when (0, 0) is the initial orientation angle in the x-axis and y-axis, in degrees; "Volume" (in cm 3 ) is the volume of the model, the number of triangles is given in the column "Triangles" and "Slices" shows the number of slices for a layer thickness of 0.2 mm.

Computational experiments
This section shows the numerical results obtained for the six models under study. Firstly, the setting of the EM parameters, using Excavator Head model, is analyzed. Then, for each model, the solution of the optimization problem (1) is reported, considering each objective function, V E, SA, SE, BT , RA and SQ. Finally, the numerical results and simulations are discussed.
As can be visualized in Table 2, the best average success rate of 94% was obtained when P OP = 20 and NF E = 2000. These parameters were then selected to be applied in the other models studied in this paper. In addition, it can also be concluded that the objective functions that had the highest success rate for the different combinations are RA and SQ.
The success rate for each model with the parameters previously selected (P OP = 20 and NF E = 2000) is displayed in Table 3.
It is possible to conclude that the objective functions RA and SQ can achieve an average success rate of 100%. Regarding the objective SA function, it was verified that it obtained a lower average success rate (66%). Overall, for P OP = 20 and NF E = 2000, all models obtained a high average success rate of over 75%. As for the Rod model, it was concluded that it was the model with the highest average success rate (89%) when compared with the other models under study.

Numerical results for all models
In this section, the numerical results for each objective function (V E, SA, SE, BT , RA and SQ) and for each model described in Section 3 are presented. The numerical tests were made considering the selected EM parameters, P OP = 20 and NF E = 2000. Table 4 shows the optimal solutions found by the Electromagnetism-like algorithm that represent different build orientations, θ * = (θ * x , θ * y ), the optimum objective function value, f (θ * ), and the number of optimal solutions obtained by the optimization method, NS, even if they have the same orientation.
It is possible to verify that the Rod model was the one that found a higher number of optimal solutions. In addition, the V E and SQ objective functions obtained the same solutions for five models (Dryer, Excavator Head, Keychain, Lego Curved and Rod) and the solutions identified in the SA objective function were also found by V E objective function.
Since most of the solutions found by the optimization method have the same print orientation, Fig. 4 presents two different solutions that correspond to the same build orientation for the Rod model.
For each model, Tables 5,6,7,8,9 and 10 present the objective function values for all obtained solutions. The values in bold represent the optimal build orientations found by the Electromagnetism-like algorithm for that specific objective function.
Observing Table 5, the solution that optimizes more objective functions (V E, SA, SQ) at the same time was (180, 0).
According to the Table 6, it can be concluded that the objective functions V E, SA and SQ obtained the same optimal solutions (55, 0) and (55, 180). For the (175, 180) and (175, 0) orientations, the objective function RA has smaller values than the ones found by the EM algorithm. This means that the Electromagnetismlike algorithm was not able to identify these global solutions and was trapped in local solutions (135, 140) and (135,40).
For the Fin model (see Table 7), the build orientation (0, 0) is the one that optimizes more objective functions at the same time, namely V E and SA. The n.d. represents a not defined value for that solution, since SE objective function has a discontinuity in that points, as can be seen in Fig. 5.
In Table 8, it is possible to verify that (135, 180) is the solution where three objective functions have the global minimum (V E, SA and SQ).  . 4 a, b Optimal solutions for the Rod model       relative error associated with each solution θ * j is defined by where f k j represents the objective function value on the solution θ * j for each k = {V E, SA, SE, BT , RA, SQ} and min(f k j ) represents the minimum value considering all identified θ * j build orientations for the k objective function, identified on Tables 5, 6, 7, 8, 9 and 10. Table 11 presents the selected optimal build orientations with minimum relative error (min(r j )), for all models.
To analyze the importance of build orientation in the presented models, simulation procedures were done. Table 12 presents the time required to print each model (TP), in minutes, and the amount of filament material spent (FL), in millimetres, for each solution presented in Tables 5,6,7,8,9 and 10. In fact, with this simulation, it is confirmed that the selected optimal build orientation angles identified in Table 11 are those that require shorter printing time and spend less amount of filament material, as can be seen in Table 12. Examples of the selected build orientations are illustrated in Fig. 6.

Conclusions and future work
In this paper, a practical study of six objective functions (volumetric error, support area, staircase effect, build time, surface roughness and surface quality) was presented for six 3D CAD models. In order to obtain optimal build orientations for 3D printing models, the Electromagnetismlike optimization method was used. Computational experiments showed the effectiveness of the proposed approach, identifying the set of optimal solutions for all models. The simulation results allow us to conclude that the selected optimal build orientation angles for 3D printing achieved less printing time and filament material.
This study also indicates that some of the presented objective functions have conflicting objectives which can lead, in the future, to a multi-objective optimization approach, optimizing two or more objective functions.