1 Introduction

Additive manufacturing (AM) comprises several innovative technologies, which are rapidly transforming the industrial scenario [1,2,3]. Among these processes, metal AM plays a crucial role due to the enormous importance of metallic parts in most mechanical applications [4].

Laser powder-bed fusion (LPBF) is far the most popular technology for the AM of metallic parts starting from powders [5, 6]. This process allows the manufacturing of a wide range of materials to obtain parts characterised by high density and mechanical resistance [7, 8]. In recent years, industrial apparatuses for LPBF have tremendously improved [9, 10]. Also, numerous studies have focused on the determination of optimal process parameters for the achievement of high-performance products [11, 12]. In fact, it has been demonstrated that the laser parameters and scanning strategies play a fundamental role to determine the microstructure and properties of the manufactured parts [13,14,15,16].

The arrangement of parts within the building chamber is also fundamental to ensure manufacturability and part quality [17, 18]. In greater detail, the orientation of parts and the design of support structures are crucial to the surface quality of parts, building time and process cost [19,20,21].

As a consequence, numerous studies have focused on automated part orientation [22] and the design of support structures [23]. Most of the approaches in the body of the literature separately manage part orientation and support design, although they are deeply interdependent. Moreover, the objective functions are frequently defined on the entire part geometry, thus failing to address the local product requirements. These aspects are discussed in greater detail in Sect. 2, which provides an overview of the body of literature.

This study introduces a new interactive method for the simultaneous optimisation of part orientation and support design. The method adopts the building time, material volume and surface quality as objectives of the optimisation. Also, the user is given the opportunity to define local constraints and aims, in order to adjust the objective function based on the specific product requirements. Genetic Algorithms (GA) are finally used to determine the optimal solution based on the defined aims.

The proposed method is detailed in Section 3 and applied to a case study in Sect. 4 in order to prove its effectiveness.

2 State of the art

2.1 Build time estimation

The building time duration is one of the main cost drivers in AM [24, 25]. For this reason, several methods for its estimation have been proposed in the body of literature.

All the studies in this field have highlighted that the number of layers \(N_L\), and therefore the height along Z direction \(h_{max}\), is the most influential factor on the process duration [26, 27]. In laser-based processes, this is also affected by the length of the scanned path. To consider this aspect, several models include the area of each layer in the computation of the build time [27,28,29].

Rickenbacher et al. [30] proposed an interpolation including, besides \(h_{max}\), the part volume and the surface of parts and supports. Di Angelo et al. [31] elaborated such parameters through a neural network in order to reach a more accurate estimation of the building time.

In the present study, build time is evaluated only for the comparison of alternative solutions and then normalised to compose the final fitness function. Therefore, a simplified estimation based on the maximum height \(h_{max}\) is implemented. Details of the calculation are presented in Sect. 3.2.2.

2.2 Surface roughness

One of the main limitations to the industrial applications of parts manufactured via LPBF is the surface quality [32, 33]. This is known to be mainly influenced by the surface orientation to the building direction [21, 34]. The body of research demonstrates that the optimal surface roughness on upward surfaces is achieved for \(0^\circ \) angles, i.e. regions with normal versor oriented along Z-axis. In the case of non-null inclinations, the roughness decreases while the angle increases in the range \(]0^\circ ; 90^\circ ]\) [35]. The same considerations can be applied to downward surfaces, where the roughness decreases moving from flat to vertical surfaces. The downward surfaces quality is worse than the one of upward ones as the molten material tends to drop down under the effect of gravity [36, 37].

The actual value of surface roughness is also deeply influenced by scanning strategy and laser parameters, especially in downward surfaces [38]. Recently, Rott et al. [39] demonstrated the interdependency of surface orientation and laser incidence using a nickel–chromium-based superalloy.

An exact prediction on the surface roughness must thus consider the set of process parameters and the material features. Such an accurate result is out of the scope of the present work, where a comparative analysis of different solutions is required. In this study, a normalised model reflecting the consideration presented above is developed for comparison. Its equation is introduced in Sect. 3.2.5.

2.3 Automated part orientation and support design

Several methods for the automated determination of the optimal build orientation were proposed in the body of the research since the end of the 20th century. The early methods scanned a finite number of possible orientations and ranked them based on the objective function [24, 40, 41]. A similar approach was recently revised by Leutenecker-Twelsiek et al. [42]. Such methods select the best orientation within an initial batch of orientations, which may not correspond to the optimal solution. Masood et al. proposed a technique to generate candidate solutions through the incremental variation of orientation angles [43]. More recently, several iterative methods for part orienting have been presented in order to increase the probability to reach the absolute optimum [44, 45].

Since the build orientation is chosen considering a number of different requirements, it can be represented as a Multi-Objective Optimisation (MOO) problem the solution of which is a Pareto front of non-dominated solutions [46, 47]. Nonetheless, only one orientation can be used for part production. Therefore, the downside with this approach is that the solution must be selected among non-dominated ones by the user [48] or through another selection algorithm [49,50,51,52]. To surpass this limitation, the objectives of the optimisation are frequently combined in a single weighted function in order to assign relative importance to each objective and output a single optimal solution [53,54,55]. This approach gives the user the possibility to adapt the objective function himself to the requirements of the manufactured product and according to his level of knowledge. Since the quality of the proposed solution depends on the manually defined weights given to requirements, the method proposed in this paper adopts an interactive approach. The user can refine these values iteratively until a satisfactory solution is met. This iterative process also contributes to an increase in the user’s know-how about the process. This interactive approach allows for a combination of software capabilities and human expertise [22, 56].

The single function optimisation problem has been solved by several authors through GA [57, 58]. This approach allows the inclusion of different objective functions and does not require assumptions on the initial orientation of parts [59,60,61].

The objectives of the optimisation algorithms proposed for LPBF usually comprise the reduction of support volumes and building time, which are the main drivers of process cost [62,63,64]. These methods assume an orientation-independent design of support structures.

By contrast, this study includes a novel approach to the design of the support structures based on the part orientation. The main advantage of this approach is to ensure efficient use of the support material while rotating the part.

The orientation of parts has also been proven to be crucial to the part distortions induced by the process [65, 66]. In fact, the internal stresses inducing the part deformation mainly derive from the temperature distribution, which in turn depends on part orientation and laser strategies [67]. The part orientation also affects the mechanical properties of manufactured products both in terms of static [68,69,70,71] and fatigue resistance [72, 73]. The optimisation of these properties should take into account the stress distribution inside the part during usage, for example by means of Finite Element Analysis (FEA). This kind of analysis is not included in the present work and is left as an area for further research.

In the optimisation methods mentioned above, the relevance of each objective is defined on the entire model. This may determine a limitation to practical applications, where the requirements of each region depend on the function of the manufactured part. In order to surpass this limit, Ga et al. [54] proposed a method where the user can select the part which must meet the best surface quality. Other authors predefined a set of features (e.g. holes or joints) in which the maximum surface quality must be achieved [74, 75]. Recently, automated methods to cluster triangular elements of orientation have been proposed in the literature [76, 77]. The full automation of these methods reduces the efforts of the user but limits the opportunity to customise the objectives of the optimisation. To surpass this limitation, this study allows the user to manually assign the importance of each requirement in different part regions. This non-uniform definition of features is presented in Sect. 3.2.5. The main advantage of the proposed approach is to establish an interaction between the user and software to achieve full customisation of the optimisation function. This allows the user to bring specific know-how within the optimisation. For example, it is possible to specify which regions should be preserved by support structures under the light of the available equipment for support removal. This is not possible in existing fully-automated methods, which consider a single predetermined post-processing strategy [78, 79].

2.4 Design of support structures

Thermal stresses occurring during LPBF tend to warp the solidified material out of the plane of the layer. If the distortion of the layer is not tackled, the warped part might become an obstacle for the powder recoater, causing the failure of the entire process. For this reason, it is necessary to build support structures anchoring overhang geometries to the building platform. These offer a mechanical resistance to thermal distortions and dissipate the heat to the building platform [80].

Several support geometries have been proposed [81]. One of the most popular design solutions presented in literature consists of lattice lightweight structures reducing the amount of wasted support material [82,83,84,85,86,87]. It is also possible to design solid supports in order to reach higher mechanical resistance and thermal conductivity. On the other hand, this solution complicates the support removal phase following the process [88,89,90].

In order to combine thermal conductivity, resistance and ease of removal, support structures are frequently shaped as a grid of vertical thin walls [87, 91, 92]. These can consist of different 2D patterns according to the desired mechanical and thermic performances [93].

The present paper adopts thin walls to support the part during the construction. The design method details are presented in Sect. 3.1.

3 Method

The proposed method consists of three main phases, namely the definition of objectives (Sect. 3.2), the build orientation optimisation (Sect. 3.3) and the design of support structures (Sect. 3.1.2).

The first phase is delegated to the user in order to include the specific product requirements within the objective function. On the contrary, the last two phases are automatically carried out by the software.

Figure 1 summarises the steps of the method, which are detailed in the next sections.

Fig. 1
figure 1

Framework of the proposed method

The build orientation optimisation includes an estimation of the support structures which are necessary to part building. For this reason, the support design strategy is firstly presented in Sect. 3.1.2. Then, Sect. 3.2 introduces the objective functions optimised through the automated orientation algorithm. Finally, details of the GA-based optimisation are presented in Sect. 3.3.

3.1 Support design

3.1.1 Determination of supported regions

Defining as \(\alpha _{lim}\) the minimum angle of a surface to the horizontal plane which allows the self-supporting of the material, the binary value \(S_i\) expressing the need for supports for the generic ith triangle can be calculated as in Eq. 1:

$$\begin{aligned} S_i =1- \lceil n_{z,i} + cos (\alpha _{lim}) \rceil \end{aligned}$$
(1)

where \(n_{z,i}\) is the Z component of the ith triangle normal versor.

The supporting structures are designed through a region-based approach. The dimensions of the bounding box enclosing the part, \(BB_{x}\), \(BB_{y}\) and \(BB_{z}\), are firstly calculated.

The XY projection of the bounding box is divided in a grid whose side step is \(s_g\), as shown in Fig. 2.

Fig. 2
figure 2

Planar grid of the part bounding box in XY

Vertical rays are cast from the centre of each grid element (highlighted with a dot in Fig. 2). The central coordinates (\(x_{i}\), \(y_{j}\)) of the generic grid element (i,j) can be calculated as in Eqs. 2 and 3:

$$\begin{aligned} x_{i}= & {} \left\{ \begin{array}{c c} \frac{1}{2} (BB_{x} - s_g \lfloor \frac{BB_{x}}{s_g} \rceil ) &{} \quad if \; i=1;\\ BB_{x} - x_{1,j} &{}\quad if \; i=\lceil \frac{BB_{x}}{s_g} \rceil ;\\ x_{1,j} + (i-1) s_g &{}\quad \hbox {elsewhere;}\\ \end{array}\right. \end{aligned}$$
(2)
$$\begin{aligned} y_{j}= & {} \left\{ \begin{array}{c c} \frac{1}{2} (BB_{y} - s_g \lfloor \frac{BB_{y}}{s_g} \rceil ) &{} \quad if \; j=1;\\ BB_{y} - y_{1,j} &{}\quad if \; j=\lceil \frac{BB_{y}}{s_g} \rceil ;\\ y_{1,j} + (i-1) s_g &{} \quad \hbox {elsewhere.}\\ \end{array}\right. \end{aligned}$$
(3)

A vector \(\mathbf {d_{i,j}}\) with origin (\(x_i,y_j,z_{min}\)) and direction (0,0,1) is defined for each element (i,j) of the grid, being \(z_{min}\) the minimum z coordinate of the bounding box. A ray-casting algorithm [94] is used to check the intersection points \(P_{i,j,k}\) of \(\mathbf {d_{i,j}}\) with the part, as shown in Fig. 3.

Fig. 3
figure 3

Intersections of ray casting with the mesh

As the part must satisfy the manifold condition, the intersection point \(P_{i,j,k}\) lays on a triangle with negative \(n_z\) if k is odd and with positive \(n_z\) if k is even. The manifold condition also implies that the total number of intersections \(P_{i,j,k}\) is even for every pair (i,j). The maximum number of intersections found on the grid (i.e. the higher value reached by index k) will be indicated as \(N_{max,int}\).

It is then possible to define two three-dimensional matrices with dimensions [\(\lceil \frac{BB_{x}}{s_g} \rceil \), \(\lceil \frac{BB_{y}}{s_g} \rceil \), \(N_{max,int} \)] that were named \(H_s\) and \(T_s\), whose generic elements are defined as in Eqs. 4 and 5, respectively.

$$\begin{aligned}&H_s(i,j,k) = \Bigl \{ \begin{array}{c c} P_{i,j,2k-1}-P_{i,j,2(k-1)} &{} \quad if \; \exists P_{i,j,2k};\\ 0 &{} \quad if \; \not \exists P_{i,j,2k};\\ \end{array} \end{aligned}$$
(4)
$$\begin{aligned}&T_s(i,j,k) = \Bigl \{ \begin{array}{c c} P_{i,j,2k}-P_{i,j,2k-1} &{} \quad if \; \exists P_{i,j,2k};\\ 0 &{} \quad if \; \not \exists P_{i,j,2k}.\\ \end{array} \end{aligned}$$
(5)

It is important to highlight that the size and values of matrices \(H_s\) and \(T_s\) vary according to the part orientation.

3.1.2 Design of support structures

As mentioned in Sect. 2.4, thin vertical lines are used as support structures. A transversal rib is added to prevent lateral bending during construction. Figure 4 shows a projection of this structure on the XY plane.

Fig. 4
figure 4

View of a supporting line and rib in the XY plane

As one single scan line is used for support construction, the actual thickness of the vertical wall depends on a number of parameters, including the scanning speed, the laser power, the reflectivity and the grain size of the powder [95, 96].

For each element of a grid in Fig. 2, the necessity of support structures can be determined by means of Eq. 1. The orientation of each wall is chosen in order to minimise the distortion of the part, as described in the following considerations. Indicating as \(Tr(P_{i,j,k})\) the triangle on which the intersection point \(P_{i,j,k}\) lays, it is possible to define the matrix \(H_{cp}\) of dimensions [\(\lceil \frac{BB_x}{s_g} \rceil \), \(\lceil \frac{BB_y}{s_g} \rceil \), \(N_{max,int} \)]. The generic element \(H_{cp}(i,j,k)\) is then calculated as in Eq. 6:

$$\begin{aligned} H_{cp}(i,j,k)= & {} S_b(Tr(P_{i,j,2k-1}))\nonumber \\&\times \sum _{l=1}^{k}[T_s(i,j,l)+H_s(i,j,l)] \end{aligned}$$
(6)

According to Eq. 6, \(H_{cp}\) elements are equal to zero if the region does not require supports and are equal to the height of the intersection point from the bottom plane otherwise. Therefore, given a value \(k^*\), referred to in the following as intersection level, the two-dimensional matrix \(H_{cp}(i,j,k^*)\) is as shown in Fig. 5. In the matrix \(H_{cp}(i,j,k^*)\), it is possible to distinguish the cluster of supported elements, coloured in blue in Fig. 5. For each cluster, the minimum values of \(H_{cp}(i,j,k^*)\) (highlighted in yellow in Fig. 5) are identified. The corresponding centres of the grid, represented as red dots in Fig. 5, are named pivotal points and indicated as \([v_{k^*,h,1}, \; v_{k^*,h,2}, \;\ldots ]\).

Fig. 5
figure 5

Example of pivot determination for a given intersection level \(k^*\)

For each element (i,j) of the grid, the supporting wall is oriented as the vector connecting the centre of the element (\(x_i\),\(y_j\)) with the projection on the XY-plane of the nearest pivotal point \(v_{k^*,h,m} = (x_{v*},y_{v*},z_{v*}) \). The direction vector \({\hat{d}}_{i,j,k}\) can thus be calculated as in Eq. 7:

$$\begin{aligned} \begin{aligned} {\hat{d}}_{i,j,k} = (\frac{x_{v*}-x_{i}}{\sqrt{(x_{v*}-x_{i})^2+(y_{v*}-y_{i})^2}},\\ \frac{y_{v*}-y_{i}}{\sqrt{(x_{v*}-x_{i})^2+(y_{v*}-y_{i})^2}},0) \end{aligned} \end{aligned}$$
(7)

The support design penetrates the point of coordinates (\(x_i\),\(y_j\)) and remains inside the grid element, as shown in Fig. 5. The length of the support structure \(L_s\) shown in Fig. 4 can be thus calculated as in Eq. 8:

$$\begin{aligned} L_S (i,j,k)=max( \frac{s_g}{|{\hat{d}}_{i,j,k} .{\hat{X}}|} ,\frac{s_g}{|{\hat{d}}_{i,j,k} . {\hat{Y}}|}) \end{aligned}$$
(8)

where \({\hat{X}}=\lbrace 1,0,0\rbrace \) and \({\hat{Y}}=\lbrace 0,1,0\rbrace \).

The length of the line is reduced in correspondence to the connection between supports and the part in order to ease the removal of the structures at the end of the process. The transitions between supports and the part are named teeth and present the typical shape shown in Fig. 6. The height of the support tooth \(h_{st}\) and the aspect ratio \(\alpha _{ls}\) between the length of the line \(L_{s}\) and the final length of the tooth \(L_{se}\) are used to define the geometry of the teeth.

Fig. 6
figure 6

Schematisation of support wall and connection teeth

The height of the support along the Z direction can be obtained by the matrix \(H_s\) calculated in Eq. 4. It is worth mentioning that the actual coordinates of the connection to the part may vary according to the slope of the surface: the ray-casting approach exposed above can be extended to calculate such positions.

The length of support penetration within the part is equal to \(h_{sl}\). This has to be compared to the thickness values in the matrix \(T_s\), Eq. 5, in order to prevent part piercing.

A difference between the top and bottom design of teeth may be operated at different levels; as an example, the bottom teeth of the first level (i.e. the connection of the part to the build platform) is often avoided (i.e. \(\alpha _{ls} =1\)) in order to improve the resistance, as this region does not affect the surface quality of the part.

3.2 Definition of the objectives

3.2.1 Fitness function

The build orientation optimisation consists in finding the optimal Eulerian angles \(\alpha _x\), \(\alpha _y\) and \(\alpha _z\) between the coordinate system of the part and the machine one. To achieve this aim, the fitness function \(F_f (\alpha _x,\alpha _y,\alpha _z)\) presented in Eq. 9 must be minimised:

$$\begin{aligned} F_f (\alpha _x,\alpha _y,\alpha _z)= & {} p_{t} \times w_t + p_{v} \times w_v {+ p_{d} \times w_d }\nonumber \\&+ \, p_r + \, p_s \end{aligned}$$
(9)

The notation in Eq. 9 is the following:

  • \(p_{b}\) : penalty value of the building time;

  • \(w_{t}\) : weight assigned to the building time;

  • \(p_{v}\) : penalty value of the support volume;

  • \(w_{v}\) : weight the support volume;

  • \(p_{d}\) : penalty value of the average distortion;

  • \(w_d\) : weight assigned to the average distortion;

  • \(p_{r}= \frac{1}{N_t} \times \sum _{i=1}^{N_t} p_{r,i} \times w_{r,i} \)

  • \(N_{t}\) : number of triangles in the mesh;

  • \(p_{r,i}\) : penalty value of the roughness of the ith triangle;

  • \(w_{r,i}\) : weight of the roughness of the ith triangle;

  • \( p_{s}= \frac{1}{N_t} \times \sum _{i=1}^{N_t} S_i \times w_{s,i}\)

  • \(S_{i}\) : presence of supports on the ith triangle;

  • \(w_{s,i}\) : weight of the presence of supports on the ith triangle;

As mentioned, the weights have to be assigned by the user according to the functional requirements of the product. It is important to underline that the weight of the building time, support volume and average distortion are defined on the entire product, whereas \(w_{s,i}\) and \(w_{r,i}\) are assigned to each triangle so as to better fit the local needs. To simplify the assignment procedure, it is possible to define clusters of elements having the same functional requirements, as shown in the case study of Sect. 4.

Penalty factors \(p_t\), \(p_v\) and \(p_r\) are real values in the range \([0;1 ]\). The calculation of these coefficients is presented in the next sections.

3.2.2 Building time penalty function

As mentioned in Sect. 2.1, the penalty value associated with the building time is estimated based on the maximum height \(h_{max}\) along the Z-axis. Obviously, the maximum height depends on the part orientation, i.e. \(h_{max}\) is a function of Eulerian angles (\(\alpha _x,\alpha _y,\alpha _z\)).

To normalise the value of \(p_t\) in the range \(]0;1]\), the maximum height is divided by the diagonal of the bounding box in its original orientation, as shown in Eq. 10:

$$\begin{aligned} p_t= \frac{h_{max}}{\sqrt{BB_{0x}^2+BB_{0y}^2+BB_{0z}^2}} \end{aligned}$$
(10)

where \(BB_{0x}\), \(BB_{0y}\) and \(BB_{0z}\) are, respectively, the x, y and z dimensions of the bounding box enclosing the part in its original orientation.

3.2.3 Support volume penalty function

In order to estimate the support mass, the volume of the supported area defined in Sect. 3.1.1 is used. In greater detail, the supported region is calculated by multiplying the area of grid elements in Fig. 2 by the height of the supported region shown in Fig. 6. This approach does not consider the volume variation occurring due to the different orientation of support structures, as this is supposed to be negligible for the purpose of the comparison.

The volume calculated through this method is then divided by the one of the bounding box enclosing the part in its original orientation, so as to have \(p_v \in [0;1[\). The penalty function of support volume is thus calculated as in Eq. 11:

$$\begin{aligned} p_v= \frac{\sum _{i=1}^{\lceil \frac{BB_x}{s_g} \rceil }\sum _{j=1}^{\lceil \frac{BB_y}{s_g} \rceil }\sum _{k=1}^{N_{max,int}} H_s(i,j,k) \, s_g^2}{BB_{0x} \, BB_{0y} \, BB_{0z}} \end{aligned}$$
(11)

3.2.4 Distortion penalty function

The penalty function for accuracy loss is calculated through an estimation of the part distortions induced by the printing process. The estimation is made through a regression of experimental results already published. Unlike FEA simulation [97,98,99], this approach allows for a fast calculation of the penalty function.

As presented in [100], experimental tests reveal a good correlation between these distortions and the main dimensions of overhangs. In greater detail, the vertical displacement of the overhang \(e_z\) depends on the overhang thickness (\(t_{oh}\)), inclination (\(\alpha _{oh}\)) and length (\(L_{oh}\)), as shown in Fig. 7.

Fig. 7
figure 7

Schematisation of support wall and connection teeth

Using the definitions given in Sect. 3.1.2, let \([x_p, y_p,z_p ]\) be the cartesian coordinates of the generic intersection point \(P_{i,j,k}\) and \([x_{v*}, y_{v*},z_{v*} ]\) the ones of the corresponding pivotal point. The equivalent overhang length \(L_{oh}(P_{i,j,k})\) and \(\alpha _{oh}(P_{i,j,k})\) for the intersection point \(P_{i,j,k}\) can thus be calculated as in Eqs. 12 and 13, respectively:

$$\begin{aligned}&{L_{oh}(P_{i,j,k})= \sqrt{(x_{p}-x_{v*})^2+(y_{p}-y_{v*})^2+(z_{p}-z_{v*})^2}}\nonumber \\ \end{aligned}$$
(12)
$$\begin{aligned}&{\alpha _{oh}(P_{i,j,k})= Arctan (\frac{z_{p}-z_{v*}}{\sqrt{(x_{p}-x_{v*})^2+(y_{p}-y_{v*})^2}} )} \end{aligned}$$
(13)

The results in [100] also highlight a pivotal role of the distance \(d_{sl}\) between support lines. For the scope of this study, this value is set equal to the cell size, i.e. \(d_{sl}=s_g\). Therefore, in the case of austenitic stainless steel, it is possible to estimate the vertical displacement \(e_Z\) by means of Eq. 14 [100]:

$$\begin{aligned} e_Z(P_{i,j,k})= & {} -1.89 \times 10^{-1} + 9.9 \times 10^{-4} \ L_{oh} \nonumber \\&+ 7.31 \times 10^{-2} \ t_{oh} + 8.56 \times 10^{-4} \ \alpha _{oh} \nonumber \\&- 2.345 \times 10^{-1} \ d_{ } + - 9.5 \times 10^{-5} \ L_{oh} \nonumber \\&+ \ \alpha _{oh} - 3.935 \times 10^{-3}\ t_{oh} \ \alpha _{oh} \nonumber \\&+5.97 \times 10^{-2} \ t_{oh} \ d_{sl} \end{aligned}$$
(14)

As discussed in [100], Eq. 14 fits experimental results with an adjusted determination coefficient \(R^2_{adj}=90.02\%\), which is considered sufficient for the scope of this comparison. The relative error \(\epsilon (P_{i,j,k})\) for the generic contact point is then obtained dividing the displacement calculated as in Eq. 14 by the height of the overhang along the Z-axis, i.e. as in Eq. 15:

$$\begin{aligned} {\epsilon (P_{i,j,k})= \frac{e_Z(P_{i,j,k})}{ L_{oh}\times Sin (\alpha _{oh})}} \end{aligned}$$
(15)

Finally, the distortion penalty function is obtained by averaging the values of \(\epsilon (P_{i,j,k})\) of all the intersection points, as shown in Eq. 16:

$$\begin{aligned} {p_d=\frac{\sum _{i=1}^{\lceil \frac{BB_x}{s_g} \rceil }\sum _{j=1}^{\lceil \frac{BB_y}{s_g} \rceil }\sum _{k=1}^{N_{max,int}}\epsilon (P_{i,j,k})}{\lceil \frac{BB_x}{s_g} \rceil \, \lceil \frac{BB_y}{s_g} \rceil \, N_{max,int}}} \end{aligned}$$
(16)

3.2.5 Roughness penalty function

As mentioned in Sect. 2.2, an estimation of PBF part roughness is adopted. This is obtained through the normal component along the Z-axis \(N_{z,i}\) of each ith facet.

Particularly, the following considerations are reflected:

  • The minimum roughness is achieved for upward-facing elements;

  • The roughness decreases with the absolute value of \(N_z\);

  • The roughness is higher on downward-facing elements.

Accordingly, the penalty of roughness for the generic ith triangle is calculated as in Eq. 17:

$$\begin{aligned} p_{r,i}= (1-\lfloor \frac{1+N_{i,z}}{2} \rfloor ) ( k_1 \, e^{\vert N_{i,z}\vert } + k_2 \lfloor \frac{1-sign(N_{i,z})}{2} \rfloor )\nonumber \\ \end{aligned}$$
(17)
Fig. 8
figure 8

Roughness penalty \(p_{r,i}\) versus z component of normal versor of the ith triangle

Fig. 9
figure 9

a Cluster of elements number 1: handle, 2384 facets. b Cluster of elements number 2: Opener, 163 facets

The coefficients \(k_1\) and \(k_2\) in Eq. 17 are set equal to 0.15 and 0.3, respectively. Figure 8 shows the graph of \(p_{r,i}\) as a function on \(N_{i,z}\). As it can be noticed, the trend of roughness reflects the experimental results of the body of research presented in Sect. 2.2.

3.3 Build orientation optimisation

The build orientation optimisation aims at the minimisation of the fitness function in Eq. 9. The G chromosome encodes the Eulerian angles \(\alpha _x\), \(\alpha _y\) and \(\alpha _z\) as integers values. The minimum rotation is thus equal to \(1^\circ \). To represent an integer in the range \([0^\circ ; 360^\circ ]\) as a binary 9 digits are necessary. As a consequence, the chromosome comprises 27 genes.

The crossover operator generates the offspring through a two-point strategy. The splitting points of the crossover correspond to the end of Eulerian angles, i.e. between the 9th and 10th chromosomes and between the 18th and 19th chromosomes.

In order to prevent deadlock in local minima, a flip-bit mutation strategy is included, i.e. each chromosome has a given probability to switch from 0 to 1 and vice versa.

An elitist strategy is applied to select the best chromosomes of each generation, which are the parents of the offspring.

The algorithm is terminated through a stagnation strategy, i.e. when the best value of the fitness function does not decrease after a predetermined number of generations.

The best individual of the last generation is the optimal orientation under the set of requirements defined by the user.

4 Case study

4.1 Model and parameters

A digital model of bottle opener made available on Thingiverse [101] was used for benchmarking the application. The model comprised 16844 triangles with a total volume of 4672 mm3.

Two clusters of elements were defined, namely the handle and the opener regions, shown in Fig. 9a, b, respectively.

The coefficients \(w_{r,i}\) and \(w_{s,i}\) of the elements belonging to cluster 1, namely the handle, were set to 10. Therefore, the objective of the orientation was to avoid support structures and reduce the roughness of this region, so as to ease the following machining operations. In order to limit as much as possible support structures in the opener region, the values \(w_{s,i}\) of elements in cluster 2 were equal to 10. As the roughness in this region was assumed not to be relevant, \(w_{r,i}\) coefficients were set to 0. \(w_{r,i}\) and \(w_{s,i}\) of all the elements out of the clusters were also equal to 0.

Three scenarios were tested assigning a different relevance to each aim of the optimisation. Specifically, in the first case, the priority was given to building time, while support volume and accuracy are considered negligible. Then, in the second scenario, the support volume was the priority. Finally, the third case aimed at the minimisation of the part distortion followed by overall roughness. Based on these priorities, the weights of the optimisation were set as summarised in Table 1.

At each iteration of the GA, the number of chromosomes in the population was between 20 and 30. The mutation coefficient of each gene was set equal to 0.3, i.e. each bit had the 30% of probability to switch from 0 to 1 and vice versa after crossover. The GA was terminated when the fitness of the best chromosome did not decrease after 25 iterations.

The part was placed at 5 mm from the base of the platform. The grid side \(s_g\) and the limit self-supporting angle were equal to 2 mm and \(50^\circ \), respectively.

The method was implemented through the C# programming language. GeneticSharp library was used for the implementation of GA functions. Calculations were run on a 32 GB Intel Core i9 - 7920X 2.9 GHz processing unit.

Autodesk NetFabb ®post processor for SLM 280 HL ®LPBF machine was used to estimate the building time of the solutions. In order to calculate the support structures volume, the width of the single line scan was assumed to be 0.3 mm.

4.2 Results

4.2.1 Case 1

The optimisation lasted 7 min and 1 s. The optimal solution was reached after 48 iterations. The values of fitness and penalty functions for significant iterations (namely the ones where an improvement in \(F_f\) is observed) are summarised in Table 2 and graphically shown in Fig. 10.

Table 1 Weights used for the different case studies
Table 2 Iterations with improvements of the fitness function for Case 1
Fig. 10
figure 10

Fitness and penalty functions over iterations for Case 1

Fig. 11
figure 11

Optimal orientation found for Case 1

Fig. 12
figure 12

Fitness and penalty functions over iterations for Case 2

The Eulerian angles corresponding to the optimal solutions were \(\alpha _x=0^\circ \), \(\alpha _y=184^\circ \) and \(\alpha _z=138^\circ \). The final orientation corresponding to these angles is shown in Fig. 11. The estimated building time of this solution is 2 h 26 min and 38 s. The volume of support structures is equal to 737.8 mm3.

4.2.2 Case 2

The optimisation lasted 9 min and 27 s. The optimal solution was reached after 65 iterations. The most relevant iterations are reported in Table 2 and Fig. 12.

The Eulerian angles corresponding to the optimal solutions were \(\alpha _x=20^\circ \), \(\alpha _y=252^\circ \) and \(\alpha _z=219^\circ \). Such orientation is shown in Fig.  12.

The estimated building time of this solution is 7 h 34 min and 48 s, while the volume of support structures is equal to 246.4 mm3 (Fig. 13, Table 3).

Fig. 13
figure 13

Optimal orientation found for Case 2

Table 3 Iterations with improvements of the fitness function for Case 2
Table 4 Iterations with improvements of the fitness function for Case 3
Fig. 14
figure 14

Fitness and penalty functions over iterations for Case 3

Fig. 15
figure 15

Optimal orientation found for Case 3

4.2.3 Case 3

The optimisation lasted 7 min and 7 s. The optimal solution was reached after 48 iterations. The most relevant iterations are reported in Table 4 and Fig. 14.

The Eulerian angles corresponding to the optimal solutions were \(\alpha _x=355^\circ \), \(\alpha _y=102^\circ \) and \(\alpha _z=203^\circ \). Such orientation is shown in Fig.  15.

The estimated building time of this solution is 7 h 40 min and 8 s, while the volume of support structures is equal to 339.5 mm3.

4.3 Discussion

The results presented in the previous section show that the algorithm converged to a minimum in all the analysed case studies. The total number of iterations and the computation time demonstrated the rapidity of the proposed approach when applied to the benchmark geometry. Nonetheless, an increase in computational cost is expected in the case of more complex meshes, i.e. increasing the number of facets.

It is worth remarking that different trends are observed for penalty functions depending on the assigned weights while the global fitness function \(F_f\) decrease through iterations. For example, Fig. 10 and Table 2 show that in Case 1 a sharp increase in support volume, part distortion and accuracy is observed at the 14th iteration. This increase is considered acceptable by the algorithm due to the concomitant reduction of the building time, which is the major aim of this scenario.

Similarly, in the second scenario both \(p_t\) and \(p_d\) increase moving from the first to the last iteration in favour of a reduction in \(p_v\). This is coherent with the values of \(w_t\), \(w_d\) and \(w_v\) set for this case.

It is possible to observe that the accuracy penalty function of Case 1 is far higher than the one of Case 2. In fact, the solution proposed for Case 1 is expected to suffer from severe curling and distortion. This is also confirmed by the fact that the optimal solution found in Case 3, where maximum priority is given to the accuracy, looks more similar to the one proposed for Case 2 (see and compare Figs. 13 and 15). Also, in Case 3 a reduction of roughness penalty function \(p_r\) between the first and the last iterations is observed. This demonstrates the ability of the proposed method to meet also the second priority of this case scenario.

As can be seen, all the solutions admitted some support structures on elements belonging to cluster 1. It is worth underlining that, due to the geometry of the part, it is not possible to completely avoid supports in this region. In the last two scenarios, a small number of supports was also placed in the opener region, i.e. cluster 2. Therefore the algorithm proposed a compromise solution balancing local and global requirements.

In a real application, the user might evaluate the features of the proposed solution and eventually modify the definition of requirements. This gives the opportunity to iteratively refine the solution through a man-machine interaction.

5 Conclusions

The part build orientation and the design of support structures are crucial steps to the success of the LPBF process. A new method to aid these steps through software was presented in this study. Unlike in previous methods, simultaneous optimisation of part orientation and support design is carried out.

The proposed approach starts from a set of local and global objectives defined by the user. To optimise these aims, comparative functions assessing the build time, support volume, roughness and position of support structures were defined. These functions describe the effects of part orientation while preserving a low computational cost. It was shown how the proposed formulation allows for manual customisation of the objective function based on specific design requirements, thus enhancing the interaction between human and software capabilities.

The application of the proposed approach to a real product reached pseudo optimal solutions in a small number of iterations and within less than 10 min. Also, these solutions efficiently interpreted the objectives imposed by the user to part orientation. In greater detail, solution 1 allowed for saving 5 h and 13 min with respect to solution 2, i.e 68.1% of the entire building time. On the other hand, the volume of support structures was reduced by 491.4 mm3 through the adoption of solutions 2. Solution 3 was used to demonstrate the effectiveness of the proposed method in minimising surface roughness and part distortion.

The proposed solution interprets some basic user requirements concerning the building time, support structures and surface roughness, and outputs the oriented part and supports. Therefore, this system is an intuitive and efficient aid to the LPBF process preparation.