Integrated processing path generation method for triangular mesh curved surface

By using two-stage clustering of a five-axis CNC machine tool, GPU parallel acceleration collision detection, and adaptive path encryption, the machining path of triangular mesh surfaces is optimized, solving the problems of low machining quality and efficiency, and achieving efficient and residue-free machining of triangular mesh surfaces.

CN121009682APending Publication Date: 2025-11-25UNIV OF CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511050764.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-29
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

Existing technologies suffer from low processing quality and low efficiency in the machining of triangular mesh surfaces, especially leaving residual material at the junction of surface pieces and processing blind spots in shallow areas, making it difficult to simultaneously achieve both accuracy and efficiency.

Method used

Using a five-axis CNC machine tool, the optimal mounting direction is determined through two-stage clustering, shallow and steep areas are divided, a collision detection model accelerated by GPU is constructed, the cutting path is generated by optimizing the cutting plane normal vector, the rapid traverse line is optimized by combining the traveling salesman problem, and adaptive path densification is performed to form an integrated machining path.

Benefits of technology

It effectively avoids the problem of residual material at the interface of curved surfaces in traditional methods, improves detection efficiency and path continuity, ensures processing quality and efficiency, adapts to complex geometric features, and balances processing accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009682A_ABST
    Figure CN121009682A_ABST
Patent Text Reader

Abstract

The invention discloses an integrated processing path generation method for a triangular mesh curved surface, and the method comprises the steps: determining an optimal clamping direction through two-stage clustering based on the direction of an outer normal of the surface of a triangular mesh model, selecting an optimal class cluster through a k-means clustering normal vector in combination with a feature evaluation function, and determining a model base according to height secondary clustering; the shoal and the steep area are divided according to a preset boundary angle, small-area isolated shoal sub-areas are deleted, and holes in the shoal are processed through boundary expansion; constructing a GPU parallel acceleration collision detection model, and obtaining a feasible machining direction set of each point for the geometric structure of the ball end milling cutter; a cutting path section is generated based on a section plane method, a section plane normal vector is optimized and determined in a shoal area, and a steep area follows a clamping direction; generating an optimal cutter lifting fast moving line by combining a path section endpoint feasible direction domain and a traveling salesman problem optimization algorithm; and carrying out adaptive path encryption by adopting geometric projection dynamic interval adjustment to ensure that a preset residual height constraint is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer-aided manufacturing technology, and more specifically, to an integrated method for generating machining paths for triangular mesh surfaces. Background Technology

[0002] Subtractive CNC machining of freeform surfaces is a core technology in the field of digital manufacturing and a key bottleneck restricting the development of my country's high-end manufacturing industry. The numerous mathematical problems involved, such as optimization algorithms, path planning, and geometric modeling, not only have significant theoretical research value but also provide crucial technical support for practical industrial applications. Therefore, the theoretical analysis and efficient algorithm design of these mathematical problems have important academic value and practical significance. Currently, China has also promulgated many policies to support the development of related industries. For example, in 2024, the Ministry of Industry and Information Technology issued a notice on the guidelines for equipment upgrading and technological transformation in key industrial sectors, requiring the completion of the upgrading of 800,000 sets of industrial operating systems and 2 million sets of industrial software by 2027.

[0003] The relevant processing flow mainly includes Computer-Aided Design (CAD), Computer-Aided Manufacturing (CAM), post-processing, and machine tool machining. In CAM, the machining path refers to the relative motion trajectory between the workpiece and the machine tool, which determines how the tool cuts the blank to form the surface shape specified by the design geometry. From a kinematics perspective, the curvature characteristics of the machining path directly affect the smoothness of the feed rate, while the differential geometric properties of the path envelope are strongly coupled with key physical quantities such as instantaneous chip area and cutting force fluctuations. Currently, driven by the demand for improved accuracy and efficiency in CNC machining, the deep integration of CAD and CAM systems has become an urgent technical requirement in the field of advanced manufacturing. The machining path, as a key information carrier connecting CAD geometric modeling and CAM process planning, directly relates its generation quality and degree of automation to the accuracy control and efficiency optimization of the machining process. Therefore, this research area still has significant research value and theoretical importance.

[0004] Furthermore, with the breakthrough development of 3D scanning and machine vision technologies, reverse engineering and rapid prototyping have become key technologies in modern intelligent manufacturing systems. This technology system significantly shortens product iteration cycles and reduces trial-and-error costs by constructing high-precision digital twin models of physical entities. The triangular mesh surfaces involved, with their efficient construction characteristics based on simple discrete topology, have become a relatively mature representation method for realizing complex geometric modeling in CAD systems.

[0005] In recent years, CAM finishing tool path planning for triangular mesh surfaces has received widespread attention from scholars. For complete solid models, the current traditional machining process is "obstacle avoidance-based surface segmentation + single-surface-piece fixed-direction path planning". This method can effectively decouple the two problems of tool axis obstacle avoidance detection and cutting path generation, thus ensuring the robustness of the algorithm when dealing with complex models. However, during machining, because each surface piece uses a fixed tool posture, there will be obvious residual material at the interface of the surface pieces, which will significantly reduce the machining quality. To address this problem, four-axis surround machining has been proposed in academia and industry, which can effectively improve the surface quality. However, this method is similar to turning, and there will be machining blind spots in the shallow areas of the model (the surface normal vector is nearly parallel to the main clamping direction). In order to satisfy the residual height constraint in this area, this method often needs to accumulate multiple layers of redundant paths, resulting in the defect that machining efficiency and machining accuracy are difficult to balance simultaneously. In addition, due to the limitations of machine tool structure, there are also some areas of the model that cannot be machined. Summary of the Invention

[0006] This specification provides an integrated machining path generation method for triangular mesh surfaces to overcome at least one technical problem existing in related technologies.

[0007] This specification provides an integrated machining path generation method for triangular mesh surfaces, applied to end milling finishing on a five-axis CNC machine tool, including the following steps:

[0008] S1. Based on the direction of the outward normal of the surface of the triangular mesh model, and combined with the travel parameters of the clamping mechanism of the five-axis CNC machine tool, the optimal clamping direction is determined by two-stage clustering.

[0009] S2. Divide the shallow area and steep area according to the preset dividing angle, and process the topological defects after the division based on the end mill diameter parameter.

[0010] S3. Construct a collision detection model based on GPU parallel acceleration, and obtain the set of feasible machining directions for each point on the model based on the geometric relationship between the ball end mill and the triangular mesh model;

[0011] S4. For shallow and steep areas, the cutting path segment is generated based on the cross-plane method. The cross-plane normal vector of the shallow area is determined by optimization, and the cross-plane normal vector of the steep area is the mounting direction. The length of the path segment is matched with the end mill feed rate.

[0012] S5. Based on the feasible direction domain of the endpoints of the path segment, the optimal tool lifting rapid traverse line is generated by combining the traveling salesman problem optimization algorithm, and the tool lifting height meets the safety stroke requirements of the five-axis CNC machine tool.

[0013] S6. An adaptive path densification method based on geometric projection is used to adjust the dynamic interval to meet the surface roughness requirements corresponding to the preset residual height. The dynamic interval h of the adaptive path densification is... adjusted The distance should be no less than the minimum step distance of the end mill and no greater than the maximum allowable interval of the machine tool's rotary axis travel, ultimately forming an integrated machining path.

[0014] In some optional implementations, the two-stage clustering in step S1 specifically includes:

[0015] Phase 1: Calculate the normal vector of each triangular facet and use it as a 3D data point. Classify the data using the k-means clustering algorithm. Determine the optimal cluster through a feature evaluation function. This feature evaluation function is used to quantify the comprehensive performance of the cluster to match the clamping stability of the five-axis CNC machine tool. The expression is s = μ·S - γ·Γ, where S is the average distance from the data point within the cluster to the cluster center, i.e., the intra-cluster similarity, Γ is the number of data points in the cluster, and μ and γ are weighting coefficients. The direction corresponding to the center point of the optimal cluster is the clamping direction.

[0016] The second stage: For the triangular facets corresponding to the optimal cluster, perform secondary clustering according to their height in the clamping direction, and select the cluster with the lowest average height as the model base. The base area is not less than the minimum clamping area of ​​the five-axis CNC machine tool table.

[0017] In some alternative implementations, the processing of topological defects in step S2 includes: deleting isolated shallow shoal sub-regions with an area smaller than a set threshold and classifying them as steep regions;

[0018] For holes within the shoal area, adjacent facets are absorbed through multiple rounds of boundary expansion, including: establishing an adjacency index for each candidate triangular facet. This index is used to determine the degree of association between the candidate facet and the current shoal area to ensure processing continuity, and its expression is: Where E f R is the set of triangular faces that are adjacent to at least one point of a candidate face; when η f When the value is ≥0.5, candidate patches are merged into the current shoal region until no further expansion is possible.

[0019] In some optional implementations, the collision detection model construction process in step S3 includes: decomposing the ball end mill into a cylindrical segment, a frustum segment, and a hemispherical cutter head, wherein the geometry is represented as the Boolean intersection of a quadratic surface and a half-space, where the diameter of the cylindrical segment is equal to the nominal diameter of the end mill; for the frustum, its internal region expression is H1∩(H2∩H3), where H1 is the region enclosed by the conical surface of the frustum's side, H2 is the downward half-space intercepted by the bottom surface of the frustum, and H3 is the upward half-space intercepted by the bottom surface of the frustum; collision detection is reduced to the emptiness of the decision set Ω=(H1∩(H2∩H3))∩T, which is used to determine whether the ball end mill collides with the workpiece surface represented by the triangle, where T is the set of points inside the triangle containing the boundary; using Vulkan as the GPU programming interface, the collision detection algorithm is written as a computation shader, which is executed in parallel by the GPU, with each thread processing one triangle, and the detection result is directly output to the toolpath planning module of the five-axis CNC machine tool.

[0020] In some optional implementations, the step S4 of generating the cutting path segment based on the cross-section method includes: generating a set of parallel cross-sections with the same normal vector, calculating their intersection with the surface of the region, i.e., the contour line, and determining the initial value of the cross-section spacing based on the end mill radius and the preset residual height; discretizing the contour line into atomic segments according to the preset atomic segment length; splicing atomic segments through reachability analysis: the reachable direction domain of the atomic segment is a set of collision-free tool directions, composed of several continuous intervals of reachable direction sectors; using a discretization sampling strategy, performing collision detection at 5° intervals within the constrained direction domain, and constructing reachable direction sector intervals through connectivity; splicing the reachable direction sectors of adjacent atomic segments based on the forward and backward traversal algorithm, wherein the forward and backward traversal algorithm includes backward traversal and forward traversal, and is optimized using a heuristic strategy: when the next atomic segment has multiple reachable direction sectors that can overlap with the currently traversed reachable direction sectors, the reachable direction sector with the largest range is selected; after the forward and backward traversal is completed, the largest representative reachable direction sector among the remaining atomic segments is taken as the starting point.

[0021] In some optional implementations, the forward and backward traversal algorithm specifically includes:

[0022] The backward traversal includes: starting from the first atomic segment, traversing the subsequent atomic segments in turn, for each current atomic segment's reachable direction sector, filtering the reachable direction sectors in the next atomic segment that overlap with it, if there are multiple overlapping reachable direction sectors, selecting the reachable direction sector with the largest range as the connecting sector, until the last atomic segment is traversed or no overlapping sectors can be found.

[0023] Forward traversal includes: starting from the last atomic segment, traversing the preceding atomic segments in turn, and for each current atomic segment's reachable direction sector, filtering out reachable direction sectors that overlap with it in the preceding atomic segments. If there are multiple overlapping reachable direction sectors, select the reachable direction sector with the largest range as the connecting sector, until the first atomic segment is reached or no overlapping sector can be found.

[0024] If neither forward nor backward traversal covers all atomic segments, select the atomic segment representing the largest reachable sector from the remaining unconnected atomic segments as the new starting point, and repeat the above backward and forward traversal process until all atomic segments are connected or it is confirmed that they cannot be connected.

[0025] In some optional implementations, the optimization determination of the cross-sectional plane normal vector of the shoal region in step S4 specifically includes: constraining the candidate cross-sectional plane normal vectors to a plane orthogonal to the average normal vector of the shoal region; generating a candidate direction set at 5° intervals, wherein the candidate direction set must match the rotary axis travel range of the five-axis CNC machine tool; excluding candidate directions whose representative reachable direction sector is 0; calculating the average value of the representative reachable direction sector size of the discrete sampled atomic segments corresponding to the remaining directions; and selecting the direction with the largest average value as the optimal cross-sectional plane normal vector.

[0026] In some optional implementations, the optimal tool lift-off rapid traverse line generation based on the traveling salesman problem in step S5 includes: calculating the transfer length between the endpoints of the path segment: the transfer length between endpoints on the same path is 0; if endpoints on different paths have no collision during a straight-line transfer, the length is the straight-line distance. The tool posture is generated using a spherical linear interpolation algorithm, and the posture change rate does not exceed the maximum rotary feed speed of the five-axis CNC machine tool; otherwise, it is the tool lift-off transfer length, which includes the distance the tool lifts from the starting point along the tool axis to the safe spherical projection point, the shortest distance between the two projection points along the spherical geodesic, and the sum of the distance from the endpoint projection point down along the tool axis to the endpoint. The global radius is slightly larger than the radius of the model's maximum outer sphere. A complete graph is constructed with the endpoints of the path segments as vertices. Virtual nodes are introduced to construct an extended graph, transforming open paths into Hamiltonian cycles. A weight adjustment strategy is adopted to ensure that all necessary edges are traversed. The weight expression for the adjusted necessary edges is N = -(mn)M, where m is the number of nodes in the extended graph, n is the number of necessary edges, and M is the maximum weight of the edges in the extended graph. This weight is used to ensure that the optimal solution traverses all necessary edges. The Traveling Salesman Problem is solved using the Christofides heuristic algorithm, and the solution is output in a G-code instruction format recognizable by a five-axis CNC machine tool.

[0027] In some optional implementations, the adaptive path encryption dynamic interval adjustment formula in step S6 is used to adjust the cross-sectional plane interval according to geometric features to match the cutting capability of the end mill. The expression is h′=h·sinθ, where h is the preset interval, θ is the angle between the cross-sectional plane normal and the triangular facet normal, and θ must satisfy the travel range of the five-axis machine tool rotary axis, and h′ is the actual interval of the next cross-sectional plane. The actual interval is not less than the minimum step distance of the end mill.

[0028] The actual interval of the next cross-section is determined in the following manner:

[0029] Let the preset interval be h, the normal of the current cutting plane be m, and the set of indices of the triangular facets intersecting the cutting plane be T, determined by the geometric intersection algorithm, with the normal of each triangular facet being n. i ,i∈T;

[0030] Calculate the angle θ between the normal of each triangular facet and the normal of the cutting plane. i =arccos(m·n i );

[0031] Take the minimum value of the sine of all included angles (min) i∈T {sinθ i}

[0032] The actual interval of the next cutting plane is h. adjusted =h·min i∈T {sinθ i};

[0033] The geometric intersection algorithm includes: for each triangular facet, determining whether it has an intersection line with the cutting plane, that is, whether the facet vertices are distributed on both sides of the cutting plane; if an intersection line exists, then the facet is added to set T.

[0034] In some optional implementations, the initial path interval corresponding to the residual height constraint is calculated using the formula... This formula is used to back-calculate the initial path interval based on the residual height requirement to meet the surface roughness of the machined surface. Here, h is the initial path interval, R is the minimum radius of curvature of the model surface, r is the tool radius, s is the given residual height, and α is the correction coefficient. The calculation result needs to match the minimum pulse equivalent of the five-axis CNC machine tool.

[0035] One embodiment of this specification can achieve at least the following beneficial effects:

[0036] This application's technical solution determines the optimal mounting direction and divides shallow and steep regions through two-stage clustering. Combined with topological defect handling, it avoids the residual material problem at the interface of curved surfaces in traditional piecewise machining. Simultaneously, collision detection accelerated by GPU parallelism significantly improves detection efficiency and accurately identifies potential collisions, overcoming overcutting and blind spots in shallow areas caused by collision detection limitations in four-axis machining. Furthermore, the cutting plane normal vectors are optimized for shallow and steep regions respectively, and cutting paths are generated. Combined with a forward and backward traversal algorithm to stitch atomic segments, path continuity is ensured. Adaptive path encryption dynamically adjusts the interval, resulting in more uniform machining area coverage and effectively ensuring that residual height meets preset constraints. Optimizing the tool lift-off rapid traverse line based on the TSP algorithm reduces idle travel time and improves machining efficiency. The overall solution is adaptable to the complex geometric features of triangular mesh surfaces and can be extended to other CAD models, ensuring both machining quality and efficiency. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments or related technologies of this specification, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a schematic diagram of the blind zone in four-axis machining, with the blind zone, cutting tool and mounting base marked, showing the blind zone in four-axis machining in shallow areas (where the surface normal vector is nearly parallel to the mounting direction);

[0039] Figure 2 This is a schematic diagram of an AC cradle-type five-axis machine tool, illustrating the structure of the five-axis machine tool used.

[0040] Figure 3 The flowchart of the technical solution method of this application includes four sub-graphs: a (selection of optimal loading direction), b (demarcation between shallow and steep areas), c (generation of cutting path segments), and d (connection of path segments based on TSP), which present the core process of the technical solution.

[0041] Figure 4 This diagram illustrates the conversion between the tool contact point and the tool position point, labeling the ball end mill, tool axis direction, tool position point, tool contact point, and machined surface. It explains the process of offsetting the tool contact point along the normal direction of the model surface to obtain the tool position point from the tool radius.

[0042] Figure 5 This is a schematic diagram of the collision between a frustum and a triangle, illustrating the geometric relationship between the frustum and the triangular facet in collision detection.

[0043] Figure 6This is a schematic diagram of the contour and MDR (reachable direction domain) generated by the cross-section method, labeled to represent MDS (reachable direction sector), showing the contour lines generated by the cross-section and the reachable direction domain of the atomic segments;

[0044] Figure 7 This is a schematic diagram of the traversal algorithm (taking forward traversal as an example), including a (initial atomic segment), b (forward traversal), and c (traversal termination), showing the process of splicing atomic segments in the forward and backward traversal algorithms;

[0045] Figure 8 For the final path result of the Bunny model, the black line is the cutting path segment, the green line is the straight transfer line, the blue line is the tool lift / drop line, and the red dashed line is the rapid traverse line on the safety sphere, presenting the final generated complete machining path;

[0046] Figure 9 This is a schematic diagram of the tool dimensions, with the dimensions of each part of the ball-end tip tool labeled and the tool's geometric parameters displayed.

[0047] Figure 10 The image shows a comparison of path encryption, with a representing the path distribution before adaptive encryption and b representing the path distribution after adaptive path encryption.

[0048] Figure 11 This is a schematic diagram of the unprocessed areas of the Bone model, showing the local unprocessed areas that exist in the Bone model due to machine tool structure limitations;

[0049] Figure 12 The toolpath comparison diagram shows that a is the toolpath of the four-axis surround machining method and b is the toolpath of this method, comparing the cutting path coverage of the two methods.

[0050] Figure 13 The image shows a comparison of residual height. Image a represents the residual height of the four-axis surround machining method, and image b represents the residual height of this method. The images compare the distribution of residual height after machining using the two methods. Detailed Implementation

[0051] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0052] In response to the problems mentioned in the background section above, this application extends the surround machining method to AC cradle-type five-axis machine tools. Figure 2This paper proposes an end-to-end integrated toolpath generation method for end milling finishing, effectively avoiding the generation of machining blind spots. The specific process is as follows: First, the clamping direction is determined based on normal vector clustering analysis, and the machining area is divided into shallow and steep regions according to the distribution characteristics of the sampled point normal vectors. Second, a high-efficiency collision detection model based on GPU parallel acceleration is constructed. A global feasible machining direction set is extracted by discretizing the tool attitude space, and the optimal machining direction is obtained for the shallow region. Finally, the cutting path is generated using the cross-plane method for both the shallow and steep regions. Based on the feasible direction domain of the path points, combined with the Traveling Salesman Problem (TSP) global optimization algorithm, and considering the constraints of the feasible domain of tool attitude, a tool lift-off path generation model with minimum idle travel time is constructed, achieving synergistic optimization of machining efficiency and surface quality. Subsequent experimental results verify the effectiveness of this method.

[0053] The technical solution of this application is briefly described below. This application provides an integrated machining path generation method for triangular mesh surfaces, applied to end milling finishing on a five-axis CNC machine tool, including the following steps:

[0054] Step S1: Based on the direction of the outward normal of the triangular mesh model surface, and combined with the travel parameters of the clamping mechanism of the five-axis CNC machine tool, the optimal clamping direction is determined through two-stage clustering.

[0055] In this step, the surface of the physical workpiece or design prototype can be scanned using equipment such as laser scanners or structured light 3D scanners to collect point cloud data. After that, Gaussian filtering is used for noise reduction, K-nearest neighbor algorithm is used to remove outliers, and ICP algorithm is used to complete point cloud registration. Then, the preprocessed point cloud data is converted into an initial triangular mesh using the Delaunay triangulation algorithm. Alternatively, after constructing a parametric surface model in CAD software, the NURBS surface is discretized into a triangular mesh by setting the mesh density parameter in the mesh generation module. For topological defects that may occur during the discretization process, hole filling algorithm and normal vector consistency adjustment algorithm can be used for repair. Alternatively, triangular mesh data can be imported from model files in formats such as STL and OBJ. For problems such as overlapping patches and non-manifold edges in the imported data, topology checking algorithm is used to identify and process them using techniques such as patch merging and edge splitting to finally obtain a complete and topologically valid triangular mesh model.

[0056] Step S2: Divide the shallow and steep areas according to the preset dividing angle, and process the topological defects after division based on the end mill diameter parameter;

[0057] Step S3: Construct a collision detection model based on GPU parallel acceleration, and obtain the set of feasible machining directions for each point on the model based on the geometric relationship between the ball end mill and the triangular mesh model;

[0058] Step S4: For shallow and steep areas, generate cutting path segments based on the cross-section method. The cross-section normal vector for the shallow area is determined by optimization, and the cross-section normal vector for the steep area is the mounting direction. The length of the path segment is matched with the end mill feed rate.

[0059] Step S5: Based on the feasible direction domain of the endpoints of the path segment, the optimal tool lifting rapid traverse line is generated by combining the traveling salesman problem optimization algorithm, and the tool lifting height meets the safety travel requirements of the five-axis CNC machine tool;

[0060] Step S6: Adaptive path densification is performed using a dynamic interval adjustment method based on geometric projection to meet the surface roughness requirements corresponding to the preset residual height, wherein the dynamic interval h of the adaptive path densification is... adjusted The distance should be no less than the minimum step distance of the end mill and no greater than the maximum allowable interval of the machine tool's rotary axis travel, ultimately forming an integrated machining path.

[0061] This step employs a dynamic interval adjustment method based on geometric projection. Adaptive path densification is performed when generating cutting path segments. Specifically, the path is first projected along the machining geometry of the triangular mesh surface. Based on the geometric mapping relationship between the distance between adjacent path segments after projection and the preset residual height, the densification interval h is dynamically calculated and adjusted. adjusted This ensures that the interval is neither less than the minimum step distance during end milling (to avoid tool interference and ensure cutting stability) nor greater than the maximum allowable interval of the machine tool's rotary axis travel (to adapt to the machine tool's motion capability and prevent the rotary axis travel from exceeding the limit). Through this densification process, the residual height between path segments strictly matches the preset surface roughness requirements. Finally, it is integrated with the cutting path segment generated in step S4 and the tool lift-off rapid traverse line optimized in step S5 to form an integrated machining path that includes continuous cutting paths and safe transfer trajectories (straight transfer lines, tool lift-off / drop lines, and safe spherical rapid traverse lines). This path can be directly output as control commands for a five-axis CNC machine tool to drive the end mill to perform end milling finishing on the triangular mesh surface, achieving high-efficiency machining with no obvious residual material or machining blind spots, and with machining accuracy (residual height), surface quality (roughness), and machine tool motion constraints (rotary axis travel) being met in a coordinated manner.

[0062] The two-stage clustering described in step S1 specifically includes:

[0063] Phase 1: Calculate the normal vector of each triangular facet and use it as a 3D data point. Classify the data using the k-means clustering algorithm. Determine the optimal cluster through a feature evaluation function. This feature evaluation function is used to quantify the comprehensive performance of the cluster to match the clamping stability of the five-axis CNC machine tool. The expression is s = μ·S - γ·Γ, where S is the average distance from the data point within the cluster to the cluster center, i.e., the intra-cluster similarity, Γ is the number of data points in the cluster, and μ and γ are weighting coefficients. The direction corresponding to the center point of the optimal cluster is the clamping direction.

[0064] The second stage: For the triangular facets corresponding to the optimal cluster, perform secondary clustering according to their height in the clamping direction, and select the cluster with the lowest average height as the model base. The base area is not less than the minimum clamping area of ​​the five-axis CNC machine tool table.

[0065] The topological defect processing described in step S2 includes: deleting isolated shallow shoal sub-regions with an area smaller than a set threshold and classifying them into steep regions;

[0066] For holes within the shoal area, adjacent facets are absorbed through multiple rounds of boundary expansion, including: establishing an adjacency index for each candidate triangular facet. This index is used to determine the degree of association between the candidate facet and the current shoal area to ensure processing continuity, and its expression is: Where E f R is the set of triangular faces that are adjacent to at least one point of a candidate face; when η f When the value is ≥0.5, candidate patches are merged into the current shoal region until no further expansion is possible.

[0067] The collision detection model construction process in step S3 includes: decomposing the ball end mill into a cylindrical segment, a frustum segment, and a hemispherical cutter head. The geometry is represented as the Boolean intersection of a quadratic surface and a half-space, where the diameter of the cylindrical segment is equal to the nominal diameter of the end mill. For the frustum, its internal region expression is H1∩(H2∩H3), where H1 is the region enclosed by the conical surface on the side of the frustum, H2 is the downward half-space intercepted by the bottom surface of the frustum, and H3 is the upward half-space intercepted by the bottom surface of the frustum. Collision detection is reduced to the emptiness of the decision set Ω=(H1∩(H2∩H3))∩T, which is used to determine whether the ball end mill collides with the workpiece surface represented by the triangle, where T is the set of points inside the triangle including the boundary. Vulkan is used as the GPU programming interface, and the collision detection algorithm is written as a computation shader, which is executed in parallel by the GPU. Each thread processes one triangle, and the detection result is directly output to the toolpath planning module of the five-axis CNC machine tool.

[0068] Step S4, which involves generating the cutting path segment based on the cross-plane method, includes: generating a set of parallel cross-planes with the same normal vector, calculating their intersection with the region surface (i.e., the contour line), and determining the initial value of the cross-plane spacing based on the end mill radius and preset residual height; discretizing the contour line into atomic segments according to the preset atomic segment length; assembling atomic segments through reachability analysis: the reachable direction domain of an atomic segment is a set of collision-free tool directions, composed of several continuous intervals of reachable direction sectors; employing a discretization sampling strategy, performing collision detection at 5° intervals within the constrained direction domain, and constructing reachable direction sector intervals through connectivity; assembling the reachable direction sectors of adjacent atomic segments based on a forward and backward traversal algorithm, which includes backward traversal and forward traversal, and is optimized using a heuristic strategy: when multiple reachable direction sectors of the next atomic segment overlap with the currently traversed reachable direction sectors, the reachable direction sector with the largest range is selected; after the forward and backward traversal is completed, the largest representative reachable direction sector among the remaining atomic segments is taken as the starting point. This forward and backward traversal algorithm specifically includes:

[0069] The backward traversal includes: starting from the first atomic segment, traversing the subsequent atomic segments in turn, for each current atomic segment's reachable direction sector, filtering the reachable direction sectors in the next atomic segment that overlap with it, if there are multiple overlapping reachable direction sectors, selecting the reachable direction sector with the largest range as the connecting sector, until the last atomic segment is traversed or no overlapping sectors can be found.

[0070] Forward traversal includes: starting from the last atomic segment, traversing the preceding atomic segments in turn, and for each current atomic segment's reachable direction sector, filtering out reachable direction sectors that overlap with it in the preceding atomic segments. If there are multiple overlapping reachable direction sectors, select the reachable direction sector with the largest range as the connecting sector, until the first atomic segment is reached or no overlapping sector can be found.

[0071] If neither forward nor backward traversal covers all atomic segments, select the atomic segment representing the largest reachable sector from the remaining unconnected atomic segments as the new starting point, and repeat the above backward and forward traversal process until all atomic segments are connected or it is confirmed that they cannot be connected.

[0072] The optimization and determination of the cross-sectional plane normal vector in step S4 specifically includes: constraining the candidate cross-sectional plane normal vectors to a plane orthogonal to the average normal vector of the shallow water area; generating a candidate direction set at 5° intervals, the candidate direction set needing to match the rotary axis travel range of the five-axis CNC machine tool; excluding candidate directions where the representative reachable direction sector is 0; calculating the average value of the representative reachable direction sector size of the discrete sampled atomic segments corresponding to the remaining directions; and selecting the direction with the largest average value as the optimal cross-sectional plane normal vector.

[0073] Step S5, which generates the optimal tool lift-off rapid traverse line based on the traveling salesman problem, includes: calculating the transfer length between endpoints of the path segment: the transfer length between endpoints on the same path is 0; for endpoints on different paths, if there is no collision during a straight-line transfer, the length is the straight-line distance. The tool posture is generated using a spherical linear interpolation algorithm, and the posture change rate does not exceed the maximum rotary feed speed of the five-axis CNC machine tool; otherwise, it is the tool lift-off transfer length, which includes the distance the tool lifts from the starting point along the tool axis to the safe spherical projection point, the shortest distance between the two projection points along the spherical geodesic, and the sum of the distance from the endpoint projection point down along the tool axis to the endpoint. The radius of the safe spherical surface is... Slightly larger than the radius of the model's maximum outer sphere; construct a complete graph with the endpoints of the path segments as vertices, introduce virtual nodes to construct an extended graph, and transform open paths into Hamiltonian cycles; adopt a weight adjustment strategy to ensure that all necessary edges are traversed, where the weight expression of the adjusted necessary edges is N = -(mn)M, where m is the number of nodes in the extended graph, n is the number of necessary edges, and M is the maximum weight of the edges in the extended graph, which is used to ensure that the optimal solution traverses all necessary edges; solve the Traveling Salesman Problem using the Christofides heuristic algorithm, and output the solution in a G-code instruction format recognizable by a five-axis CNC machine tool.

[0074] The adaptive path encryption dynamic interval adjustment formula described in step S6 is used to adjust the intersecting plane interval according to geometric features to match the cutting capability of the end mill. The expression is h′=h·sinθ, where h is the preset interval, θ is the angle between the normal of the intersecting plane and the normal of the triangular facet, and θ must meet the travel range of the five-axis machine tool rotary axis, and h′ is the actual interval of the next intersecting plane. The actual interval is not less than the minimum step distance of the end mill.

[0075] The actual interval of the next cross-section is determined in the following manner:

[0076] Let the preset interval be h, the normal of the current cutting plane be m, and the set of indices of the triangular facets intersecting the cutting plane be T, determined by the geometric intersection algorithm, with the normal of each triangular facet being n. i ,i∈T;

[0077] Calculate the angle θ between the normal of each triangular facet and the normal of the cutting plane. i =arccos(m·n i );

[0078] Take the minimum value of the sine of all included angles (min) i∈T {sinθ i}

[0079] The actual interval of the next cutting plane is h. adjusted =h·min i∈T {sinθ i};

[0080] The geometric intersection algorithm includes: for each triangular facet, determining whether it has an intersection line with the cutting plane, that is, whether the facet vertices are distributed on both sides of the cutting plane; if an intersection line exists, then the facet is added to set T.

[0081] The initial path interval corresponding to the residual height constraint is calculated using the formula. This formula is used to back-calculate the initial path interval based on the residual height requirement to meet the surface roughness of the machined surface. Here, h is the initial path interval, R is the minimum radius of curvature of the model surface, r is the tool radius, s is the given residual height, and α is the correction coefficient. The calculation result needs to match the minimum pulse equivalent of the five-axis CNC machine tool.

[0082] The technical solution of this application is described in detail below with reference to the accompanying drawings.

[0083] Part 1 of this application will introduce the relevant work on the integrated toolpath generation of triangular meshes; Part 2 will introduce the proposed novel integrated machining path method. Figure 3 The method is divided into four parts: optimal turning direction, shallow and steep boundary, cutting path generation, and optimal tool lifting / rapid traverse line generation. Part 3 presents the experimental results and comparisons of this method to illustrate its effectiveness and superiority. Part 4 briefly summarizes the technical solution work of this application and gives future research directions.

[0084] 1. Related work

[0085] Besides the three traditional methods for machining single-curved surface patches (isoparametric method, cross-sectional plane method, and equal residual height method), integrated machining of triangular meshes can be broadly categorized into two types: piecewise toolpath planning and wraparound toolpath planning. In the former strategy, a key metric is optimizing the number of surface patches to minimize the number of setups. Fanni et al. proposed a surface patching method based on polygon cube mappings and analyzed the machinability of patching in additive and subtractive manufacturing, considering both 3-axis and 4-axis milling. Muntoni et al. redefined the discrete constrained optimization problem of surface patching as an unconstrained optimization of a continuous function, thereby calculating a set of potentially overlapping height domain surface patches that collectively cover the model surface. To improve machining efficiency, Yang et al. adopted a more general double height field (DHF) slicing method to replace single height domain patching. By minimizing the number of DHF slices and maximizing the slice height, this method can effectively improve machining efficiency.

[0086] Furthermore, those skilled in the art also consider the selection of machining direction during the surface segmentation process, aiming to minimize the number of surface segments, transforming the problem into a multi-label graph cut optimization solution, and assigning an optimal machining direction to each surface segment based on tool reachability constraints. This graph cut-based segmentation planning method has proven its effectiveness and robustness in three-axis, four-axis, and five-axis machining.

[0087] Regarding another type of wraparound machining strategy, related work mainly focuses on four-axis machining and is concentrated in the industrial field (commercial industrial software), lacking technical reports due to commercial purposes. Analysis of the results from several commercial software programs reveals that Luban handles four-axis machining by utilizing the convex hull of the slice profile. It generates a 360-degree toolpath along the convex hull boundary for each slice layer and projects it onto the slice profile. However, experiments show that it can only handle simple geometric models with only one profile per slice layer and cannot handle models with multiple profiles per layer. Autodesk's Fusion 360 provides a "rotational" finishing strategy for four-axis simultaneous machining, allowing users to choose from helical, linear, or circular rotational toolpaths. However, experiments show that Fusion 360 cannot generate completely collision-free machining paths, resulting in significant overcutting and undercutting. Siemens NX offers a semi-automatic strategy for generating simultaneous toolpaths from CAD models, requiring manual specification of the driving geometry or guide curve to generate toolpaths at a feature-based level, involving numerous parameters and requiring cumbersome programming. In contrast, in academia, Zhang et al. proposed an end-to-end, single-step 4-axis toolpath generation method. This method uniformly slices the model, then performs reachability analysis on each cutting contour within each slice layer, and finally generates the optimal transfer path based on a graph cut algorithm or the TSP algorithm. However, as mentioned earlier, this method has a machining blind spot, and this limitation is the core starting point of the technical solution in this application.

[0088] 2. Technical solutions and methods of this application

[0089] This application proposes a method for generating toolpaths for end milling finishing on a five-axis machine tool, based on triangular mesh surface representation. The method comprises four main steps: (1) optimal clamping direction selection; (2) shallow / steep boundary demarcation; (3) cutting path segment generation; and (4) path segment connection based on TSP. The process is as follows: Figure 3 As shown.

[0090] 2.1 Selection of Optimal Mounting Direction

[0091] In practical CNC machining scenarios, a portion of the model must first be selected as a base for mounting, while the remaining portion is machined normally. The mounting base generally needs to be as flat as possible and have the largest possible area. Therefore, the technical solution of this application uses a two-stage clustering method to determine the optimal mounting base, while simultaneously determining the mounting direction perpendicular to the mounting base.

[0092] In the first stage, the technical solution of this application calculates the normal vector of each triangular facet in the model and treats each normal vector as a data point in three-dimensional Euclidean space. Then, the k-means clustering algorithm is used to automatically classify these data points. After the clustering is completed, the resulting clusters are quantitatively analyzed by constructing the following feature evaluation function:

[0093] ε=μ·S-γ·Γ

[0094] In the formula, S is the intra-class similarity, which is the average distance from the intra-class data point to the class center, Γ is the number of data points in the class, and μ and γ are two weighting coefficients, which are 0.7 and 0.3 respectively in the technical solution of this application. The cluster that minimizes the evaluation function is the optimal cluster, and the direction corresponding to the center point of the optimal cluster can be used as the loading direction.

[0095] However, the clusters identified in the first stage may map to multiple disconnected regions on the model surface. Therefore, a second clustering is needed based on the height of the triangular facets corresponding to the optimal cluster in the mounting direction, selecting the cluster with the lowest average height as the final model base.

[0096] 2.2 Shallow and steep boundary

[0097] In five-axis CNC machining, to achieve the adaptation between the tool tilt angle and the geometric features of the triangular facet, and to ensure tool accessibility and residual height constraints, the original surface needs to be divided into several shallow areas (i.e., regions where the angle between the surface normal vector and the mounting direction is small). Figure 3 b) Non-blue areas or steep areas ( Figure 3 (blue area in b). The method in this section first divides the triangular facets into steep and shallow categories based on a pre-set dividing angle (40° in this application's technical solution) by determining the angle between the normal vector and the loading direction, according to a threshold. After the initial classification, connected facets are merged to form continuous regions, but this will result in two types of topological defects: (1) isolated shallow sub-regions with too small an area; (2) holes inside the shallow regions. In order to eliminate these two types of defects, subsequent iterative processing steps are required.

[0098] In the iterative processing steps, for the shallow sub-region, isolated branches with an area smaller than a set threshold are deleted and reclassified into the steep region. For the holes inside the shallow region, adjacent faces are gradually absorbed through multiple rounds of boundary expansion: In each iteration, let the candidate triangular face be f, the current shallow branch be R, and the set of triangular faces that are at least one point adjacent to f be E. f An adjacency index can be established for each candidate face:

[0099]

[0100] When η f When the value is ≥0.5, f is merged into the current patch until it can no longer be expanded, ultimately forming a complete and continuous processing area division. It is worth noting that the above boundary algorithm will result in non-smooth area boundaries, but the subsequent path generation uses the cross-plane method (rather than the contour offset method), which is not sensitive to boundary quality. Therefore, this area boundary method is feasible in the technical solution of this application.

[0101] 2.3 Collision Detection Based on Triangular Mesh

[0102] Avoiding collisions with the workpiece model is the most basic requirement for CNC machining toolpath planning. The collision detection algorithm proposed in this application automatically calculates the tool contact point and outputs a Boolean variable representing the collision result by inputting a triangular mesh model, tool contact point coordinates, model surface normal vector, tool axis direction, and tool geometric parameters. The determination of the tool contact point is as follows: Figure 4 As shown, the collision detection problem can be obtained by offsetting the tool contact point along the normal direction of the model surface by the tool radius. Then, by decomposing the tool geometry, the collision detection problem is transformed into a problem of determining the intersection of a quadratic surface and a triangle.

[0103] The ball-head cutter used in this application can be decomposed into a combination of three basic geometric shapes: a cylindrical segment, a frustum segment, and a hemispherical cutter head. These geometric shapes can be represented as the Boolean intersection of a quadratic surface and a half-space. The half-space is defined as a set of points in three-dimensional space that satisfies the linear inequality n·x + d ≥ 0 (where n is the normal vector and d is the offset). Geometrically, it is difficult to directly determine whether the planar boundaries dividing space into two infinite regions collide with a triangle, but this application simplifies the problem by first performing an intersection operation between the triangle and the half-space. Taking a frustum as an example, let H1 be the region enclosed by the conical surface containing the side of the frustum, H2 be the downward half-space intercepted by the plane containing the bottom surface of the frustum, and H3 be the upward half-space intercepted by the bottom surface. Then, the internal region of the frustum can be represented as H1∩(H2∩H3). Let T be the geometry of all points inside a triangle (including the boundary). Collision detection can be further reduced to determining the emptiness of the set Ω = (H1∩(H2∩H3))∩T. Since the intersection operation satisfies the associative law, Ω = H1∩((H2∩H3)∩T). Therefore, we can first use a planar clipping algorithm to transform the triangle into a polygon P, and then check the surface intersection of P and H1, such as... Figure 5 As shown, existing technologies can be referenced for the intersection problem of polygons and quadric surfaces.

[0104] Because accurately representing a surface in a triangular mesh requires a large number of triangles, the collision detection method in this application is slow when executed serially on a CPU. However, since the detection of each triangle is independent, the method can be easily parallelized. This application uses Vulkan as the GPU programming interface, writing the above-mentioned triangle-tool collision detection algorithm as a computation shader for parallel execution on the GPU. Each thread processes one triangle, significantly accelerating the computation speed by leveraging the high concurrency of the GPU.

[0105] 2.4 Path segment generation based on the cutting plane method

[0106] The algorithm goal of this section is to generate cutting path segments within each zone based on the shallow-to-steep boundary results. First, for each region, a set of parallel cutting planes with the same normal vector are generated, and their intersections with the region surface are calculated; these intersections are called contour lines. Then, according to the preset atomic segment length L... a The contour line is discretized into a set of points, and the points in the set are defined as atomic segments; then, reachability analysis is performed.

[0107] (Obstacle Avoidance Detection) The tool contact points within the same contour line that meet the continuous machining conditions are spliced ​​into path segments. The algorithm in this section is similar to some existing technologies, but the difference is that the technical solution of this application selects different cutting plane normal vectors for different regions. The selection of cutting plane normal vectors adopts a partitioning strategy: steep regions are directly along the machine tool mounting direction, while shallow regions will be optimized and determined according to the method described in Section 2.5.

[0108] It is important to note that, such as Figure 6 As shown, a sectional plane may not necessarily provide only one contour line; the connections between atomic segments will be considered separately on unconnected contour lines. Furthermore, since the regions after the boundary are no longer closed, the contour lines generated by the sectional plane are not necessarily closed either.

[0109] 2.4.1 Reachability Analysis

[0110] Based on the reasonable selection of the cutting plane normal, this section constrains the tool axis direction within a two-dimensional plane perpendicular to the cutting plane normal. For the discretized atomic segments on the contour line, its Machinable Direction Range (MDR) is defined as the set of all tool directions that satisfy the collision-free condition. Since continuous reachable directions form a sector, the MDR is actually composed of several continuous direction intervals, each interval being called a Machinable Direction Sector (MDS), such as... Figure 6 As shown in the figure. In this application, the MDS with the largest range of an atomic segment is referred to as the representative MDS of that point.

[0111] To efficiently solve the MDR problem, this section's algorithm employs a discretization sampling strategy: collision detection is performed at 5° intervals within the constrained direction domain, and reachable directions are marked before constructing MDS intervals based on connectivity. Subsequently, based on existing forward and backward traversal algorithms, this application's technical solution selects directionally compatible (non-empty MDS intersection) MDS segments on adjacent atomic segments along the same contour line for splicing.

[0112] 2.4.2 Forward and Backward Traversal Algorithms

[0113] The algorithm in this section aims to merge atomic segments within the same contour segment as closely as possible while ensuring continuous tool movement along the path segment. This algorithm requires an initial atomic segment as input and specifies one of its MDSs as the traversal MDS. Let the initial atomic segment be A. i Record the current atomic segment index c←i. During the backward traversal, let e←c+1, if A e One of the MDS is able to interact with A c If the MDS overlaps (intersection is not empty) during traversal, then A can be... e Merge it in, and specify that the MDS can be A.e Traverse the MDS, then let c←c+1 for the next iteration; if A e If no such MDS exists, the backward traversal terminates. At this point, the backward traversal restarts from the initial atomic segment, letting c←i, e←c-1. In each iteration, atomic segments are merged backward in the same way. See [link to previous section]. Figure 7 The technical solution of this application refers to the set of atomic segments obtained by the forward and backward traversal algorithm as the cutting path segment, and each atomic segment on the path segment has its unique traversal MDS.

[0114] Randomly specifying the starting atomic segment and traversing the MDS does not always yield good results, as the actual path segments that can be merged are easily split. This application's technical solution employs two heuristic strategies to optimize the greedy strategy in the prior art: (1) when multiple MDSs of the next atomic segment can overlap with the current traversed MDS, the one with the larger range is selected as the traversed MDS of the next atomic segment; (2) when one forward and backward traversal algorithm ends, the atomic segment with the largest representative MDS among the remaining atomic segments is selected as the starting segment, and its representative MDS is designated as the starting MDS. In practice, these two strategies are sufficient to guarantee the stability of the algorithm.

[0115] 2.5 Selection of Optimal Processing Direction in Shallow Water Area

[0116] This algorithm optimizes the cut-plane normal to ensure the machinability of the shallow area and improves the path continuity within it. For a five-axis machine tool, given an atomic segment, the reachable directions at that point ideally form a hemisphere. Considering no collision constraints, its reachable direction domain is a subset of this hemisphere. When a cut-plane normal is selected, and the reachable directions are constrained to be perpendicular to the cut-plane normal, the reachable direction domain of the atomic segment degenerates into a two-dimensional MDR. If the representative MDS of the atomic segment is 0, it indicates that the point is not machinable under the constraint of this cut-plane normal; conversely, a larger representative MDS indicates better reachability, which is beneficial for generating more continuous path segments later.

[0117] Since the normal vectors of the surface patches in the shallow area are relatively consistent, the technical solution of this application can constrain the candidate cutting plane normals to a plane orthogonal to the average normal vector of the region, and evaluate the normals of each cutting plane through discretization sampling. The technical solution of this application generates a set of candidate directions in the constraint plane at 5° intervals, and discretizes atomic segments in the shallow area, calculating their representative MDS. Since machinability is a hard constraint, the technical solution of this application first eliminates candidate directions with atomic segments whose representative MDS is 0, avoiding unmachinable cases. For the remaining directions, the technical solution of this application calculates the average value of the representative MDS of the discretized atomic segments, and finally selects the direction that maximizes this average value as the optimal cutting plane normal for the shallow area. This strategy achieves optimized selection of the machining direction by quantitatively evaluating the impact of different directions on path continuity; the subsequent toolpath generation is equivalent to that in steep areas.

[0118] 2.6 TSP-based path segment connection

[0119] 2.6.1 Calculation of distance between endpoints of path segments

[0120] Before connecting different path segments, the technical solution of this application first calculates the length of the transfer path required to connect the endpoints of different path segments, and uses it as the distance between the endpoints of the path segments. The technical solution of this application defines three relationships between the endpoints of the path segments:

[0121] (1) Same path

[0122] (2) Linear transfer

[0123] (3) Lifting the knife and transferring

[0124] For two endpoints on the same path, the technical solution of this application sets the length of their transfer path to 0. For two endpoints on different paths, the feasibility of the transfer is first evaluated by performing discrete collision detection on the line connecting the two endpoints with the tool radius as the step size. Since determining the tool posture at these discrete points also requires obtaining the tool axis direction and the model surface normal, and the technical solution of this application aims for a smooth transfer of the tool posture on a straight line, the technical solution of this application still requires interpolation results to determine the tool posture, even though there is no real model surface normal on the connecting line. The technical solution of this application generates the required direction by performing spherical linear interpolation (Slerp) on the corresponding direction at the endpoint. This method ensures a smooth transition of direction by performing quaternion interpolation on the endpoint direction vector. At the endpoints, the tool axis direction is selected as the geometric median direction representing the MDS, and the model surface normal is taken as the actual normal. If the collision detection passes, the distance between the two endpoints is set to the straight line length.

[0125] When a straight-line collision detection fails, the length of the tool lifting and transfer path needs to be calculated. The technical solution in this application constructs a safety sphere with a radius slightly larger than the maximum outer sphere of the model, using the center of the workpiece clamping base as the sphere's center, to ensure collision-free movement outside the sphere. The two endpoints are projected onto the safety sphere along their respective tool axis directions to obtain the projection point S. a With S b The total length of the transfer path consists of three parts:

[0126] (1) The tool is raised from the starting point along the tool axis to S. a The straight-line distance.

[0127] (2)S a To S b The shortest distance along a geodesic line on a sphere.

[0128] (3) From S b The straight-line distance along the cutter axis from its starting point to its endpoint.

[0129] 2.6.2 Minimize the transfer path length

[0130] This problem can be abstracted as a graph theory problem: construct a complete graph G with the endpoints of the path segments as vertices, where the weight of the edges represents the length of the transition path between the two vertices, and zero-weight edges correspond to the actual cutting path. The method in this section requires finding a path that traverses all vertices in the graph (and this path must pass through all edges with a weight of 0). This problem can be solved by designing a transformation method to utilize the solver of the TSP problem.

[0131] To address the structural differences between open paths and TSP closed loops, this application introduces a virtual node O to construct an extended graph G1. Specifically, by connecting O to all original nodes in G with zero-weight edges, the open path of the original problem is transformed into a Hamiltonian cycle in G1. For example, if the optimal open path of the original problem is T, the corresponding cycle form is O→T→O. If a cycle in G1 exists that is shorter than O→T→O, then its corresponding open path in G must be superior to the original solution T, which contradicts the optimality of T. Conversely, the optimality of the original problem also guarantees the optimality of the extended cycle.

[0132] To ensure that the algorithm traverses all required edges, the technical solution in this application adopts a weight adjustment strategy. Let G1 have m nodes and n required edges, denoted as H... k Let G1 be a Hamiltonian cycle passing through k necessary edges, M be the maximum weight of an edge in G1, N be the adjusted weight of a necessary edge in G1, and L(H) represent the length of cycle H.

[0133] L(H k )≥kN

[0134] nN+(mn)M≥L(H n )

[0135] The technical solution proposed in this application aims to ensure L(H) k )>L(H n If k < n, simply let

[0136]

[0137] Therefore, setting N = -(mn)M guarantees that the solution to the TSP problem in G1 must pass through the mandatory edges. Since a feasible solution must pass through the mandatory edges, it is clear that the optimal solution after changing the weights is also the optimal solution before changing the weights. Finally, a fixed offset is added to all edges to eliminate negative weights, making it compatible with the standard TSP solver.

[0138] The technical solution of this application actually uses the Christofides heuristic algorithm to solve the TSP problem, which can obtain an approximate solution with an error rate of no more than 50% in polynomial time, thus meeting the engineering requirements of the technical solution of this application. Figure 8 The final path generation result is shown, where the black line is the cutting path segment; the green line is the straight transfer line; the blue line is the tool lift / drop line; and the red dashed line is the rapid traverse line on the safety sphere.

[0139] 2.7 Adaptive Path Encryption

[0140] In CNC machining path planning, the actual path interval constraint is essentially the geodesic distance between adjacent toolpaths on the model surface. Existing methods approximate this value using the spatial distance between cutting planes. However, for areas where the angle between the model surface normal and the mounting direction is much greater than 90°, due to the structural limitations of 5-axis machine tools, the technical solution of this application can only classify these areas as steep regions. For such regions, the aforementioned distance approximation relationship does not hold. Therefore, the technical solution of this application proposes a dynamic interval adjustment method based on geometric projection:

[0141] Let the preset interval be h, the normal of the current cutting plane be m, the set of indices of the triangular facets intersecting the cutting plane be T, and the normal of each facet be n. i (i∈T), the actual interval of the next intercept plane is determined by the following formula:

[0142] h adjusted =h·min i∈T {sinθ i},θ i =arccos(m·n i )

[0143] Thus, when the angle between the normal of the cross-section plane (the opposite direction of the mounting direction) and the normal of the surface patch is nearly perpendicular, the sine value is close to 1, and the interval is close to the preset h; while when the angle is small, the sine value decreases, thereby reducing the interval to ensure that the projection of the path interval on the model surface remains reasonable.

[0144] 3. Experimental Results and Analysis

[0145] 3.1 Parameter Settings

[0146] This application's technical solution used four models for testing. The experiment first scaled the models to a uniform size: maintaining the original model's bounding box aspect ratio, and normalizing the maximum side length to 30cm to standardize model dimensions. The specific dimensions and number of triangular facets of the test models are detailed in Table 1. The cutting tool used has the following cross-section... Figure 9 The ball-headed scalpel shown has the following geometric parameters: scalpel diameter 3.0 mm, frustum cone angle 10°, cylindrical section diameter 3.175 cm, length 30 cm; atomic segment length L. a =1mm, the discrete angle is fixed at 5°, and the radius of the safety sphere is set at 35cm.

[0147] The core algorithm of this application is implemented using the C++17 standard and compiled using Microsoft Visual Studio 2022 (MSVC 19.42). The collision detection module utilizes the Vulkan 1.0 API for GPU acceleration. All tests were run on the same experimental platform with Windows 11 operating system and the following hardware configuration: Intel Core i9-13900KF processor and NVIDIA GeForce RTX 4090 graphics card.

[0148] Table 1 Basic Information of the Test Model

[0149]

[0150] 3.2 GPU Acceleration Performance Analysis

[0151] To quantify the GPU acceleration effect, this experiment randomly sampled 10 points on the model surface as tool contact points, and randomly generated tool postures for each tool contact point: the tool axis direction was randomly determined, and the normal vector of the model surface at the corresponding position was recorded. Ten sets of test data were thus constructed, and the CPU single-threaded version and the GPU accelerated version were run on the same hardware platform for comparative testing. The test results are shown in Table 2.

[0152] As can be seen, for the Bunny model, the parallel algorithm running on the GPU achieves a speedup of over 8000, demonstrating a significant acceleration effect. It is worth noting that when running the algorithm on the GPU, the runtime is not linearly related to the number of model faces. This is because when the number of model faces is less than the maximum number of threads the GPU can support in parallel processing, the algorithm's time complexity per model face is approximately O(1); furthermore, even with a short runtime, data transmission latency and driver initialization time cannot be ignored.

[0153] Table 2 Comparison of CPU and GPU runtime

[0154]

[0155] 3.3 Toolpath Result Analysis

[0156] To visually demonstrate the algorithm's effectiveness, this section fixes the initial toolpath interval at 5mm. The simulated path results are as follows: Figure 12 As shown (black lines represent the cutting path, green lines represent the straight-line transfer path). For ease of illustration, the toolpath lift / drop lines and rapid traverse lines are not drawn. Since five-axis machine tools can actually perform toolpaths planned for four-axis machine tools, this application also reproduces the existing four-axis wraparound machining method for comparison. Experimental results show that the toolpath generated by the algorithm in this application can uniformly cover flat areas, effectively ensuring the quality of the machined surface.

[0157] It is worth noting that the collision detection method in the prior art has limitations: this method only detects collisions within the same cross-sectional plane, which may lead to overcutting problems in actual machining. This problem is particularly pronounced when the angle between the normal vector of the tool contact point and the assembly direction is less than 10° (depending on the generatrix angle of the frustum portion), constrained by the tool geometry. The collision detection method adopted in this application can more accurately identify potential collisions throughout the entire space. This allows the four-axis method to automatically eliminate some paths in flat areas due to collision risks, ultimately creating blind spots on the machined surface.

[0158] For machining areas with the surface facing downwards, the adaptive toolpath refinement strategy of this algorithm is remarkably effective, such as... Figure 10 As shown, compared to fixed-interval toolpath planning, the adaptive encryption strategy significantly improves the toolpath distribution density in the downward region, while maintaining uniform and stable path intervals.

[0159] In CNC machining, the residual height requirement directly determines the final quality of the machined surface. Therefore, this section first needs to deduce the optimal initial path interval based on the given residual height constraint. The technical solution of this application uses the following formula to calculate this interval given the residual height requirement.

[0160]

[0161] In the formula, h is the initial path spacing, R is the minimum radius of curvature of the model surface, r is the tool radius, s is the given residual height, and α is the correction coefficient. The reason for introducing the correction coefficient α is that at the transition boundary between the shallow and steep regions, the actual path spacing may locally increase, causing the residual height to exceed the design requirements. By introducing the correction coefficient, it can be ensured that the residual height constraint can still be met under the most unfavorable conditions. In the experiment of the technical solution of this application, alpha is taken as 0.9. In addition, the tool path in the shallow region can also be slightly extended to further eliminate the abnormal path spacing at the boundary.

[0162] Under the conditions of a preset residual height of 0.6 mm and a residual allowance of 2 mm before processing, the simulation results of the residual height are as follows: Figure 13 As shown in Table 3, the maximum residual heights of the three models, Bunny, Beetle, and Kitten, are 0.58mm, 0.53mm, and 0.48mm, respectively, which meet the preset residual height constraints. This demonstrates that the technical solution method of this application can cover the machining of the entire model. In contrast, current advanced four-axis surround machining has significant unmachined areas and does not meet the requirements of high-precision machining, thus further illustrating the effectiveness of the technical solution method of this application.

[0163] It is worth noting that due to machine tool structure limitations, some models still have inherent machining blind spots. For example, the Bone model has a concave area with the normal vector pointing downwards, which prevents this area from being machined using five-axis simultaneous machining under the current mounting posture, resulting in... Figure 11 The unprocessed area shown represents approximately 0.08% of the total area. The technical solution method of this application will significantly reduce and optimize these processing blind spots through adaptive encryption. For the very small portion of the unprocessed area, the final high-precision processing can be completed by re-mounting the model (in the opposite direction of the current mounting direction).

[0164] Table 3 Comparison of Processing Quality Evaluation Indicators

[0165]

[0166] To address the issue of integrated triangular mesh machining and the problems of current methods (piecework machining leaves large residual curves at the boundaries, and wraparound machining only extends to 4 axes, resulting in machining blind spots), this application proposes a novel end-to-end five-axis wraparound toolpath generation method. The specific process is as follows: First, based on normal vector clustering analysis, the clamping direction is selected, and the machining area is divided into shallow and steep regions according to the distribution characteristics of the sampled point normal vectors. Second, a high-efficiency collision detection model based on GPU parallel acceleration is constructed. By discretizing the tool's attitude space, feasible machining directions are extracted globally, and the optimal cutting plane machining direction is obtained for the shallow region. Finally, cutting paths are generated using the cutting plane method for both the shallow and steep regions. Combining the feasible direction domain of the path points, the TSP global optimization algorithm is used to construct a tool lifting path generation model with minimum idle travel time under the constraint of the feasible domain of tool attitude, thereby achieving synergistic optimization of machining efficiency and surface quality.

[0167] This application's technical solution determines the optimal mounting direction and divides shallow and steep regions through two-stage clustering. Combined with topological defect handling, it avoids the residual material problem at the interface of curved surfaces in traditional piecewise machining. Simultaneously, collision detection accelerated by GPU parallelism significantly improves detection efficiency and accurately identifies potential collisions, overcoming overcutting and blind spots in shallow areas caused by collision detection limitations in four-axis machining. Furthermore, the cutting plane normal vectors are optimized for shallow and steep regions respectively, and cutting paths are generated. Combined with a forward and backward traversal algorithm to stitch atomic segments, path continuity is ensured. Adaptive path encryption dynamically adjusts the interval, resulting in more uniform machining area coverage and effectively ensuring that residual height meets preset constraints. Optimizing the tool lift-off rapid traverse line based on the TSP algorithm reduces idle travel time and improves machining efficiency. The overall solution is adaptable to the complex geometric features of triangular mesh surfaces and can be extended to other CAD models, ensuring both machining quality and efficiency.

[0168] It should be noted that the terms "comprising" and "having," and any variations thereof, in the embodiments and drawings of this specification are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0169] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating integrated machining paths for triangular mesh surfaces, applied to end milling finishing on a five-axis CNC machine tool, characterized in that, Includes the following steps: S1. Based on the direction of the outward normal of the surface of the triangular mesh model, and combined with the travel parameters of the clamping mechanism of the five-axis CNC machine tool, the optimal clamping direction is determined by two-stage clustering. S2. Divide the shallow area and steep area according to the preset dividing angle, and process the topological defects after the division based on the end mill diameter parameter. S3. Construct a collision detection model based on GPU parallel acceleration, and obtain the set of feasible machining directions for each point on the model based on the geometric relationship between the ball end mill and the triangular mesh model; S4. For shallow and steep areas, the cutting path segment is generated based on the cross-plane method. The cross-plane normal vector of the shallow area is determined by optimization, and the cross-plane normal vector of the steep area is the mounting direction. The length of the path segment is matched with the end mill feed rate. S5. Based on the feasible direction domain of the endpoints of the path segment, the optimal tool lifting rapid traverse line is generated by combining the traveling salesman problem optimization algorithm, and the tool lifting height meets the safety stroke requirements of the five-axis CNC machine tool. S6. An adaptive path densification method based on geometric projection is used to adjust the dynamic interval to meet the surface roughness requirements corresponding to the preset residual height. The dynamic interval h of the adaptive path densification is... adjusted The distance should be no less than the minimum step distance of the end mill and no greater than the maximum allowable interval of the machine tool's rotary axis travel, ultimately forming an integrated machining path.

2. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, The two-stage clustering described in step S1 specifically includes: Phase 1: Calculate the normal vector of each triangular facet and use it as a 3D data point. Classify the data using the k-means clustering algorithm. Determine the optimal cluster through a feature evaluation function. This feature evaluation function is used to quantify the comprehensive performance of the cluster to match the clamping stability of the five-axis CNC machine tool. The expression is s = μ·S - γ·Γ, where S is the average distance from the data point within the cluster to the cluster center, i.e., the intra-cluster similarity, Γ is the number of data points in the cluster, and μ and γ are weighting coefficients. The direction corresponding to the center point of the optimal cluster is the clamping direction. The second stage: For the triangular facets corresponding to the optimal cluster, perform secondary clustering according to their height in the clamping direction, and select the cluster with the lowest average height as the model base. The base area is not less than the minimum clamping area of ​​the five-axis CNC machine tool table.

3. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, The topological defect processing described in step S2 includes: deleting isolated shallow shoal sub-regions with an area smaller than a set threshold and classifying them into steep regions; For holes within the shoal area, adjacent facets are absorbed through multiple rounds of boundary expansion, including: establishing an adjacency index for each candidate triangular facet. This index is used to determine the degree of association between the candidate facet and the current shoal area to ensure processing continuity, and its expression is: Where E f R is the set of triangular faces that are adjacent to at least one point of a candidate face; when η f When the value is ≥0.5, candidate patches are merged into the current shoal region until no further expansion is possible.

4. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, The collision detection model construction process in step S3 includes: decomposing the ball end mill into a cylindrical segment, a frustum segment, and a hemispherical cutter head. The geometry is represented as the Boolean intersection of a quadratic surface and a half-space, where the diameter of the cylindrical segment is equal to the nominal diameter of the end mill. For the frustum, its internal region expression is H1∩(H2∩H3), where H1 is the region enclosed by the conical surface on the side of the frustum, H2 is the downward half-space intercepted by the bottom surface of the frustum, and H3 is the upward half-space intercepted by the bottom surface of the frustum. Collision detection is reduced to the emptiness of the decision set Ω=(H1∩(H2∩H3))∩T, which is used to determine whether the ball end mill collides with the workpiece surface represented by the triangle, where T is the set of points inside the triangle including the boundary. Vulkan is used as the GPU programming interface, and the collision detection algorithm is written as a computation shader, which is executed in parallel by the GPU. Each thread processes one triangle, and the detection result is directly output to the toolpath planning module of the five-axis CNC machine tool.

5. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, Step S4, which involves generating the cutting path segment based on the cross-section method, includes: generating a set of parallel cross-sections with the same normal vector, calculating their intersection with the region surface (i.e., the contour line), and determining the initial value of the cross-section spacing based on the end mill radius and the preset residual height; discretizing the contour line into atomic segments according to the preset atomic segment length; splicing atomic segments through reachability analysis: the reachable direction domain of an atomic segment is a set of collision-free tool directions, consisting of several continuous intervals of reachable direction sectors; using a discretization sampling strategy, collision detection is performed at 5° intervals within the constrained direction domain, and reachable direction sector intervals are constructed through connectivity; splicing the reachable direction sectors of adjacent atomic segments based on a forward and backward traversal algorithm, wherein the forward and backward traversal algorithm includes backward traversal and forward traversal, and is optimized using a heuristic strategy: when multiple reachable direction sectors of the next atomic segment can overlap with the currently traversed reachable direction sectors, the reachable direction sector with the largest range is selected; after the forward and backward traversal is completed, the largest representative reachable direction sector among the remaining atomic segments is taken as the starting point.

6. The integrated machining path generation method for triangular mesh surfaces according to claim 5, characterized in that, The specific steps of the forward and backward traversal algorithm include: The backward traversal includes: starting from the first atomic segment, traversing the subsequent atomic segments in turn, for each current atomic segment's reachable direction sector, filtering the reachable direction sectors in the next atomic segment that overlap with it, if there are multiple overlapping reachable direction sectors, selecting the reachable direction sector with the largest range as the connecting sector, until the last atomic segment is traversed or no overlapping sectors can be found. Forward traversal includes: starting from the last atomic segment, traversing the preceding atomic segments in turn, and for each current atomic segment's reachable direction sector, filtering out reachable direction sectors that overlap with it in the preceding atomic segments. If there are multiple overlapping reachable direction sectors, select the reachable direction sector with the largest range as the connecting sector, until the first atomic segment is reached or no overlapping sector can be found. If neither forward nor backward traversal covers all atomic segments, select the atomic segment representing the largest reachable sector from the remaining unconnected atomic segments as the new starting point, and repeat the above backward and forward traversal process until all atomic segments are connected or it is confirmed that they cannot be connected.

7. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, The optimization and determination of the cross-sectional plane normal vector in step S4 specifically includes: constraining the candidate cross-sectional plane normal vectors to a plane orthogonal to the average normal vector of the shallow water area; generating a candidate direction set at 5° intervals, the candidate direction set needing to match the rotary axis travel range of the five-axis CNC machine tool; excluding candidate directions where the representative reachable direction sector is 0; calculating the average value of the representative reachable direction sector size of the discrete sampled atomic segments corresponding to the remaining directions; and selecting the direction with the largest average value as the optimal cross-sectional plane normal vector.

8. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, Step S5, which generates the optimal tool lift-off rapid traverse line based on the traveling salesman problem, includes: calculating the transfer length between endpoints of the path segment: the transfer length between endpoints on the same path is 0; for endpoints on different paths, if there is no collision during a straight-line transfer, the length is the straight-line distance. The tool posture is generated using a spherical linear interpolation algorithm, and the posture change rate does not exceed the maximum rotary feed speed of the five-axis CNC machine tool; otherwise, it is the tool lift-off transfer length, which includes the distance the tool lifts from the starting point along the tool axis to the safe spherical projection point, the shortest distance between the two projection points along the spherical geodesic, and the sum of the distance from the endpoint projection point down along the tool axis to the endpoint. The radius of the safe spherical surface is... Slightly larger than the radius of the model's maximum outer sphere; construct a complete graph with the endpoints of the path segments as vertices, introduce virtual nodes to construct an extended graph, and transform open paths into Hamiltonian cycles; adopt a weight adjustment strategy to ensure that all necessary edges are traversed, where the weight expression of the adjusted necessary edges is N = -(mn)M, where m is the number of nodes in the extended graph, n is the number of necessary edges, and M is the maximum weight of the edges in the extended graph, which is used to ensure that the optimal solution traverses all necessary edges; solve the Traveling Salesman Problem using the Christofides heuristic algorithm, and output the solution in a G-code instruction format recognizable by a five-axis CNC machine tool.

9. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, The adaptive path encryption dynamic interval adjustment formula described in step S6 is used to adjust the intersecting plane interval according to geometric features to match the cutting capability of the end mill. The expression is h′=h·sinθ, where h is the preset interval, θ is the angle between the normal of the intersecting plane and the normal of the triangular facet, and θ must meet the travel range of the five-axis machine tool rotary axis, and h′ is the actual interval of the next intersecting plane. The actual interval is not less than the minimum step distance of the end mill. The actual interval of the next cross-section is determined in the following manner: Let the preset interval be h, the normal of the current cutting plane be m, and the set of indices of the triangular facets intersecting the cutting plane be T, determined by the geometric intersection algorithm, with the normal of each triangular facet being n. i ,i∈T; Calculate the angle θ between the normal of each triangular facet and the normal of the cutting plane. i =arccos(m·n i ); Take the minimum value of the sine of all included angles (min) i∈T {sinθ i } The actual interval of the next cutting plane is h. adjusted =h·min i∈T {sinθ i }; The geometric intersection algorithm includes: for each triangular facet, determining whether it has an intersection line with the cutting plane, that is, whether the facet vertices are distributed on both sides of the cutting plane; if an intersection line exists, then the facet is added to set T.

10. The integrated machining path generation method for triangular mesh surfaces according to claim 1, characterized in that, The initial path interval corresponding to the residual height constraint is calculated using the formula. This formula is used to back-calculate the initial path interval based on the residual height requirement to meet the surface roughness of the machined surface. Here, h is the initial path interval, R is the minimum radius of curvature of the model surface, r is the tool radius, s is the given residual height, and α is the correction coefficient. The calculation result needs to match the minimum pulse equivalent of the five-axis CNC machine tool.