1 Introduction

Additive manufacturing (AM) is an advanced freeform fabrication process in which a physical part is manufactured from its 3D digital model layer-by-layer without the limitations of geometric complexity [1]. AM is also known as rapid prototyping and 3D printing. It is extensively adopted throughout the aircraft, medical implants, and motor industry because it reduces the development time and cost for new productions [2]. AM techniques can be divided into seven categories: material extrusion, powder bed fusion, vat photopolymerization, material jetting, binder jetting, sheet lamination, and directed energy deposition [3]. Fused deposition modeling (FDM), or fused filament fabrication, is a material extrusion process and is the widely applied AM technique. In FDM, the thermal melting filament is heated and extruded from the nozzle and moves on the fabrication platform according to a pre-defined toolpath [4, 5].

The layer-by-layer fabrication process will generate a staircase effect (SE) on the surface of AM parts [6]. SE adversely results in poor dimensional accuracy and surface quality and cannot be eliminated. A proper AM process planning contributes to decreasing the influence of the SE. The process planning for AM mainly includes the build orientation determination, support creation, model slicing, toolpath generation, and selection of machine manufacturing parameters [7]. Build orientation determination is the first procedure for AM process planning and directly affects the subsequent operations. Build orientation is crucial in AM since it critically affects the dimensional accuracy, surface roughness, support structure, build time, build cost, and other properties [8]. Determining an optimal build orientation (OBO) for an AM part is a challenging issue and draws the interests of many researchers [8,9,10]. The build orientation determination in AM involves rotating the model to the desired orientation regarding certain requirements and then manufacturing the rotated model along the vertical direction. It is difficult to select a suitable OBO manually, considering the relative fabrication issues.

Besides the build orientation, model slicing is another critical process in AM since the layer thickness impacts the surface quality and build time of AM parts [6]. A small layer thickness equates to high surface quality and long build time. Conversely, a large layer thickness equates to a short build time and low surface quality. To tackle this trade-off, adaptive slicing is developed in AM, where the part is fabricated using variable layer thickness to maintain high part accuracy and shorter build time [6, 11,12,13,14].

For the problem of build orientation optimization, most past studies assumed that the build layer thickness was constant because of its simple application [9, 10, 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 36,37,38,39,40]. Few works considered adopting the variable layer thickness while optimizing the build orientation [32,33,34,35]. Generally, the build orientation and layer thickness have a complicated coupling effect on the final fabrication performance of AM parts. It is worth optimizing the build orientation and layer thickness simultaneously in practical AM applications.

This study proposes a method to address the simultaneous optimization problem of the build orientation and layer thickness in extrusion-based AM. First, a new adaptive slicing algorithm is developed. Second, the relative decision criteria for part build orientation are estimated by certain models. Then, a set of alternative build orientations (ABOs) is generated based on the minimum bounding rectangles of the facet clusters in a manifold mesh model. Finally, an integrated multi-criteria decision-making (MCDM) model consisting of the weighted sum model and grey relational analysis is conducted to select the best build orientation from the ABOs, simultaneously optimizing the criteria above. This study is conducive to optimizing a part’s build orientation and layer thickness in extrusion-based AM.

This study is organized as follows. The related work is introduced in Sect. 2. Section 3 proposes the adaptive slicing algorithm. Section 4 presents the optimization frame for build orientation determination. Two complex parts are adopted to validate the proposed approach in Sect. 5. Section 6 provides the conclusions.

2 Related work

2.1 Build orientation optimization methods

The past approaches for build orientation optimization can be classified into computation-based methods [9, 10, 15, 16, 18,19,20,21,22,23,24,25,26,27,28,29,30] and evaluation methods [17, 31,32,33, 36,37,38,39]. Computation-based methods adopt certain exhaustive search methods to obtain one or more OBOs from the infinite orientation space regarding one or several decision criteria. Researchers have performed many exhaustive search methods, such as population-based optimization methods [9, 10, 15, 16, 18,19,20,21,22,23,24,25] and nonlinear optimization methods [26,27,28,29]. Masood et al. [9] developed an approach to determine the build orientation by minimizing the volumetric error encountered in parts during the building process using a genetic algorithm (GA). Ahn et al. [10] optimized the build orientation by minimizing the surface roughness by GA.

Given the relative criteria affected by build orientation usually are conflicting, applying a multi-objective optimization (MOO) technique is desirable to obtain the optimal orientation. Pandey et al. [34] determined the optimal build orientations considering the surface roughness and build time in FDM with the non-dominated sorting genetic algorithm-II (NSGA-II). However, the build time was computed by the total layers and a coefficient between the supported area and total model area; this was easy but inaccurate. Byun and Lee [15] presented a method to determine an OBO using GA with a weighted sum model (WSM) approach. The average surface roughness and build time were considered as the factors in their method. Tyagi et al. [16] utilized an evolutionary stickers-based DNA algorithm to generate an OBO regarding two parameters: volumetric error and build time. This algorithm obtained a better efficacy compared with GA. Nezhad et al. [35] proposed a build orientation optimization method using a multi-objective GA to find a set of Pareto optimal orientations with minimum build time and support volume under adaptive slicing in stereo-lithography (SLA). They adopted the adaptive slicing method proposed by Dolenc and Makela [6]. This method would induce high computation cost because all members (orientations) in each generation should be adaptively sliced for further computation of the build time and support volume in the optimization process.

Phatak and Pande [18] presented a methodology to obtain the optimum orientations for CAD models hollowed with desired shell thickness using GA in selective laser sintering (SLS). The optimization criteria were considered a weighted average of the performance measures, such as part height, part quality, and the material used in the hollowed model. Brika et al. [19] utilized the WSM method to obtain the OBO considering support structure, surface roughness, build time, build cost, and mechanical properties in laser powder bed fusion. Mele et al. [20, 21] studied the orientation optimization approaches via evolutionary algorithms to reduce the economic and environmental impacts of AM parts. Matos et al. [22] adopted a MOO method to simultaneously optimize the volumetric error, support area, build time, and surface roughness for achieving the OBO by NSGA-II. However, they utilized the support area and part height to estimate the amount of support and build time, respectively. This was inaccurate since the support volume was affected by the area and height of the support facets, and the support volume also influenced the build time. This shortcoming likewise appeared in Singhal et al. [26, 34].

Xu et al. [23] developed a method based on the weighted volumetric error to optimize the build orientation for mechanical parts with multiple circular holes. Mele et al. [24] numerically analyzed five fabrication characteristic defects affected by the part geometry and build orientation in Multi Jet Fusion process: capillarity, abrasion, staircase effect, surface sinking, and thermal bleeding. They adopted the WSM to formulate these characteristic defects into a single objective for optimizing the build orientation. The GA was applied to settle the optimization issue to reduce these defects. Mele et al. [25] proposed a novel design strategy for the support structure while optimizing the build orientation in laser powder bed fusion. Their method aggregated the build time, support volume, distortion, surface roughness, and support contact points objectives into a fitness function and was solved by GA. In addition, they allowed manual customization for local-specific function requirements.

Singhal et al. [26] introduced an attempt using the WSM to determine an OBO for achieving minimum average surface roughness, minimum build time, and support structure in SLA and SLS processes by the trust region method. Paul and Anand [27] presented a voxel-based approach to calculate the support volume, which was utilized to obtain an OBO by minimizing the support volume while minimizing the cylindricity and flatness errors of the part features. The computation method of support volume required converting the input STL (standard tessellation language) model into a voxel representation, which induced a high computation cost. This method was also applied in Chowdhury et al. [29]. Das et al. [28] not only considered the cylindricity and flatness errors proposed in Paul and Anand [27], but the perpendicularity, parallelism, and angularity errors were involved in the build orientation optimization. Chowdhury et al. [29] proposed a novel two-step optimization approach of build orientation to minimize the geometric error resulting in AM process. The OBO was determined in the first step by the WSM, considering the support volume and accessibility, build time, cusp error, thin features, and sharp corners. In the second step, an artificial neural network was utilized to compensate for the geometric error based on the OBO.

Golmohammadi and Khodaygan [30] developed a bi-objective optimization problem regarding the amount of support and surface roughness to obtain an OBO using a Zooming-Taguchi method. The support volume was calculated by summing the volume of the irregular prism formed by each downward facet and the build platform. Nonetheless, this calculation method is inaccurate for the commonly applied nonconvex model since certain prisms will intersect the model itself instead of the platform [15]. Similar calculation methods were also applied in Qie et al. [37, 38].

Generally, the computation-based methods suffer from high computation cost while achieving a more accurate result. For this, the evaluation methods generate a set of meaningful ABOs and then select an optimal one among them via specific techniques, for example, the MCDM method. Several methods have been developed to generate the ABOs, such as shape feature generation [31, 32, 36], convex hull detection [33], and facet clustering [39, 40]. Cheng et al. [31] utilized the regular shape features of the input model to generate the ABOs; for example, the normal vector of a planar feature was selected as an ABO. They further determined an OBO by evaluating the part accuracy and build time one by one. West et al. [32] introduced a method to select desirable build orientation, layer thickness, and recoating parameters in SLA. In their approach, the ABOs were generated by the model’s planar, conical, and cylindrical surfaces. Byun and Lee [33] developed the methodology for determining the OBO in different AM processes by considering the average surface roughness, build time, and part cost with variable layer thickness. They selected the vertical directions of the surfaces of the convex hull of the input model as the ABOs. The best orientation was obtained from the alternatives with the technique for order preference by similarity to ideal solution (TOPSIS). But the convex hull is not the original model, which induces a precision issue.

Zhang et al. [36] proposed a methodology to optimize the build orientation using AM features associated with a production knowledge vector and MCDM. The knowledge vector includes the surface roughness, part accuracy, support volume, build height, tensile strength, build time, build cost, and favorableness of AM Feature. The AM features were classified into planes, cylinders, cones, and structural units, which were simple classifications. Qie et al. [37] studied a strategy to select the build orientation from given limited candidate orientations using a feedback MCDM model. The feedback MCDM model expanded the finite candidate space to infinity by quaternion rotation, and the build orientation with the user’s expectation can be obtained from the infinite alternative orientations. However, the rotation axis was obtained randomly, which could miss the true OBO.

Since shape recognition is difficult to apply for freeform models, Zhang et al. [39] proposed a facet clustering method using the k-means clustering algorithm with the Davies-Bouldin index to generate the ABOs. The facets with similar normal vectors were collected into a cluster, and the central normal vector in this cluster and its opposite vector served as the ABOs of this cluster. This method avoided feature recognition and was available for both regular and freeform models. Qin et al. [40] improved the stability and rationality of the facet clustering of Zhang et al. [39] using an accelerated HDBSCAN* (hierarchical density-based spatial clustering of applications with noise*) algorithm rather than the k-means clustering algorithm. And the ABOs were created similarly to Zhang et al. [39] in little computation time. This ABO generation rule may be detrimental to the surface quality of some facet clusters, for example, the facet cluster on a cylindrical surface.

The generation methods of the ABOs above are efficient in practical applications because they can reduce the computation time on meaningless orientations. Nevertheless, it risks missing the true OBO since it focuses on finite ABOs [37, 40]. To this end, Padhye and Deb [17] performed the MOO with evolutionary approaches to generate a set of Pareto optimal orientations, considering minimizing the surface roughness and build time in SLS. An OBO was selected from the Pareto ABOs by three MCDM methods: aspiration point, marginal utility, and L2 metric. Khodaygan and Golmohammadi [38] applied the Kriging method to model the build time and the surface roughness objectives in the explicit form in terms of build orientation. The NSGA-II was implemented to obtain the Pareto ABOs, and the TOPSIS was used to select an OBO. Similarly, acquiring the Pareto ABOs requires a certain computation cost.

The literature review above suggests that applying exhaustive search techniques will obtain more accurate results while requiring more calculation costs. Generating the ABOs with specific methods induces high efficiency, but risks missing the true OBO. Additionally, several estimation models of the decision criteria in the literature have accuracy issues, affecting the quality of the ultimate results. It is preferable to improve the computation efficiency while obtaining more accurate results, especially in the case of variable layer thickness. The estimation models concerning criteria should be more precise and easy to apply.

2.2 Adaptive slicing methods

The adaptive slicing process adopts variable thicknesses determined by the geometry deviation error of the model surface to fabricate the part. Several metrics have been presented in the literature to evaluate the geometry deviation error. Dolenc and Makela [6] introduced a metric, namely cusp height, to evaluate the SE, and the layer thickness of each layer should satisfy the cusp height threshold constraint. Cusp height is the mostly applied metric to measure the deviation error in AM. Kulkarni and Dutta [11] also adopted the cusp height to define the thickness, in which twelve different equations could represent the maximum allowed cusp height at a point of the model. Different from the methods of Dolenc and Makela [6, 11], Byun and Lee [33] implemented surface roughness as the metric to evaluate the deviation error, and the thickness was determined by the allowed surface roughness threshold.

Hayasi and Asiabanpour [12] reported an adaptive slicing method to slice a CAD model at the pre-defined sheets’ thickness for the fully dense freeform fabrication process through seamless curvature detection. Their approach investigated all internal and external features to reduce the geometry deviation. Mao et al. [13] developed a metric profile to measure the global deviation error using past proposed metrics, such as the cusp height, surface roughness, area deviation, and volume deviation. They applied the metric profile to find the best slicing plan via dynamic programming. Mele and Campana [14] presented a parametric cradle-to-gate life cycle assessment method of the liquid crystal display 3D printing via adaptive slicing. The adaptive slicing algorithm first sliced the model with the minimum layer height, then collapsed adjacent layers to preserve a certain maximum imposed cusp height. Due to the characteristic of the machine, the layer height varies on three levels, namely 25 μm, 50 μm, and 100 μm.

In accordance with the past studies of build orientation and adaptive slicing, the main challenge for the simultaneous optimization of build orientation and layer thickness in extrusion-based AM is obtaining desirable results while taking small computation costs. To this end, this study first introduces a three-dimensional geometry deviation metric to acquire the adaptive slicing results. The estimation models of the decision criteria are improved for better accuracy. Based on the observations of the criteria’s estimation models, the facet cluster method is revised via the minimum bounding rectangle to achieve reasonable and meaningful ABOs in little computation time. An MCDM method is proposed to select an OBO from the ABOs coupling with adaptive slicing results. The details are expressed in the following sections.

3 Adaptive slicing

As discussed above, the SE causes the inaccuracy of shape and dimension between the original part and AM fabricated part, as shown in Fig. 1. The metric, cusp height, is the maximum distance between a facet of a mesh model and the actual fabricated part surface [6].

Fig. 1
figure 1

SE in AM process

Cusp height δ can be written as

$$\delta = t \cdot \left| {\cos (\alpha )} \right|$$
(1)

where t is layer thickness, α (in degree) is the surface angle between d and n, i.e., \(\alpha \in [0^{^\circ } ,180^{^\circ } ]\), \({\varvec{d}} = (0,0,1)^{{\text{T}}}\) is the build direction along the vertical direction, and n is the unit normal vector of a facet. cos(α) can be obtained by

$$\cos (\alpha ) = \frac{{{\varvec{d}} \cdot {\varvec{n}}}}{{\left| {\varvec{d}} \right| \cdot \left| {\varvec{n}} \right|}}$$
(2)

The layer thickness and facet slope have a critical effect on cusp height. A thicker layer will produce a worse surface accuracy following Eq. (1). Cusp height can measure the deviation error of one facet of the model. Nonetheless, cusp height is a 1-dimensional deviation metric. It cannot precisely evaluate the inaccuracy of the entire layer since it involves a set of facets, and this situation also appears in the surface roughness metric.

This study adopts an adaptive slicing approach based on a three-dimensional deviation metric, namely volume deviation, to achieve a trade-off between the manufacturing accuracy and build time of AM parts. As shown in Fig. 2, a manifold mesh is sliced by two slices and will form one layer with two slice polygons. The original layer mesh comprises the sliced mesh belonging to this layer and the upper and lower slice polygons. The virtual printing layer mesh is created by an extruded cylinder generated by the upper slice polygon. Due to the mesh shape could be inclined, there will be a volume deviation between the original and virtual printing layer meshes.

Fig. 2
figure 2

Different layer meshes of lofting model in AM

To obtain the volume deviation, the Boolean intersection operator of the upper and lower slice polygons is applied, as presented in Fig. 3.

Fig. 3
figure 3

Boolean intersection of the upper and lower slice polygons

The area deviation between the upper and lower slice polygons is given by

$$A_{{{\text{dev}},i}} = A_{{{\text{upper}},i}} + A_{{{\text{lower}},i}} - 2A_{{{\text{intersection}},i}}$$
(3)

where \(A_{{{\text{upper}},i}}\) and \(A_{{{\text{lower}},i}}\) are the areas of the upper and lower slice polygons of the ith layer, respectively,\(A_{{{\text{intersection}},i}}\) is the area of the Boolean intersection polygon between the upper and lower slice polygons.

The volume deviation between the original and virtual printing layer meshes of the ith layer could be calculated by

$$V_{{{\text{dev}},i}} = \frac{1}{2}A_{{{\text{dev}},i}} t$$
(4)

The volume produced by the Boolean intersection polygon of the ith layer could be calculated by

$$V_{{{\text{intersection}},i}} = A_{{{\text{intersection}},i}} t$$
(5)

Accordingly, the original mesh volume of the ith layer could be written as

$$V_{{{\text{ori}},i}} = V_{{{\text{dev,}}i}} + V_{{{\text{intersection}},i}}$$
(6)

In Fig. 2, the original layer mesh volume is 3158.4521mm3, the computed layer mesh volume using Eq. (6) is 3168.6679mm3, and the difference is 0.32%. The result demonstrates the computation accuracy. The volume deviation ratio Vdr is defined as

$$Vdr = \frac{{V_{{{\text{dev}},i}} }}{{V_{{{\text{ori}},i}} }}$$
(7)

It can be known that the smaller the Vdr, the high accuracy of this layer. Accordingly, the Vdr could be the evaluation metric in adaptive slicing. The proposed adaptive slicing algorithm follows the following steps. First, the manifold mesh model is sliced into many small thin layers using uniform slicing. Then, the small layers are merged based on the Vdr constraint from bottom to top, and the merging process is similar to Hayasi and Asiabanpour [12, 14]. The merged layer thickness, \(t_{{\text{m}}}\), should also satisfy the maximum (\(t_{\max }\)) and minimum (\(t_{\min }\)) layer thickness constraints, i.e., \(t_{\min } \le t_{{\text{m}}} \le t_{\max }\), which is the same as the previous work [11,12,13,14]. The adaptive slicing results for the lofting and half sphere models are presented in Fig. 4. Notably, the first layer is set to the maximum thickness to enhance the adhesion between the part and fabrication platform.

Fig. 4
figure 4

Adaptive slicing results

4 Build orientation optimization

The main steps of build orientation optimization for extrusion-based AM coupling with adaptive slicing include determination of relative decision criteria, generation of ABOs, and selecting an OBO from the ABOs. In this study, the major relative decision criteria for build orientation optimization are the support volume, volume deviation, surface roughness, build time, and build cost. The details of the three steps are described in the following sections.

4.1 Relative decision criteria

4.1.1 Support volume

In FDM, the overhang region of a model requires support structures to maintain its fabrication stability. The support structure needs to be stripped after fabrication; it is time-consuming and detrimental to the surface finish of the facets in contact with the support structure. The volume of the support structure has a crucial effect on the build time and cost. Minimizing the support volume is desirable for optimizing the part build orientation.

The ray triangle intersection algorithm [41] is adopted to calculate the support volume, and the diagram of support volume calculation is presented in Fig. 5. First, the overhang facets of a model should be detected with a critical angle αc (αc is 45° in this study). If the angle between the normal vector of the overhang facet and the horizontal plane is greater than the critical angle, i.e., \(\alpha \ge \alpha_{{\text{c}}} + 90^{^\circ }\), a support structure should be generated below this facet [42, 43]. Then, many small grids are created in the printing platform, and the rays are generated along the build direction at the center of each grid. The rays are further intersected with the overhang facets. The ray could be divided into several segments due to the spatial positions of the overhang facets, and the heights of these segments can be calculated.

Fig. 5
figure 5

Diagram of support volume calculation

Ultimately, the model’s support volume is formulated as

$$V_{{{\text{support}}}} = \sum\nolimits_{i} {\sum\nolimits_{j} {A_{{{\text{grid}}}} H_{ij} } }$$
(8)

where \(A_{{{\text{grid}}}}\) is the area of the grid, and \(H_{i,j}\) is the jth segment height of the ith ray.

4.1.2 Volume deviation

The volumetric deviation directly affects the fabricated shape and dimensional accuracy. The total volume deviation, \(V_{{{\text{deviation}}}}\), of a model under adaptive slicing is formulated as

$$V_{{{\text{deviation}}}} = \sum\nolimits_{i} {V_{{{\text{dev}},i}} }$$
(9)

It is essential to decrease the total volume deviation to maintain the shape accuracy of the model when optimizing the build orientation.

4.1.3 Surface roughness

Surface roughness is a typical indicator to evaluate the surface quality of parts and is a nature of existence in AM since SE cannot be eliminated. The surface roughness of an AM part is mostly affected by the layer thickness, build orientation, and support structure. Several approaches have been conducted to estimate the surface roughness of AM parts [10, 15, 33, 34]. However, these approaches still have accuracy and application issues. Inspired by the previous work, this study designs a benchmark artifact for the surface roughness test in FDM to obtain an accurate estimation model of surface roughness. Figures 6 and 7 show the original digital and FDM fabricated models of the benchmark artifact, respectively. The fabricated layer thickness and material are 0.1 mm and PLA, respectively. The benchmark artifact is composed of many platens at an interval of 10°. The surface angle α between the normal vector of the platen and the vertical direction can be found in Fig. 6. Notably, the surface angles of the top and bottom surfaces for each platen are complementary to each other.

Fig. 6
figure 6

Benchmark artifact model for surface roughness test in FDM

Fig. 7
figure 7

FDM fabricated benchmark artifact

Each platen is measured three times using a Mahr MarSurf PS 10 contact surface roughness tester, and the measurement parameters according to ISO 4288 are presented in Table 1. The scanning direction of the surface roughness tester is vertical to the slicing plane, as depicted in Fig. 8. The average measurement values of different surface angles are presented in Table 2. As can be seen, the Ra values of surface angles 170° and 180° are outside the measurement range of the tester due to extreme overhang and support adhesion, and their visual roughness is increasingly worse. It is essential to decrease the total area of the facets whose surface angles are close to 180° as far as possible.

Table 1 Measurement parameters of the contact surface roughness tester
Fig. 8
figure 8

Surface roughness measurement with a contact surface roughness tester

Table 2 Measurement values of surface roughness (Ra) for the benchmark artifact

For the facet paralleled to the horizontal plane, i.e., the surface angle is 0° or 180°, the infill line direction directly affects the measurement accuracy of surface roughness. Here, another artifact, a cantilever beam, is designed to measure those Ra values, as shown in Fig. 9. Additionally, to present the effect of layer thickness on surface roughness, different layer thicknesses are applied to fabricate the cantilever beam. The vertical (surface angle is 90°), top (surface angle is 0°), and bottom (surface angle is 180°) surface profiles of three fabricated cantilever beams are also shown in Fig. 9.

Fig. 9
figure 9

Vertical, top, and bottom surface profiles of the cantilever beams fabricated by FDM

From Fig. 9, with the increment of layer thickness, the air gaps appear on the top surface, damaging the surface finish. All three bottom surfaces have air gaps and rough profiles, which bring about poor surface accuracy. The measurement Ra values of the three surface profiles of the cantilever beams with different layer thicknesses are presented in Table 3. The scanning direction of the surface roughness tester is vertical to the infill line direction for top and bottom surfaces. The Ra values of all three bottom surfaces and the top surface with 0.3-mm layer thickness are beyond the measurement range of the tester owing to the air gap or poor finish.

Table 3 Measurement values (μm) of surface roughness (Ra) for the cantilever beams with different layer thicknesses

Tables 2 and 3 show that the surface angle with the minimum surface roughness is 90°, which belongs to the vertical surface.

The past studies suggest that the surface roughness has a nonlinear relationship with the surface angle and varies in different angle intervals [10, 34]. To present such relationship, the previous estimation models have been validated and revised based on the measured Ra values. The model of Pandey et al. [34] shows the effectiveness in several angle intervals in accordance with the validation. However, they adopted the build angle β (shown in Fig. 1) between the vertical direction and facet tangent as the input parameter. Build angle is defined well when \(0^{^\circ } < \beta < 90^{^\circ }\), i.e., \(\beta = 90^{^\circ } - \alpha\). However, when \(\beta \ge 90^{^\circ }\), it is difficult to define. Especially, when surface angle \(\alpha = 90^{^\circ }\), β could be 0° and 180°; when \(\alpha = 0^{^\circ }\) or \(\alpha = 180^{^\circ }\), β is 90°, but the facet with \(\alpha = 180^{^\circ }\) requires support while the facet with \(\alpha = 0^{^\circ }\) requires not. Consequently, the surface angle α is more desirable for calculating the surface roughness. The estimation models in Ahn et al. [10, 15, 33] also utilized surface angle as the input parameter.

Pandey et al. [34] explicitly gave the calculation equations when \(\beta \le 90^{^\circ }\). Such equations have been revised using the surface angle α, as presented in Eq. (10). When \(90^{^\circ } < \alpha < \alpha_{{\text{c}}} + 90^{^\circ }\), this surface is parallel to the upper surface of the platen; the surface angle of that upper surface is 180°-α. Their Ra values could be considered the same due to the parallel relationship. Accordingly, the intervals [20°, 90°] and (90°, αc + 90°) could be merged. For a facet that requires support, i.e., \(\alpha_{{\text{c}}} + 90^{^\circ } \le \alpha\), a weight value is considered due to support adhesion. Notably, when \(\alpha \ge 170^{^\circ }\), the model of Ahn et al. [10] is adopted since the tester cannot successfully measure the corresponding Ra values. Here, assuming that the measured Ra value for \(\alpha = 180^{^\circ }\) is 50 μm in 0.1-mm thickness and the measured Ra value for \(\alpha = 170^{^\circ }\) is obtained by linear interpolation. Ultimately, the surface roughness for a facet fi, can be estimated by

$$Ra_{i} = \left\{ {\begin{array}{*{20}l} {117.6t,} \hfill & {\alpha_{i} { = }0^{^\circ } } \hfill \\ {\frac{1}{20}(90Ra^{20} - 70Ra^{0} + (90 - \alpha_{i} ) \cdot (Ra^{0} - Ra^{20} )),} \hfill & {0^{^\circ } < \alpha_{i} < 20^{^\circ } } \hfill \\ {70.82\frac{t}{{\cos (90^{^\circ } - \alpha_{i} )}},} \hfill & {20^{^\circ } \le \alpha_{i} < \alpha_{{\text{c}}} + 90^{^\circ } } \hfill \\ {70.82(1 + \sigma )\frac{t}{{\cos (\alpha_{i} - 90^{^\circ } )}},} \hfill & {\alpha_{{\text{c}}} + 90^{^\circ } \le \alpha_{i} < 170^{^\circ } } \hfill \\ {\frac{1000t}{2}\left| {\frac{{\cos (\alpha_{i} - \phi )}}{\cos (\phi )}} \right|,} \hfill & {170^{^\circ } \le \alpha_{i} \le 180^{^\circ } } \hfill \\ \end{array} } \right.$$
(10)

where \(Ra^{0}\) and \(Ra^{20}\) are the Ra values when \(\alpha_{i} { = }0^{^\circ }\) and \(\alpha_{i} { = 2}0^{^\circ }\), respectively, \(\sigma = 0.2\) is a dimensionless adjustment parameter for supported facets [34], and ϕ is the surface profile angle [10]. Here, it is set as 5°. The value 70.82 is the mean value for the confidence interval [69.28, 72.36] proposed in Pandey et al. [34]. The simulated and measured Ra values for the surface angles are shown in Fig. 10.

Fig. 10
figure 10

Distribution of surface roughness for surface angle

As shown in Fig. 10, the two lines maintain similar trends. In the interval (0°, 20°), the simulation Ra values are obtained by linear interpolation using the Ra values of \(Ra^{0}\) and \(Ra^{20}\), and the simulated values are less than the measured values. The interpolation purpose is to keep the continuity and avoid sudden changes at the critical angle, i.e., \(\alpha = 0^{^\circ }\). In the interval [20°, 90°], most measured values are greater than the simulated values, while the measured and simulated values are very close in the interval (90°, αc + 90°). The revised equation basically unifies the two intervals. In the interval [αc + 90°, 170°), it seems that the Ra value does not require weighting when \(\alpha \le 150^{^\circ }\). This phenomenon is because the surfaces with such angles are self-support, which means the support structure does not adhere to that surfaces, although such surface angles are more than the threshold. The angle that meets the self-support requirement can be called the self-support angle and varies for different materials. If the fabrication material’s self-support angle is already known, then the critical overhang angle αc can be set as the same as it. This study assigns the αc to be 45°, a commonly used critical angle in AM.

Then, the average surface roughness of a fabricated part in AM is written as

$$Ra_{{{\text{asr}}}} = \frac{{\sum\nolimits_{i} {Ra_{i} A_{i} } }}{{\sum\nolimits_{i} {A_{i} } }}$$
(11)

where Ai is the area of facet fi.

Equation (11) assumes that the layer thickness is constant. However, the surface roughness is simultaneously affected by the surface angle and layer thickness; it is unsuitable for variable layer thickness. As shown in Fig. 11, a triangular facet could be sliced into several sub-polygons by variable layer thickness in four cases. The facet’s vertices are arranged in counter-clockwise (CCW) order, and the maximum, middle, and minimum values of vertex coordinates (z coordinates) along the build direction can be obtained. Based on the spatial position relationship of the z coordinates of the slicing planes and three vertices, the sub-polygons of a facet could be classified into the triangle, quadrangle, and pentagon.

Fig. 11
figure 11

Facet sub-polygons sliced by variable layer thickness

In Fig. 11a, the facet fi intersecting with the jth slicing plane, the z coordinate \(z_{{i,{\text{mid}}}}\) of middle z vertex \(V_{i,2}\) is less than the height \(Z_{j}\) of the jth slicing plane. Thus, the minimum z vertex \(V_{i,1}\) and the two intersections, \(P_{j,1}\) and \(P_{j,2}\), between fi and the jth slicing plane form a triangle with area \(A_{i,1}\) and layer thickness \(t_{j}\), while \(P_{j,1}\), \(P_{j,2}\), \(V_{i,2}\), and maximum z vertex \(V_{i,3}\) form a quadrangle with area \(A_{i,2}\) and layer thickness \(t_{j + 1}\). In Fig. 11b, the z coordinate of a new slicing plane satisfies \(z_{i,\min } < Z_{j} < Z_{j + 1} < z_{{i,{\text{mid}}}}\), the four intersections \(P_{j,1}\), \(P_{j,2}\), \(P_{j + 1,2}\), and \(P_{j + 1,1}\) form a new quadrangle, and \(P_{j + 1,1}\), \(P_{j + 1,2}\), \(V_{i,2}\), and \(V_{i,3}\) form a quadrangle which is the same as Fig. 11a. This case finally produces three sub-polygons, i.e., one triangle and two quadrangles. In Fig. 11c, the z coordinates of the slicing planes and the triangle satisfy \(z_{i,\min } < Z_{j} < z_{{i,{\text{mid}}}} < Z_{j + 1} < z_{{i,{\text{max}}}}\). Thereby, the four intersections \(P_{j,1}\), \(P_{j,2}\), \(P_{j + 1,1}\), \(P_{j + 1,2}\), and \(V_{i,2}\) form a pentagon, and \(P_{j + 1,1}\), \(P_{j + 1,2}\), and \(V_{i,3}\) form a triangle. This case produces one pentagon and two triangles. In Fig. 11d, this case considers a critical situation where the slicing plane’s z coordinate is equal to the middle z vertex, i.e., \(Z_{j + 1} { = = }z_{{i,{\text{mid}}}}\), and the intersection \(P_{j + 1,2}\) and \(V_{i,2}\) are located at the same position; hence, the pentagon degenerates into a quadrangle. This critical situation will also appear in \(V_{i,1}\) and \(V_{i,3}\), and other slicing planes. For example, if \(Z_{j} { = = }z_{{i,{\text{mid}}}}\) in Fig. 11a, then the second sub-polygon will degenerate from a quadrangle into a triangle. The case in Fig. 11d generates two triangles and two quadrangles.

Figure 12 presents the facet sub-polygons of the half sphere model using the adaptive slicing result in Fig. 4. Figure 12a shows all sub-polygons of each facet, and Fig. 12b depicts all sub-polygons belonging to each layer. Due to the layer thickness change, the surface roughness of different sub-polygons of one facet differs.

Fig. 12
figure 12

Facet sub-polygons with adaptive slicing for half sphere model

Consequently, the average surface roughness of an FDM fabricated model under adaptive slicing can be given by

$$Ra_{{{\text{asras}}}} = \frac{{\sum\nolimits_{i} {\sum\nolimits_{j} {Ra_{ij} A_{ij} } } }}{{\sum\nolimits_{i} {A_{i} } }}$$
(12)

where \(Ra_{ij}\) and \(A_{ij}\) are the Ra value and area of the jth sub-polygon of facet fi, respectively.

Desirable build orientation is conducive to optimizing the fabricated surface roughness of a part in FDM.

4.1.4 Build time

Build time is a crucial criterion in FDM and directly affects the final build cost of a part. Build orientation has an essential effect on build time since it will influence the support volume and the number of total layers. It is difficult to estimate an accurate build time because the FDM technology involves many process parameters. Generally, the build time for an FDM part includes the sum of idle time and fabrication time of each layer, which can be expressed as

$$T_{{{\text{build}}}} = T_{{{\text{idle}}}} \cdot n_{{{\text{layer}}}} + \sum\limits_{i = 1}^{{n_{{{\text{layer}}}} }} {T_{{{\text{layer}},i}} }$$
(13)

where \(T_{{{\text{idle}}}}\) is the idle time between two adjacent layers, \(n_{{{\text{layer}}}}\) is the number of layers, and \(T_{{{\text{layer}},i}}\) is the fabrication time of the ith layer.

The idle time includes the move time of the printing platform to a new z height and the traveling time of the nozzle from the end point of the last layer to the start point of the new layer. The number of layers is simple to calculate for uniform slicing, where layer thickness is constant. However, the number of layers in adaptive slicing is calculated based on the deviation error rate threshold. Basically, for an FDM part, the fabrication time of each layer is composed of the fabrication time of outer contour (\(T_{{{\text{outcontour}},i}}\)), inner contour (\(T_{{{\text{incontour,}}i}}\)), infill (\(T_{{{\text{infill,}}i}}\)), support (\(T_{{{\text{support}},i}}\)), and the traveling time between the former four kinds of paths of this layer, which could be written as

$$T_{{{\text{layer}},i}} = T_{{{\text{outcontour}},i}} + T_{{{\text{incontour,}}i}} + T_{{{\text{infill,}}i}} + T_{{{\text{support}},i}} + T_{{{\text{traveling}},i}}$$
(14)

The fabrication time of each layer is affected by the toolpath (as shown in Fig. 13) and process parameters, such as nozzle moving speed and infill density. To obtain a more accurate result, each layer should be calculated. \(T_{{{\text{traveling}},i}}\) is hard to estimate, and the nozzle moves quickly during traveling; therefore, \(T_{{{\text{traveling}},i}}\) is merged into the idle time of each layer. Figure 13a presents the toolpath of a normal layer. Due to the width of the extruded material, the toolpath’s outer contour has a small offset from the original contour, and the inner contour also has an offset from the outer contour. In FDM, the infill is usually not total 100%, and most models can be fabricated with 10–20% infill. This infill density is enough to maintain the fabrication stability. Moreover, too high infill density will increase the build time and material usage. But for the layer in which the involved facets are parallel to the horizontal plane, such as top and bottom horizontal surfaces, this layer must be completely filled to maintain the geometry integrity, which will form a solid layer, as shown in Fig. 13b. Normally, there are several solid layers for top and bottom horizontal surfaces to decrease the influence of bridging and improve surface finish. Similarly, the support structure is also printed with a certain density or path interval, i.e., hatch distance (\(H_{{\text{s}}}\)), which can be seen in Fig. 13a.

Fig. 13
figure 13

Layered toolpaths in extrusion-based AM

Applying an offset algorithm to calculate the outer contour perimeter is cumbersome; here, an approximate method is adopted to obtain the perimeters of outer and inner contours. This offset is very small (usually half of the extrusion width); consequently, the perimeter of the outer contour could be given by

$$L_{{{\text{outcontour}},i}} = 0.95L_{{{\text{oricontour}},i}}$$
(15)

where \(L_{{{\text{oricontour}},i}}\) is the perimeter of the original contour of the slice polygon of the ith layer. Thus, the fabrication time of the outer contour could be calculated by

$$T_{{{\text{outcontour}},i}} = L_{{{\text{outcontour}},i}} /v_{{{\text{oc}}}}$$
(16)

where \(v_{{{\text{oc}}}}\) is the scanning speed of the outer contour.

For the inner contour, there will be several contours, similar to the outer contour; the perimeter of the jth inner contour could be given by

$$L^{j}_{{{\text{incontour}},i}} = 0.9^{j} L_{{{\text{outcontour}},i}}$$
(17)

The total perimeter of the inner contour is the sum of the perimeters for \(n_{{{\text{incnt}}}}\) inner contours, expressed as

$$L_{{{\text{incontour}},i}} = \sum\nolimits_{j = 1}^{{n_{{{\text{incnt}}}} }} {L^{j}_{{{\text{incontour}},i}} }$$
(18)

Notably, there will be no inner contour or a specified number of inner contours cannot be obtained in a given layer since the area of the slice polygon is not enough to accommodate that. For this, it is essential to confirm the actual number of inner contours, and it can be conducted by

$$L^{j}_{{{\text{incontour}},i}} = \left\{ {\begin{array}{*{20}l} {0.9^{j} L_{{{\text{outcontour}},i}} ,} \hfill & {{\text{if }}A_{{{\text{layer}},i}} - L_{{{\text{outcontour}},i}} H_{{\text{e}}} (1 + \sum\nolimits_{k = 1}^{j} {0.9^{k} } ) > 0} \hfill \\ {0,} \hfill & {{\text{else}}} \hfill \\ \end{array} } \right.$$
(19)

where \(H_{{\text{e}}}\) is the extrusion width of the nozzle, and \(A_{{{\text{layer}},i}}\) is the original area of slice polygon of the ith layer. The fabrication time of the inner contour could be calculated by

$$T_{{{\text{incontour}},i}} = L_{{{\text{incontour}},i}} /v_{{{\text{ic}}}}$$
(20)

where \(v_{{{\text{ic}}}}\) is the scanning speed of the inner contour.

For the infill, it should also confirm whether there is infill for a given layer. There will be infill only when the actual number of inner contours of this layer satisfies the pre-defined number. Accordingly, the area for an infill could be expressed as

$$A_{{{\text{infill}},i}} = \left\{ {\begin{array}{*{20}l} {A_{{{\text{layer}},i}} - L_{{{\text{outcontour}},i}} H_{{\text{e}}} (1 + \sum\nolimits_{j = 1}^{{n_{{{\text{incnt}}}} }} {0.9^{j} } ),} \hfill & {{\text{if }}A_{{{\text{layer}},i}} - L_{{{\text{outcontour}},i}} H_{{\text{e}}} (1 + \sum\nolimits_{j = 1}^{{n_{{{\text{incnt}}}} }} {0.9^{j} } ) > 0} \hfill \\ {0,} \hfill & {{\text{else}}} \hfill \\ \end{array} } \right.$$
(21)

Many infill styles, such as the Zig Zag and Grid styles, have been applied in FDM. The infill style in Fig. 13 is a typical Zig Zag type and is a popular application in FDM. For simplified calculation, the Zig Zag style is selected in this study. Based on whether the layer is solid or not, the fabrication time of the infill could be given as

$$T_{{{\text{infill}},i}} = \left\{ {\begin{array}{*{20}l} {\frac{{A_{{{\text{infill}},i}} }}{{v_{{\text{f}}} H_{{\text{e}}} }},} \hfill & {\text{solid layer}} \hfill \\ {\frac{{A_{{{\text{infill}},i}} D_{{{\text{infill}}}} }}{{v_{{\text{f}}} H_{{\text{e}}} }},} \hfill & {\text{normal layer}} \hfill \\ \end{array} } \right.$$
(22)

where \(v_{{\text{f}}}\) is the scanning speed of the infill, and \(D_{{{\text{infill}}}}\) is the infill density.

Indeed, Eq. (22) can also be applied to the Grid style. The fabrication time of the support could be calculated by

$$T_{{{\text{support}},i}} = \frac{{n_{{{\text{ray}},i}} A_{{{\text{grid}}}} }}{{v_{{\text{s}}} H_{{\text{s}}} }}$$
(23)

where \(v_{{\text{s}}}\) is the scanning speed of the supports, and \(n_{{{\text{ray}},i}}\) is the number of support rays existing in the ith layer.

Apparently, it is crucial to minimize the total build time in build orientation optimization.

4.1.5 Build cost

Estimating an accurate build cost for an FDM part is difficult because the build cost is affected by the build time, support volume, material properties, and process parameters. The build cost usually comprises material usage, energy consumption, and pre-processing and post-processing costs. The pre-processing and post-processing costs are hard to quantify and thus are not considered. Accordingly, the build cost could be calculated by

$$C_{{{\text{build}}}} = P_{{{\text{material}}}} D_{{{\text{material}}}} V_{{{\text{material}}}} + P_{{{\text{energy}}}} T_{{{\text{build}}}}$$
(24)

where \(P_{{{\text{material}}}}\) is unit material price, and \(D_{{{\text{material}}}}\) is the material density, \(V_{{{\text{material}}}}\) is the volume of material usage, and \(P_{{{\text{energy}}}}\) is the unit energy price. \(V_{{{\text{material}}}}\) could be calculated by summing the volume of material used for manufacturing the part itself and the support of each layer, expressed as

$$V_{{{\text{material}}}} = \sum\limits_{i = 1}^{{n_{{{\text{layer}}}} }} {\left( {V_{{{\text{part}},i}} + V_{{{\text{support}},i}} } \right)}$$
(25)

where \(V_{{{\text{part}},i}}\) and \(V_{{{\text{support}},i}}\) are the volume of material usage of the part itself and the support for the ith layer, respectively. \(V_{{{\text{part}},i}}\) could be calculated by

$$V_{{{\text{part}},i}} = \left\{ {\begin{array}{*{20}l} {t_{i} (H_{{\text{e}}} (L_{{{\text{outcontour}},i}} + L_{{{\text{incontour}},i}} ) + A_{{{\text{infill}},i}} ),} \hfill & {\text{solid layer}} \hfill \\ {t_{i} (H_{{\text{e}}} (L_{{{\text{outcontour}},i}} + L_{{{\text{incontour}},i}} ) + D_{{{\text{infill}}}} A_{{{\text{infill}},i}} ),} \hfill & {\text{normal layer}} \hfill \\ \end{array} } \right.$$
(26)

where \(t_{i}\) is the layer thickness of the ith layer. And \(V_{{{\text{support}},i}}\) could be written as

$$V_{{{\text{support}},i}} = \frac{{t_{i} n_{{{\text{ray}},i}} A_{{{\text{grid}}}} H_{{\text{e}}} }}{{H_{{\text{s}}} }}$$
(27)

4.2 Generation of ABOs

As discussed in related work, there are two meanings to obtaining the ABOs. Applying the exhaustive search method will obtain a more accurate result. However, for the situation with adaptive slicing, the computation cost of the exhaustive search method is not desirable for practical application. Consequently, the method proposed in Qin et al. [40] is improved to generate certain meaningful ABOs. The method adopted the HDBSCAN* algorithm to produce facet clusters from the mesh model based on the normal vectors of the facets. Further, the unitized central vector of all normal vectors of the facets in a cluster and its opposite vector were calculated. For an obtained unitized central vector or its opposite vector (nx, ny, nz), the part model was rotated around X-axis at an angle of ϴx (in degree) and Y-axis (in degree) at an angle of ϴy, respectively, which ultimately makes this vector vertically upward, and forms one ABO for the model. The two rotation angles, ϴx and ϴy, can be calculated by the following equations:

$$\theta_{x} = \left\{ {\begin{array}{*{20}l} {0,} \hfill & {{\text{if }}ny = {\text{0 and }}nz = 0} \hfill \\ {\begin{array}{*{20}l} {\arctan (ny/nz),} \hfill & {{\text{if }}nz \ge 0} \hfill \\ {180 + \arctan (ny/nz),} \hfill & {{\text{else}}} \hfill \\ \end{array} ,} \hfill & {{\text{else}}} \hfill \\ \end{array} } \right.$$
(28)
$$\theta_{y} = - \arctan (\frac{nx}{{\sqrt[{}]{{ny^{2} + nz^{2} }}}})$$
(29)

This ABO will make the facets in the corresponding cluster become or close to top horizontal facets. Nonetheless, in accordance with the study of surface roughness in Sect. 4.1.3, the surface roughness of the top horizontal surface is not the smallest, while that of the vertical surface is the smallest. Additionally, the vertical surface does not generate volume deviation and does not require support. More preferably, the ABO obtained above is rotated into an orientation in which the unitized central vector of the corresponding facet cluster changes from along the build direction to perpendicular to the build direction. That is, another rotation is essential to obtain the meaningful ABO for extrusion-based AM. However, there will be infinite orientations for that rotation since it only requires rotating the vector from (0,0,1)T to parallel to a horizontal plane, that is, make \(nz = 0\). To settle this issue, the minimum bounding rectangle (MBR) algorithm for a set of 2-dimensional points is applied and explained in detail below.

As shown in Fig. 14, the test mesh model generates many facet clusters. In Fig. 14b, the facets with the same color represent one facet cluster. The resulting facet clusters are sorted based on the total area of the facets in a cluster. The MBR has the minimum area of the bounding box for a set of points, and it is conducive to approximating the geometry representation of the facet cluster with a few points. This property makes the MBR available for the second rotation of the facet cluster to generate the final ABO.

Fig. 14
figure 14

Facet clusters of test mesh model

Figure 15 illustrates the generation process of the ABOs via the MBR of a facet cluster. Taking the facet cluster with red color in Fig. 14b as an example, its unitized central vector is (0, − 1,0)T. This facet cluster is first rotated to parallel to the horizontal plane, as shown in Fig. 15a. Then, all vertices of the facets in this cluster are projected on the XOY plane, and the MBR of these projection vertices is created. Figure 15a depicts the MBR and its four vertices, where the MBR is translated to the maximum z height of the vertices among the facet cluster. And the project of the MBR on the XOY plane can be seen in Fig. 15b. To obtain the angles for the second rotation, the edge of the MBR is selected as the rotation reference. The model requires to be rotated to make that edge along the build direction via the Eqs. (28) and 29. Because there are the long and short edges for the MBR, the two edges are both selected; that is, one facet cluster ultimately generates two ABOs. Here, the first vertex, P1, of the MBR is selected as the start of the edge, and the two edges can be represented by \(\overrightarrow {{P_{1} P_{2} }}\) and \(\overrightarrow {{P_{1} P_{4} }}\), respectively. The generated first and second ABOs for the facet cluster are presented in Fig. 15c, d, respectively. As shown in Fig. 15c, the edge \(\overrightarrow {{P_{1} P_{2} }}\) is now along the build direction, and the edge \(\overrightarrow {{P_{1} P_{4} }}\) in Fig. 15d is likewise along the build direction. A vector can express the final ABO with four rotation angles.

Fig. 15
figure 15

Illustration of the generation of ABOs via the MBR for a facet cluster

4.3 Decision-making for optimal build orientation

Determining an OBO from the ABOs obtained above is essential in practice, and it is a typical MCDM problem. This study adopts the integration of the WSM and grey relational analysis (GRA) [44] to obtain the final OBO. The WSM is a simple and commonly used method in MCDM; however, it only maps the comprehensive performance of the alternative. The GRA reveals the trend relationship between the alternative and the aspired goal and is suitable for the MCDM with complicated interrelationships between the criteria [45]. This characteristic makes the GRA desirable for this study since the involved relative decision criteria have complex interrelationships, such as the support volume affecting the build time and cost. Consequently, the WSM and GRA are integrated to obtain a preferable result.

The process of the WSM can be summarized as follows:

  1. 1.

    Normalize the values of the decision criteria, since the unit and order of magnitude of the criteria are different:

$$r_{i,j} = \frac{{x_{i,j} }}{{\sqrt {\sum\nolimits_{i = 1}^{m} {x_{i,j}^{2} } } }},i = 1,2, \cdots ,m;j = 1,2, \cdots ,n$$
(30)

where \(r_{i,j}\) and \(x_{i,j}\) are the normalized and original values of the jth criterion of the ith alternative, respectively.

  1. 2.

    Adjust the normalized value following the property of the criterion:

    $$u_{i,j} = \left\{ {\begin{array}{*{20}l} {1 - r_{i,j} ,} \hfill & {{\text{if }}r_{i,j} {\text{ is a cost criterion}}} \hfill \\ {r_{i,j} ,} \hfill & {{\text{if }}r_{i,j} {\text{ is a benefit criterion}}} \hfill \\ \end{array} } \right.$$
    (31)
  1. 3.

    Assign the weight to each criterion:

    $$v_{i,j} = w_{j} u_{i,j}$$
    (32)

    where wj is the weight of the jth criterion owing to different preferences for the criterion, and \(\sum\nolimits_{j = 1}^{n} {w_{j} } = 1\).

  1. 4.

    Calculate the summary value of the criteria of each ABO:

    $$S_{i} = \sum\limits_{j = 1}^{n} {w_{j} v_{i,j} }$$
    (33)

The alternative with the highest Si value is the final option for the WSM.

The main steps of the GRA are described as follows:

  1. 1.

    Same with step 1 of the WSM

  2. 2.

    Same with step 3 of the WSM, the only difference is that the normalized value does not require to adjust in GRA.

  3. 3.

    Determine the positive ideal (\(A^{ + }\)) and negative ideal (\(A^{ - }\)) solutions:

$$A^{ + } = \left( {v_{1}^{ + } ,v_{2}^{ + } , \cdots ,v_{n}^{ + } } \right)$$
(34)
$$A^{ - } = \left( {v_{1}^{ - } ,v_{2}^{ - } , \cdots ,v_{n}^{ - } } \right)$$
(35)

where \(v_{j}^{ + } = \max \left\{ {v_{1,j} ,v_{2,j} , \cdots ,v_{m,j} } \right\}\) and \(v_{j}^{ - } = \min \left\{ {v_{1,j} ,v_{2,j} , \cdots ,v_{m,j} } \right\}\) if the jth criterion is a benefit criterion; \(v_{j}^{ + } = \min \left\{ {v_{1,j} ,v_{2,j} , \cdots ,v_{m,j} } \right\}\) and \(v_{j}^{ - } = \max \left\{ {v_{1,j} ,v_{2,j} , \cdots ,v_{m,j} } \right\}\) if the jth criterion is a cost criterion.

  1. 4.

    Calculate the grey relational coefficients:

The grey relational coefficient between the ith alternative and the positive ideal solution referring to the jth criterion, \(v_{j}^{ + }\), is given as

$$\gamma_{i,j}^{ + } = \frac{{\Delta_{\min }^{ + } + \zeta \Delta_{\max }^{ + } }}{{\Delta_{i,j}^{ + } + \zeta \Delta_{\max }^{ + } }}$$
(36)

where \(\Delta_{i,j}^{ + } = \left| {v_{i,j} - v_{j}^{ + } } \right|\), \(\Delta_{\min }^{ + } { = }\min \{ \Delta_{i,j}^{ + } \}\), \(\Delta_{\max }^{ + } { = }\max \{ \Delta_{i,j}^{ + } \}\), \(\zeta \in [0,1]\) is the distinguish coefficient, usually, \(\zeta { = }0.5\).

Similarly, the grey relational coefficient between the ith alternative and the negative ideal solution refers to the jth criterion, \(v_{j}^{ - }\), is given as

$$\gamma_{i,j}^{ - } = \frac{{\Delta_{\min }^{ - } + \zeta \Delta_{\max }^{ - } }}{{\Delta_{i,j}^{ - } + \zeta \Delta_{\max }^{ - } }}$$
(37)

where \(\Delta_{i,j}^{ - } = \left| {v_{i,j} - v_{j}^{ - } } \right|\), \(\Delta_{\min }^{ - } { = }\min \{ \Delta_{i,j}^{ - } \}\), \(\Delta_{\max }^{ - } { = }\max \{ \Delta_{i,j}^{ - } \}\).

  1. 5.

    Calculate the grey relational grades:

The grey relational grade between the ith alternative and the positive ideal solution is written as

$$G_{i}^{ + } = \frac{1}{n}\sum\nolimits_{j = 1}^{n} {\gamma_{i,j}^{ + } }$$
(38)

Similarly, the grey relational grade between the ith alternative and the negative ideal solution is written as

$$G_{i}^{ - } = \frac{1}{n}\sum\nolimits_{j = 1}^{n} {\gamma_{i,j}^{ - } }$$
(39)
  1. 6.

    Calculate the relative grey relational grade:

$$C_{i} = \frac{{G_{i}^{ + } }}{{G_{i}^{ + } + G_{i}^{ - } }}$$
(40)
  1. 7.

    Rank the alternatives by the value of Ci, and the alternative with the highest value of Ci is selected.

The Si and Ci have the same positive effect on the decision-making; accordingly, the WSM and GRA are integrated to select an OBO for the ABOs, expressed as

$$WG = \rho S_{i}^{\prime } + (1 - \rho )C_{i}^{\prime }$$
(41)

where \(S_{i}^{\prime } = {{S_{i} } \mathord{\left/ {\vphantom {{S_{i} } {\sum\nolimits_{i = 1}^{m} {S_{i} } }}} \right. \kern-\nulldelimiterspace} {\sum\nolimits_{i = 1}^{m} {S_{i} } }}\), \(C_{i}^{\prime } = {{C_{i} } \mathord{\left/ {\vphantom {{C_{i} } {\sum\nolimits_{i = 1}^{m} {C_{i} } }}} \right. \kern-\nulldelimiterspace} {\sum\nolimits_{i = 1}^{m} {C_{i} } }}\), and ρ (\(0 \le \rho \le 1\)) is a coefficient to adjust the relative importance of the WSM and GRA. Here, ρ is set as 0.5, which means the importance of the WSM and GRA are the same. The greater WG is, the better alternative will be.

5 Case studies and discussion

The proposed method is developed in MATLAB R2021a and runs on a 16 GB AMD Ryzen 5 3600 3.6 GHz processing unit. Two complex parts, namely jet bracket and fan duct, are applied to validate the proposed method; the detailed information of which is presented in Table 4. The manifold mesh models of the test parts with original orientation are shown in Fig. 16. The corresponding facet clusters of the two parts are presented in Fig. 17. The relative process parameters of the extrusion-based AM technology are presented in Table 5.

Table 4 Geometric information of the test parts
Fig. 16
figure 16

Manifold mesh models of the test parts

Fig. 17
figure 17

Facet clusters of the test parts

Table 5 Process parameters used for the criterion estimation models

5.1 Case study 1

Figure 18 presents the twelve ABOs of the jet bracket using the generation method in Sect. 4.2. The corresponding rotation angles for the twelve ABOs are listed in Table 6.

Fig. 18
figure 18

ABOs of the jet bracket

Table 6 Rotation angles of different ABOs for the jet bracket

The estimated criterion values of the ABOs for the jet bracket are listed in Table 7. To obtain an OBO from the ABOs, the weights of each criterion should be first assigned. Given the fuzziness of human judgment, this study adopts the fuzzy analytical hierarchy process [46] to obtain the weight vector for the five criteria. For the jet bracket, the importance of the volume deviation and surface quality is considered to be more crucial than other criteria, and the resulting weight vector can be achieved as \({\varvec{W}}_{{1}} = \left( {0.1843, \, 0.2581, \, 0.2581,{ 0}{\text{.1843, }}0.1152} \right)^{{\text{T}}}\). Subsequently, the MCDM values, i.e., WG values, of the twelve ABOs can be obtained as presented in Table 7, and the rankings of the twelve ABOs are likewise listed in Table 7. As can be seen, the ultimate OBO for the jet bracket is ABO 6, and its rotation angle vector is (0.0000°, 0.0000°, − 90.0000°, 2.0794°)T.

Table 7 Estimated criterion values and quantitative comparison in different ABOs of the jet bracket

To further demonstrate the effectiveness of the proposed method, the criterion values applying uniform and adaptive slicing in the original orientation of the jet bracket are compared with ABO 6, which can be seen in Table 8. In Table 8, Origin 1–3 represent the results of the uniform slicing with minimum and maximum allowable thicknesses, and adaptive slicing in the original orientation of the jet bracket, respectively. Based on the slicing results, the proposed MCDM method is applied to evaluate them, and the resulting WG values and their rankings are likewise listed in Table 8. As can be seen, ABO 6 is still the optimal one, which demonstrates the effectiveness of the proposed method.

Table 8 Estimated criterion values and quantitative comparison of the Origin 1–3 and OBO for the jet bracket

The supports of the jet bracket in different orientations are presented in Fig. 19 to verify the estimation values in Tables 7 and 8. It can be seen that the supports of ABO 1 and ABO 12 are more than that of the original orientation and ABO 6. The slicing results for the Origin 1–3 and ABOs in Fig. 19 are depicted in Fig. 20. The application of adaptive slicing can effectively decrease the total build time and cost. The layer thicknesses will vary with the change of build orientation. The physical fabrications of the jet bracket for the Origin 1–3 and OBO are shown in Fig. 21. The actual support structure layouts of the fabrication parts are similar to that in Fig. 19. The result supposes that the OBO considering adaptive slicing obtained by the proposed method is desirable for practical application in extrusion-based AM.

Fig. 19
figure 19

Supports of the jet bracket in different orientations

Fig. 20
figure 20

Slicing results of the jet bracket in different orientations

Fig. 21
figure 21

Physical fabrications of the jet bracket in different orientations

5.2 Case study 2

To further present the effectiveness of the proposed method, the fan duct case considers more potential ABOs. Figure 22 depicts the sixteen ABOs of the fan duct, and the corresponding rotation angles of the sixteen ABOs are listed in Table 9.

Fig. 22
figure 22

ABOs of the fan duct

Table 9 Rotation angles of the ABOs for the fan duct

The estimated criterion values of the ABOs of the fan duct are listed in Table 10. In the MCDM model, different weights for the decision criteria will induce various optimal alternatives. Therefore, another weight vector \({\varvec{W}}_{{2}} = \left( {0.2422, \, 0.2121, \, 0.1819,{ 0}{\text{.2665, }}0.0973} \right)^{{\text{T}}}\) is achieved to reveal the influence of weights on the obtained OBO. Table 11 lists the WG values and corresponding rankings of the sixteen ABOs using the weight vectors, W1 and W2. In Table 11, WG 1 and WG 2 represent the WG values for the cases of W1 and W2, respectively. In the case of W1, the OBO for the fan duct is ABO 6, and its rotation angle vector is (231.4675°, 2.6093°, 90.0000°, 10.8305°)T. For the weight vector W2, since the weights of support volume and build time are more crucial than others, the OBO for the fan duct becomes ABO 12, and its rotation angle vector is (221.9946°, 0.3437°, − 90.0000°, 0.0000°)T.

Table 10 Estimated criterion values in different ABOs of the fan duct
Table 11 Quantitative comparison in different ABOs of the fan duct with different weight vectors

Similarly, the two OBOs obtained are compared with the result of the fan duct in the original orientation, which is listed in Table 12. Here, the criterion values of the original orientation are added to the decision matrix of the sixteen ABOs above. The WG values of the three orientations in the cases of W1 and W2, are both calculated and listed in Table 12, and the two OBOs are better than the original orientation. Notably, owing to the participation of the original orientation, ABO 12 is now the OBO for the two cases of W1 and W2. This is because the support volume and build time in ABO 12 are the least among the sixteen ABOs. This result demonstrates that the proposed MCDM method effectively produces an optimal alternative while the input data changes.

Table 12 Estimated criterion values and quantitative comparison of the fan duct in the original orientation and two OBOs

To demonstrate the estimated criterion value, the supports of the fan duct in different orientations are presented in Fig. 23. It can be seen that the support of ABO 12 is the least. Figure 24 depicts the adaptive slicing results for the orientations in Fig. 23. The relative physical fabrications in the original orientation and the two OBOs obtained are shown in Fig. 25. As can be seen, the actual support structure layouts for the fan duct are similar with that in Fig. 23. The results in Tables 11 and 12, and Figs. 23, 24 and 25 demonstrate that the proposed method effectively obtains a preferable build orientation and layer thickness distribution for the fabrication in extrusion-based AM.

Fig. 23
figure 23

Supports of the fan duct in different orientations

Fig. 24
figure 24

Adaptive slicing results of the fan duct in different orientations

Fig. 25
figure 25

Physical fabrications of the fan duct in different orientations

5.3 Discussion

The facet clustering method of Qin et al. [40] can generate a set of facet clusters and its unitized central normal vectors with high efficiency. The MBR algorithm is also fast by using vectorized calculation. The time to obtain the final ABOs within 100 facet clusters is about 1 s; even for 1000 facet clusters, it only requires about 4 s. The adaptive slicing process for an ABO requires a few seconds. In the realistic implementation of extrusion-based AM, this characteristic of the proposed method makes it desirable for practical applications in the case of simultaneous optimization of build orientation and layer thickness. And the physical experiments of the jet bracket and fan duct demonstrate the effectiveness. Although the proposed method still risks missing the true OBO compared with the computation-based methods. It is preferable since applying adaptive slicing for all alternatives of each iteration in the computation-based optimization process is time-consuming.

The infill style affects the calculation results of build time and cost. The Zig Zag style is selected for the case studies due to its convenient computation. The calculation equations are likewise suitable for the Grid style. But this calculation technique is not available for other complex infill styles, such as the Honeycomb and Gyroid styles. Applying the complex style’s original generation rules will help obtain accurate calculation results. In addition, the intersection lines between the infill lines and the contour are ignored for simplified computation. A correction factor for considering the intersection lines is conducive to making the results more accurate and can be obtained by certain physical experiments.

The weights of the decision criteria have a crucial effect on the ultimate decision choice in the proposed MCDM method. The case study of the fan duct discusses the results in the two cases of different weight vectors, which suggests that the input data and weights are significant for the final optimal alternative. Assigning suitable weights to the corresponding criteria is worth paying more attention to, as the decision criteria are usually conflicting and interrelated. Certain experiments may help find the inherent correlation between the decision criteria and the as-built part.

In addition, this study considers all the surfaces of the part are of the same importance. However, in some cases, for example, the assembly surfaces of a model require more manufacturing precision to improve product performance. Consequently, assigning different weights to different surface features of the part is desirable for the specific requirements in the optimization process. Similar work can be found in Xu et al. [23, 25, 27, 28].

6 Conclusions

This study proposes a part build orientation optimization method in extrusion-based additive manufacturing coupling with adaptive slicing. The proposed approach first develops an adaptive slicing method using volume deviation rate. Second, the relative decision criteria, namely support volume, volume deviation, surface roughness, build time, and build cost, are considered, and their values are estimated via certain models. Especially, a benchmark artifact for the estimation of surface roughness is designed, and the actual fabrication and measurement using a contact surface roughness tester for the artifact are done to produce an accurate estimation model. Afterward, a set of ABOs defined by four rotation angles is generated based on the MBRs of the facet clusters in a manifold mesh model. Last, an integrated MCDM model composed of the WSM and GRA is proposed to achieve an OBO among the ABOs. Two complex parts are utilized to validate the effectiveness of the proposed approach with quantitative comparisons and physical fabrications. The case studies indicate that the proposed method is conducive to simultaneously optimizing the build orientation and layer thickness for complex parts in extrusion-based AM.

As the present study only considers the fabrication in extrusion-based AM, future work will aim at other AM processes, such as SLA and selective laser melting. Nowadays, multi-part fabrication is fashionable for the application of AM, which means a group of parts is built simultaneously. As a result, the proposed method could be improved to determine the build orientations of multiple parts simultaneously. Additionally, machine learning can also be applied to estimate the values of decision criteria.