Surface mesh generation method of CAD model
By generating the initial mesh in the CAD model and applying valence optimization, short edge shrinkage, Laplacian smoothing and edge flipping techniques, the problem of "dirty" geometry structure processing and CAE simulation requirements in complex CAD model mesh generation is solved. It achieves the generation of high-quality meshes and the improvement of CAE simulation results.
Patent Information
- Application Number
- CN202410320067.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-20
- Publication Date
- 2024-09-06
AI Technical Summary
Existing technologies encounter difficulties in processing "dirty" geometric structures when generating high-quality surface meshes for complex CAD models, and cannot meet CAE simulation requirements, resulting in low mesh quality and affecting simulation results and efficiency.
By generating an initial mesh on each patch parameter domain of CAD, using uniform sampling and the triangle library for mesh division, and combining techniques such as valence optimization, short edge shrinkage, Laplacian smoothing and edge flipping to improve the quality of triangular elements. Ensure mesh fit and quality.
It achieves the acquisition of high-quality meshes while ensuring body fit, effectively handles "dirty" geometric structures, and improves mesh generation efficiency and accuracy of CAE simulation results.
Smart Images

Figure CN118607157A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geometric design and specifically to a surface mesh generation method for a CAD model. Background Art
[0002] Surface mesh generation of CAD models is an inevitable step in model visualization, numerical calculation, simulation, rendering, etc. On the one hand, the generated surface mesh needs to be close to the surface of the CAD model, and on the other hand, the quality of the mesh must meet the application requirements. Generally speaking, CAD surface mesh generation is divided into unstructured mesh generation and (block) structured mesh generation, among which triangular mesh is the most common unstructured mesh with good simplicity and flexibility.
[0003] For models involving complex domains, the time spent on mesh creation is usually longer than the time spent on numerical analysis, and the quality of the mesh directly affects the convergence of the solution and the analysis error. At present, there are many algorithms available for generating isotropic surface meshes, but the mesh effect may not meet expectations. In order to obtain high-quality mesh output, many optimization strategies are required, and sometimes some manual operations are required for post-processing, which greatly affects the efficiency of mesh generation. Especially in the meshing work of CAD models, the divided area is defined by a set of continuous parametric surface patches. Some algorithms are limited by the conditions of the model itself and generate a lot of redundant computational overhead. Therefore, generating high-quality surface meshes for complex CAD models remains a challenge. For complex CAD models, there are several difficulties in mesh generation:
[0004] 1. Dealing with "dirty" geometry of CAD models. As the complexity of CAD products increases, erroneous, degenerate or ambiguous geometric designs often exist (such as Figure 2 ), existing mesh generation algorithms often encounter difficulties in dealing with these problems, and it is also difficult to achieve high-quality mesh output using mesh repair algorithms.
[0005] 2. Unable to meet the simulation requirements of CAD models. CAE simulation requires meshes to meet the requirements of body fit and high quality. Existing mesh generation methods rarely directly combine CAD representation with CAE requirements.
[0006] Due to the above-mentioned defects, many mesh generation methods do not work well on complex CAD models, have poor practicality, and are difficult to meet the requirements of CAE simulation. Summary of the invention
[0007] The technical problem solved by the present invention is to provide a surface mesh generation method for a CAD model to solve the low-quality mesh problem caused by several types of "dirty" geometric structures of the CAD model.
[0008] The technical solution to achieve the purpose of the present invention is:
[0009] A method for generating a surface mesh of a CAD model, comprising:
[0010] Step 1: Generate the initial mesh on each CAD patch parameter domain:
[0011] 1.1. Pre-process the CAD input model and perform the same number of uniform sampling on the common boundaries of the parameter patch splicing to discretize the parameter domain boundaries to ensure that there is no splicing error between adjacent surfaces;
[0012] 1.2. Adjust the parameter domain to eliminate the stretching problem, and then use the triangle library to generate a mesh in the plane parameter domain;
[0013] 1.3. Perform valence optimization on the generated mesh to obtain the initial mesh;
[0014] Step 2: Improve the quality of the initial mesh triangle elements:
[0015] 2.1. Use short-side contraction to reduce the proportion of triangle units with sharp angles less than the set threshold, and use flipping to reduce the proportion of triangle units with obtuse angles;
[0016] 2.2. Use Laplace smoothing method to further optimize the distribution of mesh vertices. For the internal vertices and boundary points of the patch, smoothing is performed in parameter domain and physical domain respectively. While optimizing the position of mesh vertices, non-feature edge constraints are eliminated to further improve the average quality of the mesh.
[0017] 2.3. Finally, perform an angle-based edge flip.
[0018] Compared with the prior art, the present invention has the following significant advantages:
[0019] (1) The method adopted by the present invention fully considers the geometric expression of the CAD model and the simulation requirements in CAE, has a closer relationship with CAD and CAE, and can obtain higher mesh quality while ensuring body fit;
[0020] (2) The particularity of representing CAD models is fully considered and a judgment and processing mechanism is integrated to deal with "dirty" geometric structures, effectively improving the lower limit of mesh quality.
[0021] The present invention is further described in detail below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is the overall flow chart of the surface mesh generation method of CAD model.
[0023] Figure 2It is a common "dirty" geometric feature in CAD models.
[0024] Figure 3 is a flow chart of the surface mesh generation example, showing the input, initial network, optimized network, and output.
[0025] Figure 4 This is the initial mesh generation flow chart of the example, which includes input, intersection curve discretization, and parameter domain meshing.
[0026] Figure 5 This is a schematic diagram of the discretization of face edges.
[0027] Figure 6 is the optimized mesh step of the example.
[0028] Figure 7 This is a schematic diagram of the Laplace smoothing method. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0030] Combination Figure 1 , the embodiment of the present invention part ( Figure 3 ) provides a surface mesh generation method for a CAD model, comprising:
[0031] Step 1: Generate the initial mesh on each CAD patch parameter domain ( Figure 4 )
[0032] The CAD model is composed of a set of cut surface patches Each piece is stitched together. i are represented by analytically defined mappings from a bounded parameter domain (parameter space) to a surface (physical space), denoted as S = S(u,v) = (x(u,v), y(u,v), z(u,v)), (u,v)∈Ω. Therefore, meshing is first performed in the two-dimensional parameter domain and then mapped back to the three-dimensional physical space. x(u,v), y(u,v), z(u,v) represent the face P i The three-dimensional coordinates of , (u, v) represent the parameters on the parameter domain Ω.
[0033] ① Discretization of intersection curves ( Figure 5 ): Perform the same number of uniform sampling on the common boundaries of the parameter patch joints to discretize the parameter domain boundaries to ensure that there is no splicing error between adjacent surfaces;
[0034] In this step, each 3D edge curve (a shared curve formed by the intersection of two facets) of the CAD model is uniformly sampled, and the sampling points on the same edge curve are matched to the parameter domain boundaries on different facets.
[0035] During the triangulation process, these sample points are marked as "locked" and remain fixed in the following steps to maintain the geometric characteristics, unless it is released at some stage. There are several options for curve discretization:
[0036] a. Discretize equally by side length;
[0037] b. Discretize according to the same number of samples;
[0038] c. Within the specified sampling quantity range, the samples are evenly discretized according to the side length;
[0039] d. Within the specified sampling quantity range, discretize evenly according to the side length and increase the sampling quantity according to the curvature.
[0040] ②Generate parameter domain grid
[0041] This step generates a mesh on the parametric domain, which is then mapped back to the CAD surface using its parameterized method.
[0042] There are several advantages to using parametric meshing. For example, 2D plane meshing technology is mature, so it is straightforward to mesh the parametric domain using the triangle library. Parametric meshing is faster and more robust than building the mesh directly on the surface. In addition, a high-fidelity result can be achieved without the need to project vertices onto a CAD surface.
[0043] After the two-dimensional mesh is mapped back to the surface using the indirect method, the change in the metric structure will inevitably lead to the size stretching and shape distortion of the mesh unit. In order to reduce this effect, the facets are divided into two categories, stretchable and reconstructed parameter domain, according to the definition of the parameter expression S(u,v), and different algorithms are used to process them. Most parametric facets can directly eliminate the size stretching problem by adjusting the stretching factor in the parameter direction. In a few cases, it is necessary to use J.Smith, S.Schaefer, Bijective parameterization with free boundaries, ACM Trans.Graph.
[0044] 34(4)(2015)1-9. The public optimization method reconstructs the parameter domain to offset the local stretching effect. After this step, the triangle library can be used for meshing.
[0045] ②Valence optimization
[0046] In this step, the topological connectivity of the mesh is improved by using the valence optimization published by Q. Sheng Wang, J. Ye, H. Wu, B. Qing Gao, P. Shepherd, A triangular mesh generator, ACM Transactions on Mathematical Software (TOMS) 41 (2) (2015) 11: 1-11: 36. The purpose of this optimization process is to ensure that the valence of each internal vertex (the number of edges connected to a vertex) is as close to 6 as possible, and to ensure that the vertices on the edge of the patch match the most appropriate valence according to the internal angles.
[0047] By implementing the above steps, we are able to obtain a watertight initial triangulation of the mesh.
[0048] Step 2: Improve the quality of the initial mesh triangle elements ( Figure 6 )
[0049] In this section, several operations are performed to improve the quality of the initial triangulated mesh.
[0050] ① Low-quality triangle elimination
[0051] The mesh quality of the CAD model directly affects the simulation solution and calculation accuracy. The most ideal state is when the mesh unit is an equilateral triangle. If the triangular unit has too small acute angles or obtuse angles, it will have adverse consequences on the simulation calculation. In order to remove the internal angles in the triangular unit that are smaller than the user-specified threshold, a short edge contraction strategy is designed. If ||v1-v2||<ε, ((v1,v2) is a short edge, ε is a threshold), short edge contraction is performed. Given an edge (v1,v2), shrink or merge vertices v1 and v2 into a single vertex, denoted as v i (v1,v2)→v i , the specific operations of i∈{1,2} can be summarized as follows:
[0052] a. If i = 1, it means moving vertex v2 to v1. This involves connecting all incoming edges of v2 to v1 and deleting vertex v2.
[0053] b. If i = 2, move vertex v1 to v2. During the edge contraction process, for the vertex v1 in (v1, v2) → v i ,i∈{1,2}, the rules for selecting i can be summarized as follows: (a). Internal vertices take precedence over boundary vertices. If v1 and v2 are both internal vertices or boundary vertices, then follow (b). Here, the internal vertices of the mesh refer to those that are located on only one face, and the other mesh vertices are called boundary vertices. (b). The moving direction with the highest angular quality improvement takes precedence over other moving directions.
[0054] In addition to short edge shrinkage, edge flipping technology is also used to eliminate obtuse triangles. When the distance between a triangle vertex and its opposite side is less than a threshold, it is defined as a "near point". At this time, the triangle is likely to be obtuse. This "near point" is connected to the opposite point in another adjacent triangle. In this way, the obtuse angle is eliminated by flipping the edge, low-quality triangles are removed, and the overall mesh quality can be improved.
[0055] ②Mixed Laplace smoothing
[0056] In this step, the Laplace smoothing method ( Figure 7 ) further optimizes the distribution of mesh vertices. Each vertex p i To its 1-neighboring triangle T j ∈Γ triangle centroid The weight of each centroid is determined by the weight of the corresponding triangle T j Area|T j |Determine, that is, vertex p i Updated to Where Γ represents the vertex p i The 1-neighborhood triangle set of Represents triangle T j The vertex p obtained by Laplace smoothing i The position of is usually not completely on the CAD surface. In order to meet the body-fitting results, it is necessary to move the vertex p i Project back onto the underlying CAD surface.
[0057] Therefore, the smoothing method is used in the parameter domain and the physical domain. The smoothing in the parameter domain can ensure that the vertices are located on the surface without projection, which is suitable for the internal vertices of the patch, that is,
[0058]
[0059] in express Represents vertex p i The corresponding vertex on the parameter domain is, and g i,j Represents a triangle on the parameter domain The position of the vertex and the corresponding g value, Represented as the triangle vertex position g i,j The average value of Represents a triangle Finally, by Mapped onto the CAD surface, we get a new vertex p i position, which is located on the CAD surface.
[0060] For the boundary points of the mesh, whose connecting vertices are in different parameter coordinate systems, they are processed by the physical domain smoothing method in the physical domain unified coordinate system.
[0061] ③Side flip
[0062] The last step is to perform edge flipping in the physical domain. If the non-feature edge meets two conditions, it is flipped: first, flipping the edge improves the angular deviation between the normal vector of the triangle surface and the normal vector of the surface vertex; second, the minimum angle of the flipped triangle is improved, and the change in the angular deviation before and after flipping is less than a threshold.
Claims
1. A method for generating a surface mesh of a CAD model, characterized in that: include: Step 1: Generate the initial mesh on each CAD patch parameter domain: 1.
1. Pre-process the CAD input model and perform the same number of uniform sampling on the common boundaries of the parameter patch splicing to discretize the parameter domain boundaries to ensure that there is no splicing error between adjacent surfaces; 1.
2. Adjust the parameter domain to eliminate the stretching problem, and then use the triangle library to generate a mesh in the plane parameter domain; 1.
3. Perform valence optimization on the generated mesh to obtain the initial mesh; Step 2: Improve the quality of the initial mesh triangle elements: 2.
1. Use short-side contraction to reduce the proportion of triangle units with sharp angles less than the set threshold, and use flipping to reduce the proportion of triangle units with obtuse angles; 2.
2. Use Laplace smoothing method to further optimize the distribution of mesh vertices. For the internal vertices and boundary points of the patch, smoothing is performed in parameter domain and physical domain respectively. While optimizing the position of mesh vertices, non-feature edge constraints are eliminated to further improve the average quality of the mesh. 2.
3. Finally, perform an angle-based edge flip.
2. The surface mesh generation method of the CAD model according to claim 1, characterized in that: There are two adjustment methods to eliminate the stretching problem: eliminating the size stretching by adjusting the stretching factor in the parameter direction, and offsetting the local stretching effect by reconstructing the parameter domain.
3. The surface mesh generation method of the CAD model according to claim 1, characterized in that: The short side shrinkage process is as follows: Given a short edge (v1, v2) of a triangle unit, shrink or merge the vertices v1 and v2 of the short edge into a single vertex, denoted as (v1, v2) → v i ,i∈{1,2}; the rules for selecting i can be summarized as follows: (a) Internal vertices take precedence over boundary vertices; if v1 and v2 are both internal vertices or boundary vertices, follow (b); (b) The moving direction with the highest angular quality improvement takes precedence over other moving directions.
4. The surface mesh generation method of the CAD model according to claim 1, characterized in that: The specific process of flipping operation is as follows: When the distance between a vertex of a triangle unit and the opposite side is less than a threshold, the vertex is defined as a "near point" and this "near point" is connected to the point opposite to the "near point" in another adjacent triangle.
5. The surface mesh generation method of the CAD model according to claim 1, characterized in that: The specific process of using Laplace smoothing method to further optimize the distribution of mesh vertices is as follows: Each vertex p i To its 1-neighboring triangle T j The center of gravity of ∈Γ The weighted average movement of vertex p i Updated to Where Γ represents the vertex p i The set of 1-neighborhood triangles of Represents triangle T j center of gravity.
6. The surface mesh generation method of the CAD model according to claim 5, characterized in that: The specific process of smoothing in the parameter domain is: in express Represents vertex p i The corresponding position on the parameter domain, and g i,j Represents a triangle on the parameter domain The position of the vertex and the corresponding g value, Represented as the triangle vertex position g i,j The average value of Represents a triangle area; Finally, by Mapped onto the CAD surface, we get a new vertex p i Location.
7. The surface mesh generation method of the CAD model according to claim 1, characterized in that: Finally, an angle-based edge flip is performed, and the flip is performed if two conditions are met: first, the flipped edge increases the angular deviation between the normal vector of the triangle surface and the normal vector of the surface vertex; second, the minimum angle of the triangle after flipping is increased, and the change in the angular deviation before and after flipping is less than the set threshold.
