#### Abstract

In view of the problems of low printing efficiency and low accuracy of 3D printers currently developed in the domestic market, based on fused deposition modeling technology, this paper constructs a processing data model with a cylindrical coordinate data structure by 3D printing and processing models according to the cylindrical coordinate slicing rules. The data model can be used to search in adjacent cylinders to obtain the cylindrical coordinate information of the printing model and use the depth-first traversal method of the slicing model to establish a cylindrical coordinate slicing function. Aiming at the problem of “pointcut” of the model cylinder in cylindrical coordinate slice, a high-performance calculation method of machining accuracy based on the cylindrical coordinate slice algorithm is proposed. This algorithm is used to perform 3D printing processing through high-performance computing of cylindrical coordinate slices. After obtaining the intersection points obtained according to the order of the cylindrical coordinate slices of the model, through the automatic generation of the section profile corresponding to the printed model in OpenGL software, the profile direction of the model section can be determined according to the first cylindrical coordinate slice data generated by cutting each contour. The software and hardware of the 3D printer control system are designed, and the actual model printing test is conducted at the same time. By debugging and testing each module of software and hardware, the system is guaranteed to run stably under scientific and reasonable design. Finally, the experimental analysis results show that the algorithm proposed in this paper can effectively reduce the topology time required for cylindrical coordinate slicing, and the operation is simple, stable, and reliable.

#### 1. Introduction

Different from traditional cutting and manufacturing technology, 3D printing technology does not require machining or the use of molds and only uses computer 3D manufacturing software to design the proposed model. The printed model is sliced through slicing software, to plan the optimal printing path and then print the model in a “layer-by-layer accumulation” manner. The application of 3D printing technology not only improves the efficiency and quality of model manufacturing and processing but also saves manufacturing costs. Therefore, the research on 3D printing technology has attracted the attention of many scholars in China and other countries. In the mid-to-late 1980s, 3D printing technology began to gradually develop in the field of rapid processing and manufacturing, mainly using the “layer-by-layer accumulation” method to produce physical objects [1–3]. Similar to the working principle of general printers, the desktop 3D printer selects the appropriate print and loads the printed model into the printer through a USB connecting to a computer or a memory card and manufactures the model file processed by the slicing software into a real object. Usually, according to the different molding methods, rapid prototyping methods can be divided into the following categories: fused deposition, stereo light curing, and selective laser sintering. Depending on the type of printed objects, the selected printing consumables are also different. Currently, 3D printing consumables on the market include PLA or ABS plastics, ceramics, metal powders, and edible materials [4, 5].

At present, 3D printers can be mainly classified into two categories: desktop and industrial. Desktop-level 3D printers are favored by 3D printing enthusiasts due to their low printing cost, short production cycle, and simple operation. With the in-depth study of rapid prototyping technology by many researchers in China and other countries, 3D printer technology has also been greatly improved. In the future manufacturing and processing field, its performance will even exceed that of existing industrial 3D printers [6, 7]. Nowadays, 3D printer manufacturing technology has become mature and economical in developed countries. Representative companies include 3D Systems, Fab@Home, Stratasys in the United States, and Reprap in the United Kingdom. Among them, Stratasys and 3D Systems almost monopolize most of the market. 3D Systems is an early research company of 3D rapid prototyping technology, and now it has become the largest 3D printer manufacturing base recognized in the world. The company acquired *Z* Corporation in 2011, cementing its dominance in the 3D printer field. Through years of hard work, 3D Systems has independently developed different types of 3D printers. Cube 3D is a desktop 3D printer that is widely used in the consumer field. Stratasys’ position in the field of 3D printing should not be underestimated. In recent years, it has also offered to make acquisitions frequently. In 2011, it first acquired Solidscape and then signed a cooperative agreement with Israel’s Objet 3D printer system company to jointly develop new 3D printers. Finally, in 2012 it launched the Makerbot 3D printer, and the company has also treated the design and manufacture of desktop 3D printers as a focus for future development. The 3D printers produced by Reprap also occupy a considerable share in the field of 3D printing due to their advantages of easy operation, high precision, and relatively low price. More than that, some of Reprap’s 3D printing technology has also been made public. Fab@Home focuses on producing 3D printers suitable for home applications and providing customers with personalized 3D printer designs. Compared with developed countries in Europe, China’s 3D printing technology is relatively backward [8–10]. This article will briefly introduce the development of 3D printers in China from the aspects of colleges and universities, enterprise companies, and the guidance of relevant government policies. Since the 1990s, a technology research and development force system with universities as the main body has gradually been established. Many Chinese universities such as Tsinghua University, Beijing University of Aeronautics and Astronautics, and Huazhong University of Science and Technology have successively started to research and design 3D printers, gradually filling the blank of China’s 3D printers in the field of printing front-end technology. Wang Huaming’s scientific research team from the Engineering Research Center of Beijing University of Aeronautics and Astronautics has conducted in-depth research on the field of laser manufacturing of metal parts and provided new methods of machining parts of aerospace vehicles, engine titanium alloys, superstrength steels, and high-temperature-resistant alloys with high performance, difficult processing, and complex structures. The team led by Prof. Yan Yongnian from Tsinghua University conducted research on fused deposition technology, put forward the modern molding theory, slice manufacturing in China, and applied the manufacturing science to the field of life science, which has opened up a new path for the development of manufacturing science. Under the leadership of Professor Shi Yusheng, Huazhong University of Science and Technology, pioneered the 3D printing method of laser sintering in three-dimensional printing technology. Compared with foreign countries, this method has obvious advantages in the slicing manufacturing process. The team of Professor Lu Bingheng of Xi’an Jiaotong University mainly studies the curing of 3D printing polymer materials, laser rapid prototyping technology, and 3D printer mechanical devices. A special nozzle for 3D printers designed under his leadership has been widely used in China’s 3D printer manufacturing and processing industry. Through the unremitting efforts of these university researchers, in general, China’s 3D printing technology has developed rapidly, but there is still a big gap compared with the level of foreign manufacturing.

The desktop 3D printer designed in this paper is a 3D printer with ARM as the core and fused deposition technology. In view of the nonlinear characteristics of the temperature control of FDM 3D printer nozzles, the algorithm analyzes the STL model files in 3D printing to establish a high-performance computing model data structure for machining accuracy. The topology is used to find the adjacent cylinder, record its cylinder coordinate data information, directly find the edge through the cylinder coordinate information, and then obtain the intersection point of the edge and the section. The establishment of the data structure takes less time and the slicing efficiency is high.

#### 2. Cylindrical Coordinate Slicing Algorithm

The cylindrical coordinate slicing algorithm can be used to reduce the number of times between the plane positions of the model slices. If the number of model slices is *n*, all the cylindrical coordinate slices are divided into *n* groups, and in the direction of the model slice, the smallest value of the three vertices of the cylindrical coordinate slice obtained by the algorithm in this paper corresponds to the layer number of the first slice of this model. The 3D slice model is traversed and searched according to the matrix relationship, and the cylindrical coordinates obtained by intersecting the same section are stored in the same group. Each layer generates a set of intersecting surfaces with layer number as the search criterion [11, 12].

It can be seen from Figure 1 that represents the newly generated slice set intersecting with the i-th tangent plane in the model. It is represented by . The set of cylindrical coordinates intersecting with the tangent plane is called the active triangular patch table, to improve 3D model slicing efficiency.

If W represents a slice set of cost-controlled finite vertices, use the elements in the set to represent the vertices. If *E* represents the set corresponding to the cost control set, then let the graph *G*=(W(*G*), E(*G*)), C be a nonnegative real function in the edge set E(*G*), and W is called a cylindrical coordinate graph; W represents the weight function, f(e) represents the weight of the edge, and the weight of *G* is defined as . A directed graph with weights is called a directed cylindrical coordinate graph.

Assume that the starting slice height of the cylindrical coordinate slicing algorithm is , the maximum value of the patch on the *Z* axis is , the minimum value is , and the thickness is . The serial number of the tangent plane between *i* and *j* intersects this patch, and the values of *i* and *j* are as follows:

From formula (1) and formula (2), it can be determined which slice the triangular facet is located in, and the corresponding relationship between the serial numbers of the triangular facet and the sliced facet is formed at the same time, and the slice relationship matrix between the two is generated. When , it means that the cylindrical coordinate slice and the slice plane are parallel to each other, and these patches will not need to be added to the slice matrix relation matrix.

As shown in Figure 2, the triangular pyramid has four cylindrical coordinate slices, which are, respectively, numbered 0, 1, 2, and 3. Then, the adjacency relationship of the cylindrical coordinate slice is shown in Figure 3. The cylindrical coordinate directed cylindrical coordinate diagram of each cylindrical coordinate slice of the triangular pyramid is shown in Figure 4.

A directed association matrix of cylindrical coordinates can be used to describe the directed cylindrical coordinate graph around the vertex of the triangular pyramid, and the adjacency matrix expression is shown in Table 1.

The adjacency matrix is used to express the directed graph composed of the vertices of the cylindrical coordinate slicing algorithm, and this adjacency matrix is a sparse one, which is used to express the large memory space occupied by the adjacency relationship. In this paper, a *c* cylindrical adjacency list suitable for storing such a sparse matrix is used, and the structure is shown in Figure 5. The storage data structure of the adjacency list of the triangular pyramid directed cylindrical coordinate graph is shown in Figure 6.

The data structure of the adjacency list C language is as follows: Typedef struct triangle { float normal [3];//The normal vector of the cylindrical coordinate slice float *x*[3];//Cylindrical vertex coordinates float y[3]; float *z*[3]; int slice_flag;//Access flag of cylindrical coordinate slice. int vertex;//cylindrical coordinate slice number. int *Q*[3];//The cylindrical coordinate of the cylindrical coordinate slice Struct triangle next//chained list pointer }

Through the directed cylindrical coordinate graph of the established cylindrical coordinate slice, the depth-first traversal method is used to search all the cylinders in the graph to find the intersection point, that is, the cylindrical coordinate slice [13]. First, we need to start searching from in the graph, then visit ( is adjacent to and has not been visited), and repeat the above-mentioned traversal method continuously, visiting all vertices and their adjacent vertices until the visit ends. The visited vertices are indicated by the flag set slice_flag = 1. We need to find cylinders that intersect the tangent plane but have not been visited by slicing cylindrical coordinates. The flow of the cylindrical coordinate slice program is shown in Figure 7.

As shown in Figure 8, during the cylindrical coordinate slicing process, the search for the L2 tangent plane is successfully completed, and a closed contour line is generated at the same time. In the case of L1, only some of the vertices are on the *L* line, and the adjacent cylinder cannot be searched.

To deal with this situation is to determine whether the vertex of the cylindrical coordinate slice intersects the straight line [13]. If it intersects, the cylindrical coordinate slice will be set to slice_flag = 1, and no intersection calculation will be performed. Based on this cylindrical coordinate slice, according to its cylindrical coordinate, find its adjacent cylindrical coordinate slice, and the search will continue. If the cylindrical coordinate slice is within the range of intersection during the search process, but the intersection is not calculated, it means that there is still a closed contour at the height of this tangent plane, and the recursive algorithm will be searched again to generate a new closed contour.

##### 2.1. Machining Accuracy High-Performance Computing Process

Hardware design greatly affects the performance of desktop-level 3D printer control systems. Among them, the rationality of the hardware circuit design is the basis for the normal operation of the entire 3D printing control system. This article selects the ARM Cortex-M3 LPC1768 chip produced by NXP as the core processor of the 3D printer control system. The hardware design structure of the 3D printer control system is shown in Figure 9. The power supply for the control system comes from the power circuit. The SPI interface is mainly used to read the model data of the SD memory card. In order to realize high-speed communication with the upper computer, the communication between the two is completed by connecting with the on-chip USB interface. Users can also use the upper computer to send print data or instructions directly to the 3D printer. After the analog signals of the two-way temperature sensors are converted by the on-chip A/*D* of the core processor, they can be used to monitor and adjust the temperature of the heating bed and extruder of the 3D printer; the three -way signals in the four-way stepping motor drive circuit are used for realizing the coordinated movement of the *X*, *Y*, and *Z* axes of the 3D printer, and the last drive circuit is the stepper motor responsible for controlling the extruder; the three-way travel switch circuit locates the origin of the *X*, *Y*, and *Z* axes and the relative movement displacement; ISP/JTAG port is used to realize program programming and debugging [14, 15].

The following situations may occur when obtaining the intersection point of the cylindrical coordinate slice and the tangent plane: (1) obtain the intersection point of the adjacent tangent plane and the same cylindrical coordinate slice; (2) obtain the intersection of the tangent plane and the uncrossed cylindrical coordinate slice.

###### 2.1.1. Obtaining the Intersection Point of the Adjacent Tangent Plane and the Same Cylindrical Coordinate Slice

The incremental calculation method in the iterative algorithm is used, that is, the calculation result of each step is composed of the calculation result of the previous step and the increment. This algorithm requires less calculation and high efficiency.

As shown in Figure 10, the coordinates of the vertices of △ABC are , , and , respectively. Assuming that the height of the tangent plane of L1 is , the point where the edge BC and L1 intersect is set to , and the coordinates are set to . When L1 increases ΔZ height, then the height of the L2 tangent plane is , then the intersection point of edge BC and L2 is , and the coordinate is . A cylindrical coordinate slice intersects with multiple tangent planes, and there is a correlation between the intersection points, which can be used to find other intersection points.

The equation for side BC is expressed as follows:

Then, the intersection point , of the intersection pair of the edge BC and the adjacent tangent plane and can be calculated by the following formula:

Based on formulas (4) and (5), two expressions can be obtained as follows:

Here, . It can be expressed by the following formula:where .

The incremental algorithm is used to find the intersection. Assuming that one side of the cylindrical coordinate slice intersects with N tangent planes when solving the coordinates of N intersection points, the amount of calculation can be reduced and the efficiency can be improved.

###### 2.1.2. Solving the Intersection of the Tangent Plane and the Cylindrical Coordinate Slice That Has Not Intersected

The tangent plane parallel to the xoy plane and the cylindrical coordinate slice are used to obtain the intersection point, set the slicing direction as the positive direction of the *z*-axis, and the line segment connecting the intersection of the tangent plane and the cylindrical coordinate slice is the section profile. As shown in Figure 11, the intersection points of the tangent plane *z* = *h* and △ABC are W1 and W2, and the coordinates of the two known points AB are set to (x1, y1, z1), (x2, y2, z3), The coordinates of the intersection point W1 of W1 and W2 are set to (x, *y*, *z*), and then the straight line W1W2 can be represented by formula (3). The coordinates of W1 can be obtained as follows:

##### 2.2. Description of Cylindrical Coordinate Slicing Algorithm

The cylindrical coordinate slicing algorithm used in this paper is to establish a slice relationship matrix according to the *Z*-axis direction of the cylindrical coordinate slice. According to the determined slice relationship matrix, a directed cylindrical coordinate graph of grouped cylindrical coordinate slices can be established. The cylindrical coordinate slice method is used to calculate the intersection of the cylindrical coordinate slices, and finally, the contour data information of each slice is obtained, to determine the profile direction of the section. The implementation steps of the algorithm are as follows:(1)Import the cylindrical coordinate slicing algorithm file to calculate the maximum space required by the model(2)Calculate the maximum and minimum values of the triangular patch in the *Z*-axis coordinates(3)Determine the thickness of *Z* of the slice(4)Establish a slice relationship matrix according to the obtained maximum and minimum values of the vertex coordinates of each patch(5)Establish a directed cylindrical coordinate diagram on the tangent plane(6)Use the cylindrical coordinate slicing method to find the intersecting cylinders in the directed cylindrical coordinate graph, remove all intersecting edges, and put the obtained intersection points into the contour line data(7)According to the obtained profile data, directly determine the direction of the section profile(8)Move the tangent plane up, if the tangent plane is higher than the maximum height of the model, go to (7), otherwise go to (2)

##### 2.3. Determination of Section Profile Direction

The orientation of the contour line obtained by slicing is not clear, and the line width compensation needs to determine the orientation of the contour line and the inner and outer boundaries. It is assumed that the counterclockwise direction of the outer contour of the entity is the positive direction, and the clockwise direction of the inner contour of the entity is the positive direction. Each cylindrical slice of data in the STL file contains its outer normal vector, so in the process of slicing the STL file, the direction of the contour ring can be directly determined.

During the description of the cylindrical coordinate slicing algorithm, it can be known that in the slicing process of the first cylindrical coordinate slice, one side of the cylinder is arbitrarily selected, and then the search continues along the direction of the adjacent side cylinder of the cylindrical coordinate slice, until return to this cylinder. Therefore, it is very important to correctly select the side of the first cylinder to obtain the direction of the section profile. As shown in Figure 11, cylinder F is the first cylinder to be cut. If the intersection point P0 is obtained, the contour will follow the direction of D0; if the point P1 is obtained, the contour will follow the direction of D1. In this paper, the following method is used to determine the direction of the section profile, and the discriminant function is as follows:

In the expression, *N* is the unit normal vector of the cylinder and *n* is the slice direction (unit vector on the *Z*-axis), *n* = [0,0,1].

If *F* > 0, select P1 as the intersection point, and then the direction of the cross section contour is D0; if *F* < 0, select P0 as the intersection point, and the direction of the cross section contour is D1.

#### 3. Experimental Results and Analysis

At present, there is no unified international standard for evaluating the quality of 3D printing. In addition to the control system designed in this paper, the printing quality of the cylindrical coordinate slice model is also affected by many factors, such as the quality of printing consumables, the mechanical transmission characteristics of the printer, and the printing data generated by the slice. This paper evaluates the printing accuracy and performance of the designed desktop 3D printer from four aspects based on actual needs. The actual desktop 3D printer designed in this paper is shown in Figure 12.(1)Model printing capability, that is, whether a model can be printed out in good condition. Model printing ability is the basic requirement for the stability test of 3D printers, and the detection of the printer’s anti-interference ability and sudden exception handling ability is carried out in the control pass mainly. For example, the reading of print data, whether the mutual communication between modules in the printing process is stable, and the abnormal situations can be handled effectively. After testing, the 3D printing control system designed in this paper can work continuously without failure when the consumables are sufficient. Figure 13 is a comparison diagram of the printing model and the effect after printing. The comparison results show that the printing ability of the 3D printer model designed in this paper can complete the printing task and has good stability.(2)*Surface Roughness of the Model*. The roughness of 3D printed objects is mainly affected by two aspects, which are caused by the principle of FDM. The “stacking” layer by layer will produce a step effect. This factor affecting the roughness can be controlled through the controlled cylindrical coordinate slice direction determination and the fast cylindrical coordinates slice thickness method mentioned above. Figure 14 shows the model printing process after introducing the directed weighted recursive algorithm of grouping sorting proposed in this paper. It can be seen from the figure that the roughness of the smooth surface of the printed model is very low. In addition, the molded object after 3D printing can also further reduce the roughness of the object through postprocessing.(3)*Model Local Detail Processing Capability*. The local detail processing capability is the processing capability of the more complex parts on the surface of the coordinates slice printer model. Figure 15 shows the molding process of the mobile phone case. The experimental results show that the 3D printing control system designed in this paper has a high model local detail processing capability.(4)*Printing Size Accuracy*. The so-called dimensional accuracy is the degree of agreement between the actual size and the ideal size of the model. The models for 3D printing are different. This article compares the lateral dimensions of the models to be printed and tests the size of the circular shaft and circular holes of the molded object. Figure 16 is a picture of the experimental model; Table 2 shows the comparison between the actual size and the ideal size of the experimental model for the experimental data of dimensional accuracy. According to the analysis of the data in the table, it can be seen that the absolute error between the inner diameter and the outer diameter of the model is usually within 0.2 mm, and the relative error of the model with an outer diameter of more than 5 mm and an inner diameter of 10 mm or more is controlled below 1%.

**(a)**

**(b)**

#### 4. Conclusions

In this paper, a high-performance computing model of machining accuracy is established on the basis of the 3D printing model according to the cylindrical coordinate slicing analysis rules. The model structure can collect data information of adjacent cylindrical coordinate slices, use the model depth-first traversal method, and use the printing model cylindrical coordinate slicing function, which is mainly used to solve the problem of cylindrical “cut points” in 3D printing models. A high-performance algorithm for 3D printing processing accuracy of coordinate slicing algorithm is proposed. The method is mainly to complete the high-performance calculation of the 3D printing processing model after the 3D printing model is sliced in the cylindrical shape, obtain the ordered intersection points between the cylindrical slices, and realize the generation of the model cross section contour. Based on the first cylindrical patch data of every contour loop cutting, the direction of the section profile can be obtained quickly. In order to test the high-performance system of 3D printing processing accuracy proposed in this paper, the printing accuracy and performance of 3D printers are tested mainly from four aspects: 3D model printing ability, model surface roughness, model local detail processing ability, and printing dimensional accuracy. According to the experimental test results: this paper proposes to apply the cylindrical coordinate slicing algorithm to 3D printing processing, and the physical printing accuracy is high, with a smooth surface.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare no conflicts of interest.

#### Acknowledgments

This research study was financially supported in part by the Natural Science Foundation of Guangdong Province (2018A0303130085). The author thank the project for supporting this article.