Detection and visualization of manufacturing errors of internal cavity structural parts

 Abstract: Aiming at the difficulty of manufacturing error detection of internal cavity structural parts, a detection method of common manufacturing error based on industrial CT images was proposed. Firstly, the image sequence of part scanned by an industrial CT machine is converted into a three-dimensional measurement model; Then, the registration of the three-dimensional measurement model with the original design model is completed; The surface information of the part is obtained by segmenting surfaces of the three-dimensional measurement model; Next, the datum surface is selected, the error value of the test surface is calculated after selecting datum surface; Finally, the detection result is obtained by comparing the error value with the tolerance value, analyzing the result and the areas that do not meet the tolerance requirements is visualized in the developed software system. The common manufacturing errors of complex inner cavity parts can be detected by the method, such as dimension error of length, planeness error, cylindricity error, parallelism and perpendicularity error of face-to-face, at the same time, it can intuitively show the area whose manufacturing errors in the cavity structure of the parts are not satisfied, which provides a basis for judging the quality of manufacturing and processing of parts.


Introduction
Parts with internal cavity structure are widely used in engineering, such as engine, hydraulic part, valve body, etc. The structure of such parts is complex, and the detection of manufacturing errors in the cavity has always been a problem. At present, the conventional method for the digital detection of manufacturing errors of part is to obtain a 3D measurement model of the part through a digital scanning method, with the original design model [1][2][3] DX. Wang and others combined the particle swarm optimization algorithm with quasi-random sequence method to realize the precise positioning of free-form surfaces based on CAD modelguided measurement and the evaluation of the form errors of high-precision free-form parts [4]. F. Lu et al. proposed a three-dimensional measurement method based on optical measurement and computer image processing technology, which provides a convenient and fast method for detecting free-form surfaces and processing quality control [5]. Z. Li and others studied the detection comparison of industrial computer tomography (CT) images and CAD design models and proposed a method for analyzing manufacturing errors of workpieces [6]. In other studies, specific sensors or scanners were used to obtain manufacturing errors for specific parts by instrument measurement and calculation analysis. For example, C. Ding and others relied on the structured light threedimensional detection method and component measurement principles to achieve quantitative detection of the depth of grooves on the inner surface of deep holes [7]. CL. Zou and others designed a digital planeness measuring instrument, and evaluated the accuracy of the instrument through the flatness measuring function module of the laser dualfrequency interferometer, which verified the validity of the method [8]. TH. Hu et al. proposed a scanning deflection measurement method using an automatic collimator for aspheric surfaces with large slope changes0. CF. Cheung and others designed a three-dimensional measurement system based on auto-stereoscopic vision to accurately measure the machining errors of the V-groove microstructure surface [9]. JH. Ge et al. used information entropy to initialize the population to improve the original artificial bee colony algorithm (ABC), and proposed a new artificial bee colony algorithm (IABC), which was introduced into the digital detection of manufacturing errors of complex parts and applied to roundness analysis and evaluation of errors [10]. The manufacturing error detection methods in the above studies are limited to the detection of the outer surface of the part, which cannot detect the manufacturing error of the inner cavity structure of the part. For the inspection of the internal cavity structure of the part, JT. Liu et al. designed a non-destructive testing tool for the analysis of internal structure and defect location of industrial complex parts based on the positron annihilation principle and the gamma photon detection mechanism [11]. A. Karageorghis et al. proposed an improved bee colony algorithm for establishing an evaluation model of cylindricity error [12]. H. Xiao et al. proposed a new 3D imaging method based on positron annihilation and γ-photon for detecting the spatial structure of complex internal cavity parts [13]. Although these methods can detect the internal cavity structure of a part, the detection process is complicated, and the manufacturing errors of the internal cavity structure of the part cannot be displayed intuitively.
In order to solve the difficult of manufacturing error detection of internal cavity structural parts and inconvenient display of results, in this paper, a method is presented for detecting and visualizing common manufacturing errors of internal cavity structural parts based on industrial CT images. The part is scanned by an industrial CT machine, obtaining the image sequence which is converted into a 3D measurement model, and registration of 3D measurement model and original design model is completed; By segmenting the 3D measurement model, the surface information of the part is obtained, and the surface features are extracted; After calculating the error value, the results are gained by comparing the error value with the tolerance value according to the design requirements, and the areas that do not meet the tolerance requirements are visualized by the results. The industrial CT technology is applied to the detection of internal cavity structural parts, so that the method is not restricted by the shape, structure and materials of the parts, and the geometric parameters and internal structure of the parts are accurately acquired without damaging the parts; Detection of size error of length, planeness error, cylindricity error, parallelism and verticality error of face-to-face is realized, and visualization of error results through development systems which visually demonstrates common manufacturing errors in the cavity structure of a part, providing a basis for judging the quality of manufacturing and processing of parts. For the mainstream reverse modeling software ICEM Surf, imageware, CDRS, etc., although there is an error detection function, if a specific surface needs to be checked for tolerance, manual point cloud segmentation is required, and the accuracy and efficiency of this process is not satisfactory, but this method can automatically segment the point cloud according to the surface features of the original model of the part, which greatly improves the efficiency and accuracy of tolerance analysis.

Acquisition of Image Data
The industrial CT machine scans the part to be tested, and the image sequence of the part is obtained through computer information processing and image reconstruction technology. A certain type of valve body is shown as Fig.1, which is scanned by an industrial CT machine to gain the image sequence shown in Fig. 2.

Building Model
Through the reconstruction algorithm, the industrial CT image sequence is transformed into a three-dimensional measurement model [14]. The format of the original design model is IGES. By formula (1), the surfaces of the original design model are sampled at equal intervals in the direction, and the sampled surfaces are fitted by the least square method to obtain the surface information of the original design model. ,, 00 ,, 00 To ensure accurate registration of the 3D measurement model and the original design model, the number of sampling points and the number of point clouds in the measurement model need to be similar [15], and the number of sampling points is determined according to formula (2).

Registration of Model
After the model is established, point cloud registration is performed on the 3D measurement model and the original design model. The registration process is divided into rough registration and precise registration. Rough registration provides the initial position for precise registration. The moment principal axis method is used in rough registration, Let X denote the point cloud set of the original design model and P denote the point cloud set of the 3D measurement model. The principal axis matrices MX, MP and the centroids up=(xp, yp, zp) and ux=(xx, yx, zx) of the two sets are gotten. The rotation matrix R is obtained through the principal axis matrix, and the translation matrix T is gained by the centroids. According to formula (3), a new point cloud set H is obtained, that is, the initial position of fine registration.

Preprocessing of Point Cloud Data
In order to perform targeted error analysis on the part, point cloud segmentation is performed on the 3D measurement model to get a subset of the point cloud of each surface in the part. The common point cloud segmentation method is generally used for segmentation between different objects in point clouds of large and complex scenes. When segmenting the surface within the same object, the effect is not ideal [17][18]. Therefore, the method based on surface information in the original design model is applied to segment the point cloud.

Point Cloud Segmentation Based on Original Model
The original design model and the 3D measurement model have been registered after registration. Calculating the distance from the point to each surface of the original design model, the surface which is closest to the point is the belonging surface of the point. But there is a special case, as shown in Fig.3. The projection point of point t on surface Ψ is t1, the distance from the point to the projection surface is l1, and the projection point on plane П is t2 and the distance is l2.

Figure 3
A special case of attribution surface for the point Therefore, for a point in the point cloud, its distance from all surfaces in the original design model and the position of the projected point are calculated, and the surfaces are arranged in ascending order of distance. The surface whose distance between the point is shortest is regarded as the belonging surface of the point.

Judging the Number of Projection Points
The  Common manufacturing errors of internal cavity structural parts are dimension error of length, planeness error, cylindricity error, parallelism error, and verticality error. These errors are analyzed and visualized in this paper.

Dimension Error of Length
When measuring the length dimension error, the datum plane is selected firstly. As shown in Figure 8, the datum plane fitted by the point cloud coincides with the datum plane of the original design model, and then a tolerance zone is established to find out the area outside the tolerance zone in the test surface. where G is the centroid point on the corresponding surface of the original design model, ni is the normal vector of the plane, and Pi is a point on the test surface of the 3D measurement model; ③After calculating the distance from all points on the test surface to the corresponding surface of the original design model, the distance sets d + ={d1 + ,d2 + ,d3 + …} and d -={d1 -,d2 -,d3 -…}, where set d + contains positive values and set dcontains negative values; ④Enter the upper deviation ES and lower deviation EI, as shown in Fig.8, to obtain the dimensional tolerance zone; ⑤Compare ES with each element in the set d + . If ES < di + , then the points corresponding to the distance are taken out to form a new set dE. Similarly, compare EI with each element in the set d -. If EI <di -, then the points corresponding to the distance are taken out and put into dE, too; ⑥The points in set dE are the points outside the tolerance zone in Fig.8, that is, the points that is outside the dimensional tolerance zone form into areas. These areas that do not meet the manufacturing requirements can be represented by different color, which is called visualization.

Planeness Error and Cylindricity Error
Planeness error is the variation of actual surface to its ideal plane. Cylindricity error is the variation of actual cylindrical surface to its ideal cylindrical surface. Planeness error and cylindricity error are shape errors, and no datum is involved in the measurement process. The planeness tolerance zone consists of two parallel planes, and the cylindricality tolerance consists of coaxial cylindrical surfaces, as shown in Fig.9 and Fig.10. The method of detecting these two errors is similar: ①Select the surface whose essence is a set of point clouds that are segmented to be tested in the 3D measurement model, then a surface is fitted by a random sampling consistency algorithm; ②Calculate the Euclidean distance from all points in the selected point cloud set to the fitted surface to get the distance set d = {d1, d2, d3…}; ③Search the minimum distance dmin in the set d, and enter the tolerance value t, obtaining the tolerance zone through dmin corresponding points and t; ④Calculate the difference di´ between each point in set d and dmin according to formula (6) ; ' min ii d d d =− (6) ⑤A new set d= {d1´, d2´, d3.} is obtained through di, and t is compared with each element in the set d. If t < di, the points corresponding to the distance are taken out to form a set dt; ⑥The points in set dt form into the area that do not meet the processing requirements. These areas can be represented by different color, that is, the planeness error or the cylindricality error is visualized.

Parallelism Error
Parallelism error is a position error, which refers to the variation of the actual element relative to the parallel direction of datum. It mainly includes face-to-face parallelism error, line-to-face parallelism, face-to-line error, and line-to-line parallelism error. The face-to-face parallelism error is detected in the paper. As shown in Fig.11, the tolerance range for parallelism consists of two planes parallel to the datum plane. All points of the surface should be limited between two parallel planes with a distance that equals the parallelism tolerance value The detection method is as follows: ①Set the plane of datum fitting surface be Bf and calculate the Euclidean distance from all points in the test surface to Bf, getting the distance set d ={d1, d2, d3…}; ②Input the parallelism error value t and the minimum distance dmin to locate the parallelism tolerance zone; ③Subtract all distance values in the distance set d from the minimum distance to get a new distance set d= {d1, d2, d3´…}; ④By comparing the distance values of all points in the distance set d with t, the corresponding points with a distance value greater than t are taken out to form a new set dt; ⑤All points in set dt form into areas that do not meet the face-to-face parallelism tolerance zone and are visualized with different colors.

Verticality Error
The verticality error is the variation of the actual elements to the datum, which is a position error. The method in this paper is suitable for analyzing and detecting the error facing the datum plane. The perpendicularity tolerance zone consists of two parallel planes which are perpendicular to the datum plane, as shown in Fig.12. ①Set the plane of the datum fitting surface to Bf and calculate the projection points from all points to Bf in the test surface to obtain the point set Pf; ②Calculate the distance from all points in set Pf to point P1 to get distance set d ={d1, d2,d 3…}; ③Search the minimum distance dmin in the set d , calculate the difference between each element di and dmin, which is recorded as di´ .The new set d ={d1, d2, d3´…} can be obtained by di; ④By comparing the distance values of all points in the distance set d´ with t, and the corresponding projection points with distance values greater than t is gained to for me a new set dt. ⑤All points in the set dt form into areas that do not meet the verticality error, and are visualized with different colors. Datum surface t Figure 12 Verticality tolerance zone Different from dimension error of length, there are many ways to locate error tolerance zone of the planeness, cylindricity, parallelism and verticality. The corresponding point of dmin is used to locate the tolerance zone in this paper and the area that does not meet the tolerance requirements is the result of this location mode. Due to the different location modes of the tolerance zone, the measurement results also vary. Therefore, the method in this paper is applicable to the case where the minimum distance point can be used to locate the tolerance zone.
Aiming at the detection method proposed in this paper, the system development was realized and applied to engineering.

Functions of System
The system in this paper mainly includes four modules: file processing, preprocessing, error detection, display and operation. As shown in Fig.13  The main function of the software is error detection and visualization. The operation process is: Firstly, the industrial CT image sequence is imported in the file processing; In the preprocessing, the CT image sequence is converted into a point cloud by a reconstruction algorithm to obtain a threedimensional measurement model. At the same time, segmentation of the point cloud based on the original design model is completed to gain information about each surface of the part; Next, the registration of the 3D measurement model and the original design model is completed; Finally, determine whether to set a datum plane according to the type of error, and select the test surface to calculate the error value; the areas that do not meet the tolerance requirements are calculated by comparing the error value and the set tolerance value; In the display and operation, the error results can be visualized by color setting and display setup. The processing flow of the system is shown in Fig.14

System Design
The system is based on Visual Studio2017 development platform, OpenGL graphic display tool library and STL standard file library to complete the function development, and Qt5.8 is used to achieve interface development. As shown in Fig.15, the software interface is composed of main and auxiliary display windows, a menu bar, a control panel. The main display window is used to display the error detection results, and interaction can be realized by the mouse; the auxiliary display window is used to display the 3D measurement model and the original design model, which is convenient for observing the status of the model; the basic operation functions can be realized in the menu bar; the control panel consists of selecting error types, test surface and datum plane, setting tolerance, error calculation and display, etc., which can realize the entire detection process.

Application Results
The developed system has been applied to the part manufacturing error detection of a company and has achieved significant results. A certain type of valve body is taken as an example to explain the application effect in the paper.

Error Detection and Visualization of A Certain Valve Body
The structural accuracy of the model valve body directly affects the static indicators and dynamic characteristics of the product. Therefore, high shape and position accuracy of the valve body is acquired. The conventional method is difficult to detect due to the complicated structure of the valve body. The method in paper is used to detect the manufacturing error of the valve body. In order to meet the tolerance accuracy requirements of the valve body, the image sequence of the valve body was gained by scanning with an industrial CT machine CD-200BX.The three-dimensional measurement model was obtained through reconstruction algorithm. The number of point clouds of the three-dimensional measurement model is 598623, and the number of surfaces of the original design model is 1408. In order to highlight the detection results, the surfaces that are not calculated were set transparency, the datum plane was set to blue, the test surface was set to green, and the areas that do not meet the error requirements were displayed in red. The overall length, width, and height of the valve body are taken as an important installation dimension. The length error of the overall length, width, and height of the valve body was detected separately by the method. As shown in Fig.16, the rightmost end surface in the length direction was used as the datum surface, and the leftmost end surface was the test surface. The length dimension error of the two surfaces was detected, that is, the length dimension error of the valve body. The tolerance value was set as ±0.2mm according to design requirements and the error value was 0.13mm by calculating. So, the length dimension error of the valve body meets the design requirements. In the same way, the height and width dimension errors of the valve body were respectively detected, and the results are shown in Fig.17 and Fig.18. According to the results, it can be seen that the height and width dimension errors of the valve body also meet the design requirements.  The upper and lower surfaces of the valve body base are used for installation. The higher the planeness and parallelism is, the better the performance is, the stronger ability to resist pressure and corrosion is, and the longer the service life is. The planeness errors of the upper and lower surfaces of the base were detected by the method. According to the design requirements, the planeness tolerance value of the upper surface was 0.05mm, and the planeness error was 0.062mm by calculating. The areas that does not meet the tolerance requirements were marked red, as shown in Fig.19. Similarly, the planeness error of the lower surface was detected, and it can be known from the results that the planeness of the lower surface meets the design requirements, as shown in Fig.20. The lower surface was used as a datum, and the parallelism of the upper and lower surfaces was detected. According to the design requirements, a tolerance value was set as 0.1mm, and the parallelism error was calculated to be 0.13mm. The areas that do not meet the design requirements were marked red, as shown in Fig.21.  The horizontal hole in the valve body cavity is used to install the valve core. The cylindricality of the horizontal hole needs to be guaranteed to ensure the normal movement of the valve core and control the flow precisely. The cylindricity error of the horizontal hole was detected by the method. As shown in Fig.22, the tolerance value was set as 0.05mm according to design and the cylindricity error value of the horizontal hole was 0.057mm. The areas that do not meet the design tolerance requirements were marked red. This type of valve body has two oil inlets No.1 and No.2. the oil inlet must be perpendicular to the lower surface of the base in order to prevent overflow and blockage. Therefore, the verticality of the two oil inlets was detected respectively. The lower surface of the base was selected as the datum, and the oil inlet No.1 was the surface to be detected. The error value of the oil inlet No.1 was calculated to be 0.27mm. According to the design requirements, the tolerance value was set to 0.2mm, and the areas that do not meet the verticality error requirements were marked red, shown in Fig.23. By the same method, the verticality error of the oil inlet No. 2 was detected with respect to the lower surface of the base. As shown in Fig.24, it can be known from the results that the verticality of the oil inlet No.2 meets the design requirements. The internal structure of the valve body is complicated, mainly consisting of oil channels, water channels, and air channels. In order to prevent oil, water, and gas from blocking and affect the normal operation of the valve body, the side of the internal channel must be parallel to the end face of the valve body. Taking an oil channel in the cavity as an example, the parallelism error of its side was detected. As shown in Fig.25, the end face of the valve body was used as the datum surface, and the side of the oil channel was the test surface. The tolerance value was set to 0.2mm according to the design, and the error was 0.23mm by calculating. The areas that do not meet the design requirements were marked red. By this method, it is also possible to detect the parallelism error of other oil channels, water channels and air channels.

Conclusion
A method for detecting common manufacturing errors of internal cavity structural parts based on industrial CT images was proposed, and a detection and visualization system was developed. It can realize the calculation and analysis of part length dimension error, planeness error, cylindricity error, face-to-face parallelism and verticality error. Taking a certain type of valve body as an example to illustrate the actual application effect, which shows the effectiveness and practicability of the method. This method solves the problem of manufacturing error detection of inner cavity structural parts, the software system is developed to realize the visualization of manufacturing error, and the results of error detection are shown visually. The detection does not destroy the parts, and is not limited by the size, shape and complexity of the parts. Error detection can be realized through software operation, which improves the detection efficiency and reduces the complexity of manual calculation.