| Surface meshing is an important step in the generation of three-dimensional numerical simulation meshes,which is widely used in finite element numerical simulation.With the increasing complexity of castings,and the large number of errors introduced by neutral files(STL files,etc.)describing casting models,how to generate high-quality surface meshes based on neutral files has become a bottleneck in the field of casting finite element numerical simulation,especially when castings are complicated.To this end,this paper has conducted a systematic study on the topic of generating triangular meshes on the surface of complex casting models based on STL files.The main work is as follows:Firstly,the topology reconstruction algorithm of STL model based on half-edge data structure is proposed.Read STL files,create nodes,half-edges,and surface objects,and construct topological information between mesh elements.Use the half-edge data structure to record the above geometric and topological information,realize the topology reconstruction of the STL model,and solve the problem of the lack of topological information.Converting the STL model to a half-edge data structure can fully express the elements in the mesh,reduce the difficulty of the mesh algorithm,and lay the data foundation for the efficient implementation of subsequent algorithms.Secondly,the key technology in 3D surface mesh generation is solved.A featurepreserving sub-region partitioning algorithm is proposed,and the angle between two triangles sharing the same edge is used as a criterion to identify the feature edges of the model.By requiring the feature edges of the model to exist only at the boundary of the sub-region,the problem of feature loss caused by sub-region division is solved.Use the dichotomy method to subdivide the boundary of the sub-region to generate control points and control edges.In the subsequent algorithm,these feature points and feature edges are guaranteed to exist in the sub-region mesh,and the topological incompatibility problem in the sub-region mesh merger is suppressed from the source.By selecting the vector sum of the normal vectors of the triangular patches in the sub-region as the projection direction,the three-dimensional sub-region is projected onto the two-dimensional plane,which solves the problem of difficult generation of the three-dimensional mesh.The CDT is used to mesh the sub-area projected onto the twodimensional plane to ensure that the boundary control points and control edges of the sub-area are maintained in the sub-area mesh.In the reverse mapping process,the nearest neighbor search algorithm based on k-d tree is introduced to reduce the time complexity of the algorithm and improve the robustness of the algorithm.Finally,based on the above key technologies,a mesh generation program was developed for the surface mesh generation of actual complex castings.The quality of the generated mesh was quantitatively analyzed and compared with the well-known open source meshing software NETGEN in terms of robustness and mesh quality.The results show that,in terms of robustness and mesh quality,the algorithm in this paper has advantages compared to NETGEN. |