A numerical control machining simulation geometry difference extraction and redundant grid cleaning method

CN123013433APending Publication Date: 2026-10-30AVICIT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611166223.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本发明的目的在于针对现有技术的不足,提供一种数控加工仿真几何差异提取与冗余网格清理方法,解决数控加工仿真结果与设计模型比对分析中布尔噪声多、伪差异误报率高、非流形网格不可用、厚度判断稳定性差的问题,在高效剥离边界毛刺与悬挂碎片的同时最大限度保留真实薄壁差异,实现过切及欠切差异的自动化、高精度判定

Benefits of technology

1、伪差异误报率大幅降低,通过迭代剥边与P95厚度筛选的组合策略,可降低70%~90%的伪差异误报,有效减少无效判定;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013433A_ABST
    Figure CN123013433A_ABST
Patent Text Reader

Abstract

The application discloses a numerical control machining simulation geometry difference extraction and redundant grid cleaning method and belongs to the technical field of computer aided design and manufacturing. In view of the defects that a large number of noise grids are generated in the existing numerical control machining simulation comparison, real thin-wall differences are easily deleted by mistake, and the interference of sharp corners and burrs causes a high false rejection rate of thickness detection, the application extracts initial difference grid of overcutting and undercutting and residual material through bidirectional Boolean difference set, performs layer-by-layer iteration edge stripping on non-water-tight connected domains after post-processing, grid repair and topological classification to retain closed real difference entities, calculates local thickness by adopting an inner hemisphere directional ray method, filters pseudo differences based on P95 thickness, and finally outputs clean difference entities which can be directly judged. The application significantly reduces the false rejection rate of pseudo differences, avoids missing detection of real thin walls, improves the automation degree and detection accuracy of comparison, and is suitable for precision manufacturing quality detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer-aided design and manufacturing technology, specifically relating to a method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation, which can be applied to the comparative analysis of CNC machining simulation results and CAD design models, and to the automatic detection of machining quality. Background Technology

[0002] In the CNC machining simulation verification stage, the triangular mesh of the CNC machining simulation result is usually compared with the triangular mesh of the CAD design model. Boolean difference set operations are used to extract geometrically different areas such as overcut, undercut, and residual material, thereby determining the rationality of the CNC machining path and the machining quality. Existing simulation software and general mesh processing tools generally adopt standard Boolean difference set algorithms, general mesh cleaning processes, and conventional wall thickness detection methods, without specifically optimizing for the specific noise structure generated after cutting simulation.

[0003] Existing technologies suffer from several shortcomings: First, Boolean difference operations easily generate numerous degenerate surfaces, duplicate surfaces, hanging patches, open-edge fragments, and non-manifold structures, failing to form effective closed entities and making them unsuitable for direct quantitative difference determination. Second, existing mesh cleaning schemes often employ a strategy of deleting entire non-closed regions, easily misjudging real thin-wall differences as noise and deleting them, leading to missed detection of important processing defects. Third, traditional thickness detection methods often use unidirectional single-ray or minimum thickness determination, which are highly susceptible to interference from sharp corners, burrs, and mesh discretization errors, resulting in a persistently high false difference misjudgment rate. Fourth, there is a lack of a closed-loop automated cleaning process specifically designed for CNC machining simulation comparison, requiring extensive manual repair of difference meshes and failing to achieve automatic determination of overcut and undercut types. Furthermore, existing mesh cleaning technologies are mostly optimized for CAD static models and lack targeted processing mechanisms for specific noise types such as hanging patches and open-edge fragments generated after Boolean operations, failing to balance noise removal with the preservation of true differences. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies by providing a method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation. This method solves the problems of high Boolean noise, high false alarm rate of spurious differences, unusable non-manifold meshes, and poor stability of thickness judgment in the comparison and analysis of CNC machining simulation results and design models. It can efficiently remove boundary burrs and hanging fragments while preserving the true thin-wall differences to the maximum extent, and realize the automated and high-precision determination of overcut and undercut differences.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: A method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation is disclosed. The core of this redundant mesh cleaning method is to filter and remove redundant connected components (closed entity hierarchical geometric primitives) generated by Boolean difference operations, retaining only the closed mesh entities representing the actual machining differences, without modifying the original geometric shape of the actual difference entities throughout the process. The method includes the following steps: S1. Obtain the triangular mesh of the CAD design model and the triangular mesh of the CNC machining simulation result, and perform mesh preprocessing on the two models; S2. Perform bidirectional Boolean difference operation on the two preprocessed models to extract the initial difference meshes of the overcut region and the undercut and residual material regions, respectively. S3. Perform post-processing and mesh repair on the initial difference mesh generated by the Boolean difference set; S4. Perform topological analysis on the repaired differential mesh, divide it into several connected domains according to connectivity, and determine the watertightness of each connected domain. S5. Perform iterative edge stripping on non-watertight connected components until the connected components become watertight or disappear completely, and retain the watertight connected components as real difference entities. S6. Perform local thickness calculations on the retained real difference entities; S7. Based on the high quantile of entity thickness, perform entity-level pseudo-difference filtering on real difference entities, and remove pure noise entities by using only the global absolute thickness threshold, while retaining the original geometric shape of entities that pass the threshold unchanged. S8. Output the filtered valid difference entities and their corresponding overcut and undercut type information.

[0006] Furthermore, the mesh preprocessing described in step S1 specifically includes coordinate alignment, normal unification, removal of zero-area patches, deduplication of vertices, and repair of inverted surfaces, ensuring the stability and computational accuracy of subsequent Boolean operations.

[0007] Furthermore, the bidirectional Boolean difference operation in step S2 specifically involves: performing a Boolean difference operation between the design model and the simulation model to obtain the overcut region mesh, corresponding to the material portion that the tool has removed; and performing a Boolean difference operation between the simulation model and the design model to obtain the undercut and residual material region mesh, corresponding to the residual material portion that the tool has not removed.

[0008] Furthermore, the post-processing and mesh repair described in step S3 specifically perform the following operations on the new facets generated by Boolean cutting: 1) Merge adjacent coplanar triangular faces to reduce the number of fragmented faces; 2) Identify all outer and inner boundaries and mark the open edge positions; 3) Delete zero-length edges and invalid edges whose length is less than the preset short edge threshold; 4) Re-subdivide the broken and distorted areas to improve the overall quality of the mesh.

[0009] Furthermore, the topological analysis in step S4 specifically includes: marking zero-area surfaces, repeating surfaces, reversed surfaces, and degenerate surfaces; marking open edges, boundary loops, non-manifold edges, and non-manifold vertices; the watertightness judgment criteria are: no open edges, no non-manifold edges and non-manifold vertices, no self-intersections, all facet normals are consistent, and connected domains that can form closed bounded entities are watertight structures; otherwise, they are non-watertight structures.

[0010] Furthermore, the iterative edge-peeling process described in step S5 specifically includes: 1) The edge stripping process is only initiated for non-watertight connected domains containing open edges and non-manifold structures; 2) Starting from the open edge, search inwards for a surface layer that directly shares an edge with the open edge, and use it as the target for this round of stripping; 3) Only delete the surface patches of the current round, and retain the main patches inside the connected domains; 4) Recalculate the boundary, number of open edges, manifold, watertightness, and minimum wall thickness of the connected domain after edge stripping; 5) Stop edge stripping and retain the current connected component when any of the following termination conditions are met: ① The connected component becomes a completely watertight structure; ② The ratio of the total length of the open edge to the initial total length of the open edge drops below a preset ratio threshold, and the current minimum wall thickness of the entity is higher than the preset minimum thin-wall protection threshold, thus determining it to be approximately watertight; ③ The minimum wall thickness of the entity after edge stripping is lower than the preset minimum thin-wall protection threshold, thus forcibly terminating edge stripping to protect the real thin-wall structure; If the connected component still does not meet the termination condition, repeat the above steps to continue stripping the next layer; If the connected component completely disappears, it is determined to be pure noise and is removed.

[0011] This step involves peeling off edges layer by layer and determining water tightness, primarily eliminating topological noise such as open edge fragments, hanging surface pieces, and boundary burrs, while retaining differentiated entities with closed main structures.

[0012] Furthermore, the local thickness calculation in step S6 specifically includes: 1) Construct BVH-level bounding boxes for real-world differential entities to accelerate spatial ray intersection calculations; 2) For each triangular facet of the entity, N detection rays are uniformly emitted within a hemispherical space, starting from the geometric center of the facet and moving in the opposite direction of the normal (pointing towards the interior of the entity). 3) Obtain the intersection point between the ray and the other side panel of the entity, and calculate the local thickness value corresponding to a single ray; for each ray, find the first intersection point between the ray start point and the entity surface along the emission direction, and calculate the distance between the intersection point and the ray start point as the local thickness of the ray; if the ray has no entity intersection point, or the distance between the intersection point and the start point is less than the preset minimum threshold, the ray is determined to be an invalid ray and discarded. 4) Perform robust statistical processing on all effective thickness values, remove outliers, and take the stable mean as the local thickness of the patch.

[0013] The aforementioned topology filtering only excludes open-boundary noise. For geometric noise that is closed in shape but extremely thin, the following thickness filtering steps are used for further removal: Furthermore, step S7 specifically includes: 1) Collect the local thickness of all facets of the real differential entity and sort them from smallest to largest; 2) Take the thickness of P95, which is the 95th percentile after sorting, as the benchmark for the true thickness of the main body of the entity. 3) Pre-set a global absolute thickness threshold. If the P95 thickness of the current entity is lower than the threshold, the entire entity will be judged as a pseudo-difference and removed. 4) The original geometric shape of the entity that passes the threshold verification is retained unchanged as the final valid difference entity.

[0014] This step performs pseudo-difference filtering based on solid thickness features, mainly removing geometric noise such as extremely thin closed surfaces generated by Boolean operations, forming a progressive two-level screening mechanism with the previous topological noise removal.

[0015] Furthermore, the information output in step S8 specifically includes: the denoised overcut solid mesh, undercut / residual solid mesh, the location, area, volume, average thickness and P95 thickness parameters of each difference region, and overcut and undercut type labels.

[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. The false alarm rate of spurious differences is significantly reduced. By combining iterative edge stripping and P95 thickness screening strategies, the false alarm rate of spurious differences can be reduced by 70% to 90%, effectively reducing invalid judgments. 2. High retention of true differences: The method of peeling off the edges layer by layer instead of deleting the whole block of non-closed areas is adopted to avoid the accidental deletion of true thin-wall differences and effectively avoid missed detection of processing defects. 3. The thickness detection is robust. It adopts an inner hemisphere directional ray sampling and high quantile statistics method, which is not affected by sharp corners, burrs and grid discrepancy errors, and the stability of thickness determination is significantly improved. At the same time, compared with full-space ray sampling, this invention only emits rays in the inner hemisphere direction, eliminating a large number of invalid ray calculations, which can reduce the amount of ray calculation by about 50% and further improve the thickness detection efficiency. 4. The entire process is automated, forming a complete closed loop from Boolean difference set operation, mesh cleaning, thickness analysis to difference type determination, eliminating the need for manual mesh repair and greatly improving the processing efficiency of CNC machining simulation comparison; 5. The output results can be directly used for machining quality judgment, and are suitable for CNC machining simulation verification scenarios in high-precision manufacturing fields such as aviation, automobiles, and molds, and have high engineering application value. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the overall process of the method described in this invention; Figure 2 This is a schematic diagram illustrating the principle of hemispherical directional ray thickness sampling in this invention; Figure 3 This is a schematic diagram illustrating the principle of the present invention based on screening pseudo-differences using P95 thickness. Detailed Implementation

[0018] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings. It should be noted that these descriptions are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0019] Example 1 This embodiment uses the difference extraction of CNC machining simulation results of a certain aerospace structural component as an example to describe the method of the present invention in detail. The overall processing flow of this method is as follows: Figure 1 As shown.

[0020] I. Input Data Preparation The CAD design model used in this embodiment is an aerospace aluminum alloy structural component. Its 3D model was discretized into a triangular mesh, resulting in a design model triangular mesh with approximately 156,000 triangular faces. The CNC machining simulation mesh was obtained through geometric simulation of the five-axis CNC milling process of this structural component, resulting in a mesh with approximately 142,000 triangular faces. Both models are stored in STL format.

[0021] II. Step S1: Mesh Preprocessing After loading the triangular mesh from the CAD design model and the triangular mesh from the CNC machining simulation results, perform the following preprocessing operations: (1) Coordinate alignment: Based on the spatial position of the CAD design model, the rigid body transformation matrix between the simulation result model and the design model is calculated by the Iterative Closest Point (ICP) algorithm. The simulation result model is then transformed to the same coordinate system as the design model to ensure that the spatial positions of the two models are consistent.

[0022] (2) Normal unification: Traverse all triangular faces of the two models, check whether the normal vector of each face points to the outside of the model, flip the face with inconsistent normals to ensure that the normals of all faces face outwards.

[0023] (3) Remove zero-area patches: Calculate the area of ​​each triangular patch and remove those with an area less than a preset threshold (1×10 in this embodiment). -6 mm 2 The facets that are determined to be zero-area faces are deleted.

[0024] (4) Deduplicated vertices: Establish a vertex hash index, and select vertices with a spatial distance less than a preset threshold (1×10 in this embodiment). -5 Duplicate vertices (mm) are merged into a single vertex, and the associated face vertex index is updated.

[0025] (5) Repairing reversed faces: Check the vertex arrangement order of all triangular faces, and flip the faces with the vertex order clockwise to the counterclockwise arrangement to ensure the consistency of the normal direction.

[0026] After preprocessing, the number of mesh patches in the design model was reduced to approximately 148,000, and the number of mesh patches in the simulation results was reduced to approximately 135,000.

[0027] III. Step S2: Bidirectional Boolean difference operation Perform bidirectional Boolean difference operation on the two preprocessed models: (1) Overcutting region extraction: Using the triangular mesh of the CAD design model as the minuend A and the triangular mesh of the simulation result as the subtrahend B, perform the Boolean difference operation A - B to obtain the material region that the tool has removed more than the design model, i.e., the initial difference mesh of the overcutting region. In this embodiment, the initial mesh of the overcutting region contains approximately 23,000 triangular faces.

[0028] (2) Extraction of undercut and residual material areas: Using the triangular mesh of the simulation result as the minuend B and the triangular mesh of the CAD design model as the subtrahend A, a Boolean difference operation B - A is performed to obtain the residual material area not removed by the tool, i.e., the initial difference mesh of the undercut and residual material areas. In this embodiment, the initial mesh of the undercut area contains approximately 18,000 triangular facets.

[0029] Boolean operations employ a fast triangle intersection algorithm based on bounding box hierarchy (BVH). During the operation, the faces of the intersection region between the two models are clipped and retriangulated.

[0030] IV. Step S3: Post-processing and Mesh Repair Perform fine-grained post-processing on the new patches generated by Boolean difference sets: (1) Grouping of coplanar patches: Traverse all triangular patches, merge coplanar adjacent triangular patches whose normal vector angle is less than a preset angle threshold (1° in this embodiment), and after merging, represent the coplanar region as a polygon, and then retriangulate it into a smaller number of triangular patches. This operation reduces the number of mesh patches in the overcut region from 23,000 to 19,500.

[0031] (2) Boundary loop extraction: Identify all outer and inner boundaries in the grid, traverse the grid boundaries using a half-edge data structure, combine the end-to-end boundary edge sequences into closed boundary loops, and mark the position and number of open edges of each boundary loop. A total of 47 boundary loops were identified in the initial grid of the overcut region and 36 boundary loops were identified in the initial grid of the undercut region.

[0032] (3) Remove collinear points and degenerate edges: Traverse all triangular faces and check whether the length of each edge is less than the preset short edge threshold (1×10 in this embodiment). -4 mm), and whether there are collinear vertices in the triangle (i.e., the triangle area is approximately zero but has not yet been marked as a zero-area surface), degenerate edges and collinear points are deleted and adjacent vertices are reconnected.

[0033] (4) Local retriangulation: For the broken and distorted regions that appear after the above operations, the Delaunay triangulation algorithm is used to re-subdivide them. The polygonal region to be retriangulated is projected onto a local two-dimensional plane, and Delaunay triangulation is performed in the two-dimensional plane before mapping back to three-dimensional space to ensure that the newly generated patches are of good quality and have no narrow triangles.

[0034] After post-processing and mesh repair, the number of mesh patches in the overcut region was further reduced to approximately 17,200, and the number of mesh patches in the undercut region was reduced to approximately 13,500.

[0035] V. Step S4: Topology Analysis and Watertightness Assessment A comprehensive topology analysis was performed on the repaired differential mesh: (1) Marking abnormal structures: Traverse all faces and edges, and mark zero-area faces, duplicate faces (i.e., faces with three identical vertex coordinates), reverse faces (faces whose normals are inconsistent with adjacent faces), and degenerate faces. In this embodiment, 12 zero-area faces, 8 duplicate faces, and 5 reverse faces are marked in the overcut region; 9 zero-area faces, 6 duplicate faces, and 3 reverse faces are marked in the undercut region. The above abnormal faces are deleted.

[0036] (2) Marking open edges and non-manifold structures: The mesh is traversed using a half-edge data structure. All edges belonging to only one face are marked as open edges, edges belonging to three or more faces are marked as non-manifold edges, and vertices associated with non-manifold edges are marked as non-manifold vertices. Approximately 680 open edges and 23 non-manifold edges are marked in the overcut region; approximately 520 open edges and 15 non-manifold edges are marked in the undercut region.

[0037] (3) Connected component segmentation: Based on the adjacency relationship between the patches, the flood fill algorithm is used to segment all patches into several connected components according to their connectivity. Overcut regions are segmented into 12 connected components, and undercut regions are segmented into 9 connected components.

[0038] (4) Watertightness assessment: Watertightness assessment is performed on each connected component. The assessment criteria are: a connected component with no open edges, no non-manifold edges and vertices, no self-intersections, all face normals are consistent, and can form a closed bounded entity is a watertight structure; otherwise, it is a non-watertight structure. After assessment, among the 12 connected components of the overcut region, 3 are watertight structures and 9 are non-watertight structures; among the 9 connected components of the undercut region, 2 are watertight structures and 7 are non-watertight structures.

[0039] VI. Step S5: Iterative edge stripping process layer by layer A layer-by-layer iterative edge stripping process is performed on the non-watertight connected domains. A detailed explanation is given using a non-watertight connected domain in an overcut region as an example. This connected domain contains approximately 2,300 facets, forming a thin-walled bowl-shaped structure with approximately 180 open edges at its opening edge, making it a typical non-watertight structure with real thin-wall differences.

[0040] (1) Screening the region to be processed: The connected region contains open edges and is a non-manifold structure, which meets the conditions for starting the edge stripping process.

[0041] (2) Extracting boundary patches: Starting from the open edge, the adjacency query function of the half-edge data structure is used to search inward for surface patches that directly share an edge with the open edge. The specific method is as follows: traverse all open edges, obtain the patches that share the open edge with each open edge, add these patches to the candidate set for this round of stripping, and exclude patches that have been marked for deletion. In this embodiment, approximately 320 boundary patches were extracted in the first round.

[0042] (3) Perform edge stripping operation: only delete the 320 boundary patches extracted in this round, and retain about 1,980 main patches inside the connected components. The deletion operation also removes the edges and vertices associated with the deleted patches and updates the topological relationships of the half-edge data structure.

[0043] (4) Update topology parameters: recalculate the boundaries, number of open edges, manifold and watertightness of the connected domains after edge stripping. After the first round of edge stripping, the number of open edges is reduced from 180 to about 95.

[0044] (5) Iterative loop: In the initial state, record the total length of the open edge of the connected domain and the initial minimum wall thickness. The preset ratio threshold is 5%, and the preset minimum thin wall protection threshold is 0.03mm. After each round of edge stripping, the minimum wall thickness of the connected domain is updated synchronously. The iteration stops when any of the following termination conditions are met: ① The connected domain becomes a completely watertight structure; ② The ratio of the total length of the open edge to the initial total length of the open edge drops below the preset ratio threshold, and the current minimum wall thickness of the entity is higher than the minimum thin wall protection threshold, which is judged as approximately watertight; ③ When the current minimum wall thickness of the entity is lower than the minimum thin wall protection threshold, the edge stripping is forcibly terminated to avoid the ultrathin real thin wall being excessively stripped through.

[0045] The connected component remains a non-watertight structure, with an open edge ratio exceeding a preset threshold and a minimum wall thickness exceeding a protection threshold. Therefore, the second round of edge stripping continues. In the second round, approximately 210 boundary patches are extracted from the remaining open edges. After deletion, the number of open edges decreases to approximately 40, but the minimum wall thickness still exceeds the protection threshold. In the third round, approximately 85 boundary patches are extracted. After deletion, the number of open edges in the connected component drops to 0. Based on watertightness assessment, it has become a closed watertight structure, triggering termination condition ①, stopping the iteration, and retaining the component.

[0046] Ultimately, through iterative edge stripping layer by layer, of the nine non-watertight connected components in the overcut region, six became watertight structures and were retained during the edge stripping process, while three completely disappeared (the number of patches decreased to 0) and were judged as pure noise and removed. Of the seven non-watertight connected components in the undercut region, five became watertight structures and were retained, while two completely disappeared and were removed.

[0047] The key difference in this step lies in the fact that traditional methods delete non-watertight connected domains entirely, while this invention uses a layer-by-layer peeling method, removing only the noisy surface patches at the boundary while preserving the internal main structure, thus avoiding the accidental deletion of genuine thin-wall differences. The aforementioned bowl-shaped thin-walled structure, with a wall thickness of approximately 0.15 mm, was completely preserved after layer-by-layer peeling; if the entire block were removed, it would be completely discarded. This stage of screening targets topological noise such as open-edge fragments and suspended surface patches. The closed entities retained after screening still need to undergo further thickness filtering to remove geometric noise.

[0048] 7. Step S6: Calculate the local thickness based on BVH and the inner hemisphere directional rays (using the first intersection rule). Robust thickness calculations are performed on all retained watertight connected components (i.e., real differential entities). The principle of inner hemisphere directional ray thickness sampling is as follows: Figure 2 As shown. The example is the bowl-shaped thin-walled differential entity retained in step S5.

[0049] (1) Constructing the BVH (Bounding Volume Hierarchy): Construct a BVH for this differential entity. The specific method is as follows: taking all the triangular faces of the entity as input, a top-down recursive segmentation strategy is adopted to divide the faces into the left and right child nodes of the bounding box tree according to their spatial positions, until the number of faces contained in each leaf node is less than a preset threshold (32 in this embodiment). The construction of the BVH is used to accelerate the subsequent spatial ray intersection operation.

[0050] (2) Inner Hemisphere Directional Ray Emission: Traverse each triangular facet of the entity and perform the following operation for each facet: Using the geometric center of the facet as the ray origin and the direction opposite to the facet's normal (pointing towards the interior of the entity) as the central axis, uniformly emit 16 detection rays within the hemispherical space on the opposite side. A total of 16 detection rays are emitted for each facet. The direction of each ray is uniformly distributed within the hemispherical space to ensure sufficient sampling of the thickness information inside the entity.

[0051] (3) Ray Intersection and Thickness Calculation: For each emitted detection ray, the constructed BVH acceleration structure is used to quickly find all intersection points between the ray and the solid surface. For each ray, the first intersection point between the ray's starting point and the solid surface along the emission direction (i.e., the intersection point closest to the ray's starting point) is taken, and the spatial distance between this intersection point and the ray's starting point is calculated as the local thickness value of the ray. If the ray has no intersection point with the solid, or the distance between the first intersection point and the ray's starting point is less than a preset minimum threshold (indicating that it intersects with the adjacent facet where the starting point is located), then the ray is considered an invalid ray and discarded. For a closed watertight solid, a ray is emitted from the center of the surface facet along the opposite direction of the normal (pointing towards the interior of the solid). The ray travels from the interior of the solid to the opposite inner surface, and the first intersection point between the ray and the opposite surface is taken. The distance between this intersection point and the ray's starting point is the local wall thickness in that direction. This rule ensures the uniqueness and repeatability of the thickness detection, thereby effectively avoiding the ambiguity problem of multiple intersection point selection caused by the complex internal structure of the solid.

[0052] (4) Robust statistical calculation: Collect the thickness values ​​corresponding to all effective rays of the patch, perform robust statistical processing, remove outliers and take the stable mean as the local thickness of the patch. Using robust statistical method instead of ordinary mean can further suppress the influence of extreme thickness values ​​caused by sharp corners and burrs on the results.

[0053] It should be noted that for any closed, watertight entity, the number of intersections between a ray emitted from a point on the surface along a certain direction and the surface of the entity depends on the geometric complexity of the entity. For a convex entity, the ray enters the interior of the entity from the surface along the inner normal direction, with only one exit point (i.e., the first effective intersection point). The distance between this intersection point and the starting point is the wall thickness at that point. For non-convex entities or structures containing internal cavities, the ray may enter and exit multiple times. In this case, taking the first intersection point is the most physically direct way to reflect the wall thickness at the ray's starting point, and it is unique and repeatable, avoiding ambiguity in selecting multiple intersection points.

[0054] As a preferred implementation, an adaptive hemispherical sampling strategy can be adopted: the surface curvature of the area where each patch is located is pre-calculated, and the angle range and number of rays of the hemispherical sampling are automatically adjusted according to the curvature. For flat areas with small curvature, a smaller sampling angle range (such as a 30° cone angle) and fewer rays (such as 8 rays) are used to reduce the amount of calculation. For sharp corners and thin-edge areas with large curvature, a complete hemispherical sampling range and more rays (such as 32 rays) are used to ensure the thickness detection accuracy.

[0055] Based on the above calculations, the bowl-shaped thin-walled differential solid comprises approximately 1,850 facets, with local thicknesses ranging from 0.08 mm to 0.35 mm, and the thickness of the main region concentrated in the range of 0.13 mm to 0.18 mm. The minimum thickness measured by the traditional unidirectional single-ray method is only 0.02 mm (affected by mesh distortion at sharp corners), while the robust statistically stable mean value measured by the inner hemisphere directional ray method of this invention is 0.15 mm, effectively suppressing the interference of sharp corner noise.

[0056] 8. Step S7: Solid-level pseudo-difference filtering based on P95 thickness This stage of screening targets geometric noise that is closed in shape but extremely thin, forming a two-stage progressive mechanism with the preceding topological noise screening. Entity-level overall filtering is performed on all real difference entities for which thickness calculations were completed in step S6, based on the pseudo-difference screening principle of P95 thickness as follows: Figure 3 As shown: (1) Thickness data preprocessing: Collect the local thickness values ​​of all facets of the current entity and sort them from smallest to largest. Take the P95 thickness of the 95th percentile after sorting as the true thickness benchmark of the main body of the entity. In this embodiment, there are a total of about 1850 thickness data of the bowl-shaped thin-walled differential entity, and its P95 thickness is 0.17mm.

[0057] (2) Entity-level overall filtering: A global absolute thickness threshold is preset (0.02 mm in this embodiment, which can be adjusted according to the processing tolerance level). If the P95 thickness of an entity is lower than the global absolute thickness threshold, the entity is judged as a pseudo-difference and removed. In this embodiment, the P95 thickness of the bowl-shaped thin-walled difference entity is 0.17 mm, which is higher than the global absolute thickness threshold, and it is retained through entity-level filtering; among the 6 watertight connected domains retained in the overcut region, 1 entity has a P95 thickness of less than 0.02 mm and is judged as pure noise and removed as a whole, while the remaining 5 entities are filtered through entity-level filtering; among the 5 watertight connected domains retained in the undercut region, 1 entity has a P95 thickness of less than 0.02 mm and is removed as a whole, while the remaining 4 entities are filtered through entity-level filtering.

[0058] (3) Result confirmation: Entities that pass the threshold verification retain their original geometric shape and are thus considered as the final valid difference entities. All retained entities maintain their complete original watertight structure.

[0059] 9. Step S8: Output the results The final output includes: (1) There are 4 overcut solid meshes after noise reduction (corresponding to 4 tool overcut areas) and 3 undercut solid meshes (corresponding to 3 undercut / residual material areas). Each solid is a closed watertight triangular mesh.

[0060] (2) Quantitative parameters of each difference region: Overcut region 1 is located at the edge of the upper surface of the structural component, with a volume of approximately 2.35 mm. 3 The average thickness is 0.16 mm, and the P95 thickness is 0.18 mm; the overcut region 2 is located at the corner of the side wall, with a volume of approximately 1.82 mm. 3 The average thickness is 0.14 mm, and the P95 thickness is 0.16 mm; the undercut area 1 is located at the bottom of the deep groove, with a volume of approximately 3.67 mm. 3 The average thickness is 0.21 mm, the thickness of P95 is 0.24 mm, and so on.

[0061] (3) Automatic labeling of overcut / undercut type: Overcut areas are labeled as "Overcut", and undercut areas are labeled as "Undercut", along with the center coordinates of each area.

[0062] The entire process from input mesh to output judgment result in this embodiment takes about 4.5 seconds (based on a computer platform with an Intel Core i7-12700H processor and 32GB of memory), without any manual mesh repair operation.

[0063] Example 2 This embodiment uses the cutting simulation comparison of a complex curved surface part as an example to illustrate the application effect of the present invention on curved surface parts.

[0064] The object of comparison in this embodiment is a complex curved cavity of an automotive body panel mold. The CAD design model's triangular mesh contains approximately 420,000 faces, while the CNC machining simulation result's triangular mesh contains approximately 398,000 faces. This mold cavity contains multiple free-form surface regions, deep and narrow grooves, and thin-walled structures, requiring high machining accuracy.

[0065] The processing flow is exactly the same as in Example 1 (steps S1 to S8). The iterative edge-peeling process in step S5 is particularly crucial: due to the large number of open-edge fragments generated after the Boolean difference operation on curved surface parts (the initial difference mesh is divided into 68 connected domains, of which 59 are non-watertight connected domains), through layer-by-layer iterative edge peeling, 41 of the 59 non-watertight connected domains become watertight structures and are retained, while 18 are completely eliminated. Among the 41 retained connected domains, 12 are thin-walled difference structures with a wall thickness of less than 0.2 mm. These would all be lost using traditional whole-block deletion methods, but this invention, through layer-by-layer edge peeling, allows these genuine thin-walled differences to be completely preserved.

[0066] In the thickness calculation stage, the curvature of curved parts varies significantly. Traditional unidirectional ray tracing methods are prone to errors in thickness calculations in areas where the surface normal changes drastically, leading to incorrect intersections between rays and adjacent facets. This invention employs an inner hemispherical directional ray tracing method, emitting 16 rays from each facet and uniformly distributed within the hemispherical space. This effectively overcomes the sampling bias caused by variations in the surface normal; simultaneously, it eliminates redundant forward sampling, reducing ray calculations by 50% and significantly improving detection efficiency. The thickness calculation results for curved areas are stable, with no abnormal thickness values ​​caused by abrupt changes in curvature.

[0067] In the solid-level pseudo-difference filtering stage, considering the large number of differential solid patches (up to approximately 8,500 patches) and wide thickness distribution range (0.05 mm to 0.45 mm) of curved parts, solid-level P95 thickness is used as the judgment benchmark. This effectively extracts the main thickness benchmark of each solid, avoiding the problem of the entire solid being mistakenly deleted due to sharp corners of local curved surfaces (thickness of only 0.03 mm), and completely preserving the original geometric shape of the solid.

[0068] The processing results of this embodiment output 33 valid difference entities, including 19 over-cut regions and 14 under-cut regions. After comparison with manual verification, the true difference detection rate was 98.7%, and the false difference false alarm rate was reduced by approximately 82% compared with traditional methods. The entire process took approximately 18 seconds, which is a significant improvement in efficiency compared with traditional manual repair methods (which usually take 2 to 4 hours).

[0069] Example 3 This embodiment uses the simulation comparison of high-precision cavity-type parts (aero-engine casing parts) as an example to illustrate the application effect of the present invention in the scenario of detecting minute differences.

[0070] The CAD design model of this embodiment is an aero-engine casing part with approximately 580,000 triangular mesh patches; the CNC machining simulation results show approximately 560,000 mesh patches. The part has a complex cavity structure, containing multiple deep cavities, narrow slots, and precision mating surfaces. There are multiple critical dimensional tolerance requirements (±0.01 mm) on the bottom and sidewalls of the cavity.

[0071] The complete processing flow of this invention is executed. After the bidirectional Boolean difference operation in step S2, the initial difference mesh contains a large number of tiny connected regions (connected regions with fewer than 50 faces account for about 65%). These tiny connected regions contain both real tiny overcut / undercut defects (such as tiny tool overcut marks at the bottom of the cavity, with a size of only 0.5 mm × 0.3 mm × 0.08 mm) and tiny noise fragments generated by the Boolean operation.

[0072] The iterative edge-peeling process in step S5 processes these tiny connected domains one by one: for real tiny defects (usually in the form of closed or nearly closed sheet-like structures), only a small number of noise patches (usually 1 to 2 layers) on the outermost layer are peeled off during the layer-by-layer edge-peeling process, and the structure becomes watertight and is retained; for pure noise fragments (usually in the form of open edges and burrs, without internal main structure), the number of patches decreases rapidly during the edge-peeling process and disappears completely after a few rounds, and they are judged as pure noise and removed.

[0073] In the entity-level overall filtering stage of entity-level pseudo-difference filtering in step S7, since the thickness of real micro-defects is usually in the range of 0.05 mm to 0.15 mm, while the thickness of noise debris is often extremely thin (less than 0.01 mm) or extremely uneven, the P95 thickness of the entity can effectively distinguish between the two. In this embodiment, the global absolute thickness threshold is set to 0.02 mm; any micro-connected domains with an overall P95 thickness of less than 0.02 mm are judged as pseudo-differences and are completely removed, while entities containing real micro-defects with an overall P95 thickness of more than 0.05 mm are completely preserved with their original geometry.

[0074] The processing results of this embodiment are as follows: 28 overcut regions (with the smallest size approximately 0.4 mm × 0.3 mm × 0.06 mm) and 31 undercut regions (with the smallest size approximately 0.3 mm × 0.25 mm × 0.05 mm) were identified. All genuine minor differences were detected without any omissions. The false alarm rate for spurious differences was reduced by approximately 87% compared to traditional methods. In the output results, the positional accuracy of each difference region reached the grid resolution level (the average side length of the grid in this embodiment is approximately 0.15 mm), which can be directly used for machining quality assessment and toolpath correction.

[0075] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.

Claims

1. A method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation, characterized in that, Includes the following steps: S1. Obtain the triangular mesh of the CAD design model and the triangular mesh of the CNC machining simulation result, and perform mesh preprocessing on the two models; S2. Perform bidirectional Boolean difference operation on the two preprocessed models to extract the initial difference meshes of the overcut region and the undercut and residual material regions, respectively. S3. Perform post-processing and mesh repair on the initial difference mesh generated by the Boolean difference set; S4. Perform topological analysis on the repaired differential mesh, divide it into several connected domains according to connectivity, and determine the watertightness of each connected domain. S5. Perform iterative edge stripping on non-watertight connected components until the connected components become watertight or disappear completely, and retain the watertight connected components as real difference entities. S6. Perform local thickness calculations on the retained real difference entities; S7. Based on the high quantile of entity thickness, perform entity-level pseudo-difference filtering on real difference entities, and remove pure noise entities by using only the global absolute thickness threshold, while retaining the original geometric shape of entities that pass the threshold unchanged. S8. Output the filtered valid difference entities and their corresponding overcut and undercut type information.

2. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The mesh preprocessing described in step S1 specifically includes: coordinate alignment, normal unification, removal of zero-area patches, deduplication of vertices, and repair of inverted faces.

3. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The bidirectional Boolean difference operation in step S2 specifically involves: performing a Boolean difference operation between the design model and the simulation model to obtain the overcut region mesh, and performing a Boolean difference operation between the simulation model and the design model to obtain the undercut and residual material region mesh.

4. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The post-processing and mesh repair described in step S3 specifically includes performing the following operations on the new patches generated by Boolean cutting: 1) Merge adjacent coplanar triangular faces; 2) Identify all outer and inner boundaries and mark the open edge positions; 3) Delete zero-length edges and invalid edges whose length is less than the preset short edge threshold; 4) Re-subdivide the broken and twisted regions.

5. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The topological analysis in step S4 specifically includes: marking zero-area faces, repeating faces, reverse faces, and degenerate faces; marking open edges, boundary loops, non-manifold edges, and non-manifold vertices; the watertightness judgment criteria are: no open edges, no non-manifold edges and non-manifold vertices, no self-intersections, all face normals are consistent, and connected domains that can form closed bounded entities are watertight structures; otherwise, they are non-watertight structures.

6. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The iterative edge-peeling process described in step S5 specifically includes: 1) The edge stripping process is only initiated for non-watertight connected domains containing open edges and non-manifold structures; 2) Starting from the open edge, search inwards for a surface layer that directly shares an edge with the open edge, and use it as the target for this round of stripping; 3) Only delete the surface layer of this round, retaining the internal main layer; 4) Recalculate the boundary, number of open edges, manifold, watertightness, and minimum wall thickness of the connected domain after edge stripping; 5) Stop edge stripping and retain the current connected component when any of the following termination conditions are met: ① The connected component becomes a completely watertight structure; ② The ratio of the total length of the open edge to the initial total length of the open edge drops below a preset ratio threshold, and the current minimum wall thickness of the entity is higher than the preset minimum thin-wall protection threshold, and it is judged to be approximately watertight; ③ The minimum wall thickness of the entity after edge stripping is lower than the preset minimum thin-wall protection threshold, and edge stripping is forcibly terminated; If the connected component still does not meet the termination condition, repeat the above steps to continue stripping the next layer; If the connected component completely disappears, it is judged as pure noise and is removed.

7. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The local thickness calculation in step S6 specifically includes: 1) Construct BVH-level bounding boxes for real-world differential entities; 2) For each triangular facet of the entity, N detection rays are uniformly emitted within the hemispherical space along the opposite direction of the normal, starting from the geometric center of the facet; 3) Obtain the intersection point between the ray and the other side panel of the entity, and calculate the local thickness value corresponding to a single ray; for each ray, find the first intersection point between the ray start point and the entity surface along the emission direction, and calculate the distance between the intersection point and the ray start point as the local thickness of the ray; if the ray has no entity intersection point, or the distance between the intersection point and the start point is less than the preset minimum threshold, the ray is determined to be an invalid ray and discarded. 4) Perform robust statistical processing on all effective thickness values, remove outliers, and take the stable mean as the local thickness of the patch.

8. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, Step S7 specifically includes: 1) Collect the local thickness of all facets of the real differential entity and sort them from smallest to largest; 2) Take the thickness of P95 after sorting as the benchmark for the actual thickness of the main body of the entity; 3) A global absolute thickness threshold is preset. If the P95 thickness of the current entity is lower than the global absolute thickness threshold, the entire entity is judged as a pseudo-difference and is removed. 4) The original geometric shape of the entity that passes the threshold verification is retained unchanged as the final valid difference entity.

9. The method for extracting geometric differences and cleaning redundant meshes in CNC machining simulation according to claim 1, characterized in that, The information output in step S8 specifically includes: the denoised overcut solid mesh, undercut / residual solid mesh, the location, area, volume, average thickness and P95 thickness parameters of each difference region, and overcut and undercut type labels.