Automatic corner cleaning driving curve biasing method based on enhanced pca

CN122732437APending Publication Date: 2026-09-11ACAD OF MATHEMATICS & SYSTEMS SCIENCE - CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610980255.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-02
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

[0002]在随着现代制造业的持续发展,数控(CNC)加工已成为精密制造的核心技术,刀具路径规划作为计算机辅助制造(CAM)阶段的基础性技术,直接决定了工件的最终加工质量与效率,刀具路径规划通常包含粗加工、半精加工和精加工三个主要阶段,各阶段分工协作,最终保证工件达到设计规定的形状和表面质量;在精加工阶段存在一个至关重要的子过程,角落清理(Corner Cleaning),该过程专门用于去除前序加工操作遗留的残余材料,残余材料的产生根源在于刀具与工件之间的几何约束:以球头铣刀为例,其球形几何形状无法完全去除尖角处的材料(如图1所示),同样,直径超过槽宽的刀具无法深入槽内从而留下残余材料,在多轴加工中不当的刀具姿态同样可能造成刀具无法到达角落处的残余材料;尽管角落清理在数控加工中不可或缺,但该领域长期面临两大核心挑战:一是理论缺失,学术界对角落清理加工的专项研究极为有限,商业CAM软件(如PowerMill、UG等)通常仅依赖描述性定义,缺乏创新性的理论表达和建模框架,实践中角落清理区域的识别仍严重依赖人工操作,距离完全自动化仍有较大差距

Benefits of technology

[0034] In this technical solution, the corner cleaning area is automatically delineated through residual height analysis, and the maximum safe tool radius is calculated based on the local principal curvature. This enables automated matching between the corner cleaning area and the tool specifications. Furthermore, by combining the enhanced PCA bi-objective optimization model, the maximization of point cloud distribution variance and the consistency of vector field direction are organically combined. This allows the optimal driving curve direction to be solved to take into account both the overall geometric direction of the area and the maximum machining strip width. Compared to relying solely on manual experience or standard PCA methods, this significantly reduces the number of tool passes, improves the coverage efficiency of a single path, and shortens idle time, thereby effectively improving the overall machining efficiency of corner cleaning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122732437A_ABST
    Figure CN122732437A_ABST
Patent Text Reader

Abstract

The application discloses a kind of corner cleaning driving curve automatic biasing methods based on enhanced PCA, comprising: input workpiece surface, antecedent machining path set, antecedent tool radius and residual height constraint;According to residual height analysis, the Boolean difference set of workpiece surface and antecedent machining complete sweep area is used as corner cleaning area;According to the local principal curvature of the area, the maximum safe tool radius is calculated;Optimal driving curve direction is automatically calculated using enhanced PCA method, and original driving curve is generated based on area point cloud;Multiple sets of biasing curves are generated by point-by-point biasing of driving curve;Self-intersection elimination and critical point pruning are performed on all biasing curves, to obtain independent path segments without self-intersection;The pruned path segments are verified by greedy nearest connection, and the tool path with smooth and continuous tool contact points without self-intersection is output.The application can automatically generate corner cleaning tool path without human interaction, effectively avoid path intersection defects, and improve machining efficiency and surface quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of CNC machining technology, and in particular to an automatic offset method for corner cleaning drive curves based on enhanced PCA. Background Technology

[0002] With the continuous development of modern manufacturing, CNC machining has become a core technology in precision manufacturing. Toolpath planning, as a fundamental technology in the Computer-Aided Manufacturing (CAM) stage, directly determines the final machining quality and efficiency of the workpiece. Toolpath planning typically includes three main stages: roughing, semi-finishing, and finishing. Each stage works collaboratively to ensure that the workpiece achieves the designed shape and surface quality. A crucial sub-process exists in the finishing stage: corner cleaning. This process is specifically designed to remove residual material left over from previous machining operations. The root cause of residual material lies in the geometric constraints between the tool and the workpiece. For example, the spherical geometry of a ball end mill cannot completely remove material from sharp corners (such as…). Figure 1 As shown in the diagram, similarly, tools with a diameter exceeding the groove width cannot penetrate deep into the groove, leaving residual material. In multi-axis machining, improper tool orientation can also prevent the tool from reaching residual material in corners. Although corner cleaning is indispensable in CNC machining, this field has long faced two core challenges: First, a lack of theoretical framework. Specialized research on corner cleaning in academia is extremely limited. Commercial CAM software (such as PowerMill and UG) typically relies only on descriptive definitions, lacking innovative theoretical expressions and modeling frameworks. In practice, the identification of corner cleaning areas still heavily relies on manual operation, and there is still a significant gap from full automation. Second, path generation is difficult. Although the drive curve offset strategy is the mainstream method in industry to ensure path uniformity, commercial CAM software still relies on manual selection of drive curves, lacking theoretical efficiency optimization. Furthermore, the self-intersection problem generated during the offset process is not adequately handled, resulting in low path quality. Summary of the Invention

[0003] This specification provides an embodiment of an automatic biasing method for corner cleaning drive curves based on enhanced PCA to solve at least one of the technical problems mentioned above.

[0004] To solve the above-mentioned technical problems, the embodiments in this specification are implemented as follows:

[0005] According to an embodiment of the present invention, an automatic offset method for corner cleaning drive curves based on enhanced PCA is provided for CNC machining corner cleaning toolpath generation, including:

[0006] S1, Input the 3D design surface of the workpiece to be processed. Pre-processing path set Preceding tool radius Preset residual height constraint on the machined surface Wherein, the workpiece surface The set of preceding machining paths refers to the surface of the CAD model of the workpiece to be processed. The preceding tool radius is the spatial trajectory curve actually swept by the tool in the previous roughing or semi-finishing process. The radius of the ball end mill used in the previous operation; the residual height constraint This is the maximum allowable residual height value on the surface of the workpiece after processing, which is preset by the processing quality requirements;

[0007] S2, based on residual height analysis, detect the corner cleaning area. The corner cleaning area For the workpiece surface Complete sweep area with previous processing Boolean difference set;

[0008] S3, based on the optimal tool selection criterion, and according to the corner cleaning area Calculation of maximum safe tool radius based on local principal curvature The maximum safety tool radius In order to be able to enter the corner cleaning area The maximum radius value of the ball end mill that reaches the deepest point without interfering with the workpiece, which is used to select the actual machining tool for this corner clearing operation from the standard tool library;

[0009] S4, uses an enhanced PCA method to automatically calculate corner cleaning areas. Optimal driving curve direction ;

[0010] S5, Generate the original driving curve based on the point cloud of the clear corner region and the direction of the optimal driving curve. ;

[0011] S6, for the driving curve Perform point-by-point offsetting to generate multiple sets of offset curves. Continue until all points on the offset curves fall within the complete sweep region. until;

[0012] S7, for all bias curves Perform self-crossing elimination and critical point pruning to obtain independent path segments without self-crossing;

[0013] S8 performs connection verification on the pruned independent path segments, and merges the path segments that meet the conditions using a greedy nearest-neighbor connection strategy, outputting a smooth and continuous tool path with no self-intersections; the tool path is a set of ordered tool contact points (CC points), which is directly input into the CNC machine tool to drive the ball end mill along the workpiece surface. Movement, using physical methods to remove corner cleaning areas The residual material in the final workpiece surface ensures that the residual height constraint is met. Design requirements.

[0014] In some alternative implementations, step S2 detects the corner cleaning area. The implementation steps are as follows:

[0015] S21, for each path in the path set The path spacing is calculated using the ball end mill residual height model. Calculation formula:

[0016] In the formula: The radius of curvature of the workpiece surface along the offset direction; The radius of the preceding tool; For residual height constraints; For the first Path in parameters The path spacing at the location, the path spacing This is the vertical distance between two adjacent preceding processing paths;

[0017] S22, for path Define geometric elements: outward normal vector of a surface Path tangent vector Bias direction vector , where the symbol This is a vector cross product operation; the outward normal vector of the surface. The path tangent vector is the unit normal pointing from the inside of the workpiece material to the outside. For the tool along the path The unit tangent in the direction of travel, the offset direction vector It is the direction that is perpendicular to both the path tangent and the surface normal, that is, the offset direction of adjacent toolpaths on the surface;

[0018] S23, Solution Path The corresponding two residual height standard area boundary scanning curves and In each parameter The following conditions must be met:

[0019]

[0020] In the formula: This is a vector pointing from the path point to the curve points in the positive direction; This is the vector that scans the curve points from the path point in the negative direction. The positive direction scanning curve; The curve is scanned in the negative direction; The bias direction vector; The path tangent vector;

[0021] S24, Construct the local scan region corresponding to a single path. ,formula:

[0022]

[0023] In the formula: The sweep interval parameter takes values ​​from 0 to... ; For the first The local scan area corresponding to each path; the local scan area For only along the path After one machining operation, the workpiece surface The residual height does not exceed the residual height constraint. The strip-shaped curved surface region formed by all the points;

[0024] S25, the complete scan area is obtained by taking the union of all local scan areas. ,formula:

[0025]

[0026] In the formula: This represents the total number of preceding processing paths; The complete swept area; the complete swept area For all preceding processing paths After machining, the workpiece surface The residual height does not exceed the residual height constraint. The sum of the surface regions formed by all the points;

[0027] S26, Perform a Boolean difference between the workpiece surface and the complete swept area to obtain the corner cleaning area. ,formula:

[0028]

[0029] In the formula: For point Euclidean distance to the path point; The corner cleaning area, the corner cleaning area For the workpiece surface All preceding processing paths failed to make its residual height meet the residual height constraint. The required set of points;

[0030] S27, clean the corner area Decomposed into multiple independent connected components of the sub-regions to be processed, formula:

[0031]

[0032] In the formula: This represents the total number of connected components. For the first A connected component, the connected component Clean the corner area Independent subregions that are not connected to each other, each connected component For each independent corner clearing machining task, separate drive curves and offset toolpaths are generated.

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

[0034] In this technical solution, the corner cleaning area is automatically delineated through residual height analysis, and the maximum safe tool radius is calculated based on the local principal curvature. This enables automated matching between the corner cleaning area and the tool specifications. Furthermore, by combining the enhanced PCA bi-objective optimization model, the maximization of point cloud distribution variance and the consistency of vector field direction are organically combined. This allows the optimal driving curve direction to be solved to take into account both the overall geometric direction of the area and the maximum machining strip width. Compared to relying solely on manual experience or standard PCA methods, this significantly reduces the number of tool passes, improves the coverage efficiency of a single path, and shortens idle time, thereby effectively improving the overall machining efficiency of corner cleaning.

[0035] Secondly, the technical solution of this application adopts a point-by-point offset strategy based on the original driving curve, combined with a self-intersection detection indicator function based on the geodesic distance between the k-th offset curve and the 0th original driving curve. This can accurately identify self-intersection regions caused by excessive local curvature or sharp corner folding during the offset process. Furthermore, it utilizes a bisection method with adaptive tolerance to iteratively solve for critical points, precisely trimming the self-intersection parts to a non-self-intersection state. This ensures that all offset paths are simple, non-self-intersection curves, effectively avoiding tool vibration, overcutting, or surface scratches caused by path overlap or reverse tool movement, thus improving the geometric integrity and surface finish of the machined surface. Thirdly, by using a greedy proximity connection strategy to automatically splice the broken path segments after trimming and setting endpoint distance threshold constraints, discrete independent path segments can be reorganized into continuous, smooth, long-range toolpaths. This reduces the number of frequent tool lifts, moves, and idle passes during machining, not only reducing machining time but also avoiding impact wear on the tool and spindle caused by frequent start-stop cycles, extending tool life. Finally, the entire method constructs driving curves based on point cloud data, is compatible with multiple CAD expression formats, and requires no manual intervention throughout the process. It forms a complete closed loop from area detection, tool selection, direction optimization, offset coverage, self-intersection reduction to path connection. In comparative experiments with multiple different geometric shapes and real machining verification, it has shown superior area detection integrity, path continuity and machining stability compared to the commercial CAM software PM24. Attached Figure Description

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

[0037] Figure 1 This diagram illustrates the residual material generated when machining a sharp corner with a ball end mill, showing the toolpath, the cross-section of the sharp corner, and the geometric relationship between the ball end mill and the workpiece. The red area represents the residual material at the root of the sharp corner that has not been removed.

[0038] Figure 2 The overall flowchart of the method in this application shows the four core steps in sequence: detecting corner cleanup areas after inputting the model, enhancing PCA to generate driving curves, point-by-point offsetting and self-intersection elimination, and connection verification and path output.

[0039] Figure 3 The diagram shows the geometric relationship between the preceding path and the two scanning curves on either side. The area between the two scanning curves is the local scanning area that satisfies the residual height constraint.

[0040] Figure 4 The diagram compares three driving curve direction strategies, from left to right: standard PCA, pure vector field, and enhanced PCA of this application, visually demonstrating the superiority of enhanced PCA in direction selection.

[0041] Figure 5 The schematic diagram for generating the driving curve illustrates the complete process from projecting the point cloud onto the driving line and then generating the final driving curve point array.

[0042] Figure 6 The diagram illustrates the phenomenon of self-intersection. (a) shows the self-intersection of a smooth curve with offset, and (b) shows the self-intersection of a broken line with offset. The blue line represents the original curve, and the red line represents the offset curve, demonstrating two typical cases of self-intersection occurring during the offset process.

[0043] Figure 7 The flowchart for path smoothing shows the complete process from drive line offset, through self-intersection elimination, critical point trimming, connection verification, and finally output of a smooth toolpath.

[0044] Figures 8 to 10 The figures show the comparative results of three experimental cases, comparing the path generation quality of the method in this application with that of the commercial software PM24 in workpieces with different geometric shapes.

[0045] Figure 11 The images show the actual machining verification results, demonstrating the application effect of the method in actual CNC machining and verifying the practicality and reliability of the method. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of one or more embodiments of this specification.

[0047] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another.

[0048] This application relates to the field of CNC machining technology, and more particularly to an automatic offset method for corner cleaning drive curves based on enhanced PCA. In the field of CNC machining of complex curved surfaces, after the preceding large tool completes the machining of the main body of the curved surface, unmachined material is usually left in areas such as concave corners and narrow grooves, requiring the use of small-diameter tools to perform corner cleaning. The quality of the generated corner cleaning toolpath directly determines the machining efficiency and workpiece surface quality. Existing methods generally rely on manual specification of the drive direction, and path offset is prone to self-intersection defects, making it difficult to balance automation and machining accuracy. To solve the above problems, this invention proposes an automatic offset method for corner cleaning drive curves based on enhanced PCA, applied to the corner cleaning path generation module of CNC machining CAM software. By automatically defining the corner cleaning machining range through residual height analysis, and combining the enhanced PCA algorithm to automatically optimize the drive curve direction, a complete corner cleaning toolpath is generated through point-by-point offset, self-intersection trimming, and path splicing. The entire process requires no manual interaction and can directly output a tool contact path that meets the requirements of CNC machining.

[0049] The corner cleaning method proposed in this application has three major contributions: First, theoretical completeness. Starting from the construction of rigorous mathematical definitions, a complete theoretical framework for corner cleaning is established, including the formal definition of the corner cleaning region and the optimal tool selection criterion, ensuring theoretical integrity. Second, application robustness. Based on point cloud construction of driving curves, it is compatible with multiple CAD expression formats. Experimental results show that the proposed method is significantly superior to the widely used commercial CAM software PowerMill 2024 in terms of robustness. Third, path smoothness. The self-intersection elimination and critical point trimming algorithms ensure the generation of self-intersection-free, smooth and continuous tool paths, effectively improving surface machining quality.

[0050] The technical solution of this application will be described in detail below with reference to the accompanying drawings.

[0051] Figure 1 This diagram illustrates the residual material generated when the ball end mill is used to machine a sharp corner, as described in this application. The red area represents the unremoved residual material. The diagram shows the toolpath, the cross-sectional view at the sharp corner, the geometric relationship between the ball end mill and the workpiece. The spherical geometry of the ball end mill cannot completely remove the material at the sharp corner, thus leaving residual material at the root of the sharp corner. Figure 2 The overall flowchart of the method in this application mainly includes four sequential steps: after inputting the model, corner cleaning areas are detected and detected based on residual height analysis; the optimal driving curve is automatically calculated and generated based on the enhanced PCA method; the driving curve is offset point by point to complete area coverage and self-intersection elimination; and a smooth and continuous final toolpath is output through connection verification and critical point trimming. Figure 3 This is a geometric schematic diagram of the scanning curve, showing the positional relationship between the preceding path and its corresponding two scanning curves. The area between the scanning curves is the local scanning region that satisfies the specified residual height constraint. Figure 4The diagram shows a comparison of three driving curve direction strategies. From left to right, they are the standard PCA method, the pure vector field method, and the enhanced PCA method proposed in this application. This visually demonstrates the superiority of enhanced PCA in direction selection. Figure 5 The diagram illustrates the entire process from point cloud projection to driving straight lines and finally to the generation of a series of driving curve points. Figure 6 The diagram illustrates the self-crossing phenomenon, where (a) shows the self-crossing case with a smooth curve offset and (b) shows the self-crossing case with a broken line offset. The blue line represents the original curve and the red line represents the offset curve, illustrating two typical cases of self-crossing during the offset process. Figure 7 This is a schematic diagram of the path smoothing process, showing the complete process from drive line offset to self-intersection elimination, critical point trimming, connection verification, and finally output of a smooth toolpath. Figures 8 to 10 The diagram shows the comparison results of various experimental cases, comparing the path generation effects of the method in this application and PM24 in three different cases. Figure 11 The diagram shows the actual machining verification results, illustrating the application effect of the method in actual CNC machining.

[0052] This application provides an automatic offset method for corner cleaning drive curves based on enhanced PCA, used for CNC machining corner cleaning toolpath generation, including the following steps S1 to S8.

[0053] Step S1: Input the 3D design of the workpiece surface of the part to be processed. Pre-processing path set Preceding tool radius Preset residual height constraint on the machined surface .

[0054] Among them, the workpiece surface This refers to the CAD model surface of the workpiece to be processed, which serves as the foundational geometric object for all subsequent geometric calculations and path planning. It also includes the set of preceding machining paths. This set represents the spatial trajectory curve actually swept by the tool in the previous roughing or semi-finishing operation, and each path in this set... It can be in the form of a continuous curve parameter or a discrete index of G01 points, depending on the format of the preceding machining data. (Previous tool radius) This is the radius of the ball end mill used in the previous operation. This parameter is an important input for subsequent residual height analysis and path spacing calculation. Residual height constraint. This is the maximum allowable residual height value on the surface of the workpiece after processing. This value is preset by the processing quality requirements, and its value directly affects the calculation of subsequent path spacing and the delineation range of the corner clearing area.

[0055] In CNC machining, the point where the cutting surface of the tool tip contacts the machined surface is called the cutter contact point (CC point). The CC point is the reference point describing the geometric relationship between the tool and the workpiece, and all geometric calculations in toolpath planning are based on the CC point. The final toolpath output by this application is a series of ordered CC points.

[0056] After a curved surface is machined, tool marks remain, forming a tiny wavy profile. The height of the highest point between adjacent toolpaths is called the residual height. The residual height directly reflects the surface quality after machining: a smaller residual height results in a smoother surface, but the total toolpath length increases, reducing machining efficiency. Therefore, reasonable constraints must be set for the residual height. To improve machining efficiency, the path spacing should be increased as much as possible while meeting constraints. For ball end mill machining, the path spacing... With residual height constraint The relationship is determined by the following formula, which is derived from the classic ball end mill residual height geometry model. Given the residual height constraint and surface curvature, the reasonable path spacing can be calculated:

[0057]

[0058] in, Let be the radius of curvature of the workpiece surface along the offset direction. The radius of the preceding tool. For the first Path in parameters The path spacing is the vertical distance between two adjacent preceding processing paths.

[0059] In the actual operation of a CNC machine tool, the tool moves in the form of discrete interpolation points (polyline segments), rather than continuously along a theoretical curve. The maximum deviation of the polyline segment from the parametric curve is the chord error. Its calculation formula is:

[0060]

[0061] in, Let be the curvature of the curve at that point. The chord length between adjacent sampling points. This represents the bow height error, i.e., the maximum deviation of the broken line segment from the parametric curve. A given maximum permissible bow height error is provided. The maximum sampling interval is:

[0062] The sampling interval decreases as the absolute value of curvature increases, meaning that regions with greater curvature are sampled more densely to ensure that the global bow height error does not exceed the constraint value. This bow height error constraint is used to calculate the sampling interval during subsequent discrete sampling of the driving curve.

[0063] Step S2: Detect and clean the corner area based on residual height analysis. Corner cleaning area For the workpiece surface Complete sweep area with previous processing The Boolean difference set. Step S2 is specifically implemented through the following sub-steps S21 to S27.

[0064] Step S21, for each path in the path set The path spacing is calculated using the ball end mill residual height model. Path spacing This represents the vertical distance between two adjacent preceding processing paths. A larger value results in higher preceding processing efficiency, but also increases the residual height. When the residual height exceeds the residual height constraint... This identifies the corner areas that need cleaning. The calculation formula is:

[0065]

[0066] In the formula: This is the radius of curvature of the workpiece surface along the offset direction, which reflects the degree of curvature of the workpiece surface along the offset direction at the current position; The radius of the preceding tool; For residual height constraints; For the first Path in parameters Path spacing at the location.

[0067] Step S22, for the path Define geometric elements: outward normal vector of a surface Path tangent vector Bias direction vector , where the symbol This is a vector cross product operation. The outward normal vector of the surface. The path tangent vector is the unit normal pointing from the inside of the workpiece material to the outside. For the tool along the path Unit tangential direction in the forward direction, offset direction vector It is the direction that is perpendicular to both the path tangent and the surface normal, that is, the offset direction of adjacent toolpaths on the surface.

[0068] Step S23, Solve the path The corresponding two residual height standard area boundary scanning curves and In each parameter The following conditions must be met:

[0069]

[0070] In the formula: This is a vector pointing from the path point to the curve points in the positive direction; This is the vector that scans the curve points from the path point in the negative direction. The positive direction scanning curve; The curve is scanned in the negative direction; The bias direction vector; This is the path tangent vector. Scan curve. and These represent the paths respectively. The left and right sides, and the distance from the path point are the path spacing. At halfway point, the residual height is exactly equal to the residual height constraint. The boundary curve. Geometrically, it means: only along the path After machining, the scanning curve is approximately located in the middle of adjacent toolpaths, defining the boundary where the residual height satisfies the constraint conditions. and The area between them satisfies the specified residual height constraint.

[0071] Step S24: Construct the local scan region corresponding to a single path. The formula is:

[0072]

[0073] In the formula: The sweep interval parameter takes values ​​from 0 to... ; For the first The local scan region corresponding to each path. Local scan region. For only along the path After one machining operation, the workpiece surface The residual height does not exceed the residual height constraint. The band-shaped curved surface region formed by all the points, i.e. Figure 3 As shown in the blue area.

[0074] Step S25: Take the union of all local scan areas to obtain the complete scan area. The formula is:

[0075]

[0076] In the formula: This represents the total number of preceding processing paths; For the complete sweep area. Complete sweep area For all preceding processing paths After machining, the workpiece surface The residual height does not exceed the residual height constraint. The sum of all points forming the surface region represents the entire surface region that satisfies the residual height constraint after all previous machining operations are completed.

[0077] Step S26: Perform a Boolean difference between the workpiece surface and the complete swept area to obtain the corner cleaning area. The formula is:

[0078]

[0079] In the formula: For point Euclidean distance to the path point; Clean up corner areas. For the workpiece surface All preceding processing paths failed to make its residual height meet the residual height constraint. The set of required points, that is, the area where the residual height constraint cannot be met by the previous machining, is also the target area that needs to be cleared with a smaller tool. That is, the area that the previous large tool cannot enter due to geometric interference, and a ball end mill with a smaller diameter needs to be used for supplementary machining.

[0080] Step S27, clean the corner area. Decomposed into multiple independent connected components of the sub-regions to be processed, as shown in the formula:

[0081]

[0082] In the formula: This represents the total number of connected components. For the first Connected components. Clean the corner area Independent subregions that are not connected to each other, each connected component For each independent corner clearing machining task, separate drive curves and offset toolpaths are generated.

[0083] The corner cleaning area detection process in step S2 above can be uniformly implemented by Algorithm 1. Algorithm 1 is a corner cleaning area detection algorithm, and its input includes the workpiece surface. Pre-processing path set Preceding tool radius and residual height constraints The algorithm first processes each path in the path set. The corresponding path spacing is calculated using formula (1). Subsequently, based on the path spacing and the geometric information of the path itself, two scanning curves corresponding to the path are calculated, denoted as follows: and These two scan curves are used to characterize the boundary positions where the residual height exactly satisfies the constraints after processing along the current path. After obtaining the scan curves, the algorithm constructs the current path. Corresponding local scan area The local scan region is defined as: when the sweep interval parameter... From 0 to At that time, all located on the scanning curve or On the workpiece surface points The union of all local scan regions. After performing the above operation on each path, the union of all local scan regions is taken to obtain the complete scan region. The complete scan area represents the entire range of surfaces whose residual height satisfies the constraints after all preceding machining operations are completed. Next, the algorithm calculates the difference between the workpiece surface and the complete scan area, i.e., the corner cleanup area. Finally, clean up the resulting corner areas. It is decomposed into several unconnected connected components, represented as ,in This represents the total number of connected components. The algorithm ultimately outputs the corner cleanup region. This serves as the target machining area for subsequent corner clearing toolpath planning. The input, output, and execution flow of Algorithm 1 are shown in the table below:

[0084] Algorithm 1: Corner Cleanup Area Detection

[0085] Algorithm 1: Detection of Corner Regions to be Cleaned Up Input: Workpiece surface Path set Preceding tool radius , residual height constraint For each set of paths : Calculate the path spacing using formula (1) Calculate the scan curve , Constructing a local scanning region Calculate the complete scan area Calculate the corner cleaning area Will Decomposed into connected components: Output: Corner cleanup area

[0086] Step S3: Based on the optimal tool selection criterion, clean the corner area. Calculation of maximum safe tool radius based on local principal curvature Maximum safety tool radius In order to access the corner cleaning area The maximum radius value of the ball end mill that reaches the deepest point without interfering with the workpiece is used to select the actual machining tool from the standard tool library for this corner clearing operation. Step S3 is specifically implemented through the following sub-steps S31 to S35.

[0087] Step S31, input the corner cleanup area point cloud. Engineering margin safety factor used to mitigate the risk of excessive curvature fluctuation. Among them, point clouds To clean the corner area The set of three-dimensional spatial points obtained by discrete sampling; safety factor This is used to introduce a safety margin based on the theoretical maximum tool radius, so as to avoid machining accidents caused by collision between the tool and the workpiece during actual machining.

[0088] Step S32: Traverse all sampling points in the point cloud and solve for the global minimum principal curvature. The formula is:

[0089]

[0090] In the formula: For point Minimum principal curvature at; It is the global minimum principal curvature; Clean up the point cloud in the corner area. Principal curvature. For the workpiece surface At point The degree of curvature along different directions, minimum principal curvature The larger the absolute value, the more severe the curvature of the surface at that point, and the stricter the restriction on the tool radius.

[0091] Step S33: The tool radius must satisfy the overcut constraint. The theoretically maximum allowable tool radius is calculated using the following formula:

[0092]

[0093] In the formula: This refers to the actual radius of the selected cutting tool; This is the theoretical minimum radius of curvature, i.e., the upper limit of the theoretical tool radius to prevent overcutting. The overcut constraint prevents the tool tip from fully entering the bottom of the concave corner when the tool radius exceeds the local radius of curvature at the concave corner, thus causing geometric interference with the workpiece. This constraint ensures that the selected tool can physically reach the corner cleaning area. The deepest part. Let's assume... Minimum principal curvature of the corner cleaning area, tool radius This constraint must be met to ensure that the blade tip can fully enter the concave area without overcutting.

[0094] Step S34: Introduce a safety factor to calculate the maximum safe tool radius. The formula is:

[0095]

[0096] In the formula: For safety factor; This is the maximum safe tool radius. This constraint ensures that the tool tip can fully enter the concave region without overcutting. To increase the safety margin, a safety factor is introduced. The actual maximum safe tool radius is obtained.

[0097] Step S35: Output the maximum safe tool radius. .

[0098] The tool radius decision process in step S3 above can be uniformly implemented by Algorithm 2. Algorithm 2 calculates the tool radius, and its input includes the point cloud of the corner clearing area. and safety factor Among them, the safety factor The range of values ​​is During the execution of this algorithm, it first traverses the point cloud of the corner clearing area. For all sampling points in the dataset, calculate the minimum principal curvature at each sampling point, denoted as [equation missing]. Then, take the absolute value of the minimum principal curvature at all sampling points, and select the global minimum value from them, denoted as . Its calculation formula is To obtain the global minimum principal curvature Then, the algorithm calculates the theoretical minimum radius of curvature. This value is the reciprocal of the absolute value of the global minimum principal curvature, and the calculation formula is: Subsequently, to increase the safety margin during machining and prevent overcutting between the tool and the workpiece, the algorithm introduces a safety factor. Multiplying the theoretical minimum radius of curvature by this safety factor yields the maximum safe tool radius. The calculation formula is: Finally, the algorithm outputs the calculated maximum safe tool radius. This serves as the basis for selecting tools in subsequent corner clearing processing. The input, output, and execution flow of Algorithm 2 are shown in the table below:

[0099] Algorithm 2: Tool Radius Calculation Input: Corner cleanup area point cloud Safety factor calculate Calculate the theoretical minimum radius of curvature: Introducing a safety factor: Output: Maximum safe tool radius

[0100] Optimal driving curve direction Let be a unit vector in three-dimensional space, used to determine the overall direction of the first toolpath in this corner clearing process, so that subsequent offset paths cover the entire corner clearing area. This process minimizes the number of tool passes and maximizes machining efficiency. Step S4 is specifically implemented through the following sub-steps S41 to S49.

[0101] The direction of the driving curve directly determines the scanning efficiency of the subsequent bias path, which is the innovation of this application. To achieve fully automatic and efficient optimization of the driving curve direction, this application proposes an enhanced principal component analysis method. Standard PCA only maximizes the variance of the point cloud distribution and finds the direction with the longest data, which may result in a smaller effective width for each pass; pure vector field direction only pursues the maximum width for each pass, but the driving curve may be very short, requiring more paths. Enhanced PCA organically integrates the two. Figure 4 The three driving curve direction strategies are compared from left to right: the standard PCA method, the pure vector field method, and the enhanced PCA method proposed in this application, which intuitively demonstrates the superiority of enhanced PCA in direction selection.

[0102] Step S41, input point cloud Maximum strip width vector field mean Weight Among them, the field mean of the maximum strip width vector. To clean the area in the corner Within, the average value of the direction vector that maximizes the machining bandwidth covered by each pass of the ball end mill; weight As a balance factor, it can typically be taken as 0.5 to 0.8, used to make a trade-off between the overall geometry of the region and the maximum bandwidth of a single pass.

[0103] Step S42, calculate the centroid of the point cloud. The formula is:

[0104] In the formula: This represents the total number of points in the point cloud. For the first point cloud Three-dimensional sampling points; The center of gravity of the dot cloud. Clean the corner area The geometric center is the point through which the driving line passes.

[0105] Step S43: Construct the point cloud covariance matrix The formula is:

[0106]

[0107] In the formula: This is the transpose of the point cloud deviation vector; Let this be the point cloud covariance matrix. for The real symmetric matrix is ​​given by eigenvectors representing the principal components of the point cloud distribution in different directions, and the corresponding eigenvalues ​​representing the degree of dispersion of the point cloud in that direction.

[0108] Step S44, construct the enhanced PCA bi-objective optimization objective function, the formula is:

[0109] In the formula: Let be the direction vector of the driving curve to be solved; In a three-dimensional real space; the first objective of optimization is to maximize the point cloud in... The variance of the direction distribution, minimize the second term. With the direction of the vector field The deviation. The physical meaning of bi-objective optimization is: the first term makes the direction of the driving curve align with the corner clearing area. The first objective aligns with the longest possible path to reduce the number of toolpaths; the second objective aligns the drive curve direction with the direction of maximum coverage in a single toolpath to improve machining efficiency per toolpath. The two objectives are linked by weights. Coordination is performed to ensure that the final driving curve direction has both global coverage efficiency and local processing efficiency.

[0110] Step S45: Transform the optimization problem into an equivalent matrix eigenvalue problem and construct an enhanced PCA matrix. It satisfies the characteristic equation:

[0111]

[0112] In the formula: To enhance the PCA matrix; The average direction of the vector field with the maximum strip width; For matrix Eigenvalues. Enhanced PCA matrix. Covariance matrix product with vector field The weighted sum integrates the point cloud geometric distribution information and processing efficiency information into the same matrix.

[0113] matrix It has the following beneficial properties:

[0114] Symmetry: As the sum of two symmetric matrices, a matrix... Maintaining symmetry. Due to the covariance matrix It is a real symmetric matrix. It is also a symmetric matrix, and the sum of the two is... The natural symmetry ensures that all eigenvalues ​​are real numbers and that the eigenvectors are orthogonal to each other, which facilitates the numerical calculation of subsequent eigenvalue decomposition.

[0115] Positive semidefiniteness of matrices It has positive semidefiniteness. For any non-zero vector ,have Among them, the covariance matrix It is a positive semi-definite matrix, therefore ;and It is always true. Therefore It is a positive semi-definite matrix with all non-negative eigenvalues, which guarantees that the objective function of the optimization problem has an upper bound in the feasible region, and that the maximum value must exist and can be obtained through eigenvalue decomposition.

[0116] Efficient solution: for matrices Perform standard feature decomposition After eigenvalues ​​are sorted in descending order Largest eigenvalue corresponding feature vector That is, the direction of the optimal driving curve. .because for For small-scale matrices, eigenvalue decomposition has extremely high computational efficiency and is suitable for real-time CAM systems.

[0117] Step S46, for the matrix The eigenvalue decomposition is performed using the following formula:

[0118]

[0119] In the formula: The eigenvector matrix; It is a diagonal matrix of eigenvalues.

[0120] Step S47: Sort the eigenvalues ​​in descending order to obtain... ,in These are the characteristic values ​​arranged in descending order.

[0121] Step S48: Select the largest eigenvalue corresponding unit eigenvector .

[0122] Step S49: Output the optimal driving curve direction ,in The unit eigenvector corresponding to the largest eigenvalue; This represents the direction of the optimal driving curve. This eigenvector represents the global optimal solution to the bi-objective optimization problem.

[0123] This application further provides an optimality guarantee theorem (Theorem 1: Optimality Guarantee). This theorem guarantees the eigenvector corresponding to the largest eigenvalue. It is the solution to the optimization problem, that is, through the matrix The direction obtained by the eigenvalue decomposition must be the global optimum of the biobjective optimization problem; there are no other directions that can obtain a larger objective function value. The proof is as follows:

[0124] Construct the Lagrange function using the Lagrange multiplier method ,in These are Lagrange multipliers. Let... The characteristic equation is obtained by rearranging. Therefore, the optimal direction Must be a matrix The eigenvectors of . And since for any unit eigenvector ,have Therefore, the objective function value equals the corresponding eigenvalue. To maximize the objective function, the eigenvector corresponding to the largest eigenvalue should be selected. Thus, the matrix... The eigenvector corresponding to the largest eigenvalue is the direction of the optimal driving curve for enhanced PCA. Q.E.D.

[0125] The enhanced PCA driving curve direction calculation process in step S4 above can be uniformly implemented by Algorithm 3. Algorithm 3 is for enhancing the PCA driving curve direction calculation, and its input includes: point cloud. ,in The total number of 3D sampling points in the point cloud; the maximum strip width vector field mean. ; and weight Its value is a fixed constant of 0.5. The algorithm first calculates the centroid of the point cloud. That is, for all sampling points The summation is followed by an average, calculated using the following formula: Subsequently, the algorithm constructs the covariance matrix of the point cloud. This matrix is ​​obtained by accumulating the deviation vector of each sampling point relative to the centroid. Transpose itself The product of the products, multiplied by the coefficient. The calculation formula is as follows: In obtaining the covariance matrix The algorithm then constructs an enhanced PCA matrix. This matrix is ​​composed of the covariance matrix. With weight Multiply by the mean of the maximum strip width vector Transpose itself The sum of the products is calculated using the following formula: Next, the algorithm enhances the PCA matrix. Perform standard eigenvalue decomposition to decompose it into an eigenvector matrix. eigenvalue diagonal matrix as well as inverse matrix The product form, i.e. After eigenvalue decomposition, the algorithm sorts all eigenvalues ​​in descending order to obtain... Then, the largest eigenvalue is selected from all eigenvectors. The corresponding unit eigenvector is denoted as Ultimately, the algorithm outputs this feature vector as the optimal driving curve direction, i.e. The algorithm outputs the direction of the driving curve. The input, output, and execution flow of Algorithm 3 are shown in the table below:

[0126] Algorithm 3: Enhanced PCA driving curve direction calculation Input: point cloud Maximum strip width vector field mean Weight Calculate the centroid of the point cloud: Construct the covariance matrix: Constructing an enhanced PCA matrix: Perform eigenvalue decomposition on C: Arrange the feature values ​​in descending order: Select the eigenvector corresponding to the largest eigenvalue Output: Direction of the driving curve

[0127] Step S5: Generate the original driving curve based on the point cloud of the clear corner region and the direction of the optimal driving curve. Original driving curve For the workpiece surface The ordered point sequence on the curve is the first reference toolpath for this corner clearing process. All subsequent offset toolpaths are generated by expanding outward from this curve. Step S5 is specifically implemented through the following sub-steps S51 to S59.

[0128] Step S51, input the point cloud of the clear corner area. Strengthen the main direction of PCA Average normal vector String error tolerance Expansion coefficient Average normal vector Clean the corner area The average value of the surface normal vectors at all points within the curve is used to project discrete points on the driving line onto the workpiece surface. Upper chord error tolerance This represents the maximum permissible chord height difference during toolpath discretization, used to control the approximation accuracy of the toolpath; the expansion factor. A positive number greater than 0 is used to extend the endpoints of the driving curve outward from the point cloud projection range to improve the coverage of the offset path on the region boundary.

[0129] Step S52, with the centroid of the point cloud With direction Construct driving line The formula is:

[0130]

[0131] In the formula: These are the free parameters of the line; To drive a straight line. (Drive a straight line) To pass through the center of gravity of the point cloud And the direction is A straight line in space is used to define the projection baseline of the driving curve.

[0132] Step S53: Clear all sampling points in the corner area. Projected onto driving line Above, determine the extreme parameters at both ends. and .

[0133] Step S54, using the expansion factor The formula for expanding the projection range is as follows:

[0134]

[0135] In the formula: These are the extreme parameters of the original projection range; These are the extreme parameters of the expanded projection range; This is the extension factor. An extension factor is introduced. Extending the endpoints appropriately can enhance robustness.

[0136] Step S55: Calculate the length of the expanded interval. The formula is:

[0137]

[0138] In the formula: This represents the length of the extended interval.

[0139] Step S56: Calculate the maximum sampling interval based on the bow height error constraint, and then calculate the number of sampling points. The formula for defining bow height error is:

[0140]

[0141] In the formula: Let be the curvature of the curve at that point; The chord length between adjacent sampling points; This refers to the bow height error, which is the maximum deviation of the broken line segment from the parametric curve. When a CNC machine tool approximates a theoretical curve using a polyline segment, the maximum distance between the midpoint of the polyline segment and the theoretical curve is considered. The smaller this value is, the higher the toolpath approximation accuracy, but the amount of toolpath file data increases accordingly.

[0142] The formula for the maximum sampling interval that satisfies the maximum allowable bow height error is:

[0143]

[0144] In the formula: This is the maximum permissible bow height error, i.e., the chord error tolerance; The maximum sampling interval is set to meet the bow height error constraint. The sampling interval decreases as the absolute value of curvature increases, meaning that the sampling density is higher in regions with greater curvature, to ensure that the global bow height error does not exceed the constraint value.

[0145] The formula for calculating the number of sampling points is:

[0146] In the formula: For integer operations; This represents the number of sampling points.

[0147] Step S57: Generate a uniformly distributed sequence of sampling points on the projection line, using the following formula:

[0148]

[0149] In the formula: For the first The parameter values ​​of each sampling point.

[0150] Step S58, the sampling points are averaged using the normal vector. Projected onto the workpiece surface The above yields the driving curve point sequence, and the formula is:

[0151]

[0152] In the formula: This is the projection step size; For the first One driving curve point. Driving curve point For the workpiece surface The three-dimensional coordinate points on the surface, and all driving curve points according to parameters The ascending order arrangement constitutes the driving curve. .

[0153] Step S59, output drive curve ,in This is a driving curve. The point cloud driving curve construction method is compatible with multiple CAD representation formats.

[0154] The driving curve generation process in step S5 above can be uniformly implemented by algorithm 4. Algorithm 4 is for driving curve generation, and its input includes: point cloud of the clear corner region. ,in The total number of 3D sampling points in the point cloud; enhance the principal direction of PCA. Average normal vector ; chord error tolerance ; and expansion coefficient The algorithm first uses the centroid of the point cloud Starting from the main direction of enhanced PCA Construct a driving straight line Its parametric equation is ,in These are the free parameters for the straight line. Then, the point cloud... All sampling points are projected onto the driving line Above, determine the parameter range of the projection point on the straight line, and denote its two extreme values ​​as follows: and Next, the algorithm utilizes the expansion coefficient. The projection range is expanded, and the minimum parameter value after expansion is obtained. and maximum parameter value Calculate using the following formulas respectively: , After expanding the projection range, the algorithm calculates the total length of the expanded parameter interval. Its calculation formula is This is the absolute value of the difference between the maximum and minimum parameter values ​​after expansion. Next, the algorithm calculates the number of sampling points based on the chord error constraint. The calculation formula is: ,in For the floor operation, To meet the chord error tolerance The maximum sampling interval under constraints. After determining the number of sampling points, the algorithm generates a uniformly distributed sequence of sampling points on the projected line, the th... Parameter values ​​at each sampling point Calculate using the following formula: That is, starting from the expanded minimum parameter value, it is gradually increased at equal intervals, generating a total of Each sampling point is then averaged along the surface normal vector. Direction projection onto the workpiece surface Above, the projected points of the curved surface Calculate using the following formula: ,in For the first The algorithm calculates the projection step size corresponding to each sampling point. Finally, it arranges all projected surface points sequentially into a driving curve point sequence and outputs the driving curve. . Figure 5 The diagram illustrates the entire process from point cloud projection to driving line generation and finally to the generation of the driving curve point sequence. The input, output, and execution flow of Algorithm 4 are shown in the table below:

[0155] Algorithm 4: Generation of Driving Curves Input: Point cloud of clear corner region Strengthen the main direction of PCA average normal vector String error tolerance Expansion coefficient With the center of gravity of the cloud With direction Construct driving line . All sampling points in the point cloud Projected onto driving line superior. Using the expansion factor Extended projection range Calculate the length of the extended interval Calculate the number of sampling points Generate uniformly distributed sampling points on the projection line. The sampling points are passed through the average normal vector. Projected onto workpiece superior Output drive curve

[0156] Step S6, for the driving curve Perform point-by-point offsetting to generate multiple sets of offset curves. Continue until all points on the offset curves fall within the complete sweep region. Up to this point. Offset curve To guide each point on the previous driving curve along the workpiece surface The new toolpath curve is obtained by moving the tangent plane by an offset distance, and the spacing between adjacent offset curves is constrained by the residual height. Together with the curvature of the local surface, it determines that the residual height between adjacent toolpaths does not exceed the preset residual height constraint. Step S6 is specifically implemented through the following sub-steps S61 to S70.

[0157] Step S61, input the original driving curve Initial bias direction vector set Bias index Complete sweep area .

[0158] Step S62, for the driving curve To determine closure, the formula is:

[0159]

[0160] In the formula: The closure determination threshold is typically set to the maximum safe tool radius. 1%; This is the tail point of the driving curve; This is the starting point of the driving curve. Closure judgment is used to determine the driving curve. Whether it is a closed curve or not depends on the bias strategy of closed curves and open curves. Closed curves require end-to-end connection processing.

[0161] Step S63, for the driving curve Each point on The unit tangent vector is calculated using the central difference method. The central difference method utilizes the current point adjacent points before and after and A numerical differential method for calculating the tangent vector based on the position difference.

[0162] Step S64: Calculate the two symmetric offset direction vectors using the right-hand rule. The formula is:

[0163]

[0164] In the formula: For the workpiece surface at point Outward normal vector at point; This is the cross product operation; For the first driving curve Unit tangent vector at each point; These are two symmetrically offset direction vectors. and Pointing to the drive curves respectively The left and right sides are used to alternately generate offset toolpaths in two directions to achieve corner cleaning. Two-way coverage.

[0165] Step S65, traverse all points Select the current bias direction; the formula is:

[0166]

[0167] Based on residual height constraints and local radius of curvature Calculate the current offset distance Generate bias point ,in For the current bias count, the initial drive curve corresponds to... ,Right now In the formula: This is a bias indicator; This represents the current bias count; For the first The point at the th The bias point after the second bias. Bias point For the point Along the offset direction Move by an offset distance The new points obtained afterward, and all the bias points form a new bias curve.

[0168] Step S66, Generate the bias path ,in This is the newly generated bias path.

[0169] Step S67: Add the bias path to the output path set and perform the assignment operation:

[0170]

[0171] In the formula: This is the set of output paths corresponding to the bias direction.

[0172] Step S68: Update the driving curve to the current bias path and perform the assignment operation:

[0173]

[0174] Step S69, alternately switch the bias index Repeat steps S65-S68 until all points on the offset curve fall within the complete swept area. Until then. Alternately switch bias indicators. This causes the toolpath to change from the drive curve. Starting from there, expand alternately to the left and right sides, ensuring the offset path clears the corner area. Uniformly distributed within; when all points on a certain bias curve have fallen into the complete swept region. When the value is zero, it indicates that the bias curve has exceeded the range that needs to be cleaned, and the biasing process terminates.

[0175] Step S70: Output the final set of bias paths. .

[0176] The offset toolpath generation process in step S6 above can be uniformly implemented by Algorithm 5. Algorithm 5 is for offset toolpath generation, and its input items include: drive curve. ,in The total number of points on the driving curve; the initial set of offset direction vectors. Two symmetrical offset directions are pre-calculated for each point on the driving curve; offset index This specifies the direction number used for the current bias operation; and the complete sweep area. The algorithm applies the algorithm to each point on the driving curve. Perform a traversal. For the currently traversed i... At each point, the algorithm first uses the bias index. The value is selected from the corresponding bias direction vector. The selection rule is: if Then take ;like Then take After selecting the offset direction, the algorithm further calculates the offset distance at the current point. And based on this offset distance, a new offset point is generated along the selected offset direction, denoted as... ,in This is the index for the current offset count. After generating the point-by-point offsets for all points on the driving curve, the algorithm organizes all the newly generated offset points into a complete offset path in their original order, denoted as . The algorithm then adds the newly generated bias path to the corresponding bias direction. In the set of output paths, perform assignment operations. This involves accumulating the new path into the output path set using a set union approach. Next, the algorithm updates the current driving curve with the newly generated bias path, using it as the baseline curve for the next bias operation, and performs the assignment operation. This involves replacing the original driving curve point set with the point set generated by the current offset. After completing the above update, the algorithm outputs the corresponding offset direction. The complete set of bias paths The input, output, and execution flow of Algorithm 5 are shown in the table below:

[0177] Algorithm 5: Offset Toolpath Generation Input: Driving curve Initial bias direction vector Bias index Complete sweep area for Select the bias direction Calculate the offset distance Generate bias point Generate bias path input Add the bias path to the output path. Update driver curve Output path

[0178] Step S7, for all bias curves Perform self-crossing elimination and critical point trimming to obtain independent path segments without self-crossing. Self-crossing elimination and critical point trimming are used to remove invalid path segments in the offset curves that self-cross or fold due to excessive local curvature, ensuring that each offset curve is a simple, smooth curve without self-crossing, thus avoiding tool vibration or overcutting of the workpiece surface caused by path intersections in actual machining. Step S7 is specifically implemented through the following sub-steps S71 to S77.

[0179] Self-intersection is unavoidable during the offset process. There are two main causes: the first is the case of a smooth curve, where the offset curve folds inward and self-intersects when the offset distance exceeds the local minimum radius of curvature; the second is the case of a broken line / non-smooth curve, where the offset curve also self-intersects at local sharp angles. Figure 6 The diagram illustrates the self-intersection phenomenon, where (a) shows the self-intersection of a smooth curve with offset, and (b) shows the self-intersection of a broken line with offset. The blue line represents the original curve, and the red line represents the offset curve.

[0180] Step S71, input the number to be processed. Offset curves , corresponding self-crossing status flag Maximum number of iterations Self-crossing status flag For each point on the bias curve Corresponding binary label, This indicates that the point is in a self-intersection region. This indicates that the point is in a non-self-intersecting region, and this marker is used to guide subsequent bisection positioning of critical points.

[0181] Step S72: Identify the two causes of self-intersection of the offset curves. For smooth curves, when the offset distance... When the local minimum radius of curvature is exceeded, the offset curve folds inward and self-intersects. The formula for the local minimum radius of curvature is:

[0182]

[0183] In the formula: For the curve in parameters Curvature at that point; This represents the local minimum radius of curvature. For polygonal / non-smooth lines, the offset curve will also self-intersect at local sharp angles.

[0184] Step S73, define the self-crossing detection indicator function. Used to determine the first Whether points on the bias curves intersect each other is determined by the function defined as:

[0185]

[0186] In the formula: For the first The first bias curve One point; The first on the original driving curve One point; for and The average path spacing between geodesic curves is determined by the average curvature of the geodesic curve. and residual height constraints The calculation shows that a function value of 1 indicates that self-intersection has occurred at the corresponding point, while a function value of 0 indicates that self-intersection has not occurred. Self-intersection detection indicator function. The physical meaning is: under normal bias conditions, the first Points on the bias curve To the original driving curve The geodetic distance should be approximately equal to The average path spacing is times the theoretical value; if this distance is less than the theoretical value This indicates that the bias curve is at point Inward folding occurred at that point, which means self-crossing occurred.

[0187] Step S74, Initialize the critical pair set ,in This is the set of critical pairs. This is used to store the indexes of point pairs whose self-intersection states change among all adjacent point pairs on the bias curve. Each point pair... Indicates at point and There exists a critical point that separates self-intersecting regions from non-self-intersecting regions.

[0188] Step S75: Traverse the points on the bias curve If the self-intersection states of adjacent points are different, that is Then the critical pair Add to collection .

[0189] Step S76, for each critical pair The bisection method is used to accurately locate the critical point separating the self-intersecting and non-self-intersecting regions on the offset curve. This includes the following sub-operations.

[0190] First, initialize the interval endpoints. , Number of iterations ,parameter , .

[0191] Secondly, calculate the adaptive tolerance:

[0192]

[0193] In the formula: For the dichotomy method, adaptive tolerance is used. These are the two endpoints corresponding to the critical pair. Adaptive tolerance. The distance between the two endpoints of the critical pair is dynamically determined, ensuring rapid convergence when the interval is large and accurate positioning when the interval is small, without the need for a preset fixed tolerance.

[0194] The critical point of the self-crossing boundary must satisfy the following set of determination equations:

[0195]

[0196] In the formula: The unit tangent vector of the line segment; This is a bisection method with adaptive tolerance. The decision equations are expressed at the critical point. one side (along the tangent vector) Insignificant directional offset ) is in a non-self-intersecting state, on the other side (along the tangent vector) Insignificant directional offset It is in a state of self-fertilization. This is the precise dividing point between self-crossing and non-self-crossing.

[0197] Then, when and At that time, perform the following loop operation: retrieve the midpoint parameter. Calculate the midpoint:

[0198] In the formula: It is the midpoint of the bisection method; This is the midpoint parameter. If... Then let , Otherwise, , Number of iterations In the formula: The endpoints of the bisection interval; This represents the number of iterations. This is the threshold parameter for the binary search method.

[0199] After the loop terminates, the critical point of self-crossing boundary is calculated:

[0200] In the formula: This is the critical point of self-crossing boundary.

[0201] Finally, the original self-intersection point is updated to the critical point of the self-intersection boundary. Then, change the corresponding status flag to "no self-intersection". Update the original self-intersection point to the critical point. And modifying the status flags essentially involves cutting off the invalid parts of the bias curve that have undergone self-intersection, using the critical point... As new curve endpoints, this ensures that the trimmed offset curve is completely free of self-intersection.

[0202] Step S77: Output the trimmed bias curve and the updated self-crossing status flag.

[0203] The self-crossing elimination and critical point trimming process in step S7 above can be uniformly implemented by Algorithm 6. Algorithm 6 performs self-crossing elimination and critical point trimming, and its input includes: bias curve. ,in This represents the total number of points on the bias curve. This is the layer index of the current bias curve; the corresponding self-intersection state flag. This is used to mark whether self-intersection occurs at each point on the bias curve; and the maximum number of iterations. Its value can be a fixed constant of 15. The algorithm first initializes a set of critical pairs. Set it to an empty set, that is, perform an assignment operation. Subsequently, the algorithm iterates through adjacent pairs of points on the bias curve, covering a range of... That is, traversing from the 0th point to the second-to-last point. For each pair of adjacent points currently traversed... The algorithm checks whether the self-intersection state flags of the two points are different, that is, it determines... Is it true? If true, it means there is a critical transition position between a non-self-intersecting state and a self-intersecting state between the adjacent point pairs. At this time, the algorithm will change the index of the point pair. Add to critical pair set In the process of completing the critical pair set. After construction, the algorithm traverses Each critical pair in For the current critical pair, the algorithm first performs an initialization operation, that is, the left endpoint of the interval... Let the first one on the bias curve be... Points , set the right endpoint of the interval Let the first one on the bias curve be... Points And the iteration count counter Set it to 0. Next, the algorithm calculates the adaptive tolerance. Its value can be 1% of the Euclidean distance between the two endpoints of the critical pair, and the calculation formula is as follows: Subsequently, the algorithm enters a binary search iterative loop, which continues to execute only if two conditions are met simultaneously: the current iteration number. Less than the maximum number of iterations And the current interval length Greater than adaptive tolerance In each iteration, the algorithm first takes the midpoint of the current interval, and its calculation formula is as follows: Among them, the midpoint parameter The value can be fixed at 0.5. Then, the algorithm calculates the midpoint. self-crossing state And update the interval endpoints based on this state. The specific rule is: if Then Update the current midpoint parameter to 0.5, and set the left endpoint... Update to midpoint Otherwise Set the current midpoint parameter to 0.5, and set the right endpoint... Update to midpoint After completing the above updates, the number of iterations is [number missing]. Increment by 1. When the loop terminates, the algorithm calculates the critical point. Its calculation formula is That is, using the current interval endpoints and threshold parameters Interpolation is performed to obtain the precise location of the critical point. Finally, the algorithm updates the self-intersection points on the original bias curve as the critical points. And synchronously update the state flag of that point to a non-self-intersecting state. For the critical pair set... After performing the above operation on each critical pair, the algorithm outputs the pruned bias curve and the updated state flag. Figure 7 This diagram illustrates the path smoothing process, showing the complete flow from drive line offsetting to self-intersection elimination, critical point trimming, connection verification, and finally, outputting a smooth toolpath. The diagram labels the positional relationships of self-intersection points, non-self-intersection regions, and transition points (i.e., critical points). The input, output, and execution flow of Algorithm 6 are shown in the table below:

[0204] Algorithm 6: Self-crossing elimination and critical point pruning Input: Offset curve status flags Maximum number of iterations Initialize the critical pair set for like Then join in For each critical pair Initialize interval endpoints: Number of iterations Calculate adaptive tolerance: while and do midpoint: like but ,otherwise end while Obtaining the critical point Update the self-intersection point to And change the state to non-self-fertilization. end for each Output: The trimmed bias curve and the updated status flags

[0205] Step S8: Perform connection verification on the trimmed independent path segments. Use a greedy nearest-neighbor connection strategy to merge path segments that meet the conditions, outputting a smooth, continuous toolpath with no self-intersections. The toolpath is a series of ordered Cutter Contact Points (CC points), which are directly input into the CNC machine tool to drive the ball end mill along the workpiece surface. Movement, using physical methods to remove corner cleaning areas The residual material in the final workpiece surface ensures that the residual height constraint is met. The design requirements are as follows. Step S8 is specifically implemented through the following sub-steps S81 to S85.

[0206] The trimmed curve may break into multiple isolated line segments, which need to be connected by a greedy strategy based on the distance between endpoints: construct a priority queue and sort all line segments in ascending order of distance between endpoints; take the nearest unconnected line segment pairs in turn, and merge them if the distance is less than a threshold; output the complete set of connected paths as the final CC point toolpath.

[0207] Step S81: Input the set of clipped path segments. and connection threshold Initialize the connection state of all path segments to unconnected. (The resulting set of pruned path segments.) After performing step S7 (self-crossing elimination and critical point pruning), the set consists of all non-self-crossing bias curve segments, some of which are broken into multiple independent segments due to self-crossing removal; connection threshold. The maximum distance is set as a preset limit. Connections are only made when the distance between the endpoints of two path segments is less than this threshold, in order to avoid incorrect connections.

[0208] Step S82, construct the priority queue according to the following formula Store all endpoint link pairs of unconnected path segments in ascending order of endpoint Euclidean distance:

[0209] In the formula: Path segment The end point; Path segment The starting point; The Euclidean distance between the two points; As an endpoint distance priority queue; For link pairs containing distance and path segment indices. Priority queue. According to endpoint distance Arrange them from smallest to largest to ensure that each connection operation prioritizes processing the two closest path segment endpoints, thus achieving a greedy nearest-neighbor connection.

[0210] Step S83, when At this point, the following loop operation is executed. First, the head element of the queue is removed. Then, the Euclidean distance between the endpoints of all unconnected path segments and the starting points of other path segments is calculated, and it is determined whether this Euclidean distance is less than the connection threshold. Next, the path segment with the shortest Euclidean distance to the endpoints is connected first to generate a new path segment:

[0211]

[0212] Starting point is The starting point The destination is The End In the formula: This refers to the new path segment generated after the merger; It is the starting point of the path segment to which the nearest starting point belongs; The endpoint of the path segment to which the nearest destination belongs; These are the two path segments that are being merged.

[0213] Next, update the topological relationships of the path segment set using the following formula: Finally, the priority queue is cleared, the endpoint Euclidean distances between the new path segment and other unconnected path segments are recalculated, and a new priority queue is constructed.

[0214] Step S84: Repeat step S83 until the priority queue is empty or there is no endpoint Euclidean distance less than the connection threshold. endpoint pairs.

[0215] Step S85: Output the complete set of merged paths. The final toolpath is the toolpath leading to the final tool contact point. This is the combined set of complete toolpaths. Each path in the code is a smooth, continuous tool contact trajectory without self-intersection. This trajectory is directly converted into G-code that can be executed by the CNC machine tool, driving the physical tool along the workpiece surface. Movement, using physical methods to remove corner cleaning areas The residual material in the final machined surface ensures that the surface quality meets the residual height constraint. Requirements.

[0216] The path connection process in step S8 above can be uniformly implemented by Algorithm 7. Algorithm 7 is a path connection algorithm, and its input includes: a set of trimmed path segments. ,in The total number of path segments; and the connection threshold. This algorithm is used to determine whether two path segments can be connected. It first initializes the connection state of all path segments, setting them all to an unconnected state. Then, it constructs a priority queue to store all link pairs between the endpoints of all path segments in ascending distance order. Specifically, for any two distinct path segments... and (in The algorithm calculates the first... The endpoint of each path segment To the The starting point of each path segment Euclidean distance between Its calculation formula is All calculated distance values, along with their corresponding path segment index pairs. Together they form a link pair and sort all links by distance They are stored in a priority queue in ascending order, i.e. After the priority queue is constructed, the algorithm enters the loop processing phase. The condition for the loop to continue executing is that the priority queue is not empty. In each iteration, the algorithm first removes the head element of the priority queue, which corresponds to the closest pair of endpoints among all currently unconnected path segments. Then, the algorithm calculates the distance between the endpoint of each path segment and the starting points of other path segments, and checks whether these distances are less than a connection threshold. If there are endpoint pairs that meet the threshold condition, the closest pair is selected first to connect them, generating a new path segment. Its starting point is the starting point of the path segment to which the nearest starting point belongs. The destination is the endpoint of the path segment to which the nearest endpoint belongs. ,Right now After generating new path segments, the algorithm updates the topological relationships of the path segment set. Specifically, it updates the topological relationships of the original set. Remove the two merged path segments and add the newly generated path segments. Adding to the set, this update operation can be represented as After completing one connection operation, the algorithm repeats the above process to continue processing the remaining connection pairs in the priority queue. The algorithm continues processing until the priority queue is empty, or the distance between all remaining endpoint pairs in the queue is not less than the connection threshold. The loop terminates when the time is reached. Finally, the algorithm outputs a set of merged path segments. This serves as the final toolpath after connection verification and splicing. The input, output, and execution flow of Algorithm 7 are shown in the table below:

[0217] Algorithm 7: Path Connection Algorithm Input: The set of clipped path segments Connection threshold Initialize the connection state. Build a priority queue and store linked pairs in ascending order of distance. when hour Deleting the head element of the queue Calculate the distance between the end point of each path segment and the start point of other path segments. Determine if the distance is less than the connection threshold Prioritize connecting the closest path segments Updated path segment topology Repeat the process until no path segment that meets the condition is found. Output: Merged path segment

[0218] The technical effectiveness of this application is verified through specific experiments below. The experiments were implemented in C++ on a workstation configured with an Intel Core i5 3.60 GHz processor and 16 GB of RAM. The unified parameters for the pre-processing finishing were: a 6.0 mm ball end mill and a residual height constraint of 0.1 mm. The comparison software was PowerMill 2024 (PM24).

[0219] Case 1: Complex Models with Symmetrical Structures

[0220] Figure 8The comparison results for Case 1 show the results generated by the method of this application on the left and the results generated by PM24 on the right. In the first experimental case, a complex model with a symmetrical structure was used as the test object. A ball end mill with a radius of 2.0 mm was automatically selected for corner clearing based on the local principal curvature of the corner clearing area. Since the model has obvious geometric symmetry, its corner clearing area should theoretically also present a symmetrical distribution. However, the experimental results show that PM24 missed a complete set of corner clearing areas, while the method of this application successfully detected all areas that should be machined. At the same time, in the critical areas, the driving curve direction generated by the method of this application is more reasonable, the subsequent offset path coverage efficiency is higher, and the tool path is more continuous and smooth; in contrast, PM24 has problems such as path distortion, self-intersection, and unstable direction. The experimental results show that the method of this application is superior to commercial CAM software in terms of the completeness of corner clearing area detection, driving curve optimization, and offset path stability.

[0221] Case 2: Workpieces with multiple corner cleaning areas

[0222] Figure 9 The comparison results for Case 2 show the path generation performance of the proposed method and PM24 on workpieces with multiple corner cleaning areas. Area 1 shows that PM24 failed to generate a path, and Area 2 shows that PM24's path is discontinuous. In the second experimental case, a workpiece with multiple corner cleaning areas was used as the test object, and a ball end mill with a radius of 1.0 mm was automatically selected for machining based on local curvature constraints. In the experiment, both the proposed method and PM24 successfully detected four corner cleaning areas, but there were significant differences in the quality of toolpath generation. In some areas, PM24 experienced path generation failure and local offset errors, resulting in discontinuous paths or even the inability to form effective toolpaths. The proposed method, however, could stably generate continuous offset paths that satisfied chordal error constraints, maintaining good path uniformity and area coverage integrity. The experiment shows that even when the corner cleaning area detection results are consistent, differences in the driving curve generation and offset algorithms can still significantly affect the final path quality. The enhanced PCA and self-crossing correction strategy proposed in this application can significantly improve the robustness and stability of paths in complex areas.

[0223] Case 3: Complex workpieces with closed parameter domains

[0224] Figure 10The comparison results for Case 3 show the path generation performance of the proposed method and PM24 on complex workpieces in closed parameter domains. In the third experimental case, a complex workpiece in a closed parameter domain was used as the test object, and a ball end mill with a radius of 2.0 mm was automatically selected for corner clearing based on the local curvature. The experimental results show that both the proposed method and PM24 can identify the four corner clearing regions, but there are significant differences in path generation performance. In some regions, PM24 cannot generate effective offset paths, which may be related to the abnormal direction calculation caused by the complex closed parameter domain; while the proposed method can stably generate complete and continuous paths. In other high curvature regions, PM24 exhibits obvious path distortion, self-intersection, and insufficient local coverage, while the toolpath generated by the proposed method is smoother, more uniform, and has complete coverage. The experiments further verify the robustness and path generation stability of the proposed method in complex curved surface regions, closed parameter domains, and high curvature regions.

[0225] Real processing verification

[0226] Figure 11 The diagram illustrates the application effect of the proposed method in actual CNC machining. In the actual machining verification, the proposed method also demonstrates superior machining results compared to PM24. The generated toolpaths can be directly used in actual CNC machining, and the surface quality of the machined workpiece meets the residual height constraint requirements, with no obvious tool marks or overcut defects. In the third experimental case, a ball end mill with a radius of 2.0 mm was automatically selected for corner clearing based on the local curvature. The experimental results show that both the proposed method and PM24 can identify the four corner clearing regions, but there are significant differences in path generation effects. In some regions, PM24 cannot generate effective offset paths, which is believed to be related to abnormal direction calculations caused by complex closed parameter domains; while the proposed method can stably generate complete and continuous paths. In other high-curvature regions, PM24 exhibits obvious path distortion, self-intersection, and insufficient local coverage, while the toolpath generated by the proposed method is smoother, more uniform, and has complete coverage. The experiment further verified the robustness and path generation stability of the method in this application in complex curved surface regions, closed parameter domains, and high curvature regions.

[0227] Experiment Summary

[0228] The combined results of three CAD model experiments and actual machining experiments demonstrate that the proposed method can more comprehensively detect complex corner clearing areas. By enhancing PCA, it effectively fuses the overall geometric direction of the region with the local machining direction, thereby generating a driving curve that better conforms to the region's geometric characteristics. Simultaneously, the proposed offset path generation, self-intersection detection, and critical trimming methods effectively improve path continuity and smoothness, reducing path anomalies and insufficient local coverage. Compared to the commercial CAM software PM24, the proposed method exhibits higher robustness, better machining stability, and superior machining efficiency and surface quality in complex freeform surface regions.

[0229] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of one embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing the present invention.

[0230] 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. An automatic offset method for corner cleaning drive curves based on enhanced PCA, used for CNC machining corner cleaning toolpath generation, characterized in that, Includes the following steps: S1, Input the 3D design surface of the workpiece to be processed. Pre-processing path set Preceding tool radius Preset residual height constraint on the machined surface Wherein, the workpiece surface The set of preceding machining paths refers to the surface of the CAD model of the workpiece to be processed. The preceding tool radius is the spatial trajectory curve actually swept by the tool in the previous roughing or semi-finishing process. The radius of the ball end mill used in the previous operation; the residual height constraint This is the maximum allowable residual height value on the surface of the workpiece after processing, which is preset by the processing quality requirements; S2, based on residual height analysis, detect the corner cleaning area. The corner cleaning area For the workpiece surface Complete sweep area with previous processing Boolean difference set; S3, based on the optimal tool selection criterion, and according to the corner cleaning area Calculation of maximum safe tool radius based on local principal curvature The maximum safety tool radius In order to be able to enter the corner cleaning area The maximum radius value of the ball end mill that reaches the deepest point without interfering with the workpiece, which is used to select the actual machining tool for this corner clearing operation from the standard tool library; S4, uses an enhanced PCA method to automatically calculate corner cleaning areas. Optimal driving curve direction ; S5, Generate the original driving curve based on the point cloud of the clear corner region and the direction of the optimal driving curve. ; S6, for the driving curve Perform point-by-point offsetting to generate multiple sets of offset curves. Continue until all points on the offset curves fall within the complete sweep region. until; S7, for all bias curves Perform self-crossing elimination and critical point pruning to obtain independent path segments without self-crossing; S8 performs connection verification on the pruned independent path segments, and merges the path segments that meet the conditions using a greedy nearest-neighbor connection strategy, outputting a smooth and continuous tool path with no self-intersections; the tool path is a set of ordered tool contact points (CC points), which is directly input into the CNC machine tool to drive the ball end mill along the workpiece surface. Movement, using physical methods to remove corner cleaning areas The residual material in the final workpiece surface ensures that the residual height constraint is met. Design requirements.

2. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, Step S2: Detect and clean corner areas The implementation steps are as follows: S21, for each path in the path set The path spacing is calculated using the ball end mill residual height model. Calculation formula: In the formula: The radius of curvature of the workpiece surface along the offset direction; The radius of the preceding tool; For residual height constraints; For the first Path in parameters The path spacing at the location, the path spacing This is the vertical distance between two adjacent preceding processing paths; S22, for path Define geometric elements: outward normal vector of a surface Path tangent vector Bias direction vector , where the symbol This is a vector cross product operation; the outward normal vector of the surface. The path tangent vector is the unit normal pointing from the inside of the workpiece material to the outside. For the tool along the path The unit tangent in the direction of travel, the offset direction vector It is the direction that is perpendicular to both the path tangent and the surface normal, that is, the offset direction of adjacent toolpaths on the surface; S23, Solution Path The corresponding two residual height standard area boundary scanning curves and In each parameter The following conditions must be met: In the formula: This is a vector pointing from the path point to the curve points in the positive direction; This is the vector that scans the curve points from the path point in the negative direction. The positive direction scanning curve; The curve is scanned in the negative direction; The bias direction vector; The path tangent vector; S24, Construct the local scan region corresponding to a single path. ,formula: In the formula: The sweep interval parameter takes values ​​from 0 to... ; For the first The local scan area corresponding to each path; the local scan area For only along the path After one machining operation, the workpiece surface The residual height does not exceed the residual height constraint. The strip-shaped curved surface region formed by all the points; S25, the complete scan area is obtained by taking the union of all local scan areas. ,formula: In the formula: This represents the total number of preceding processing paths; The complete swept area; the complete swept area For all preceding processing paths After machining, the workpiece surface The residual height does not exceed the residual height constraint. The sum of the surface regions formed by all the points; S26, Perform a Boolean difference between the workpiece surface and the complete swept area to obtain the corner cleaning area. ,formula: In the formula: For point Euclidean distance to the path point; The corner cleaning area, the corner cleaning area For the workpiece surface All preceding processing paths failed to make its residual height meet the residual height constraint. The required set of points; S27, clean the corner area Decomposed into multiple independent connected components of the sub-regions to be processed, formula: In the formula: This represents the total number of connected components. For the first A connected component, the connected component Clean the corner area Independent subregions that are not connected to each other, each connected component For each independent corner clearing machining task, separate drive curves and offset toolpaths are generated.

3. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, Step S3 calculates the maximum safe tool radius based on the optimal tool selection criterion. The specific steps are as follows: S31, Input corner cleanup area point cloud Engineering margin safety factor used to mitigate the risk of excessive curvature fluctuation. ; wherein, the point cloud To clean the corner area The set of three-dimensional spatial points obtained by discrete sampling; the safety factor This is used to introduce a safety margin based on the theoretical maximum tool radius to avoid machining accidents caused by collisions between the tool and the workpiece during actual machining. S32, traverse all sampling points of the point cloud and solve for the global minimum principal curvature. ,formula: In the formula: For point Minimum principal curvature at; It is the global minimum principal curvature; Clean up point clouds in corner areas; S33, the tool radius must satisfy the overcut constraint. The theoretically allowed maximum tool radius formula is as follows: In the formula: This refers to the actual radius of the selected cutting tool; This is the theoretical minimum radius of curvature, i.e., the upper limit of the theoretical tool radius that prevents overcutting; S34, Introducing a safety factor to calculate the maximum safe tool radius. ,formula: In the formula: For safety factor; Maximum safe cutting tool radius; This constraint ensures that the blade tip can fully enter the concave area without overcutting; S35, outputs the maximum safe tool radius. .

4. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, Step S4: Enhanced PCA to solve for the optimal driving direction The specific steps include: S41, Input point cloud Maximum strip width vector field mean Weight Wherein, the maximum strip width vector field mean value To clean the area in the corner The weight is the average value of the direction vector that maximizes the machining bandwidth covered by the ball end mill in each pass; This is a balancing factor used to compromise between the overall geometry of the region and the maximum bandwidth of a single pass. S42, Calculate the centroid of the point cloud. ,formula: In the formula: This represents the total number of points in the point cloud. For the first point cloud Three-dimensional sampling points; The centroid of the point cloud; the centroid of the point cloud Clean the corner area The geometric center of the line is the point through which the driving line passes. S43, Construct the point cloud covariance matrix ,formula: In the formula: This is the transpose of the point cloud deviation vector; The point cloud covariance matrix; S44, Construct the enhanced PCA bi-objective optimization objective function, formula: In the formula: Let be the direction vector of the driving curve to be solved; In a three-dimensional real space; the first objective of optimization is to maximize the point cloud in... The variance of the direction distribution, minimize the second term. With the direction of the vector field Deviation; S45, transforming the optimization problem into an equivalent matrix eigenvalue problem, constructs an enhanced PCA matrix. It satisfies the characteristic equation: In the formula: To enhance the PCA matrix; The average direction of the vector field with the maximum strip width; For matrix eigenvalues; S46, for the matrix Perform eigenvalue decomposition, formula: In the formula: The eigenvector matrix; It is an eigenvalue diagonal matrix; S47, arrange the eigenvalues ​​in descending order to obtain ; In the formula: The eigenvalues ​​are arranged in descending order; S48, Select the largest eigenvalue corresponding unit eigenvector ; S49, outputs the optimal drive curve direction: In the formula: The unit eigenvector corresponding to the largest eigenvalue; The optimal driving curve direction; This eigenvector represents the global optimal solution to the bi-objective optimization problem.

5. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, Step S5 generates the driving curve The specific steps are as follows: S51, Input the point cloud of the corner region. Strengthen the main direction of PCA Average normal vector String error tolerance Expansion coefficient The average normal vector Clean the corner area The average value of the surface normal vectors at all points within the curve is used to project discrete points on the driving line onto the workpiece surface. Above; the aforementioned chord error tolerance The maximum allowable chord height difference during toolpath discretization is used to control the approximation accuracy of the toolpath; the expansion coefficient A positive number greater than 0 is used to extend the endpoints of the driving curve outward from the point cloud projection range to improve the coverage of the offset path on the region boundary. S52, with point cloud center of gravity With direction Construct driving line ,formula: In the above formula, For the free parameters of the line, To drive a straight line, the driving straight line To pass through the center of gravity of the point cloud And the direction is A spatial straight line, used to define the projected baseline of the driving line; S53, clear all sampling points in the corner area Projected onto driving line Above, determine the extreme parameters at both ends. and ; S54, using the expansion factor The formula for expanding the projection range is as follows: In the above formula, and These are the extreme parameters of the original projection range; and These are the extreme parameters of the expanded projection range; This is the expansion factor; S55, Calculate the length of the expanded interval. ,formula: In the formula: This is the length of the extended interval; S56, calculate the maximum sampling interval based on the bow height error constraint, and then calculate the number of sampling points. ; The formula for defining bow height error is as follows: In the formula: Let be the curvature of the curve at that point; The chord length between adjacent sampling points; This refers to the bow height error, which is the maximum deviation between the broken line segment and the parametric curve. The formula for the maximum sampling interval that satisfies the maximum allowable bow height error is: In the formula: This is the maximum permissible bow height error, i.e., the chord error tolerance; To meet the maximum sampling interval constrained by the bow height error; Formula for calculating the number of sampling points: In the formula: For integer operations; This represents the number of sampling points; S57, Generate a uniformly distributed sequence of sampling points on the projection line, formula: In the formula: For the first The parameter values ​​of each sampling point; S58, the sampling points are averaged using the normal vector. Projected onto the workpiece surface The above yields the driving curve point sequence, formula: In the formula: This is the projection step size; For the first One driving curve point; the driving curve point For the workpiece surface The three-dimensional coordinate points on the surface, and all driving curve points according to parameters The ascending order arrangement constitutes the driving curve. ; S59, Output Drive Curve: In the formula: This is the driving curve.

6. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, The specific steps for generating the offset curve by point-by-point offsetting in step S6 are as follows: S61, Input the original drive curve Initial bias direction vector set Bias index Complete sweep area ; S62, for the driving curve To determine closure, the formula is: In the formula: The threshold for determining closure; This is the tail point of the driving curve; This is the starting point of the driving curve; S63, for the drive curve Each point on The unit tangent vector is calculated using the central difference method. ; S64, using the right-hand rule to calculate two symmetric offset direction vectors, formula: In the formula: For the workpiece surface at point Outward normal vector at point; This is the cross product operation; For the first driving curve Unit tangent vector at each point; These are two symmetrically offset direction vectors; S65, iterate through all points : Select the current bias direction and choose the formula: Based on residual height constraints and local radius of curvature Calculate the current offset distance ; Generate bias point ,in For the current bias count, the initial drive curve corresponds to... ,Right now ; In the formula: This is a bias indicator; This represents the current bias count; For the first The point at the th The bias point after the second bias; the bias point For the point Along the offset direction Move by an offset distance The new points obtained afterward, and all the bias points form a new bias curve; S66, Generate bias path ; In the formula: For the newly generated bias path; S67, Add the bias path to the output path set and perform the assignment operation: In the above formula: This is the set of output paths corresponding to the offset direction; S68, update the driving curve to the current bias path, and perform the assignment operation: S69, Alternating Bias Indicator Repeat steps S65-S68 until all points on the offset curve fall within the complete swept area. Until then; wherein, the alternating switching bias index This causes the toolpath to change from the drive curve. Starting from there, expand alternately to the left and right sides, ensuring the offset path clears the corner area. Uniformly distributed within; when all points on a certain bias curve have fallen into the complete swept region. When the time is reached, it indicates that the bias curve has exceeded the range that needs to be cleaned, and the biasing process terminates; S70, Output the final bias path set .

7. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, The steps for implementing step S7, self-crossing elimination and critical point pruning, are as follows: S71, Input the number to be processed Offset curves , corresponding self-crossing status flag Maximum number of iterations ; S72, Identifying two causes of self-intersection of offset curves: For smooth curves, when the offset distance When the radius of curvature exceeds the local minimum, the offset curve folds inward and self-intersects. The formula for the local minimum radius of curvature is: In the formula: For the curve in parameters Curvature at that point; It is the local minimum radius of curvature; Polyline / Non-smooth case: At local sharp angles, the offset curve also produces self-intersection; S73, Define the self-crossing detection indicator function Used to determine the first Whether points on the bias curves intersect each other is determined by the function defined as: In the formula: For the first The first bias curve One point; The first on the original driving curve One point; for and The average path spacing between geodesic curves is determined by the average curvature of the geodesic curve. and residual height constraints The calculation shows that a function value of 1 indicates that the corresponding points have self-intersected, and a function value of 0 indicates that the corresponding points have not self-intersected. S74, Initialize the critical pair set The critical pair set This is used to store the indexes of point pairs whose self-intersection states change among all adjacent point pairs on the bias curve. Each point pair... Indicates at point and There exists a critical point that separates self-intersecting regions from non-self-intersecting regions. S75, iterate through the points on the offset curve. If the self-intersection states of adjacent points are different, that is Then the critical pair Add to collection ; S76, for each critical pair The bisection method is used to accurately locate the critical point of the boundary between the self-intersecting region and the non-self-intersecting region on the offset curve, specifically including: Initialize interval endpoints , Number of iterations ,parameter , ; Calculate adaptive tolerance: In the formula: This is an adaptive tolerance for the bisection method; These are the two endpoints corresponding to the critical pair; The critical point of the self-crossing boundary must satisfy the following set of determination equations: In the formula: The unit tangent vector of the line segment; This is an adaptive tolerance for the bisection method; when and hour: Take midpoint parameters Calculate the midpoint: In the formula: It is the midpoint of the bisection method; For midpoint parameters; like Then let , Otherwise, , ; Number of iterations ; In the formula: The endpoints of the bisection interval; This represents the number of iterations. The threshold parameter for the binary search method; The self-crossing boundary critical point was calculated as follows: In the formula: This is the critical point of self-intersection; Update the original self-intersection point to the critical point of the self-intersection boundary. And change the corresponding status flag to "no self-intersection"; S77 outputs the trimmed bias curve and the updated self-crossing status flag.

8. The automatic biasing method for corner cleaning drive curves based on enhanced PCA according to claim 1, characterized in that, The specific steps for step S8, connection verification and greedy path connection, are as follows: S81, Input the set of clipped path segments and connection threshold Initialize the connection status of all path segments to unconnected; S82, construct the priority queue according to the following formula Store all endpoint link pairs of unconnected path segments in ascending order of endpoint Euclidean distance: In the formula: For path segment The end point; Path segment The starting point; The Euclidean distance between the two points; As an endpoint distance priority queue; For link pairs containing distance and path segment indexes; the priority queue According to endpoint distance Arrange them from smallest to largest to ensure that each connection operation prioritizes processing the two closest path segment endpoints, thus achieving a greedy nearest-neighbor connection. S83, when hour: Delete the head element of the queue; Calculate the Euclidean distance between the endpoints of all unconnected path segments and the starting points of other path segments; Determine if the Euclidean distance is less than the connection threshold. ; First, connect the path segments with the shortest Euclidean distance to the endpoints to generate new path segments: Starting point is The starting point The destination is The End ; In the formula: This refers to the new path segment generated after the merger; It is the starting point of the path segment to which the nearest starting point belongs; The endpoint of the path segment to which the nearest destination belongs; These are the two path segments being merged; Update the topological relationships of the path segment set, using the formula: Clear the priority queue, recalculate the endpoint Euclidean distances between the new path segment and other unconnected path segments, and construct a new priority queue; S84, Repeat step S83 until the priority queue is empty or the endpoint Euclidean distance is less than the connection threshold. endpoint pairs; S85, Output the complete set of merged paths. The final toolpath at the tool contact point; the merged complete path set Each path in the code is a smooth, continuous tool contact trajectory without self-intersection. This trajectory is directly converted into G-code that can be executed by the CNC machine tool, driving the physical tool along the workpiece surface. Movement, using physical methods to remove corner cleaning areas The residual material in the final machined surface ensures that the surface quality meets the residual height constraint. Requirements.