1 Introduction

In mold flow analysis, a computer aided design (CAD) model must be converted into solid meshes for the analysis solver. Tetrahedral (Tet) mesh elements are commonly used because they are easy to generate and can be fitted for any complex geometry. However, the mesh element must be close to isotropic for achieving good mesh quality, which can result in excessive number of elements, especially for thin-shell components. On the contrary, hexahedral (Hex) or prismatic (Prism) meshes can be anisotropic while preserving good mesh quality, which indicates that the number of elements in the shell and thickness directions can be independent. However, to apply Hex or Prism elements, the decomposition of a CAD model is necessary. Although significant research on automatic Hex meshing of CAD models has been carried out, most of the methods are restricted to block structures [1,2,3,4,5,6,7,8,9]. As fully Hex meshing is difficult for complex components, research on semi-automatic Hex-dominant meshing has also be investigated [10,11,12,13,14,15]. However, automatic decomposition of CAD models is still a bottleneck owing to the complexity of CAD models in real applications.

Thin-shell plastic parts are used in many products and are frequently manufactured by injection molding. On both the inside and outside of this type of part, various features (such as protrusions and depressions) are attached to a main body (referred to as the thin shell). The thin shell and the features that reside on it can be complex in shape. The inner side is typically more complex in structure as it has many functional and structural features design. However, complex features may exist on the outside too. In addition, a CAD model usually involves fillets that are tiny or long and narrow to some extent. Fillet is one of the most troublesome issues in meshing as its dimension is usually much smaller than its neighboring faces. To improve the accuracy of mold flow analysis, users would rather perform mesh generation manually, as they are free to design and adjust meshes region by region. However, this requires considerable efforts in planning, model decomposition, and mesh generation.

For the decomposition of thin-shell CAD models, several approaches in the literature could be addressed. As a thin-shell part is mainly composed of a thin shell and various types of feature residing on it, it could be possible by applying feature recognition to identify the features directly. Feature recognition has been studied for many years. However, most of the methods are for the applications in CAD, CAM and CAPP [16,17,18,19,20]. Lu’s method [1] based on the extraction of various types of edge loops can extract block shapes from a CAD model for Hex meshing. Wu’s method [2] based on sweep direction extraction can divide a CAD model into several blocks that can be meshed by sweeping. However, they both claimed that their algorithms were valid only for limited cases. For automatic Hex meshing, the approaches of 3D cross field [3,4,5,6] and polycube [7,8,9] can convert smooth surface triangular meshes of an object into all Hex meshes. These methods are suitable primarily for block structures too. For semi-automatic Hex-dominant meshing, Robinson and Armstrong’s approach [10,11,12,13,14] for thin-walled parts is much close to the issue addressed in this study. Their application is mainly for aerospace parts, e.g. engine cases, which involve the recognition and meshing of thin-shell and long-slender regions. However, the remaining complex regions are still processed manually.

The concept proposed in this study for solving the decomposition problem for thin-shell CAD models is to separate the thin shell and protrusions individually. Protrusions on different CAD models could be complex and variable. Traditional feature recognition methods by recognizing protrusions directly are error-prone. Both edge loops extraction [1] and sweep directions extraction [2] that directly extract block shapes from a model could easily result in overflow for complex components. This is why these two methods can only be applied for limited cases. In this study, the faces belonging to the thin shell are recognized and classified first. They are then used as the constraints for recognizing protrusion faces group by group. As the faces on each group are less complex in structure, the recognition and classification of protrusions become easier. The contours that each group of protrusion faces lie on the thin shell can also be evaluated. Once the faces of the thin shell and protrusions are separately obtained, it would be possible to achieve automatic volume decomposition of complex thin-shell models.

Recognition and classification of the faces on the thin shell is a critical issue for the aforementioned method. A typical thin-shell part can be divided into inner and outer faces. Faces that can be seen from outside when two parts are assembled are called outer faces, while those that cannot be seen are called inner faces. Inner faces mainly include faces that belong to the inner thin shell (including transition, wall and bottom faces; see Sect. 3) and the remaining protrusion faces. Similarly, outer faces also include faces that belong to the outer thin shell (including flange, outer wall and bottom faces; see Sect. 3) and the remaining protrusion faces. The face pair method proposed by Sun et al. [13] for extracting thin shell faces on thin-shell components could be employed. However, their method was only implemented on an “engine case”, but has not been applied to other models. In addition, excessive face pairs that do not lie on the thin shell could be extracted as the conditions used for finding a face pair are relatively simple. Unlike most literature that only uses limited examples for demonstration, we collected many thin-shell CAD models in the beginning of this study to find out all kinds of situations that may occur.

In [21,22,23], we have developed algorithms for the recognition and decomposition of thin-shell CAD models. In [21], we focused on the recognition of ribs as ribs occupy most of the protrusions on a model. However, erroneous recognition result may still occur for complex models. In [22], we focused on the recognition of faces on the thin shell and employed them for the recognition of protrusion faces. In [23], we developed a volume decomposition algorithm for the thin shell by considering the matching of the meshes at the transition of the thin shell and protrusions. However, the complexity of the thin-shell models that can be processed was limited as follows: (1) the transition between the inner and outer faces is flat, (2) protrusions exist on inner faces only, and (3) other complex conditions are not considered.

The purpose of this study was to present an enhanced method for the recognition and classification of faces on the thin shell for more general thin-shell CAD models. In addition to the above-mentioned conditions, this study emphasizes the processing of the following conditions: (1) complex transition between inner and outer faces, (2) protrusions exist both on the inside and outside, (3) fillets are included, and (4) complex holes across multiple faces are included. A detailed description of the above-mentioned conditions will be given in Sect. 2. The proposed face recognition and classification method can accurately evaluate the faces on the thin shell of different kinds of thin-shell parts. A detailed description of the procedures in each step of the proposed method is provided. Twenty-five CAD models and the recognition results are also presented to demonstrate the feasibility of the proposed face type recognition and classification method.

2 Literature review

Feature recognition on CAD, CAM, and CAPP are mainly divided into two approaches, graph-based and volumetric-based. For the graph-based approach, Joshi et al. [24] proposed an attributed adjacency graph (AAG) built on a B-rep model and employed heuristics for recognizing polyhedral features for machining. Corney et al. [25] constructed a face-edge graph (FEG) for 2 1/2D parts and proposed a procedure for recognizing holes and pockets. Bruzzone et al. [26] addressed the problem of extracting adjacency information from a description of a solid object in terms of the face-to-face composition (FFC) model. The problem related to the development of adjacency-finding algorithms was discussed. Lim et al. [18] presented an algorithm for partitioning protrusion and depression features (DP-features) on models with free-form surfaces. A vertex-edge-graph (VEG) of all of the candidate edges on the model was generated. For the volumetric-based approach, Waco et al. [27] proposed a method based on alternating sum of volumes with partitioning (ASVP) for extracting block volumes form a solid model. Sakurai et al. [28] presented a method based on maximal volume decomposition (MVD) for extracting the maximum volume on a model. Woo et al. [29] proposed a quantitative measure, called orthogonal bounding factor (OBF), for the detection of protrusion features on loops of concave edges. All the above-mentioned methods only show the ability of extracting interesting features or volumes from a model for the machining purpose. They cannot be used for the decomposition of the entire model.

Liu et al. [30] employed CLoop (convex and concave loops) proposed in Gadh et al. [31] to decompose a solid model into multiple block structures, each of which represents a simple block shape, and then apply a transfinite mapping method that maps a unit cube into a Hex region in 3D space to convert each block shape into Hex meshes. Lu et al. [1] extended CLoop into PLoop (pure convex or concave loop), SLoop (mixed convexity, closed link), and HLoop (mixed convexity, open link), and investigated the partition of the 3D model based on these types of loop. A separator is one or more loops which can bound a cutting face to separate the model. Heuristic rules were proposed for generating separators and the corresponding cutting face for each of them was described. The limitation of this method is that the loop-based block volume recognition is not robust, especially for complex parts that contain loops beyond the consideration of this study.

In mesh generation, one of the approaches is to idealize a solid model with mid surfaces to apply shell elements on some regions that can be described by mid surfaces. Depending on the range of a model that is represented by mid surfaces, the resultant model can be a pure mid-surface model or a mixed-dimensional model combining mid surfaces and the remaining complex regions. This technique can greatly reduce the number of elements and hence the degrees of freedom required for meshing. Sheen et al. [32] proposed a solid deflation method to shrink a solid model into a very thin solid, and then convert it into a mid-surface model. This technique is applicable only to limited types of models with planar and quadratic surfaces. Zhu et al. [33] proposed a mid-surface abstraction method for thin-walled models based on rib feature decomposition. It defined a hierarchical semantic structure to describe the connection relationships between sub-regions and the affiliation relationship of two connected sub-regions. The rib features on the thin-walled model were identified and organized to form a hierarchical semantic structure. A model decomposition algorithm was then employed to decompose rib features in accordance with the hierarchical semantic structure. The mid-surface patches for each sub-region were finally abstracted through an adaptive abstraction method. Only three models were demonstrated in this study. More complex models need to be tested for verifying the robustness of this method. Robinson et al. [10] proposed a decomposition process based on the medial axis transform (MAT) for idealizing the thin-sheet regions of thin-walled structures as mid-surfaces, which can then be meshed using shell elements. The remaining complex regions on the 3D model were then meshed with tetrahedral meshes. Makem et al. [11] extended Robinson’s work to find the long slender regions on thin-walled structures. It employed shape metrics generated using local sizing measures to identify long slender regions within the thick body. A series of algorithms were then applied for partitioning the think region into a non-manifold assembly of long/slender and complex sub-regions, which were then meshed with structured anisotropic meshes and unstructured isotropic tetrahedral meshes, respectively.

Nolan et al. [12] focused on the creation of a dimensionally reduced model for the purpose of structural analysis in the preliminary design and optimization stage of a thin-walled product. The 3D thin-walled CAD model was divided into thin-sheet, long-slender and complex regions. The thin-sheet regions were first identified using the method described in Robinson et al. [10]. The remaining thick regions were then sub-divided into long-slender and complex regions using the method described in Makem et al. [11]. The decomposed model was a non-manifold assembly of thin-sheet, long-slender and complex volumes, which were then meshed using shell, beam and tetrahedral elements, respectively. Sun et al. [13] proposed a face-pair based method for identifying thin-sheet regions, which is computationally more efficient than the MAT method described in Robinson et al. [10]. Instead of extracting mid surfaces from the face pairs, this method focused on how to decide the boundaries of the target thin-sheet regions and how to create cutting faces to decompose the models without generating silver volumes in either thin-sheets or residual domain. Each set of face pair can form a sweepable region that can be meshed with hexahedral meshes. Sun et al. [14] later proposed an enhanced method for long-slender region identification. It also emphasized the decision of the boundaries of the target regions and the corresponding cutting faces to isolate the long-slender regions suitable for sweep meshing.

For automatic Hex meshing, sweeping is one of the most robust techniques to generate Hex meshes. White et al. [34] proposed a CCSweep technique to automatically decompose multi-sweepable volumes into many-to-one sweepable volumes. It converted multiple-source-and-target-faces into a single-target-face problem, enabling the sub-volumes to be automatically meshed using a many-source-to-one-target Hex sweeping approach. Cai et al. [35] addressed the one-to-one sweeping and indicated that the most difficult problem was to map an all-quad source surface mesh onto its target surface. They proposed a harmonic function for the morphing of the meshes on a source surface onto its target surface, and a cage-based method for locating nodes inside volumes. This algorithm can map surface meshes between two concave or multiply-connected surfaces, and can also deal with geometries with twisted and complicate boundaries. Wu et al. [36] proposed an automatic swept volume decomposition technique based on sweep directions extraction. It first extracted all potential local sweep directions from the model and generated relevant face sets for each of them. The reasonable cutting face set that can split the model into swept sub-volumes was then constructed. Finally, the relevant face sets were used to generate maximal single-axis swept subvolumes. However, based on the decomposed results provided, it seems that some subvolumes are still complex in shape and may not be meshed by sweeping.

Research on automatic Hex meshing for an object represented as smooth Tet surface meshes has also been studied extensively. Luo et al. [37] proposed a method to obtain a near optimal finite element mesh from a coarse Tet surface mesh of a CAD model. It can identify thin sections of the model through a set of discrete medial surface points computed from an Octree-based tracing algorithm and convert Tet elements into Prism elements in the thin directions. It can also identify geometric singular edges and generate geometrically graded meshes from the edges. The meshes can then be mapped onto the geometry to the required level. Liu et al. [38] presented a method based on skeleton-based polycube generation to construct feature-preserving T-meshes. From the input skeleton of a model, initial interior cubes and boundary cubes that contact with the outer surface were created. Each cubic region was then subdivided to obtain T-spline control mesh. During the subdivision, the mesh boundary was aligned to preserve surface features, which include open curves, closed curves and singularity features. The T-meshes were finally extracted as Bezier elements for isogeometric analysis. Hu et al. [7] proposed an automatic polycube construction algorithm using harmonic boundary-enhanced centroidal Voronoi tessellation (HBECVT) based surface segmentation. Given a smooth surface triangle mesh, the polycube construction was viewed as a mesh segmentation task. The HBECVT method introduces local neighboring information into the energy function, which can reduce non-monotone boundaries and is less sensitive to the noise. Based on the constructed polycube, uniform Hex meshes, T-spline control meshes and adaptive all-Hex dual meshes could be generated. Hu et al. [8] modified the HBECVT method by introducing eigenfunctions of the secondary Laplace operator for surface segmentation and a novel generalized harmonic boundary-enhanced CTV model for polycube construction. This modified method can reduce the computational cost and eliminate unsmoothed boundary and over-segmentations.

Yu et al. [9] presented a software package, HexGen and Hex2Spline, to integrate geometry design with isogeometric analysis in LS-DYNA. Given a CAD model, HexGen creates a Hex mesh by using a semi-automatic polycube-based mesh generation method. Hex2Spline can construct hierarchical splines by using the Hex mesh from HexGen. HexSpline can also transfer spline information to LS-DYNA and performs isogeometric analysis. Yu et al. [15] further presented a Hex-Dom software package that can create a Hex-dominant mesh in real applications. A semi-automated polycube-based mesh generation method was employed. The resulting mesh is Hex dominant, but is also composed of Tet and Prism meshes.

3 Basic concept and method overview

A thin-shell CAD model is basically composed of a thin shell that forms the basic shape of the part. The faces on a part can be divided into inner and outer faces, where the former are invisible when two parts are assembled and the latter are visible. The inner faces can be divided into the following four types (Fig. 1a): transition, wall, bottom, and protrusion faces. Faces that are adjacent to outer faces are called transition faces. Faces that form the bottom of the inner region are called bottom faces. Faces on the side wall are called wall faces. The remaining faces belong to protrusion faces. When multiple layers of wall face exist, the upper layer is called wall faces, while the lower layers are called step-wall faces, as shown in Fig. 1b. Similarly, the outer faces can be divided into the following four types (Fig. 1c): outer wall, outer bottom, protrusion and flange faces. The definition of outer wall, outer bottom and protrusion faces is similar to those on inner faces. Faces that are between outer wall and transition faces are called flange faces. Flange faces may not exist on a model.

Fig. 1:
figure 1

Composition of faces on thin-shell parts, a inner faces, b multiple-layer inner wall, and c outer faces

Thin-shell CAD models can be analyzed in accordance with the following conditions. First, a transition face is basically a face that directly connects to inner and outer wall faces simultaneously. However, complex transition faces with different kinds of cross section may exist. Five types of transition face are commonly occurred, which are: (1) simple transition (Fig. 2a): the cross section is composed of a line or a line and arcs that connect to the line smoothly. The transition faces include a face or a face and its neighboring fillets. It is the most common type; (2) step (Fig. 2b): the cross section is a step. The transition faces include two faces of different heights and a face that connects to them; (3) open step (Fig. 2c): it is like a “step”, but with a sudden jump to become a “simple translation” in some regions; (4) extruded ridge (Fig. 2d): the cross section involves a convex ridge. The transition faces include the faces on the ridge and its neighboring faces; and (5) depressed ridge (Fig. 2e): the cross section involves a concave ridge. The transition faces include the faces on the ridge and its neighboring faces.

Fig. 2
figure 2

Five types of transition faces, a simple transition, b step, c open step, d extruded ridge, and e depressed ridge

Second, the protrusion structure on the outside is more complex than that on the inside. Both outer wall and outer bottom faces can be divided into concave and non-concave types, as shown in Fig. 3. When most of the protrusions on the outside are distributed continuously and partition the wall faces into many regions, this kind of part is called a concave wall type (Fig. 3a). On the contrary, when most of the protrusions are distributed sparsely, it is called a non-concave wall type (Fig. 3b). In addition, the outer bottom face is normally lower than its neighboring wall faces, e.g. Fig. 3a, b). However, it may occur that the outer bottom face is sunken inside and becomes higher than its neighboring wall faces, e.g. Fig. 3c. The former is called a non-concave bottom type, while the latter is called a concave bottom type. Such a classification is helpful for the recognition of different face types.

Fig. 3
figure 3

Three types of wall and bottom faces on the outside, a concave wall, b non-concave wall, and c concave bottom

Finally, fillets and holes are common features on CAD models. They are usually neglected or simplified for the simplification of the problem. However, in real CAD models, these features always exist and should be addressed too. When classifying faces on a thin shell into different face types, the belonging of the fillets that connect to these faces should be determined also. In addition, most holes are located on a simple face only. However, holes that lie across multiple faces may also exist and complicate the face type recognition problem. Therefore, the issues related to fillets and holes should be addressed and solved also.

In this study, an enhanced inner and outer faces recognition algorithm is developed to cover all kinds of thin-shell CAD models, as mentioned above. Figure 4 shows the overall flowchart of the proposed face type recognition algorithm. It can mainly be divided into the following two steps: preliminary functions and face type recognition. The input is a boundary representation (B-rep) model of the thin-shell part, and the output is the composition of faces both on the inside and outside. The main improvement of this study, compared with that in [22], is that the enhanced method can cover five types of transition face, fillets, complex holes, and concave and non-concave types both on outer wall and bottom faces. This study primarily focuses on the development of the face type recognition. However, preliminary functions are briefly described below for completeness of the method.

Fig. 4
figure 4

Flowchart of the proposed face type recognition method for thin-shell CAD models

In preliminary functions, the edge and face databases are computed first. Each database records the geometric and topological data of the associated entity. Fillet recognition is implemented next, which outputs the compositions of edge blended faces (EBF) and vertex blended faces (VBF). Fillet data enable the evaluation of faces across any EBF or VBF. Next, hole recognition is implemented. Hole recognition allows all blind and through holes on the B-rep model to be recognized. Coaxial holes can also be detected by this algorithm. More importantly, holes that lie across multiple faces are also recognized. It relies on the recognition of virtual and multi-virtual loops first. A virtual loop is a closed contour formed by multiple faces that connect at least G1 continuous, whereas a multi-virtual loop is also a closed contour by multiple faces, but with some junctions G0 continuous.

In face type recognition (Figs. 140, 150, 160), inner and outer faces are separated first. It can normally yield a closed loop of parting line representing the transition of inner and outer faces. Transition faces are next determined. For “simple transition” (Fig. 2a), the transition faces are directly adjacent to the parting line. However, to cover the other four types of transition face (Fig. 2b–e), an algorithm is employed to search the faces that can represent the cross section of transition faces and determine the transition type. The face types on inner and outer faces are next recognized, respectively. For inner faces, a smooth face is often partitioned into many pieces owing to the complex structure of protrusions on the inside. Fillets may also appear at the junction of two or several faces and complicate the determination of the face type. Specific rules are provided to recognize wall and bottom faces in sequence. With transition, wall and bottom faces recognized, protrusion faces can be recognized and divided into groups based on the adjacency relationship. For outer faces, wall, bottom and flange faces are recognized in sequence. Both outer wall and bottom faces are divided into two types: concave and non-concave types. The distinction of concave and non-concave bottom types is used for the recognition of wall, bottom and flange faces; while the distinction of concave and non-concave wall types is used for the recognition of protrusion faces.

4 Proposed face type recognition method

4.1 Separation of inner and outer faces

Consider that the part model is aligned so that the mold opening direction is along + Z, and the two axes of its horizontal plane are parallel to the X and Y directions, respectively. The other five faces on the bounding box of the part model are perpendicular to + X, − X, + Y, − Y and − Z, respectively. Based on the definition on inner and outer faces previously, the outer faces are visible from the outside, whereas the inner faces are invisible. The visibility of a face could be detected by projecting lines from this face onto the boundary planes and checking the intersection of these lines with the other faces [22]. However, this concept could be valid for simple shape, but may not be applicable for complex geometry, especially when protrusion features exist on outer faces. Figure 5 shows the flowchart of inner and outer faces separation. The faces are initially divided into three types based on the visibility from + Z. Some of the face types are modified in accordance with the adjacency relationship. One or several loops of transition edges that represent the boundary of inner and outer faces can then be obtained. The inner and outer faces are finally separated based on the main loop of transition edges. The detailed algorithm is described below.

Fig. 5
figure 5

Flowchart of inner and outer faces separation

4.1.1 Step 1: Divide faces into three types

The faces are initially divided into candidate inner, wall and outer faces by checking the intersection with the boundary box. Consider one face \({f}_{i}\) on the model. If \({f}_{i}\) meets the following conditions, then it is regarded as a candidate outer face: (1) \({\theta }_{f}> 170^\circ\), where \({\theta }_{f}\) is the angle between the surface normal \({{\varvec{n}}}_{f}\) and + Z; (2) \({L}_{f}\) does not intersect any face on the model, where \({L}_{f}\) is a line from the centroid of \({f}_{i}\) towards \({{\varvec{n}}}_{f}\); and (3) \({f}_{i}\) is not a hole face of through holes. When \({f}_{i}\) is neither a candidate outer face nor a hole face of through holes, it is assigned to one of the following two regions: (1) Region I: \(0^\circ \le {\theta }_{f}\le 90^\circ +\varepsilon\), and (2) Region II: \(90^\circ +\varepsilon <{\theta }_{f}\le 180^\circ\), where \(\varepsilon\) is a draft angle, \(3^\circ\) in this study.

When fi is in Region I, the candidate inner and wall faces are determined based on a projecting-line intersection check and face adjacency relationship. Define two parameters \(\mathrm{Max}\left({{\varvec{n}}}_{b}\right)\) and \({C}_{2}\), where \(\mathrm{Max}\left({{\varvec{n}}}_{b}\right)\) denotes one of the six directions \(\pm\) X, \(\pm\) Y, \(\pm\) Z that is closest to the direction of \({{\varvec{n}}}_{f}\), and \({C}_{2}\) is the status of intersection. Project a line from the centroid of \({f}_{i}\) towards the direction \(\mathrm{Max}\left({{\varvec{n}}}_{b}\right)\) and check if it intersects any face on the model. If an intersection occurs, then set \({C}_{2}\) as true, otherwise set \({C}_{2}\) as false. The face type of \({f}_{i}\) is determined based on face adjacency relationship, as follows:

  1. (1)

    If \({f}_{i}\) is not adjacent to any candidate outer face, then regard fi as a candidate inner face.

  2. (2)

    If \({f}_{i}\) is adjacent to a candidate outer face, \(\mathrm{Max}\left({{\varvec{n}}}_{b}\right)\ne +\mathrm{Z}\), and \({C}_{2}=\) false, then regard \({f}_{i}\) as a candidate wall face

  3. (3)

    Otherwise, regard \({f}_{i}\) as a candidate inner face. Also, mark \({f}_{i}\).

The reason to apply such complex rules is because some special cases cannot be judged by the angle \({\theta }_{f}\) only. The faces marked in Condition (3) will later be used to help determining the parting line. The left plot in Fig. 6a shows two faces that satisfy Conditions (1) and (2), respectively.

Fig. 6
figure 6

Immediate results for inner and outer faces separation, a Step 1, b Step 2, c Step 3, d Step 4, and e Step5

When \({f}_{i}\) is in Region II, the candidate inner and wall faces are determined by projecting a line from the target face and check the number of intersections. Different face type has different number of intersections. Define a parameter \({C}_{5}\), where \({C}_{5}\) denotes the status of the intersection. Project a line from the centroid of \({f}_{i}\) towards \(\pm\) X, \(\pm\) Y and -Z, respectively, and check if it intersects any face on the model. If an intersection occurs, then \({C}_{5}\) is increased by 1 (The values of \({C}_{5}\): 0–5). The face type of \({f}_{i}\) is determined as follows:

  1. (1)

    If \({C}_{5}=\) 5, then regard \({f}_{i}\) as a candidate inner face.

  2. (2)

    Otherwise, regard \({f}_{i}\) as a candidate wall face.

The right plot in Fig. 6a shows two faces that are assigned as candidate wall (\({C}_{5}=\) 4) and inner (\({C}_{5}=\) 5) faces, respectively.

4.1.2 Step 2: Modify candidate inner and wall faces

Some groups of candidate inner and wall faces may wrongly be recognized in previous step. They are detected and modified in accordance with face adjacency relationship, as follows:

  1. 1.

    Group candidate inner faces \({{\varvec{G}}}_{ci}\): all candidate inner faces that are adjacent to each other are regarded as a group \({{\varvec{G}}}_{ci}\).

  2. 2.

    Check and modify candidate inner faces: Let \({f}_{i}\) be one face in \({{\varvec{G}}}_{ci}\). Project a line from the centroid of \({{\varvec{G}}}_{ci}\) towards \({{\varvec{n}}}_{f}\) and check if it intersects any face in \({{\varvec{G}}}_{ci}\). Let \({m}_{ci}\) be the intersection count for faces in \({{\varvec{G}}}_{ci}\). When an intersection occurs, \({m}_{ci}\) is increased by 1. If any group \({{\varvec{G}}}_{ci}\) with \({m}_{ci}<4\), then all faces in \({{\varvec{G}}}_{ci}\) are changed to candidate wall faces.

  3. 3.

    Group candidate wall faces \({{\varvec{G}}}_{cw}\): all candidate wall faces that are adjacent to each other are regarded as a group \({{\varvec{G}}}_{cw}\).

  4. 4.

    Check and modify candidate wall faces: if all faces in \({{\varvec{G}}}_{cw}\) are not adjacent to any candidate outer face, then all faces in \({{\varvec{G}}}_{cw}\) are changed to candidate inner faces.

Figure 6b shows two groups of faces that meet the conditions in Procedures (2) and (4), respectively.

4.1.3 Step 3: Compute candidate transition edges

Transition edges represent the common boundary of inner and outer faces. The edges on all candidate inner faces are checked one by one to determine candidate transition edges. Let \({f}_{i}\) be a candidate inner face and \({e}_{ci}\) be an edge on \({f}_{i}\). The conditions for determining candidate transition edges are as follows:

  1. (1)

    If \({e}_{ci}\) is adjacent to a candidate outer face and convex, and \({f}_{i}\) is marked, then \({e}_{ci}\) is regarded as a candidate transition edge.

  2. (2)

    If \({e}_{ci}\) is adjacent to a candidate wall face and convex, then \({e}_{ci}\) is regarded as a candidate transition edge.

  3. (3)

    If \({e}_{ci}\) is adjacent to a candidate wall face and one of its neighboring faces is a fillet, then \({e}_{ci}\) is regarded as a candidate transition edge.

  4. (4)

    If \({e}_{ci}\) is adjacent to a candidate wall face and concave, then the following algorithm is implemented: search the neighboring faces of the candidate wall face in all directions. If the boundary edge is convex or the face is not a candidate wall face, then stop search in that direction. It finally yields a set of neighboring candidate wall faces that are convex in all boundary edges. The boundary edges are regarded as candidate transition edges.

Figure 6c shows four edges that represent the above-mentioned four conditions, respectively.

4.1.4 Step 4: Separate inner and outer faces, and compute transition faces

Separate all faces into two types: inner and outer faces, except through hole faces. The common boundaries of inner and outer faces are regarded as transition edges. Transition edges will form one or several loops. For a group of inner faces that are adjacent to each other, it should have at least one face that is facing up and has a projecting line that does not intersect any face on the model. The algorithm to separate inner and outer faces and evaluate transition edges is as follows:

  1. (1)

    Divide faces into groups by candidate transition edges and edges of through holes: Faces that are adjacent to each other are regarded as a group, with candidate transition edges and edges of through holes being the boundary. It can yield multiple groups of face \({{\varvec{G}}}_{f}\).

  2. (2)

    Divide faces (except transition hole faces) into inner and outer faces: All faces in each group \({{\varvec{G}}}_{f}\) are checked. Consider that \({f}_{i}\) is a face in \({{\varvec{G}}}_{f}\). Generate a line \({L}_{i}\) from the centroid of \({f}_{i}\) towards + Z. If the following two conditions are satisfied, then all faces in \({{\varvec{G}}}_{f}\) are regarded as inner faces:

    1. (a)

      At least a face \({f}_{i}\) that is nearly horizontal and facing up, i.e. \({\theta }_{f}\le \varepsilon\).

    2. (b)

      At least a line \({L}_{i}\) that does not intersect any face on the model.

Otherwise, all faces in \({\boldsymbol{G}}_{f}\) are regarded as outer faces.

  1. (C)

    Compute transition faces: When an edge is the common boundary of an inner and outer faces, it is regarded as a transition edge.

Figure 6d shows an example divided into 7 groups by candidate transition edges. Only one group of faces are assigned as inner faces in this step.

4.1.5 Step 5: Modify inner and outer faces based on loops of transition edges

One or several loops of transition edges can be formed. By checking the number of loops and geometric and face adjacency conditions on each loop of faces, the face type can be determined. The procedures are as follows:

  1. (1)

    Evaluate loops of transition edges: each set of adjacent transition edges that form a loop are recorded. It can yield one or several loops of transition edges \({{\varvec{G}}}_{te}\). Denote \({m}_{te}\) as the number of loops.

  2. (2)

    Modify inner and outer faces based on mte:

    1. (a)

      \({m}_{te}=0\): ideally, at least one loop of transition edges can be found. If \({m}_{te}=0\), it indicates that a model with ambiguous transition edges between inner and outer faces exists. The step in Sect. 4.1.3 must be implemented again, with Condition (1) modified as: (1’) The edge exists between a candidate outer and inner face and is convex.

    2. (b)

      \({m}_{te}=1\): only one loop of transition edges is found. It is the typical case. No modification of the inner or outer face is needed. The corresponding loop of transition edges is called the parting line herein.

    3. (c)

      \({m}_{te}>1\): at least two loops of transition edges are found. The one with the longest length is the parting line, while the remaining loops must be checked. Consider that \({{\varvec{G}}}_{te}\) is one of the remaining loops. Find all outer faces that are adjacent to \({{\varvec{G}}}_{te}\). All such outer faces are expanded outside to form a face group \({{\varvec{F}}{\varvec{G}}}_{te}\) until it reaches another loop of transition edges or through holes. Whether \({{\varvec{G}}}_{te}\) should be preserved or not is determined as follows:

      1. (i)

        If FGtr contains at least a candidate outer face, then Gte is preserved.

      2. (ii)

        If FGte does not contain any candidate outer face, then Gte is deleted.

If \({{\varvec{G}}}_{te}\) is preserved, then it indicates that a large through hole (or pocket) exists on the model. On the contrary, if \({{\varvec{G}}}_{te}\) is deleted, all faces inside this loop should be changed to inner faces.

Figure 6e shows two examples with \({m}_{te}=1\) and 4, respectively. The parting lines and final inner faces are also displayed.

4.2 Transition faces recognition

As Fig. 2 depicts, transition faces are divided into the following five types: simple transition, step, open step, depressed ridge and extruded ridge. The “step” type may involve some faces from outer faces, while the faces on the other four types are all from inner faces. Therefore, the algorithm described below is used for detecting four types of transition faces only. The “step” type will be detected later in outer faces recognition. Figure 7 shows the flowchart of recognizing four types of transition faces, where the open step, extruded ridge and depressed ridge are detected in sequence. When none of the above three types is satisfied, it is regarded as a simple transition. In this algorithm, inner faces that are adjacent to the parting line are put into a group \({{\varvec{G}}}_{dtr}\) first. The “open step” type has a sudden jump on neighboring transition faces. Therefore, it is detected by checking the edge concavity between neighboring transition faces in \({{\varvec{G}}}_{dtr}\). For the “extrude ridge” and “depressed ridge” types, the faces in \({{\varvec{G}}}_{dtr}\) are grown along the thickness direction to find a set of neighboring faces that can describe the cross-sectional shape of the transition. The detection of each transition type should be implemented individually as each has its own procedures of determining transition faces.

Fig. 7
figure 7

Flowchart of transition faces recognition

4.2.1 Open step type

Consider that \({f}_{z}\) is the open bounding plane perpendicular to + Z. For each \({f}_{i}\) in \({{\varvec{G}}}_{dtr}\), if it is parallel to \({f}_{z}\), then the distance between \({f}_{i}\) and \({f}_{z}\) is computed. Denote the minimum distance among them as \({d}_{\mathrm{min}}\). All other inner faces that are parallel to \({f}_{z}\) are then checked to find faces with a distance smaller than \({d}_{\mathrm{min}}\). All such faces are put into a group \({{\varvec{G}}}_{ut}\), called upper transition faces. Check all faces \({f}_{n}\) that are adjacent to the faces in \({{\varvec{G}}}_{ut}\) and divide them into two groups. Generate a line \({f}_{n}\) from the centroid of \({f}_{n}\) towards its surface normal \({{\varvec{n}}}_{f}\). If \({L}_{n}\) intersects with a bounding plane, then put \({f}_{n}\) into a group \({{\varvec{G}}}_{\mathrm{out}}\). Otherwise, if \({L}_{n}\) intersects with an inner face, then put \({f}_{n}\) into another group \({{\varvec{G}}}_{\mathrm{in}}\). The conditions for determining the “open step” type is as follows:

  1. (a)

    If \({{\varvec{G}}}_{ut}\) is empty, then the transition is not an “open step” type.

  2. (b)

    If \({{\varvec{G}}}_{ut}\) is not empty, then

  • If all faces in \({{\varvec{G}}}_{\mathrm{out}}\) are adjacent to \({{\varvec{G}}}_{dtr}\) and all faces in \({{\varvec{G}}}_{in}\) are not adjacent to \({{\varvec{G}}}_{dtr}\), then the transition is an “open step” type.

  • Otherwise, the transition is not an “open step” type.

When the transition is an “open step” type, the faces in \({{\varvec{G}}}_{dtr}\), \({{\varvec{G}}}_{\mathrm{out}}\) and \({{\varvec{G}}}_{ut}\) are regarded as transition faces. Figure 8a shows the definition of \({{\varvec{G}}}_{dtr}\), \({{\varvec{G}}}_{\mathrm{out}}\), \({{\varvec{G}}}_{ut}\) and \({{\varvec{G}}}_{in}\), and transition faces for the “open step” type.

Fig. 8
figure 8

Immediate results for transition faces recognition, a open step, b extruded ridge, c depressed ridge, and d simple transition

4.2.2 Extruded ridge type

For recognizing extruded and depressed ridge types, a threshold \({d}_{w}\) for the maximum width of the ridge allowed must be assigned. An extruded ridge can be detected by searching neighboring faces that are connected convexly. Put all faces in \({{\varvec{G}}}_{dtr}\) into a face set \({{\varvec{F}}}_{rs}\). For each of the faces in \({{\varvec{F}}}_{rs}\), its neighboring faces are searched recursively along the thickness direction on both sides. Consider that \({f}_{i}\) is a face in \({{\varvec{F}}}_{rs}\) and \({f}_{n}\) is one of the neighboring faces. If \({f}_{n}\) meets the following conditions, then \({f}_{n}\) is put into \({{\varvec{F}}}_{rs}\): (1) \({f}_{i}\) and \({f}_{n}\) are connected convexly, and (2) \(0^\circ <{\theta }_{f}\le 90^\circ\), where θf is the angle between the surface normal of \({f}_{n}\) and + Z. Otherwise, the search stops on \({f}_{n}\). The search is continued for all faces in \({{\varvec{F}}}_{rs}\) until all neighboring faces have been checked. The conditions for determining the “extruded ridge” type are as follows:

  1. (a)

    Check every pair of vertical and parallel faces in \({{\varvec{F}}}_{rs}\) and compute its distance, namely \({f}_{rs}\) and \({f}_{re}\) in Fig. 8b. For example, if there are four side walls on the thin shell, it will yield four pairs of vertical faces, and hence four distances. If all distances are smaller than \({d}_{w}\), then the transition is an “extruded ridge” type.

  2. (b)

    Otherwise, the transition is not an “extruded ridge” type.

When the transition is an “extruded ridge” type, the transition faces are divided into three regions: (1) ridge faces: all faces in \({{\varvec{F}}}_{rs}\). The fillets that are adjacent to the faces in \({{\varvec{F}}}_{rs}\) are also included as ridge faces; (2) the horizontal face outside and its neighboring fillet; and (3) the horizontal face inside and its neighboring fillet. Figure 8b shows the definition of \({{\varvec{G}}}_{dtr}\), \({{\varvec{F}}}_{rs}\), \({f}_{rs}\) and \({f}_{re}\), and transition faces for the “extruded ridge” type.

4.2.3 Depressed ridge type

Like the case of “extruded ridge”, the detection of a “depressed ridge” is also started by searching neighboring faces convexly. However, it can only reach half of the cross-sectional shape as concave edges exist at the bottom of the depressed ridge. Start from a face \({f}_{i}\) in \({{\varvec{G}}}_{dtr}\), put all neighboring faces that are connected convexly into a face set \({{\varvec{F}}}_{rs}\). In \({{\varvec{F}}}_{rs}\), find a face \({f}_{rs}\) with a face angle \(90^\circ \pm \varepsilon\), where ε is the draft angle. Generate a line from the centroid of \({f}_{rs}\) towards its surface normal to intersect with a face \({f}_{re}\). The conditions for determining the “depressed ridge” type is as follows:

  1. (a)

    Check every pair of \({f}_{rs}\) and \({f}_{re}\) along the loop of side walls and evaluate a distance for each pair. If all distances are smaller than \({d}_{w}\), then the transition is a “depressed ridge” type.

  2. (b)

    Otherwise, the transition is not a “depressed ridge” type.

When the transition is a “depressed ridge” type, the transition faces are divided into three regions: (1) ridge faces: the faces between \({f}_{rs}\) and \({f}_{re}\) are regarded as ridge faces, where \({f}_{rs}\) and \({f}_{re}\) are included. The fillets that are adjacent to \({f}_{rs}\) and \({f}_{re}\) are also included as ridge faces; (2) the horizontal face outside and its neighboring fillet; and (3) the horizontal face inside and its neighboring fillet. All three regions of faces can be obtained by using the adjacency relationship of \({f}_{rs}\) and \({f}_{re}\). Figure 8c shows the definition of \({{\varvec{G}}}_{dtr}\), \({{\varvec{F}}}_{rs}\), \({f}_{rs}\) and \({f}_{re}\), and transition faces for the “depressed ridge” type.

4.2.4 Simple transition

When a model does not belong to any of the above three types, it is regarded as a simple transition. Ideally, a simple transition only involves a face along the thickness direction. However, fillets may exist on one or both sides. When fillets exist, they should be included as transition faces also. Figure 8d shows the definition of \({{\varvec{G}}}_{dtr}\) and transition faces for the “simple transition” type.

4.3 Inner face recognition

Inner faces are divided into transition, wall, bottom and protrusion faces. When multiple-layer wall exists, the faces can further be divided into wall and step-wall faces. As transition faces have been recognized, the remaining faces, including wall, bottom, step-wall and protrusion faces are recognized in sequence. When fillets exist, they must be regarded as either wall, bottom or protrusion faces in accordance with the adjacency relationship. When a fillet is adjacent to two different types of face, the priority of the face type that it is assigned is protrusion, bottom and wall face in sequence.

4.3.1 Recognition of wall faces

Wall faces are generally connected to transition faces by convex edges and are perpendicular to the open bounding plane. However, not all wall faces are necessarily connected to transition faces. For example, when a wall face is composed of several faces, only one of them is connected to a transition face, while the others are not. Also, not all wall faces are exactly perpendicular. Some of them may be tilted slightly. Therefore, the procedures for detecting wall faces are described below:

  1. (1)

    Assign initial wall faces: For all inner faces, except transition faces, the faces that connect to transition faces by convex edges are assigned as initial wall faces \({{\varvec{G}}}_{rw}\).

  2. (2)

    Determine the other wall faces recursively: Consider that \({f}_{i}\) is an inner face whose face type hasn’t been determined. If it meets the following conditions, then it is regarded as a wall face: (a) \({f}_{i}\) is adjacent to a face in \({{\varvec{G}}}_{rw}\) by a convex edge, and (b) \({\theta }_{f}>{\theta }_{t}\), where \({\theta }_{f}\) is the angle between \({{\varvec{n}}}_{f}\) and + Z, \({n}_{f}\) is the surface normal of \({f}_{i}\) and \({\theta }_{t}\) is the inclined angle allowed, 10° in this study. This step is repeated for all remaining inner faces recursively. Whenever a face is regarded as a wall face, it is put into \({{\varvec{G}}}_{rw}\).

  3. (3)

    Check wall faces: Some faces may be wrongly recognized as wall faces because a transition face may be a virtual face that crosses over multiple features. The procedures to detect and modify erroneous wall faces are described below:

  • Consider that \({f}_{w1}\) is a wall face in \({{\varvec{G}}}_{rw}\). Generate a line from the centroid of \({f}_{w1}\) towards \(-{{\varvec{n}}}_{f}\), where \({{\varvec{n}}}_{f}\) is the surface normal. Find a face \({f}_{o}\) that intersects with the line and is the closest face of \({f}_{w1}\).

  • If \({f}_{o}\) is not an outer face, then \({f}_{w1}\) is not a wall face. Remove \({f}_{w1}\) from \({{\varvec{G}}}_{rw}\).

  • If \({f}_{o}\) is an outer face, then record the distance \({d}_{1}\) between \({f}_{w1}\) and \({f}_{o}\).

This step is repeated for all faces in \({{\varvec{G}}}_{rw}\).

  1. (b)

    For all wall faces in \({{\varvec{G}}}_{rw}\), check if several faces point to the same outer face. Keep the one with the minimum distance in \({{\varvec{G}}}_{rw}\), while the others are removed from \({{\varvec{G}}}_{rw}\).

All faces in \({{\varvec{G}}}_{rw}\) are the final wall faces. Figure 9a shows the results of Procedures (1) and (3) for two examples, respectively.

Fig. 9
figure 9

Immediate results for inner face types recognition, a recognition of wall faces, b recognition of bottom faces, c Recognition of 2nd layer wall faces, and d recognition of protrusion faces

4.3.2 Recognition of bottom faces

Bottom faces are located on the bottom of the inner faces, mostly characterized by concave edges on the outer loop or connecting with wall faces. Most bottom faces are horizontal, but a small inclined angle is allowed. The procedures for detecting bottom faces are described below:

  1. (1)

    Assign initial bottom faces: Consider that \({f}_{i}\) is an inner face whose face type hasn’t been determined. If \({f}_{i}\) meets the following conditions, then it is regarded as an initial bottom face: (a) \({f}_{i}\) is not a fillet, (b) all edges on the outer loop are concave, except the edge adjacent to a hole face, and (c) \({\theta }_{f}>{\theta }_{t}\), where \({\theta }_{f}\) is the angle between \({{\varvec{n}}}_{f}\) and + Z, \({{\varvec{n}}}_{f}\) is the surface normal of \({f}_{i}\) and \({\theta }_{t}\) is the inclined angle allowed, 10° in this study. This step is repeated for all inner faces recursively, except transition and wall faces. Whenever a face is regarded as a bottom face, it is put into \({{\varvec{G}}}_{rb}\).

  2. (2)

    Assign fillets as bottom faces: The fillets that are adjacent to initial bottom faces should be regarded as bottom faces. Consider a face \({f}_{i}\) that is adjacent to a vertex on the outer loops of the faces in \({{\varvec{G}}}_{rb}\). If \({f}_{i}\) meets the following condition, then it is regarded as a bottom face: (a) \({f}_{i}\) is a fillet, or (b) \({f}_{i}\) is not a fillet, but it connects to a face in \({{\varvec{G}}}_{rb}\) convexly. Condition (b) is applied for some tiny faces that are not considered as fillets. All faces that are adjacent to the faces in \({{\varvec{G}}}_{rb}\) are checked recursively. Whenever a face is regarded as a bottom face, it is put into \({{\varvec{G}}}_{rb}\).

  3. (3)

    Assign isolated bottom faces separated by ribs: It may occur that some isolated bottom faces are separated by ribs. To overcome this issue, consider an inner face \({f}_{i}\) whose face type hasn’t been determined. If \({f}_{i}\) meets the following conditions, then it is regarded as a bottom face: (a) \({f}_{i}\) is a fillet, (b) it is adjacent to a wall face, and (c) it is adjacent to rib faces. Whenever a face is regarded as bottom face, it is put into \({{\varvec{G}}}_{rb}\).

  4. (4)

    Check bottom faces: Some protrusion faces may wrongly be regarded as bottom faces. When it happens, the common edge at two adjacent faces will be concave and G0 continuous. Therefore, detect two adjacent faces in \({{\varvec{G}}}_{rb}\) that are G0 continuous and connected concavely. Regard the one with a higher centroid along the Z direction as a protrusion face, while the other one with a lower centroid as a bottom face. Update the faces in \({{\varvec{G}}}_{rb}\). All neighboring faces in \({{\varvec{G}}}_{rb}\) with concave edges should be checked in sequence.

All faces in \({{\varvec{G}}}_{rb}\) are the final bottom faces. Figure 9b shows the results of Procedures (1) and (4) for one example.

4.3.3 Recognition of step-wall faces

Till now, transition, wall (1st layer) and bottom faces on inner faces have been recognized. When there is only one layer of wall faces, the wall and bottom faces are directly connected to each other. However, when there are multiple-layer wall faces, some of the faces between wall and bottom faces are still undetermined yet. The undetermined faces may belong to either step-wall or protrusion face. To recognize step-wall faces, a set of reference faces that connect to wall faces are obtained first. The remaining faces are then divided into groups. Protrusion faces are then recognized and excluded from the groups. The final faces in the groups are step-wall faces. Two algorithms are employed to detect protrusion faces. First, most protrusion faces on a group have at least a set of face pair that are parallel or nearly parallel to each other. A face intersection check can be performed to detect this kind of protrusion. Second, some protrusion faces may not be detected by the first algorithm, but they are higher than the neighboring wall faces. A check of the heights can detect his kind of protrusion. The procedures of step-wall face recognition are described as follows:

  1. (1)

    Assign reference faces \({f}_{r}\): for all inner faces, except transition, wall and bottom faces, the faces that directly connect to wall faces are evaluated, denoted as reference faces \({f}_{r}\). The remaining inner faces that connect convexly, beside \({f}_{r}\), are divided into grouped \({{\varvec{G}}}_{lw}\).

  2. (2)

    Exclude candidate protrusion faces based on face intersection check: the next step is to check all faces in each group \({{\varvec{G}}}_{lw}\) and exclude the groups that belong to candidate protrusion faces. Generate a line for every face \({f}_{i}\) in \({{\varvec{G}}}_{lw}\) towards \(-{{\varvec{n}}}_{f}\), where \({{\varvec{n}}}_{f}\) is the surface normal, and check the intersection between the line and the closest face \({f}_{c}\). The conditions for a group in \({{\varvec{G}}}_{lw}\) are as follows:

  1. (a)

    If one of the closest faces fc is an inner face, then exclude that group of faces from \({{\varvec{G}}}_{lw}\).

  2. (b)

    Otherwise, keep that group in \({{\varvec{G}}}_{lw}\).

  3. (c)

    Exclude candidate protrusion faces based on heights and assign step-wall faces: for all groups of faces in \({{\varvec{G}}}_{lw}\), if the faces on a group belong to step-wall faces, then all faces in that group should be lower than the reference faces \({f}_{r}\). On the contrary, if some of the faces are higher than the reference faces \({f}_{r}\), then all faces in that group are considered as protrusion faces. Consider that the maximum height of all centroids of the faces in \({f}_{r}\) along the z direction is hr. Also, the maximum height hg for all centroids of the faces in a group \({{\varvec{G}}}_{lw}\) is evaluated. The faces in \({{\varvec{G}}}_{lw}\) are determined as follows:

  4. (d)

    If \({h}_{g}<{h}_{r}\), then all faces in that group are step-wall faces.

  5. (e)

    Otherwise, all faces in that group are not.

Figure 9c shows the results of Procedures (2) and (3) for two examples, respectively.

4.3.4 Recognition of protrusion faces

Inner faces can be divided into transition, wall, bottom and protrusion faces. Once transition, wall and bottom faces are recognized, the remaining faces are grouped in accordance with the adjacency relationship. Most of the groups can be regarded as protrusion faces, but there are still minor groups that must be regarded as either wall or bottom faces. Fillets should be assigned as one face type too. When a fillet is connected to a protrusion face, it is regarded as part of that protrusion group. The procedures are described below:

  1. (1)

    Assign face groups: All remaining inner faces whose face type hasn’t been determined are grouped in accordance with the adjacency relationship. The faces on each group are adjacent to each other. If the faces of a blind hole are adjacent to those of a group, then the faces of this hole are included to the group also. It is noted that some small fillets which haven’t been assigned yet will be recognized as individual groups. It results in protrusion groups \({{\varvec{G}}}_{pi}\).

  2. (2)

    Check face intersection on each group: For a face \({f}_{i}\) in a group \({{\varvec{G}}}_{pi}\), generate a line from the centroid of fi towards \(-{{\varvec{n}}}_{f}\). Find a face \({f}_{c}\) that intersects the line and is closest to \({f}_{i}\). It is noted that all faces on the same group must be checked. Based on the type of \({f}_{c}\), some protrusion groups are determined, as follows:

  1. (a)

    If any intersection face \({f}_{c}\) is an inner face or hole face, then regard the faces in \({{\varvec{G}}}_{pi}\) as protrusion faces.

  2. (b)

    Otherwise, proceed to next step.

  3. (c)

    Determine a flag k for each group: The faces on each of the remaining groups may belong to protrusion, wall or bottom faces depending on the status of a flag k on each group. Check the number of faces on each group first.

  4. (d)

    If the number of faces is less than 2, then set k as true.

  5. (e)

    Otherwise, proceed to check the intersection by generating a line along the surface normal for each \({f}_{i}\).

  6. (f)

    If all \({f}_{i}\) intersect with any face, then set k as true.

  7. (g)

    If there is one \({f}_{i}\) on the group that does not intersect any face, then check the neighboring face of \({f}_{i}\). If a bottom face is the neighboring face, then set k as true. Otherwise, set k as false.

  8. (h)

    Check the remaining face groups: Based on the status of k, the face type for each group are determined.

  9. (i)

    If k is false, then assign all faces on the group as protrusion faces.

  10. (j)

    Otherwise, check neighboring faces of the group.

  11. (k)

    If the group has a wall face as its neighboring face, then sort some of the faces on the group to be either wall or bottom. Vertical faces will be assigned as wall faces, while the remaining faces will be bottom faces.

  12. (l)

    If there is no wall face as its face neighboring, then convert faces on the group as bottom faces.

Figure 9d shows the results of Procedures (1) and (4) for two examples, respectively.

4.4 Outer faces recognition

Figure 10 shows the flowchart of the face types evaluation for outer faces, where the inputs are the holes, fillets, inner faces and parting line, and the outputs are the composition of faces on the outer faces. The faces are initially divided into outer wall and bottom faces. The model is then divided into concave and non-concave bottom types. For the non-concave bottom type, some of the transition, outer bottom and outer wall faces are modified in accordance with the adjacency relationship. The flange faces are then recognized. Outer wall and bottom faces are finally determined. The model is then divided into concave and non-concave wall types for evaluating protrusion faces. For the concave bottom type, outer wall and bottom faces are modified first. It follows the recognition of flange faces. The remaining procedure is the same as that of non-concave bottom type. A detailed description of the procedures is shown below.

Fig. 10
figure 10

Flowchart of the face types evaluation for outer faces

4.4.1 Initially separate outer wall and bottom faces

Outer wall and bottom faces are initially evaluated by checking the intersection with the boundary box and inner faces. The procedures are as follows:

  1. (1)

    Set the outer faces that are adjacent to the parting line as outer wall faces: most of the faces that are adjacent to the parting line are vertical or nearly vertical, and hence can be considered as outer wall faces.

  2. (2)

    Separate the outer faces into two regions by \({\theta }_{f}\): consider an outer face \({f}_{i}\) with an angle \({\theta }_{f}\) between \({{\varvec{n}}}_{f}\) and + Z. It is assigned to one of the following two regions: (1) Region I: \(0^\circ \le {\theta }_{f}\le 90^\circ +\varepsilon\), and (2) Region II: \(90^\circ +\varepsilon <{\theta }_{f}\le 180^\circ\), where \(\varepsilon\) is a draft angle, 3° in this study.

When a face \({f}_{i}\) is in Region I, the outer wall and bottom faces are determined by projecting a line from the target face and check the number of intersections. Different face type has different number of intersections. Compute a parameter C5, where C5 denotes the status of the intersection. Project a line from the centroid of \({f}_{i}\) towards \(\pm\) X, \(\pm\) Y and \(\pm\) Z, respectively, and check if it intersects any face on the model. If an intersection occurs, C5 is increased by 1 (The values of C5: 0 ~ 5). Rules of determining whether \({f}_{i}\) is an outer wall or bottom face is as follow:

  1. (1)

    if \({C}_{5}=5\), then regard \({f}_{i}\) as an outer bottom face.

  2. (2)

    Otherwise, regard \({f}_{i}\) as an outer wall face.

The left plot in Fig. 11a shows two faces that are assigned as outer bottom (\({C}_{5}=4\)) and outer wall (\({C}_{5}=3\)), respectively.

Fig. 11
figure 11

Immediate results for outer face types recognition, a Step 1, b Step 2, c Step 3, d Step 4, and e Step 5

When a face \({f}_{i}\) is in Region II, the outer wall and bottom faces are determined in a way like that of Region I. Compute a parameter \({C}_{4}\), where \({C}_{4}\) denotes the status of the intersection. Project a line from the centroid of \({f}_{i}\) along \(\pm\) X and \(\pm\) Y, respectively, and check if it intersects any inner face on the model. If an intersection occurs, \({C}_{4}\) is increased by 1 (The values of \({C}_{4}\): 0 ~ 4). Rules of determining whether \({f}_{i}\) is an outer wall or bottom face is as follow:

  1. (1)

    If \({C}_{4}=0\), then regard \({f}_{i}\) as an outer bottom face.

  2. (2)

    If \({C}_{4}=1\), then

  3. (3)

    If \({\theta }_{f}> 170^\circ\), then regard \({f}_{i}\) as an outer bottom face.

  4. (4)

    Otherwise, regard \({f}_{i}\) as an outer wall face.

  5. (5)

    If \({C}_{4}=2\) to 4, then

  6. (6)

    If \({C}_{5}=5\), then regard fi as an outer bottom face.

  7. (7)

    Otherwise, regard fi as an outer wall face.

The right plot in Fig. 11a shows three faces that are assigned as outer bottom ((\({C}_{4}=0\)) and (\({C}_{4}=4\) amd \({C}_{5}=5\))) and outer wall (\({C}_{4}=1\) and \({\theta }_{f}< 170^\circ\)), respectively.

4.4.2 Check concave or non-concave bottom type

A model is divided into concave or non-concave bottom type. For the concave bottom type, the bottom face is sunken compared with its neighboring wall faces; while for the non-concave bottom type, the bottom face is convexly connected to its neighboring wall faces. Therefore, non-concave bottom faces are normally facing down and can form an individual loop, while concave bottom faces can further be divided into two types of faces: concave bottom and concave wall faces. The procedures for detecting concave and non-concave bottom types are as follows:

  1. (1)

    Group outer wall faces: Start from an outer wall face that is adjacent to the parting line, find all outer wall faces that are adjacent to each other. Put these faces into a group \({{\varvec{G}}}_{ow}\).

  2. (2)

    Group outer bottom faces and determine non-concave bottom type: An outer bottom face fi is put into a group \({{\varvec{G}}}_{cb}\) if it meets the following two conditions: (1) \({\theta }_{f}> 170^\circ\), and (2) \({f}_{i}\) is connected to any face in \({{\varvec{G}}}_{ow}\). The remaining outer bottom faces are put into a group \({{\varvec{G}}}_{ncb}\). Check the boundary loops of the faces in \({{\varvec{G}}}_{cb}\).

  3. (3)

    If there is only a loop, then the model is regarded as a non-concave bottom type. Stop the process.

  4. (4)

    On the contrary, if there is more than one loop, then the faces in \({{\varvec{G}}}_{cb}\) are called concave bottom faces. Proceed Step 3.

  5. (5)

    Determine concave bottom type: Find an outer bottom face \({f}_{i}\) that is in \({{\varvec{G}}}_{ncb}\) and is adjacent to a face in \({{\varvec{G}}}_{cb}\). Generate a line \({L}_{i}\) at the centroid of \({f}_{i}\) and along \(-{{\varvec{n}}}_{f}\). If \({L}_{i}\) intersects an outer wall face in \({{\varvec{G}}}_{ow}\), then put \({f}_{i}\) into a group \({{\varvec{G}}}_{cw}\). Start from \({f}_{i}\), keep checking the other faces in \({{\varvec{G}}}_{ncb}\) by neighboring until \({L}_{i}\) does not intersect any face in \({{\varvec{G}}}_{ow}\). Put all faces with \({L}_{i}\) intersecting a face in \({{\varvec{G}}}_{ow}\) into \({{\varvec{G}}}_{cw}\). Once all faces in \({{\varvec{G}}}_{ncb}\) are tested, check the faces in \({{\varvec{G}}}_{cw}\). If \({{\varvec{G}}}_{cw}\) is not empty, then the model is regarded as a concave bottom type, and the faces in \({{\varvec{G}}}_{cw}\) are called concave wall faces. Otherwise, the model is regarded as a non-concave bottom type.

Figure 11b shows the results of outer wall grouping, outer bottom grouping and concave wall evaluation for a model of concave bottom type.

4.4.3  For nonconcave bottom type

4.4.3.1 (A) Step 3: Update transition faces

In general, a parting line separates the faces into inner and outer faces. The first layer of inner faces that are adjacent to the part line are transition faces, whereas the first layer of outer faces that are adjacent to the pat line are outer wall faces. The first layer of outer wall faces is typically vertical or nearly vertical. However, it may occur that the first layer of outer wall faces is close to horizontal. In such a situation, the parting line should be moved outward to cover this layer of faces as transition faces. The procedures to detect such a situation and update transition faces are as follows:

  1. (1)

    Get faces that are adjacent to the parting line: The outer faces that are adjacent to the parting line are put into a group \({{\varvec{G}}}_{f}\).

  2. (2)

    Get outer wall faces that are adjacent to the faces in Gf: Let \({f}_{i}\) be an outer face that is adjacent to a face in \({{\varvec{G}}}_{f}\). If \({f}_{i}\) meets the following two conditions, then it is regarded as a transition face:

  3. (3)

    \({f}_{i}\) and all faces in \({{\varvec{G}}}_{f}\) are outer wall faces.

  4. (4)

    \({f}_{i}\) is adjacent to all faces in \({{\varvec{G}}}_{f}\).

When \({f}_{i}\) is changed into a transition face, all faces in \({{\varvec{G}}}_{f}\) are also changed into transition faces. The left plot in Fig. 11c indicates the parting line and \({{\varvec{G}}}_{f}\) for an example, while the right plots indicate the situation of outer wall faces before and after the modification.

4.4.3.2 (B) Step 4: Modify outer bottom and wall faces

Some of the outer bottom and wall faces may wrongly be recognized. They are detected and modified based on geometric and face adjacency criteria. The procedures are as follows:

  1. (1)

    Group outer bottom faces \({{\varvec{G}}{\varvec{B}}}_{i}\): All outer bottom faces that are adjacent to each other are regarded as a group, yielding \({{\varvec{G}}{\varvec{B}}}_{i}\). The group with the maximum area is denoted \(\mathbf{M}\mathbf{a}\mathbf{x}\left({{\varvec{G}}{\varvec{B}}}_{i}\right)\).

  2. (2)

    Check and modify outer bottom faces: For a face \({f}_{i}\) in \(\mathbf{M}\mathbf{a}\mathbf{x}\left({{\varvec{G}}{\varvec{B}}}_{i}\right)\), compute two parameters \({R}_{bf/nf}\) and \({L}_{w/all}\), where the former denotes the ratio between the number of outer bottom faces neighboring to \({f}_{i}\) and the number of faces neighboring to \({f}_{i}\), and the latter denotes the ratio between the length of edges neighboring to outer wall faces and the length of all edges neighboring to \({f}_{i}\). The face type for \({f}_{i}\) is determined in accordance with the following conditions:

  3. (3)

    If \({\theta }_{f}>\) 170°, \({f}_{i}\) is kept no change.

  4. (4)

    If \({\theta }_{f}\le\) 170°,

  5. (5)

    If \({R}_{bf/nf}>0.5\), \({f}_{i}\) is kept no change.

  6. (6)

    If \({R}_{bf/nf}<0.5\), \({f}_{i}\) is modified as an outer wall face.

  7. (7)

    If \({R}_{bf/nf}=0.5\), then if \({L}_{w/all}<0.5\), then \({f}_{i}\) is kept no change. Otherwise, \({f}_{i}\) is modified as an outer wall face.

  8. (8)

    Group outer wall faces \({{\varvec{G}}{\varvec{W}}}_{i}\): All outer wall faces that are adjacent to each other are regarded as a group, yielding \({{\varvec{G}}{\varvec{W}}}_{i}\).

  9. (9)

    Check and modify outer wall faces: For an outer wall face \({f}_{i}\) that is adjacent to the faces in \(\mathbf{M}\mathbf{a}\mathbf{x}\left({{\varvec{G}}{\varvec{B}}}_{i}\right)\), check if it meets the following conditions:

  10. (10)

    \({f}_{i}\) is not a fillet.

  11. (11)

    \({f}_{i}\) is not adjacent to the parting line.

  12. (12)

    A line at the centroid of \({f}_{i}\) and along \({{\varvec{n}}}_{f}\) intersects the boundary plane on –Z.

If yes, then regard \({f}_{i}\) as an outer bottom face and put it into \(\mathbf{M}\mathbf{a}\mathbf{x}\left({{\varvec{G}}{\varvec{B}}}_{i}\right)\). On the contrary, if no, then stop the search along \({f}_{i}\).

  1. (E)

    Regroup outer bottom and wall faces: Outer bottom and wall faces that are adjacent to each other are respectively grouped again.

The left example in Fig. 11d shows a situation in Procedure (2), where outer bottom is modified as outer wall; while the right example in Fig. 11d shows a situation in Procedure (4), where outer wall is modified as outer bottom.

4.4.3.3 (C) Step 5: Recognize flange faces

Search flange faces both from transition faces and outer bottom faces. Most flange faces are parallel to transition faces, and hence can be evaluated by checking the intersection of lines projected from transition faces. However, not all flange faces can be obtained. Therefore, lines projected from outer bottom faces are also checked, which can yield the residual flange faces. The procedures are as follows:

  1. (1)

    Evaluate candidate flange and flange faces using transition faces: Generate one or two lines along − Z direction on each transition face and find faces that intersect with the lines. If a transition face has at most 4 edges, apply one line for the intersection check. Otherwise (i.e. more than 4 edges), apply two lines for the intersection. For each transition face \({f}_{ti}\), a line \({L}_{i}\) from a face point (\({{\varvec{P}}}_{i}\)) along –Z is generated. If there are two face points, then two lines will be generated. The faces that intersect with any of the lines are obtained. The one with the shortest distance is regarded as \({f}_{c}\). Define two parameters \({d}_{z}\) and \({d}_{t}\), where the former denotes 0.5 length of the boundary box along Z direction, and the latter denotes the shortest distance between \({f}_{ti}\) and \({f}_{c}\) (along − Z direction). If \({f}_{c}\) meets the following criteria, then it is regarded as a flange face:

    1. (a)

      \({f}_{c}\) is an outer face

    2. (b)

      \({d}_{t}<{d}_{z}\)

    3. (c)

      \({\theta }_{f}\ge 170^\circ\) (i.e. \({f}_{c}\) is almost facing down).

In addition, if fc meets the following criteria, then it is regarded as a candidate flange face:

  1. (a)

    \({f}_{c}\) is an outer face

  2. (b)

    \({d}_{t}<{d}_{z}\)

  3. (c)

    \(100^\circ <{\theta }_{f}<170^\circ\) (i.e. \({f}_{c}\) is an inclined face).

Because \({f}_{c}\) is an inclined face, further rules must be applied later to determine if \({f}_{c}\) is a flange face.

  1. (B)

    Evaluate candidate flange and flange faces using outer bottom faces: For some cases, applying transition faces only cannot obtain all flange faces. Outer bottom faces are mostly facing down, and flange faces also fit this feature. Therefore, a line from an outer bottom face is also tested to check if it can intersect any transition face. If an intersection occurs, the outer bottom face is also regarded as a flange face. For each outer bottom face \({f}_{bi}\), a line \({L}_{i}\) from a face point (\({{\varvec{P}}}_{i}\)) along + Z is generated. If there are two face points, then two lines will be generated. The faces that intersect with any of the lines are obtained. The one with the shortest distance is regarded as \({f}_{c}\). Define two parameters \({d}_{z}\) and \({d}_{b}\), where the former denotes 0.5 length of the boundary box along Z direction, and the latter denotes the shortest distance between \({f}_{bi}\) and \({f}_{c}\) (along + Z). If \({f}_{c}\) meets the following criteria, then it is regarded as a flange face:

  2. (C)

    \({f}_{c}\) is an outer bottom face (not in Max(GBi))

  3. (D)

    \({d}_{b}<{d}_{z}\)

  4. (E)

    \({\theta }_{f}\ge 170^\circ\) (i.e. fc is almost facing down).

In addition, if fc meets the following criteria, then it is regarded as a candidate flange face:

  1. (a)

    \({f}_{c}\) is an outer bottom face (not in Max(GBi))

  2. (b)

    \({d}_{b}<{d}_{z}\)

  3. (c)

    \(100^\circ <{\theta }_{f}<170^\circ\) (i.e. fc is an inclined face).

  4. (d)

    Group candidate flange faces: In Steps 1 and 2, some faces are already regarded as flange faces. However, some other faces are regarded as candidate flange faces. All candidate flange faces that are adjacent to each other are regarded as a group, yielding GFi.

  5. (e)

    Modify candidate flange faces: If any candidate flange face in a group GFi is adjacent to a flange face, then all faces in that group are changed into flange faces. Otherwise, all faces in that group are returned to the original face type (i.e. either outer wall or bottom face type)

  6. (f)

    Regroup outer wall, bottom and flange faces: All types of faces are regrouped again. It yields GWi, GBi and GFi.

The example in Fig. 11e shows two faces that are initially detected as flange and candidate flange faces, respectively. The candidate flange face is finally modified as a flange face as it is adjacent to a flange face.

4.4.3.4 (D) Step 6: Determine final outer wall and bottom faces

All outer wall and bottom faces are divided into separate groups now. However, some of the face types are still wrong and must be corrected. The procedures are as follows:

  1. (1)

    Compute Max(GBi), where the number of outer bottom faces is the largest: Some of the outer wall faces will separate outer bottom faces into different groups. If all faces in a group GWi do not connect with any flange or transition face, then all faces in GWi are changed to outer bottom faces. All outer bottom faces are re-grouped again. The one with the largest number of faces is called Max(GBi).

  2. (2)

    Check outer bottom faces: There are several groups of outer bottom faces GBi. Keep the faces in Max(GBi) as outer bottom faces, whereas the faces on the other groups are changed to outer wall faces.

  3. (3)

    Check outer wall faces: All outer wall faces in a group GWi are checked.

  4. (4)

    If any of the faces in GWi is adjacent to both flange and transition faces, then all faces in GWi are regarded as flange faces.

  5. (5)

    If all faces in GWi are not adjacent to any flange face, transition face or bottom face, then all faces in GWi are regarded as outer bottom faces.

Figure 12a shows some erroneous bottom and wall faces detected in this step and the correction of them.

Fig. 12
figure 12

Immediate results for outer faces recognition, a Step 6, b Step 7, c Step 8, d Step 9–1, and e Step 9–2

4.4.3.5 (E) Step 7: Check concave or non-concave wall type

Till now, outer protrusion faces are regarded as either outer wall, bottom or flange faces. The model is further classified as two types for the recognition of protrusion faces. For the concave wall type, substantial protrusions exist on outer faces and divide wall faces into many regions. It looks like many concave regions exist on outer faces. On the contrary, for the non-concave wall type, protrusions may exist on outer faces, but are distributed individually. Most of the outer wall faces are not divided.

During the recognition of inner and outer faces, there is a stage that generates several groups of potential inner faces. Only one group of faces is finally regarded as inner faces, while the other groups are located on outer faces, which are called candidate inner faces \({{\varvec{G}}}_{cif}\) here. Consider that \({f}_{i}\) is a face in \({{\varvec{G}}}_{cif}\) and \({n}_{cif}\) is the intersection count for faces in \({{\varvec{G}}}_{cif}\). Project a line from the centroid of each \({f}_{i}\) along its \({{\varvec{n}}}_{f}\). If it intersects with any face in \({{\varvec{G}}}_{cif}\) then \({n}_{cif}\) is increased by 1. All groups of candidate inner faces \({{\varvec{G}}}_{cif}\) are checked one by one. If any group meets the following criteria, then the model is regarded as a “concave wall type”:

  1. (1)

    There exists a face fc that is nearly horizontal and facing up, i.e. \({n}_{cif}\le \varepsilon\), where ε is the draft angle.

  2. (2)

    At least three faces intersect with other faces on the same group, i.e. \({n}_{cif}>2\).

If all groups \({{\varvec{G}}}_{cif}\) do not meet the above criteria, then the model is regarded as a “non-concave wall type”. The left plot in Fig. 12b shows an example of non-concave wall type. The right plot in Fig. 12b shows an example with 33 groups of candidate inner faces in \({{\varvec{G}}}_{cif}\). This example is regarded as a concave wall type as some of the groups meet the above-mentioned conditions.

4.4.4 For concave bottom type

The difference between concave bottom and non-concave bottom is that there are two layers of outer wall for the former, while there is only one layer of outer wall for the latter. The concave wall separates outer bottom faces into two regions, where the first region has been detected in Step 2, while the second region has not. Figure 12c shows an example of concave bottom type, where the left and middle plots indicate the results of Steps 1 and 2, respectively. As the middle plot indicates, the 1st region outer bottom is just a simple face, while the 2nd region outer bottom is a complex structure. The faces on the 2nd region must be analyzed again to separate outer wall, outer bottom and flange faces. The algorithm is similar to those used in Steps 1, 4 and 5, and is not addressed again. The right plot in Fig. 12c shows the results of outer wall, outer bottom and flanged faces obtained for the 2nd region of outer bottom faces.

4.4.5 Determine protrusion faces

4.4.5.1 Step 9–1: For concave wall type

Extract protrusion faces from outer faces, including bottom, wall and flange faces. The procedures are as follows:

  1. (1)

    Extract protrusion faces from outer faces: For each outer face \({f}_{i}\), a line Li along \(-{{\varvec{n}}}_{f}\) is generated, where \({{\varvec{n}}}_{f}\) denotes the surface normal of \({f}_{i}\). The faces that intersect with the line are obtained and the one that has the shortest distance is regarded as \({f}_{c}\). If \({f}_{c}\) is an outer face, then regarded \({f}_{i}\) as a protrusion face. Otherwise, \({f}_{i}\) is kept no change.

  2. (2)

    Check and modify outer wall faces: In previous step, some outer wall faces that are on the top of protrusion faces have not been recognized correctly. The convexity of the neighboring edges can be used to check the correctness of these faces. Consider an outer wall face \({f}_{w}\). Define two parameters cv as the number of convex edges between \({f}_{w}\) and its adjacent protrusion faces, and \({c}_{c}\) as the number of concave edges between \({f}_{w}\) and its adjacent protrusion faces. If \({f}_{w}\) is on the top of a protrusion, \({c}_{v}\) should be larger than \({c}_{c}\). Otherwise, \({c}_{v}\) should be smaller than \({c}_{c}\). That is

  3. (3)

    If \({c}_{v}\ge {c}_{c}\), then change \({f}_{w}\) as an outer protrusion face.

  4. (4)

    Otherwise, \({f}_{w}\) is kept no change.

  5. (5)

    Check and modify fillets: When a fillet exists between a protrusion and other types of faces, it is regarded as a protrusion face. Consider a fillet face \({f}_{f}\). Define four parameters \({c}_{p}, {c}_{w},{l}_{p}\) and \({l}_{w}\) as follows: (1) \({c}_{p}\) is the number of protrusions faces that are adjacent to \({f}_{f}\), (2) \({c}_{w}\) is the number of outer wall faces that are adjacent to \({f}_{f}\), (3) \({l}_{p}\) is the total length of the edges of protrusions that are adjacent to \({f}_{f}\), and (4) \({l}_{w}\) is the total length of the edges of outer wall faces that are adjacent to \({f}_{f}\). The fillet face \({f}_{f}\) is determined according to the following rules:

  6. (6)

    If \({c}_{p}<{c}_{w}\), then \({f}_{f}\) is kept no change.

  7. (7)

    If \({c}_{p}>{c}_{w}\), then change \({f}_{f}\) as an outer protrusion face.

  8. (8)

    If \({c}_{p}={c}_{w}\)

  9. (9)

    If \({l}_{p}<{l}_{w}\), then \({f}_{f}\) is kept no change.

  10. (10)

    If \({l}_{p}\ge {l}_{w}\), then change \({f}_{f}\) as an outer protrusion face

  11. (11)

    Check and modify protrusion faces: All outer protrusion faces that are adjacent to each other are regarded as a group, yielding GPi. Each group needs to be checked as follows: Define a parameter \({c}_{i}\) as follows. Consider a protrusion face \({f}_{i}\) in GPi. A line \({L}_{i}\) along \({-{\varvec{n}}}_{f}\) is generated. If this line intersects with any protrusion face in GPi, then the flag \({c}_{i}\) is true, otherwise ci is false.

  12. (12)

    If \({c}_{i}\) is true, then all faces in GPi are kept no change.

  13. (13)

    If \({c}_{i}\) is false, then change all faces in GPi as outer bottom faces

The three plots highlighted in Fig. 12d show a situation in Procedures (1), (2) and (3), respectively.

Step 9–1 is a stage for detecting protrusion features in concave wall type where the protrusion features cover part of the outer wall. Concave wall types are classified based on the presence of a protrusion on the outer wall, which serves as a reinforcement for the model. In step 9–1(2), two parameters, cv and cc, are used to analyze the faces on the top of the protrusion feature. Generally, a single-layer protrusion formed in concave wall type is cv ≥ cc, as shown in Fig. 13a. However, for multi-layer protrusions, there could exist concave faces with cv < cc, such as the case in Fig. 13b. We have not found any concave protrusion on the concave wall type for the test cases we used. However, Step 9–1(2) must be modified if multi-layer protrusions exist on concave wall type.

Fig. 13
figure 13

Two types of protrusion on outer wall face, a single-layer protrusion, and b multi-layer protrusion

4.4.5.2 Step 9–2: For non-concave wall type

Extract protrusion faces from outer faces, including bottom, wall and flange faces.

  1. (1)

    Extract candidate protrusion faces from outer faces: For each outer face or outer hole face \({f}_{i}\), a line \({L}_{i}\) along \({-{\varvec{n}}}_{f}\) is generated, where \({{\varvec{n}}}_{f}\) denotes the surface normal of \({f}_{i}\). The faces that intersect with \({L}_{i}\) are obtained. The one with the shortest distance is regarded as \({f}_{c}\). Put \({f}_{i}\) in different stacks in accordance with the following conditions:

  1. (a)

    If \({f}_{i}\) is an outer face and is not adjacent to any transition face

  2. (b)

    If \({f}_{c}\) is an outer face, then put \({f}_{i}\) into the stack G1.

  3. (c)

    If \({f}_{c}\) and \({f}_{i}\) are equal, then put \({f}_{i}\) into the stack G1.

  4. (d)

    If \({f}_{i}\) is a hole face and \({f}_{c}\) is an outer face, then put \({f}_{i}\) into the stack G2.

    1. (c)

      Otherwise, skip \({f}_{i}\).

The faces in each stack will further be checked next.

  1. (B)

    Extract protrusion faces from candidate protrusion faces: For each face \({f}_{i}\) in G1, generate a line \({L}_{i}\) along \({-{\varvec{n}}}_{f}\). If \({L}_{i}\) intersects with any face in \({{\varvec{G}}}_{i}\), then regard all faces in G1 as protrusion faces. Perform the same check for all faces in G2 too.

  2. (C)

    Generate protrusion faces by convex edges: Start from a face \({f}_{i}\) that is adjacent to a protrusion face, but not a protrusion face. Search its neighboring faces that are convexly connected. Continue this process until no more face is found. All these faces are regarded as outer protrusion faces.

The example in Fig. 12e shows a situation in Procedure (3), where erroneous outer wall faces are modified as protrusion faces.

5 Results and discussion

A program, written in C +  + and based on the Rhino CAD platform and the openNURBS functions, was implemented to test the feasibility of the proposed inner and outer faces recognition algorithm for thin-shell parts. The input data is a B-rep model of the part. The program will recognize fillets and holes first, and then recognize inner and outer faces, transition faces, inner face types, and outer face types in sequence. As the dimension of the parts may be different, three parameters \({l}_{\mathrm{max}}\), \({r}_{max}\) and ε in the proposed algorithm are provided for adjusting. The parameter \({l}_{\mathrm{max}}\) denotes the maximum perimeter of the hole or pocket that will be recognized. The parameter \({r}_{\mathrm{max}}\) denotes the maximum radius of the fillets. And, the parameter ε denotes the draft angle. The default values for \({l}_{\mathrm{max}}\), \({\theta }_{\mathrm{max}}\) and \(\varepsilon\)are 100 mm, 6.5 mm and 3°, respectively, in this study.

The results of the proposed method for 25 thin-shell parts are divided into four groups, as shown in Figs. 14, 15, 16, 17 respectively, for discussion. In each part, four intermediate results are displayed, including separation of inner and outer faces, transition faces, wall, bottom and protrusion faces on the inside, and wall, bottom and protrusion faces on the outside. Figure 14 shows seven of the parts that are complex on the internal structure, while simple on the outside. Most of the ribs on the inside are connected together, and may even connect to other tubes or bosses (e.g. Cases 1–5). By isolating internal wall and bottom faces first, the remaining protrusion faces can easily be divided into groups. A protrusion classification algorithm can later be implemented to recognize different types of protrusion, e.g. ribs, tubes, columns, and symmetric extrusions [22]. In Cases 6 and 7, substantial through holes exist on bottom faces. If some of the through holes are not recognized, it may affect the recognition of bottom faces. In particular, in Case 6, several holes are lying across multiple faces. It needs the introduction of virtual loop (edges on a loop are G1 continuous) [39] in order to recognize the loops that cross multiple faces, and hence the corresponding holes.

Fig. 14
figure 14

Results of inner and outer faces recognition- complex structure outside

Fig. 15
figure 15

Results of inner and outer faces recognition- freeform surfaces and complex shape on translation and wall faces

Fig. 16
figure 16

Results of inner and outer faces recognition- complex structure outside

Fig. 17
figure 17

Results of inner and outer faces recognition- different types of transition faces

Figure 15 shows six of the parts that are freeform on the shape or complex on translation and wall faces. In Cases 8 and 9, substantial freeform surfaces exist on the wall or bottom faces. When freeform surfaces exist on the wall, they are usually not perpendicular. This inclination cannot be compensated by the draft angle ε. Therefore, in Sect. 4.3.1, an allowable inclined angle \({\theta }_{t}\), 10° in this study, is employed to compensate for the inclination of freeform surfaces. When the inclined angle of a freeform surface is larger than \({\theta }_{t}\), it may become difficult to distinguish from the wall and bottom faces, which is considered as another type of thin-shell part and will be discussed elsewhere. In Cases 10 and 11, the transition faces belong to “simple translation” although some of the faces are inclined along the X or Y direction. The faces on each side along the thickness direction are composed of three faces, a main face and two fillets that connect to the main face. It is noted that if the proposed algorithm is not employed, part of the fillets may easily be regarded as wall faces, instead of transition faces, In Case 12, substantial through holes exist on the bottom faces. In particular, several holes are lying on more than three faces, including a fillet. When these holes are not recognized correctly, some of the bottom faces would not be detected correctly. In addition, the fillet on the outer wall is difficult to deal with as it has a large inclined angle. This fillet is correctly recognized as an outer wall face here. Case 13 should be regarded as one of the most difficult cases as it has a very complex wall structure and many through holes of irregular types. It needs the recognition of multi-virtual loops (edges on a loop are G0 continuous) [39] in order to recognize all irregular holes correctly. The results also show that all inner and outer face types are recognized correctly.

Figure 16 shows seven of the parts that are complex on the external structure. Cases 14 to 16 show the examples of nonconcave wall type, where protrusion faces are sparsely distributed. In Cases 14 and 15, protrusion faces exist on the inside too. In Case 16, flange faces exist on the reverse side of transition faces. All three examples indicate that all face types on the inside and outside are recognized correctly. Cases 17 and 18 show the examples of concave wall type. All faces on the outer faces are carefully checked, especially protrusion faces colored in green and fillets that exist between different types of faces. The result shows that all protrusion faces and fillets on the outside are correctly recognized. Cases 19 and 20 show two examples of concave bottom type. The outer bottom faces on both cases are sunken compared with their neighboring outer wall faces. In Case 19, some protrusion faces are further extracted from outer bottom faces; while in Case 20, some flange faces are further extracted from outer bottom faces. All these results are achieved automatically by the program.

Figure 17 shows five of the parts with different types of transition faces, other than “simple transition”. The transition faces in Cases 21 to 25 are “depressed ridge”, “simple translation with holes”, “extruded ridge”, “step”, and “open step”, respectively. All these examples show that the proposed algorithm can detect different types of translation faces accurately. Correct classification and recognition of transition faces is very important as the remaining inner and outer faces recognition all counts on the accuracy of translation faces. In addition, the inner wall faces are divided into multiple layers in Cases 22 to 24, where the wall and step-wall faces are colored in blue and light blue, respectively. Cases 22 and 23 show the typical situation on which the wall and bottom faces are separated by step-wall faces. Fillets existing between wall and step-wall faces can also be detected correctly. However, Case 24 shows a particular situation that part of the wall faces are connected to the bottom face directly. All these results show that different kinds of multi-layer wall faces can be recognized satisfactorily.

Table 1 summarizes the results of inner and outer faces recognition for 25 cases, where the number of total faces, through holes, inner faces and outer faces are listed to check the accuracy of the proposed algorithm. For inner faces, only total number of faces are listed as the success rates for all cases are 100%. Outer faces listed include wall, flange, bottom and protrusion faces. The first and second values on each field represent total number of faces and number of faces not recognized correctly, respectively. Table 1 indicates that the summation of through holes, inner and outer faces is equal to total faces for all cases. This result is very important as it indicates that all faces on a model have been recognized as one of the face types. It would become easy to look for the matching faces between the inside and outside of the thin shell on a model. Of 25 cases tested, the success rate for four of them, namely Cases 10, 14, 16 and 22, are not 100%, which is because the composition of the face types on outer faces is more complex and variable. Figure 18 depicts four examples of outer face types that are not recognized correctly. In Fig. 18a, \({f}_{i}\) is a long and narrow surface lying across outer wall and bottom faces. The surface normal is changed across the entire surface. However, only one sampling point is taken for the projecting-line intersection check. It might be necessary to take more sampling points on a surface and modify the criteria to determine the status of the surface correctly. In Fig. 18b, \({f}_{i}\) is a fillet between outer wall and bottom faces. As the fillet is also a surface, the problem is like that of Fig. 18a. In Fig. 18c, the blending faces between protrusion and flange faces are divided into multiple pieces. The face composition is too complex to be recognized correctly. Similar situation occurs in Fig. 18d, where the face composition on the highlighted region is too complex, and hence the faces are not recognized correctly.

Table 1 Compositions of inner and outer faces and CPU time for 25 thin-shell parts
Fig. 18
figure 18

Four examples of incorrect outer face types recognition, a example 1, b example 2, c example 3, and d example 4

The CPU time required for the entire process for all cases is also listed in Table 1. The CPU time required is not fully proportional to total number of faces on the model. Sect. 4.4.1, initially separate outer wall and bottom faces, requires the maximum percentage of CPU time as this step has a complex procedure to check each outer face one by one. Therefore, Cases 16, 17 and 22 require more CPU time as the outer/total face of them are 613/718, 403/845 and 718/873, respectively. The simulations were performed on a personal computer with an Intel Core i7-9700 CPU 3.2 GHz and 16 GB of RAM.

6 Conclusion

An enhanced approach for inner and outer faces recognition of thin-shell parts was proposed in this study. A thin-shell part can be divided into a thin shell and protrusions that locate both on the inside and outside of the thin shell. The face types on the thin shell are recognized first. The complexity of the parts that can be dealt with includes: (1) five types of transition faces between inner and outer faces are detected. The composition of faces on the top of different thin-shell parts can be analyzed accurately; (2) protrusion faces that distribute continuously or sparsely both on the inside and outside of a part can be recognized; (3) fillets are also assigned as appropriate face types in accordance with the adjacency relationship. No simplification of fillets is necessary in this algorithm; and (4) holes that locate across multiple faces are allowed. It can enhance the applicability of the proposed algorithm for cases that involve holes across multiple faces. With the proposed method, all complex protrusion structures on the inside and outside of a part can be divided into groups of protrusion face. A protrusion classification algorithm can later be used to recognize all types of protrusion [22].

The results of the face type recognition for the thin shell can further be used in volume decomposition. The primary task in volume decomposition is to decompose a model into a series of sweepable sub-volumes so that each of them can be meshed with better type of solid meshes. In [23], an approach by evaluating the matching pairs of inner and outer contours was proposed to decompose the thin shell of a thin-shell part into sweepable sub-volumes. It employs the face types on the inner and outer faces to help the evaluation of inner and outer matching contours. As mentioned previously, the composition of faces on a thin-shell part could vary significantly. The face type recognition method proposed in this study can analyze the composition of faces for complex thin-shell parts. It is now possible to expand the capability of the method in [23] to deal with more complex thin-shell parts.