Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 6, No. 3, 2023 144 Design of A Support Automatic Generation Algorithm Based on Layer Information Yan Shan Army Academy of Armored Forces, Changchun, China Abstract: 3D printing technology as a new type of manufacturing technology application field is getting larger and larger, and it also plays an important role in the field of large-scale construction machinery maintenance. In this chapter, the algorithm of support automatic generation of STL model is studied, and the algorithm of support automatic generation is designed based on the layer contour information. The problem of identification of suspension area is solved by the method of intersecting and comparing the contours of adjacent layers, which provides the algorithm basis for the application of subsequent improvement technology in the field of maintenance. Keywords: 3D printing, Support automatic generation, Algorithm. 1. Introduction In recent years, 3D printing technology as a new type of manufacturing technology is developing faster and faster, the application field is more and more extensive, in education, medical, aerospace, transportation, machinery manufacturing and other fields, 3D printing technology has different degrees of application. In practical applications, 3D printing technology has incomparable advantages over traditional manufacturing technology, but there are still some important contradictory problems to be solved, such as the problem of adding support. When printing parts, especially complex parts, it is inevitable to use support structure addition technology, also known as support automatic generation technology, so the research of 3D printing support technology is also an important research direction, and has an extremely important role in the application of 3D printing technology in the field of large-scale construction machinery maintenance. 2. Analysis of the Mainstream Support Automatic Generation Algorithms At present, there are three main types of support, which are basic support, overall support and local support. The foundation support mainly provides the base support during the manufacturing process of the parts and eliminates the influence of the local unevenness of the workbench on the parts, which is convenient to remove the parts from the workbench after the completion of the parts, so that the surface quality of the bottom of the parts is better. The shape and size of the foundation support are appropriately enlarged by the projection of the largest enclosure box of the part to the Z direction. The overall support is to completely surround the whole part, and all areas except the entity are supported. This kind of support structure is often used in the early stage of rapid prototyping. Do not consider the complexity of the part, and the generation process is simple, if the support material is water-soluble removal material can ensure the surface quality of the part. The disadvantage is a large waste of supporting materials and an increase in manufacturing time. Local support is an improvement on the basis of the overall support, removing excess support, and adding support only to the position where it is needed. According to the characteristics of the material, it can support the superstructure under certain conditions. The upper layer has a certain protruding length relative to the lower layer, which is called the hanging distance. If the distance is not greater than L, as shown in Figure 1, there is no need to generate a support body, because the melting material has a certain self-supporting ability. At this time, the inclination Angle is the self-supporting Angle of the material. The relationship between inclination Angle θ and layer thickness h and hanging length L is: tanθ= L/H. When theθ is smaller than or equal to the self-supporting Angle of the solid body, the incline plane is called a small incline plane, and there is no need to add support. When θ is greater than the self-supporting Angle of the solid body, the incline plane is called the high incline plane, and the support needs to be added. In addition, the suspension surface, suspension edge and suspension point are also the locations where support must be added. Figure 1. Local bracing 2.1. BOX support automatic generation algorithm First, the minimum BOX domain of the part prototype, that is, the minimum cuboid of the enveloping part prototype, whose height is the height of the part prototype, while the bottom surface is the minimum enveloping rectangle projected by the part prototype on the XOY plane, and each layer section of the entity is within each layer section of the minimum enveloping rectangle, and then the entity section is filled with solid materials. The area between the solid cross- section outline and the rectangular boundary is filled with supporting materials, so as to obtain a cuboid object containing the part prototype similar to the LOM process. Finally, the subsequent material is stripped to obtain the part prototype. This method is one of the simplest ways to 145 automatically generate support structures. It does not consider the shape characteristics of the part prototype, regardless of whether it needs to be supported, it is used as a support body between the BOX domain and the part prototype. 2.2. Automatic support generation algorithm based on projection region This method improves the automatic generation method of BOX support. When it is used as the support domain on each layered cross-section, the smallest envelope rectangle of the part prototype projected on the XOY plane is not used as the boundary, but its projection on the XOY plane is used as the boundary. The solid cross-section within the projection domain is filled with solid materials, while the other areas are filled with supporting materials. In this way, a cylinder with the projection domain of the part prototype as the base surface is obtained, and then the supporting material is removed, and the prototype of the part is finally obtained. Compared with Box-type automatic generation algorithm, this algorithm saves support materials and forming time, but when making special parts with large middle parts, it still generates unnecessary redundant supports. 2.3. Automatic support generation algorithm based on triangular mesh of parts The basic principle is to judge the normal vector of all triangles and classify all triangles, that is, triangles that need to be supported and triangles that do not need to be supported. The triangles to be supported and their adjacent surfaces are combined into several areas to be supported. A suitable support structure is automatically generated on the area to be supported, and then layered slicing is performed. The algorithm is more accurate to judge the region to be supported, but the difficulty of judgment and the complexity of the algorithm are relatively high. 2.4. Slice-based support automatic generation algorithm Firstly, the entity model is sliced by layers, and then the support is added automatically on the basis of slices. When the layer information is output, it is divided into entity information and support information. This method is essentially Boolean operation on the contours of adjacent two layers. The calculation of the algorithm is large, but the judgment is less difficult, so this paper adopts the automatic generation algorithm based on the layer contour information to do further research. 3. Optimization Design Based on Automatic Generation Algorithm Supported by Layer Information 3.1. The basic idea of the algorithm The basic idea of the automatic support generation algorithm based on layer information is that layers of section profile information are obtained after hierarchical processing of the model. When the upper and lower sections (such as layer i+l and layer i) are compared, the overhanging part of the upper section relative to the lower section is the area where support should be added to the lower section. The solid material of the upper suspended part collapses or deforms due to the lack of support on the lower section. Therefore, when printing the section i, in addition to filling the solid section area, the corresponding support should be added to the section i, so as to support the suspended part of the solid section on the i+1 layer. The support automatic generation algorithm based on layer information is based on the Boolean operation of two- dimensional planar simple polygons, including the difference between polygons, intersection and union. It used to belong to the research field of computer graphics, but now it is widely used in computer-aided design, rapid prototyping manufacturing, computer-aided drawing and other fields. The intersection of polygons is to calculate the area where two polygons overlap, as shown in Figure 2 (a). Two arbitrary simple polygons A and B, the intersection part of A and B is the gray part in the figure, denoted as A∩B; The difference of polygons is to calculate A polygon and remove the area intersecting with another polygon, as shown in Figure 2 (b). The difference between A and B is the gray part of polygon A in the figure, denoted as A-B; The union of polygons is to calculate the area composed of two polygons, as shown in Figure 2 (c). The union of A and B is the gray part of the two polygons in the figure, denoted as A∪B. Figure 2. Polygon Boolean operation 3.2. The design idea of algorithm According to the algorithm, there are the following designs: The solid cross-section area of the i layer is Ei, and the solid cross-section area of the i+1 layer is Ei+1. Since the Ei+1 region is larger than the Ei region, the support region that should be added to the section of the i layer is S. The support domain S is denoted as Si = Ei+1 - Ei. When Si =Ф, it means that it is not necessary to add this support domain on the section i. In addition, when calculating the layer i support domain, it is also necessary to determine whether the actual support domain S'i+1 in layer i+1 needs to be inherited, as follows: If the S'i+1 area is all outside the solid section area of the i layer, it should be inherited. If the S'i+1 area is all within the solid section area of the i layer, it is omitted from the i layer because it can be supported by the solid section material of the i layer. If the relation between the S'i+1 region and the solid section of layer i does not belong to the above two cases, then the inheritance falls outside the solid section of layer i, and the omission falls within the solid section of layer i. 3.3. Algorithm design steps The specific steps can be designed as follows: Process the contour data of each layer, identify the internal and external contours of the entity part, form the entity area, and record the entity area of the section i as Ei(i=0,1,2... n-1); Using the Boolean operation of the polygon region, the following loop is performed starting from i=n-1 (i.e. starting from Zmax) : The difference between Ei+1 of the previous section and Ei of the current section is calculated and denoted as Si, that is, 146 Si = Ei+1-Ei; The difference between the actual support domain S'i+1 of the previous layer and the physical cross-section region Ei of the current layer is denoted as Di, which represents the corresponding support region inherited from the i layer, that is, Di= S'i+1-Ei, where the initial value S'n is empty, because there is no need for any support on the cross-section of the top layer. Si and Di are combined as the actual support area S'i of the current layer, that is, S'i = Si∪Di; Repeat the above three steps until i<0, and then calculate the support area of each layer of cross-section entity in turn. In the actual production of parts prototype, should start from i=0, respectively print the solid section area and support area. 3.4. The problems still need to be solved in the algorithm design 3.4.1. The problem of oversupport It is not necessary to add support to the part of the small inclination plane referred to in the printing mode of the molten material. Here, the contour bias method can be used to judge, that is, the offset distance of the contour to the non- solid area is set as the critical distance of the material's self- support, and then compared with the solid area and support area of the upper layer, to judge whether the difference between the upper and lower contours meets the conditions for adding support. In 3D printing, contour polygons are non- self-intersecting simple polygons (including convex polygons and concave polygons, self-intersecting polygons are not considered in this paper), each polygon has an important feature, that is, the two adjacent line segments are not parallel, and this feature is used to calculate biased polygons. Each polygon has only one direction, either clockwise or counterclockwise. For polygons with different directions, the polygon in the counterclockwise direction is denoted as the outer contour, and the polygon in the clockwise direction is denoted as the inner contour. The outer contour or inner contour is biased outside the solid area, which is the right bias type, and the inner one is biased inside the solid area, which is the left bias type. In the judgment of the support area, all the biased polygons are right biased because the outer and inner profile polygons are biased outward to the solid area. The problem of sharp Angle and interference should be solved in the process of contour bias. The contours polygon interference after bias includes polygon self-intersection and polygon cross-intersection. 3.4.2. The problem of suspension wires and suspension points In the above design, the judgment of suspension area is fuzzy, and the judgment of suspension line and suspension point may fail after adding the contour bias judgment link. To solve this problem, some additional judgments can be added in the design. A certain entity area Ei of the model of the current layer i is judged to intersect with the outer contours of all entity areas of the next layer i-1. If the intersection of entity area Ei and the outer contours of all entity areas of the i-1 layer is empty, then this area is a suspended area. At the i-1 layer, a support region for region Ei needs to be added, and the outline of the support region is the same as that of Ei. However, when the model has multiple entity areas and each entity area contains relations, that is, when the suspension area is located inside the cavity of the entity, the above judgment will also show that the upper suspended entity area intersects with the outer contour of the outermost entity area of the lower layer is not empty, but in fact, the upper suspended entity is already the lowest layer, and the lower layer must add a support structure in this area. At this point, it is not perfect to determine whether to add support only by judging that the intersection with the physical area is empty, and some key support positions will be missed. In order not to miss the support area, the upper solid area should not only intersect with the outer contour of the lower solid area, but also intersect with the inner contour of the solid area. Specifically, if the upper solid area intersects with the inner and outer contours of all the lower solid areas as empty, or intersects with the inner and outer contours of the lower solid area with cavity as itself, then it can be judged that the upper solid area is a suspension area, and a support area for region Ei needs to be added in the i-1 layer, and the outline of the support area is the same as Ei. After identifying the suspension area, determine whether it is a suspension point or a suspension line. You can set an area threshold by calculating the area of the suspension area, if it is less than the threshold, it is regarded as the suspension point or suspension line. In order to effectively support the suspension point or suspension line, the added support is a tower-type support structure, that is, the topmost outline of the support is slightly larger than the suspension point or suspension line, and the outline is offset by a certain distance layer by layer. An area threshold is also set here, which is the maximum cross-section area of the support tower. When the area of the offset profile is greater than or equal to the threshold area, the outline of the support tower will not be offset. It can be used downwards. 4. Summary In this chapter, the automatic support generation algorithm of STL model is studied, and the automatic support generation algorithm is designed based on the contour information of the layer. The problem of identifying the suspension area is solved by the method of intersecting and comparing the contours of adjacent layers, and the tower support structure of the suspension point and suspension line is designed. The problem of sharp Angle and offset contour is the key problem to be solved by the subsequent algorithm, and it is also the future optimization direction of the algorithm. References [1] Shen wei, Tao Menglun, Li Lijie, et al.Research on the algorithm of rapid prototyping support structure design.Journal of Wuhan University of Technology,2014(6):63-68. [2] Wang Yanyun, Chen Hong, Xie Mingshi, et al.Research on automatic generation algorithm of support structure in FDM rapid prototyping. Computer Technology and Its Application, 2015 (8):146-148. [3] Qiu Kai.Research on the design and optimization of self- supporting porous structures inside 3D printing models. HUAQIAO UNIVERSITY,2021. [4] Chen Tap, Guo Zhidong.Optimization of the model processing of the defects of hanging parts based on FDM 3D printing. JOURNAL OF SANMENXIA POLYTECHNIC,2020 (2) 133- 137.