A primitive-based reverse modeling method for obtaining the editable CAD model of reversed parts

 Abstract: By the traditional inversion methods, the model of the part reversed is obtained in mesh feature , which is hard to edit and redesign. In the paper, for the revised part, a modeling method to obtain the editable CAD mode was proposed. Firstly, an approach to construct the primitive structure tree used to describe the geometric structure of a part was proposed, by which the all the basic geometry primitives and their Boolean operations are logically arranged in tree format. Then, for each basic geometry primitive, a method to calculate the characteristics parameters and position and posture was proposed, which could be used to guide reversion measurement and modeling. For the basic primitives made of quadratic surface, a method for modeling the torus surface, whose model little research has been carried on, was proposed in which the torus surface equation is deduced by coordinate transformation method, has 8 independent parameters. Last, based on the guidance of primitive structure tree, a process for the characteristics parameters, minimum measuring points, forward modeling, positioning and assembly process was proposed, which could be used to direct measurements and to forward modeling. The example showed that the method proposed could be used to reverse the parts in the editable CAD model and provide for subsequent optimization design


Introduction
The method of traditional reverse engineering, in which the point cloud data measured are used to build the models of the products reversed, has been widely applied in new product development and product optimization design, so  Jin Yao Jinyao163@163.com as to shorten product design and reduce the cost of enterprises. The geometry features of the reversed parts are fitted with spline curves and spline surfaces, and expressed in B-REP (Boundary Representation) format. The reverse process needs to deal with a large amount of data and to identify their relations, which is complicated and even uncertain [1].
Although the B-REP model can be directly used in NC processing and finite element analysis, it lacks important structure details for the geometry feature of the part [2,3]. That is to say, the part cannot be fully described only in B-REP format and its reverse model cannot be edited and cannot be used for redesign, which makes it difficult to further modify and optimize the part model.
Different from the reverse model, the forward model of the part is used in CAD systems to obtain the Constructive Solid Geometry (CSG) model. CSG is usually a userfriendly model [4,5] which has enough effective size and constraint information and can be easily edited for modification and redesign. So transforming B-REP model obtained by reverse engineering into CSG model is considered to be a very effective way to solve the problem of non-editable B-REP model. There have been multifarious algorithms for automatically transforming B-REP to CSG [6][7][8][9][10][11][12]. However, the disadvantage of these algorithms is that it is easy to lose data in the transformation process to result in distortion of the transformed CSG model such as deformity, deformation, etc.
There is another reverse method in which the point cloud is transformed the grid data (similar with B-REP), then the characteristic parameters for the part reversed is extracted with use of the grid data, finally the CSG model is constructed by the forward modeling. There have been various automatic algorithms to complete the extraction. Marshall used the least square method to match the ball the cylinder, and etc. to extract the size parameters by the grid data [13][14][15]. Wang proposed the extraction of the characteristic parameters of bending, scanning, rotation, extrusion and setting out from the mesh grid, then completed the reconstruction of the entity model through the forward modeling, so as to ensure that the part model be editable [16]. However, since there is uncertain situations in transforming point clouds into the grid data, this method also leads to confusion of feature extraction, so that the models obtained by automatic processing are often inferior in accuracy, and manual intervention is required for correction.
By different from the former two methods, Cai Min and Cai Chuang extracted the CSG primitives by manual interaction based on the grid data or B-REP model, and calculated their characteristic parameters and obtained the CSG model by forward modeling [17][18][19]. In their methods, manual operations are needed to get the grid data on the basis of the point cloud of the part. The operation is very complicated, and there are many uncertainties in the manual operation process.
To sum up, there is uncertainty in transforming B-REP model into CGS model or in extracting the grid data from the point cloud. In order to reduce the uncertainty, much manual intervention is required to improve efficiency and ensure accuracy [21,22]. Moreover, forward feature modeling should be used to obtain the CGS model after extracting the structural geometry features and the corresponding the feature parameters in reverse engineering. In fact, the features of most parts to be reversed are easily identified by the professional engineers. However, there is a lack of a systematical method to structurally express these features and their relationship. Once the structural expression of the geometry features is obtained, it is easy to find where the parameters for a geometry feature to be measured. In this way, when the size and location parameters of the feature are obtained, all the features can be assembled automatically by forward modeling and following the structural expression to form the CGS model of the part reversed. In this paper, a method for constructing the primitive structural tree for the part reversed was proposed, by which the all the geometry primitives and their Boolean operations are logically arranged in tree format. Then modeling the basic primitives and determining their measurement points were completed. Further, a reverse modeling process was put forward in which the geometry primitive tree was used to guide the detection for each primitive to determine the geometric size, position and posture of the primitive and to complete the regular operation between primitives, and the comprehensive geometric features and CSG file format of the reversed part are formed. Finally, an example was given to illustrate the proposed method.

Construction of primitives' structure tree for part
The A part is composed of basic primitives including geometry features and their size, position and posture, and their regular set operations (Boolean operations). The primitive structure tree is a tree structure organized by primitives according to the branching relationship, that is, Boolean operation. It can be constructed gradually with the process to divide the part into basic primitives.

Definition of primitives and their regular set operation
The most simply spatial geometry with complete geometric information and topological information is called basic primitive [23], such as cylinder, cuboid, cone, sphere and torus, etc. A primitive may consist of a few basic primitives with their regular set operations. For convenience, a combination of more than two basic primitives can be considered as an extended basic primitive, which is also called a basic primitive.
The proper determination of the regular set operation (Boolean operation) between two primitives is the guarantee of the correct description of the parts. The regular set operation includes regular sum   So parts can be expressed by the combination of primitives and regular set operations.

Construction of primitive structure tree
In order to build the relationship among the primitives, their regular set operation and measurement process for the reversed part, a framework of primitive structure tree was proposed, which could be applied in reverse modeling to ensure the correct description of the part, as shown in Figure  1. The construction process of the primitive structure tree for the revised part is as follows.
(1) The left-most node corresponded to the modeled object is defined as the primitive in level 0. The primitive in level 0 is divided into the multiple primitives in level 1 and any two primitives are described by proper regular operation, according to the structure composition of the part. (2) Each primitive in level 1 is decomposed into the corresponding primitives in level 2, in turn. And any two of the primitives are described by proper regular operation (3) Similarly dividing each primitive in level 2, until dividing into the basic primitives without nodes, such as cylinder, cone, cuboid, sphere and torus, etc. (4) The primitive structure tree for the part including all the primitives, their regular operations are stored in the corresponding database The primitive structure tree for the part reversed may be used to guide the subsequently measuring, modeling and combining the primitives. Beforehand, the model for each basic primitive should be completed, which is discussed in the following section.

Figure 1
The primitive structure tree for part 3 Characteristic parameters and modeling of basic primitives

Characteristic parameters and measurement points for the basic primitives
A basic primitive has a definite topology, so it needs a group of feature parameters to describe its shape, size, space position and posture. For example, when the basic primitive is a cuboid body, it is possibly defined in space by its characteristic parameters, such as length, width and height of the body which are determined by three pairs of plane equations. At least 3 points are needed to determine a space plane, called as measurement points, and the number of the measurement points for the 3 adjacent plane of the cuboid are at least 9. To further get the parameters of length, width and height, at least 1 point on the opposite parallel plane is needed to measure to calculate distance between the parallel planes. Therefore, as shown in Figure 2, at least 12 measurement points is required to form a cuboid. The minimum number of the measurement points of the remaining basic primitives are shown in Table 1.
These measurement points are marked with the ordinal numbers which can be used to guide to measure. It is called a process of teaching measurement. The values for these measurements are used to get the feature parameters of the basic primitives. In modeling basic a primitive, the model of two kinds of elements geometric elements, such as plane and surface, are needed, which are presented in the following section.

Modeling the primitives consisting of planes
A cuboid is taken as an example to show the calculation of plane coefficients and its application. The measuring points for a cuboid are at least 12 points as shown in Figure  2.
Firstly, for plane P, 3 non collinear points (point 1 ,, x y z and point 3   3 3 3 ,, x y z ) are measured and substituted into the coefficient equation of plane. (1) Then the coefficients of plane P,   x y y x y y x y y D x y z y z x y z y z x y z y z Secondly, the point 4   4 4 4 ,, x y z and the normal vector of plane S, the same as one of plane P, i.e.   ,, are substituted into equation (1) to get S D of plane S. As shown in Figure 2, the distance from plane P to plane S is calculated to get the height.
Thirdly, for plane K and G, plane U and W, by the similar computation, their coefficients are obtained and used to get the width and length of the cuboid respectively.
Finally, after the shape of the cuboid is determined by plane P, plane S, plane K, plane G, plane W and plane U, its position and posture are needed to determined. The position and posture of a cuboid are described by one plane among six planes P, S, G, K, U, W. Without losing generality, Plane S is used. The center of plane S is taken as to the position and its normal vector as the posture.

Modeling the primitives consisting of quadratic surface
When a primitive is of quadratic surface, the surface points are measured and the characteristics coefficients of the primitive can be calculated [24,25,26,27,29,30] for cylindrical surface, conical surface and sphere. In this paper, 0 Ax By Cz D     much attention is put to torus surface whose model little research has been carried on. A torus primitive is made up of generatrix circle and alignment circle. A local coordinate system is show in Figure 3. The torus generatrix is located on the y' ' ' ozplane and revolved around the ' z -axis. The standard equation of torus generatrix circle is The two parameters included are alignment R and generatrix r. And the torus standard equation is obtained by rotating the Γ around the -axis, as follows.
where Cα=cosα, Sα=sinα, and so forth. α is rotation angle for which the relative coordinate system rotates around the X-axis, β around the Y-axis, and γ around the Z-axis [28]. Substituting (6) into (5), a torus surface equation with 8 parameters is obtained.
Therefore, a complete description of a torus requires at least 8 points on the torus surface.
After obtaining the equation coefficients of the torus primitive, its position and posture can be computed and their editable model in CSG format can be constructed by CAD system manually or automatically.

Reverse modeling process
In this section, a process for reverse modeling is proposed as shown in Figure 5 and the steps are detailed as follows.
(1) The structure composition of a part is analyzed and decomposed to construct the primitive structure tree by the method proposed in section 2.2, including all the primitives and their regular Boolean combinations. (2) Each primitive is measured according to Table 1 in section 3.1.

Case study
A pipeline valve shown in Figure 6 is taken as an example.

Figure 6 Primitives division
In the first step, the primitive structure of the part is first divided into four primitives as shown in Figure 6  In the second step, after the basic primitive category being specified, the basic primitive is measured according to the table 1. Taking torus 1.2.1.2 as an example, the measurement data are shown in Table 2.
In the third step, all the characteristic parameters and the position and posture of each basic primitive of the part can be determined by the method proposed in section 3.2 and 3.3. Still taking torus 1.2.1.2 as an example, according to the requirements of modeling accuracy, after simplifying the calculation data, the modeling parameter guideline of torus 1.2.1.2 is obtained as shown in Table 3.  In the fourth step, after all the basic primitives are obtained, the parts are automatically combined according to the structure tree to obtain the model of the part reversed in CSG format.
In order to illustrate the propose method, import the model obtained and the original design model into the professional reverse software Geomagic Studio for deviation analysis. The precision error analysis of the model is carried out, as shown in Figure 8. The distance error range is (-0.3067mm, +0.4932mm), the average deviation is 0.0288mm, the standard deviation is 0.0907mm, and root mean square error is 0.0416 mm, which shows that the part is manufactured in relative high accuracy and the method proposed can be used to reverse and effectively obtain the editable CAD model of reversed parts.

Conclusion
In this paper, a primitive-based reverse modeling method for the parts was proposed for obtaining the editable CAD model of reversed parts. The main contributions are as follows.
(1) A method for constructing the primitive structural tree for the part reversed was proposed, by which the all the geometry primitives and their Boolean operations are logically arranged in tree format and in which a framework of primitive structure tree is used to ensure the correct description of the part. (2) For the basic primitives made of quadratic surface, a method for modeling the torus surface, whose model little research has been carried on, was proposed. The torus surface equation is deduced by coordinate transformation method. It includes 8 independent parameters, which means that there are at least 8 point on the torus surface to require to torus surface is obtained. This work expands the scope of basic primitives modeling. (3) Based on the guidance of primitive structure tree, a process for the characteristics parameters, minimum measuring points, forward modeling, positioning and assembly process was proposed, which could be used to direct measurements and to forward modeling. The example showed that this method could be used to reverse the parts in the editable CAD model and provide for subsequent optimization design services. Following the primitive structure tree and the process proposed in this paper, the reverse modeling can be carried out systematically and logically. However, the establishment of the primitive structure tree of parts requires human interaction. The way to solve this problem is to develop a computer-aided system to build the primitive structure tree of the parts. The system can be integrated with the measurement system and the CAD forward modeling system, which can greatly improve the speed and efficiency of the proposed method.
In addition, this paper does not involve the reverse modeling of free-form surface, so a primitive-based freeform surface modeling method needs to be researched in the subsequent work. It is also necessary to study the method for the characteristics parameters, minimum measuring points, forward modeling, positioning and assembly for the extended basic primitives which makes the primitive structural tree for the part reversed more simple and improves the efficiency of the method proposed.