Three-axis numerical control milling machine tool path generation method and system based on elevation fitting
By generating toolpaths for three-axis CNC milling machines using an elevation fitting method, the problem of generating toolpaths for complex curved surfaces and high-precision workpieces in existing technologies has been solved. This method enables precise tool placement and machining path optimization, thereby improving machining accuracy and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-14
AI Technical Summary
Existing three-axis CNC milling technology struggles to achieve accurate toolpath generation and improve machining efficiency in complex curved surfaces and high-precision workpiece environments, lacking intelligent automated toolpath generation capabilities with elevation fitting and multi-parameter constraints.
By acquiring discrete spatial sampling points of the workpiece model, converting them into a regular grid for elevation fitting, and combining tool parameters and machining process parameters to arrange tool positions, mapping them into toolpath trajectories, and performing control interference detection and correction, a three-axis CNC milling machine toolpath is generated.
It enables precise surface characterization of complex curved surfaces and multi-curvature workpieces, improves the continuity and accuracy of machining paths, ensures the safety of tool movement and the stability of the machining process, and improves machining efficiency and part surface quality.
Smart Images

Figure CN121857518A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machining technology, and in particular to a method and system for generating toolpaths for a three-axis CNC milling machine based on elevation fitting. Background Technology
[0002] In existing three-axis CNC milling machining technology, traditional toolpath planning methods are typically used for workpiece machining path design. These methods often rely solely on the geometric boundaries of the CAD model or manually defined tool positions to generate the toolpath. While this approach can generally complete machining tasks in scenarios with regular workpiece shapes, low surface accuracy requirements, or limited machining ranges, it struggles to guarantee machining accuracy and efficiency in environments with complex surfaces, multiple curvatures, or high-precision requirements. This is because machining path planning depends on operational experience, tool radius compensation is inaccurate, tool height control is insufficient, and surface elevation variations are not adequately considered. While existing technologies can generate basic toolpaths through CAD geometric models or manual settings, they generally suffer from the following problems: First, they can only provide approximate or segmented machining toolpaths, lacking accurate fitting of continuous workpiece elevation changes; second, they cannot perform intelligent tool position placement and toolpath optimization based on tool parameters and machining process conditions, resulting in insufficient spatial tool position accuracy; third, the current toolpath generation process relies heavily on human experience and manual correction, which is inefficient, easily affected by human factors, and lacks intelligent automated toolpath generation capabilities based on elevation fitting and multi-parameter constraints. Summary of the Invention
[0003] Therefore, it is necessary for the present invention to provide a method and system for generating toolpaths for a three-axis CNC milling machine based on elevation fitting, in order to solve at least one of the above-mentioned technical problems.
[0004] To achieve the above objectives, a method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting is provided, comprising the following steps: Step S1: Obtain discrete spatial sampling points of the workpiece model and convert the discrete spatial sampling points into a regular mesh; use the regular mesh to fit the surface elevation of the workpiece model to generate a continuous elevation surface; Step S2: Obtain tool parameters and machining process parameters; use tool parameters and machining process parameters to arrange tool positions; map tool positions along a continuous elevation surface to form a toolpath trajectory; Step S3: Perform control interference detection on the workpiece model based on the toolpath trajectory and record the offset tool position; correct the toolpath trajectory according to the offset tool position and record the height of the corrected tool position point; generate the toolpath for a three-axis CNC milling machine using the height of the corrected tool position point.
[0005] Preferably, this specification also provides a three-axis CNC milling machine toolpath generation system based on elevation fitting, used to execute the above-described three-axis CNC milling machine toolpath generation method based on elevation fitting. The three-axis CNC milling machine toolpath generation system based on elevation fitting includes: The elevation fitting module is used to obtain discrete spatial sampling points of the workpiece model and convert the discrete spatial sampling points into a regular mesh; the regular mesh is used to fit the surface elevation of the workpiece model to generate a continuous elevation surface; The toolpath mapping module is used to acquire tool parameters and machining process parameters; arrange tool points using tool parameters and machining process parameters; and map tool points along a continuous elevation surface into a toolpath trajectory. The interference detection module is used to perform control interference detection on the workpiece model based on the toolpath trajectory, record the offset tool position; correct the toolpath trajectory according to the offset tool position, record the height of the corrected tool position point; and generate the toolpath for a three-axis CNC milling machine using the height of the corrected tool position point.
[0006] The beneficial effects of this invention are as follows: (1) By performing regular gridding and elevation fitting on the discrete space sampling points of the workpiece model, a continuous elevation surface is generated, which enables accurate surface characterization of complex surfaces and multi-curvature workpieces, ensuring the accuracy and completeness of the tool height and machining path input data.
[0007] (2) In the process of tool point arrangement and tool path generation, spatial mapping and offset correction are performed in combination with tool parameters and machining process parameters to dynamically generate a three-axis tool path trajectory that meets the machining accuracy and tool motion constraints, thereby realizing the intelligent, controllable and precise spatial distribution control of tool path planning, and improving the continuity of machining path and machining accuracy.
[0008] (3) In the tool path execution and interference detection stage, the tool path is corrected based on the real-time judgment of tool overcutting, fixture interference and clamping collision, and the height information of the corrected tool position point is extracted to realize the safe control of tool movement and real-time optimization of machining path, thereby improving the stability of machining process and the surface quality of parts. Attached Figure Description
[0009] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a schematic diagram of the steps of the method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to the present invention; Figure 2 This is a schematic diagram of the architecture of the three-axis CNC milling machine toolpath generation system based on elevation fitting in this invention; Figure 3 This is a schematic diagram of the toolpath trajectory in this invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0010] The technical method of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this invention.
[0011] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.
[0012] It should be understood that although the terms "first," "second," etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are used merely to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0013] To achieve the above objectives, please refer to Figures 1 to 3 This invention provides a method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting, the method comprising the following steps: Step S1: Obtain discrete spatial sampling points of the workpiece model and convert the discrete spatial sampling points into a regular mesh; use the regular mesh to fit the surface elevation of the workpiece model to generate a continuous elevation surface; In one embodiment, a 3D scanner (such as a laser scanner or structured light scanner) is used to acquire discrete spatial sampling points on the surface of the workpiece. Each point contains X, Y, and Z coordinates, with a measurement accuracy of approximately 0.05 mm. The sampling points are projected onto the XY plane to form a boundary rectangle, and grid lines are drawn according to a preset interval (e.g., ΔX=ΔY=0.5 mm) to generate a regular grid. The average Z coordinate of each grid node is counted as the node elevation, and missing grid nodes are filled using bilinear interpolation of four neighboring nodes. Finally, the node elevations of the regular grid are fitted using a B-spline surface to obtain a continuous elevation surface.
[0014] In another embodiment, assuming a total of 15,000 sampling points and an XY projection boundary of 300mm × 200mm, a 120 × 80 grid is generated, with approximately 10% of the nodes being empty. After filling the empty nodes using bilinear interpolation, a continuous elevation surface is obtained by B-spline fitting, with an average fitting residual of approximately 0.12mm and a maximum residual of approximately 0.35mm. This continuous surface can accurately reflect the local concavity and curvature changes of the machined part, providing a reliable surface reference for toolpath generation and ensuring high continuity and precision control during the machining process of the three-axis CNC milling machine.
[0015] Step S2: Obtain tool parameters and machining process parameters; use tool parameters and machining process parameters to arrange tool positions; map tool positions along a continuous elevation surface to form a toolpath trajectory; In one embodiment, tool parameters (diameter 12mm, tip radius 0.5mm, effective cutting length 50mm) and machining process parameters (feed stepover 0.2mm, row spacing 0.3mm, depth of cut 1mm) are obtained, and tool points are arranged on a continuous elevation surface. The tool points are arranged according to a parallel tool path strategy to form a two-dimensional tool position grid, which is then mapped to a three-dimensional toolpath trajectory through the elevation surface. This mapping maintains continuous contact between the tool and the workpiece surface, ensuring a smooth machining path and uniform cutting. The initially generated toolpath can cover the entire surface of the machined part.
[0016] In another embodiment, it is assumed that a total of 5,000 tool points are arranged, with an average spacing of approximately 0.25 mm between each tool point on the curved surface. The total length of the generated toolpath after mapping is approximately 1.8 m, covering the entire surface of the machined workpiece while maintaining a high degree of continuity. By mapping the tool points to the surface elevation, the tool cutting position is ensured to be accurate, while maintaining a uniform step distance in complex curved surface areas, which can effectively reduce machining errors and improve the machining accuracy and surface quality of the three-axis CNC milling machine.
[0017] Of particular importance is that step S2, which involves arranging the tool position points using tool parameters and machining process parameters, includes: Determine the tool shape using tool parameters; extract the depth of cut based on machining process parameters; set the XY plane layout interval using tool shape and depth of cut. In one embodiment, the tool shape and machining range are first determined based on the tool type (e.g., end mill, ball end mill) and tool parameters (diameter, length, number of cutting edges, etc.). Then, the depth of cut information for each tool position is extracted based on machining process parameters (e.g., depth of cut, width of cut, material removal rate). Based on the tool shape and depth of cut, the arrangement intervals ΔX and ΔY in the XY plane are set according to the surface characteristics of the workpiece and the machining accuracy requirements to ensure that the tool covers the target area without interference during machining, while also meeting the requirements for process allowance control. Finally, the arrangement coordinates of each tool position point in the XY plane and the corresponding depth of cut information are recorded.
[0018] In another embodiment, assuming the workpiece surface dimensions are X:[0,200]mm, Y:[0,100]mm, a 10mm diameter ball end mill is used for rough machining of the plane. Based on a cutting depth of 2mm and the tool geometry, the XY plane arrangement intervals ΔX=5mm and ΔY=5mm are calculated. Under these conditions, a preliminary tool position matrix of 840 points is formed, each point corresponding to the cutting depth. (Considering slight differences in workpiece shape).
[0019] The tool tip contact height is determined based on the XY plane arrangement interval to form a tool position sequence; tool radius compensation is performed on the tool position sequence to arrange the tool positions.
[0020] In one embodiment, the tool tip contact height at each tool position is calculated based on the obtained XY plane arrangement coordinates and cutting depth information. Subsequently, tool radius compensation is performed on the tool position sequence (adjusting the XY coordinates based on the tool radius, tool direction, and machining strategy) to form the final tool position sequence. , , This ensures that the tool path meets the process accuracy requirements and avoids interference with the workpiece or fixture. Finally, the tool position sequence and corresponding offsets ΔX, ΔY, and ΔZ are recorded for subsequent toolpath verification and simulation.
[0021] In another embodiment, it is assumed that the initial tool position sequence comprises 840 points, and the tool radius is 5 mm. After radius compensation of the tool positions, the average offset of the XY coordinates is ΔX≈0.3 mm and ΔY≈0.25 mm. The tool tip contact height is then calculated. Varying within the range of 1.9–2.1 mm, the final corrected height accuracy for each tool position is approximately ±0.05 mm.
[0022] Step S3: Perform control interference detection on the workpiece model based on the toolpath trajectory and record the offset tool position; correct the toolpath trajectory according to the offset tool position and record the height of the corrected tool position point; generate the toolpath for a three-axis CNC milling machine using the height of the corrected tool position point.
[0023] In one embodiment, based on the generated 3D toolpath trajectory, control interference detection is performed on the workpiece model, including tool overcut detection, fixture interference detection, and clamping collision detection. During the detection process, offset tool position information is recorded, and the toolpath trajectory is corrected according to the offset tool position. Simultaneously, the height information of the corrected tool position is extracted to ensure that the tool does not overcut or collide during machining. The corrected toolpath trajectory generates a final toolpath that can be directly used for machining on a three-axis CNC milling machine.
[0024] In another embodiment, it is assumed that a total of 120 overcutting tool points, 45 fixture interference tool points, and 30 collision tool points are detected during the interference detection process. After offset correction, the tool point height adjustment range is within ±0.4mm, and the final generated toolpath trajectory has a total length of approximately 1.82m, covering the entire workpiece surface and meeting the machining accuracy requirements.
[0025] Of particular importance, step S3, which involves generating the three-axis CNC milling toolpath using the corrected tool position height, includes: The tool position height is converted into G-code instructions; the G-code instructions are used to control the tool simulation verification and record the machining results; the tool retraction procedure is executed according to the machining results, and the tool is positioned in the residual material area; In one embodiment, the generated corrected tool position height The data is converted into corresponding CNC G-code instructions, including the positioning instruction G00, the cutting instruction G01, and the feed rate F setting. The generated G-code is then input into tool simulation software (such as VERICUT or UG / NXCAM simulation modules) for machining path verification, real-time monitoring of tool-workpiece collisions and machining trajectory coverage. Based on the simulation results, the machining status, cutting amount, and path error at each tool position are recorded. After simulation, a tool retraction procedure is executed to position the tool at the starting point of the preset residual material area, preparing for subsequent residual material cleaning operations.
[0026] In another embodiment, assuming that the generated G-code controls 840 tool positions, simulation results show a machining coverage of 99.2%, a maximum path error of 0.12 mm, and an average path error of 0.05 mm. The tool retraction procedure moves the tool to the residual material area coordinates X:[50,100] mm, Y:[20,80] mm, Z=2.1 mm, in preparation for cleaning up the residual material.
[0027] Identify the thickness of residual material in the residual material area; set the cleaning toolpath according to the residual material thickness, execute the cleaning toolpath, and record the residual material removal rate; identify high residual material areas based on the residual material removal rate; generate a three-axis CNC milling machine toolpath based on the high residual material areas.
[0028] In one embodiment, for the residual material area located after tool retraction, the thickness information of the residual material is obtained using a tool or measuring sensor (such as a contact probe or laser scanner), generating a residual material thickness distribution map. A clearing toolpath is set according to the residual material thickness, including selecting an appropriate tool (such as a ball end mill or flat end mill), depth of cut, and tool position interval. The clearing toolpath machining is executed, and the residual material removal rate and remaining residual material distribution are recorded in real time. Areas with high residual material are identified and marked, and a finishing toolpath for a three-axis CNC milling machine is generated based on the information of these areas to ensure complete removal of residual material and that the machined surface accuracy meets process requirements.
[0029] In another embodiment, it is assumed that the thickness sequence (in mm) of the residual material area is measured as: [0.8, 1.2, 0.5, 1.5, 0.9, 0.7, 1.1, 1.3]. Based on this thickness distribution, the cutting depth of the clearing toolpath is set to 1.0 mm, the XY interval is 5 mm, and a ball end mill with a diameter of 10 mm is selected for machining. After the clearing process is completed, the residual material removal rate is recorded as 92%, and the remaining high residual material area is mainly concentrated at coordinates X: [60, 70] mm, Y: [30, 40] mm, with a maximum residual material thickness of 1.5 mm.
[0030] It should be noted that you should refer to [link / reference]. Figure 3 The diagram shows the machining interface, featuring a ring-shaped part and a blue toolpath. The two green line segments on the part are the reference curves of the toolpath, serving as a reference path for curve projection machining. The tool position point is mapped onto the part surface along a continuous elevation curve, thereby generating a toolpath that fits the shape of the part. The diagram also marks the X / Y / Z machining coordinate system, where the X and Y axes form the planar machining reference for the part, and the Z axis corresponds to the elevation direction of the part (i.e., the machining depth direction). Subsequently, interference detection will be performed based on the toolpath in this coordinate system to ultimately generate a three-axis CNC milling machine machining path adapted to the part.
[0031] Preferably, step S1, which involves obtaining discrete spatial sampling points of the workpiece model and converting these discrete spatial sampling points into a regular mesh, includes: Obtain discrete spatial sampling points of the workpiece model, where each discrete spatial sampling point includes X coordinate, Y coordinate, and Z coordinate; perform planar projection based on the X coordinate and Y coordinate to form an XY projection boundary rectangle; In one embodiment, a 3D laser scanner is used to acquire discrete spatial sampling points on the surface of the workpiece. Each sampling point includes X, Y, and Z coordinates, with a sampling accuracy of approximately 0.05 mm. All sampling points are projected onto the XY plane to determine the boundary range in the XY directions, generating a minimum boundary rectangle to cover the entire surface of the workpiece. The length and width of the boundary rectangle are recorded as follows: and This provides a reference for subsequent mesh generation. Simultaneously, the projected boundaries are smoothed to remove the influence of sampling anomalies or extreme values, ensuring that the rectangular boundaries completely and uniformly cover the workpiece surface, thus laying the foundation for regular mesh generation.
[0032] In another embodiment, it is assumed that the total number of discrete spatial sampling points collected is 20,000, with the X-coordinate ranging from 0 to 250 mm and the Y-coordinate ranging from 0 to 180 mm. The XY boundary rectangle formed after projection has a length and width of 250 mm × 180 mm, respectively. Statistical analysis of the projected points reveals that approximately 2% of the points are outliers. These outliers are removed through boundary smoothing, ultimately resulting in a rectangular boundary that completely covers the surface of the workpiece.
[0033] Grid lines are divided using XY projection boundary rectangles to form an XY grid structure; X and Y coordinates are assigned to the XY grid structure, and the average value of the Z coordinate falling into the XY grid structure is calculated. The average value is used as the elevation value of the grid node. In one embodiment, the formed XY projected boundary rectangle is divided into grid lines in the X and Y directions according to a preset step size ΔX=ΔY=0.5mm to generate a regular XY grid structure. Subsequently, the X and Y coordinates of discrete sampling points are mapped to grid nodes, the Z coordinates falling within each grid node are statistically analyzed, and the arithmetic mean of the Z coordinates is calculated. This average value is used as the elevation value of the grid node. In this way, the elevation information corresponding to each node is obtained, realizing the mapping of discrete points to a regular grid. This method can preserve the overall contour of the workpiece surface while eliminating local fluctuations at discrete points.
[0034] In another embodiment, it is assumed that the mesh generates 150×120 nodes, with each node having an average of 10 sampling points. Node statistics reveal approximately 15 nodes with no sampling points (missing nodes), while the average Z-coordinate of the other nodes ranges from 0 to 50 mm. The average elevation of each node is used to represent the local surface height, ensuring that the regular mesh accurately reflects the overall shape and local features of the workpiece, facilitating subsequent elevation surface fitting and toolpath generation.
[0035] The missing grid nodes in the XY grid structure are counted, and the elevation values of the grid nodes are used for bilinear interpolation to generate a regular grid.
[0036] In one embodiment, for empty grid nodes in the XY grid structure that are not covered by sampling points, their four neighboring nodes are selected as reference points. A bilinear interpolation coordinate system is established, the interpolation weights are calculated, and the Z coordinates of the reference nodes are weighted to obtain the elevation values of the empty nodes. The interpolation results are then filled into the empty nodes to complete the generation of the regular grid.
[0037] In another embodiment, assuming there are a total of 18 missing nodes, and the Z-coordinates of the four neighboring nodes of each missing node are [12.5, 13.0, 12.8, 13.2] mm, the elevation of the missing node is calculated to be approximately 12.875 mm using bilinear interpolation. After all missing nodes are filled, a regular mesh with a total of 18,000 nodes is generated, with elevation values distributed between 0 and 50 mm.
[0038] Preferably, the process of identifying missing grid nodes in the XY grid structure and performing bilinear interpolation using the grid node elevation values to generate a regular grid includes: Count the missing grid nodes in the XY grid structure; select four adjacent grid nodes of the missing grid node as interpolation reference points; establish a bilinear interpolation coordinate system, and calculate the interpolation weights based on the X and Y coordinates of the interpolation reference points; In one embodiment, the XY grid structure is traversed to identify empty grid nodes that do not contain discrete sampling points, and their coordinate indices within the grid are recorded. For each empty node, its four adjacent nodes (up, down, left, and right) are selected as interpolation reference points, and the X-coordinates, Y-coordinates, and corresponding elevation values of these nodes are obtained. Using the positions of these four reference nodes in the XY plane as a reference, a bilinear interpolation coordinate system is established, and the local interpolation weight coefficients of the empty node relative to the four reference nodes are calculated.
[0039] In another embodiment, it is assumed that 18 missing nodes are counted in the XY mesh structure, and the Z coordinates of the four neighboring reference nodes of each missing node are [12.3, 12.7, 13.1, 12.9] mm. By calculating the interpolated coordinate system, the positional proportion of the missing node in the local coordinates of the reference nodes is obtained, for example... Based on the bilinear interpolation formula, the weight coefficients of each reference node are calculated to be 0.24, 0.36, 0.16, and 0.24, forming a complete interpolation coordinate system. This provides parameters for the weighted calculation of the elevation value of each missing node, ensuring that the elevation of the regular grid filling is smooth and continuous.
[0040] The elevation values of four adjacent grid nodes are weighted according to the interpolation weight to generate the elevation values of the missing grid nodes; the missing grid nodes are then filled according to the elevation values of the missing grid nodes to generate a regular grid.
[0041] In one embodiment, the elevation values of the reference nodes in the four neighboring areas of a missing node are weighted using interpolation weighting coefficients to generate the elevation value of the missing node. The calculated elevation value is then filled back into the missing grid node to restore grid integrity. By performing this operation sequentially on all missing nodes, a complete and regular grid is finally generated, ensuring that the entire XY grid structure has a continuous and smooth elevation distribution, while eliminating surface discontinuities caused by sampling gaps.
[0042] In another embodiment, assume that the weighted elevation values of the 18 missing nodes are calculated as [12.875, 13.050, 12.700, 12.900, 13.100, 12.850, 12.950, 12.800, 13.000, 12.750, 12.900, 12.950, 12.800, 12.850, 12.900, 12.950, 13.050, 12.875] mm. After filling these elevation values back into the corresponding missing nodes, the total number of nodes in the regular grid is 18,000, and the elevation values are smoothly distributed between 12.7 and 13.1 mm.
[0043] Preferably, step S1, which uses a regular mesh to fit the surface elevation of the workpiece model and generate a continuous elevation surface, includes: Extract grid elevation values from the regular grid; reconstruct the first elevation surface based on the regular grid; calculate the residual distribution values based on the grid elevation values and the first elevation surface; identify high residual regions on the first elevation surface using the residual distribution values; In one embodiment, the elevation values of each grid node are extracted from the generated regular grid, and these elevation values are used as input data for the reconstruction of a first elevation surface. A quadratic B-spline surface fitting method or bilinear interpolation method is used to generate the first elevation surface, and the residual between the actual elevation value of each grid node and the fitted surface elevation value is calculated to obtain the residual distribution value. By analyzing the residual distribution, grid node regions with residuals exceeding a preset threshold (e.g., 3 mm) are selected as high residual regions of the first elevation surface. These high residual regions typically correspond to local abrupt changes or irregular points. Marking these regions can be used for subsequent surface control node placement and local surface optimization to ensure that the final continuous surface is smooth and without obvious abrupt changes.
[0044] In another embodiment, it is assumed that the regular mesh has a total of 10,000 nodes, and the elevation value of each node ranges from 12.5 to 13.2 mm. After fitting the first elevation surface using bilinear interpolation, the residuals are calculated to obtain the deviation values of each node as [-0.8, 1.2, -1.0, 0.5, 0.9, -0.6, 1.1, -0.7, 0.3, 1.0…] mm. Among them, approximately 120 nodes have residuals exceeding ±1 mm, which are marked as high residual regions. These regions are mainly distributed in local convexities and depressions, serving as target areas for subsequent surface optimization and control of node addition, to improve the local smoothness of the surface.
[0045] Add surface control nodes to the high residual region and use the surface control nodes to reconstruct the second elevation surface; eliminate abrupt change points based on the second elevation surface and calculate the fitting residual. Repeat the elimination of abrupt change points until the fitting residual is less than the preset residual threshold to generate a continuous elevation surface.
[0046] In one embodiment, for identified high residual regions, surface control nodes are added to the surface to increase the local fitting degrees of freedom. Using the newly added control nodes, a second elevation surface is generated by refitting the B-spline surface. Abrupt points in the high residual regions are eliminated by densifying local nodes and adjusting the surface. The entire surface is iteratively optimized, the fitting residuals are calculated, and the positions of the surface control nodes are continuously adjusted until the residual distribution meets a preset threshold (e.g., average residual ≤ 0.5 mm).
[0047] In another embodiment, assuming the high residual region has 120 nodes, 1-2 surface control nodes are added to each node, for a total of approximately 180 control nodes. After quadratic B-spline surface reconstruction, the initial fitting average residual is 0.92 mm, and the maximum residual is 1.8 mm. After three rounds of iteration to adjust the positions and weights of the control nodes, the final average residual is reduced to 0.48 mm, the maximum residual is controlled within 0.9 mm, the continuous surface transitions smoothly, and all local abrupt changes are eliminated.
[0048] Preferably, in step S3, control interference detection is performed on the workpiece model based on the toolpath trajectory, and the offset tool position is recorded, including: Based on the toolpath, perform tool control overcut detection on the workpiece model and record the overcut tool position; based on the toolpath, perform fixture control interference detection on the workpiece model and record the fixture interference tool position. In one embodiment, based on a preset 3D model of the workpiece and toolpath, the tool movement process is simulated sequentially, and overcut detection is performed at each tool position point. By analyzing the intersection point between the tool and the workpiece surface, tool positions where the tool cuts too deeply into the workpiece are identified, and their 3D coordinates and corresponding toolpath parameters are recorded as overcut tool positions. Simultaneously, fixture interference detection is performed on the same toolpath trajectory to simulate the spatial relationship between the fixture and the tool or workpiece, mark tool positions with interference risk, and record their positions.
[0049] In another embodiment, assuming the workpiece model contains 15,000 tool points, 320 overcut tool points are identified after overcut detection, distributed in the workpiece groove and sharp corner areas; fixture interference detection finds 210 interference tool points, mainly concentrated in the part where the workpiece is fixedly clamped and contacts the tool side edge. Each tool point records the X, Y, Z coordinates and the tool attitude angle (α, β, γ), which are used for subsequent offset tool position calculation and path optimization.
[0050] Based on the toolpath trajectory, clamping control and collision detection are performed on the workpiece model, and the collision tool position is recorded; the overcutting tool position, the fixture interference tool position, and the collision tool position are integrated as the offset tool position.
[0051] In one embodiment, clamping control collision detection is performed on the toolpath trajectory of the workpiece model to simulate the dynamic spatial positions of the tool, workpiece, and fixture during the machining process, and the tool positions where collisions may occur are recorded, referred to as collision tool positions. Subsequently, the overcut tool positions, fixture interference tool positions, and collision tool positions are integrated to generate a comprehensive offset tool position set.
[0052] In another embodiment, it is assumed that clamping collision detection identifies 180 collision tool positions, mainly located on the bottom surface of the workpiece and near the end of the fixture. After integrating overcut, interference, and collision tool positions, a total of 690 offset tool positions are generated, including 320 overcut points, 210 fixture interference points, and 180 collision points. The coordinate range of the offset tool positions is assumed to be X: [50–250] mm, Y: [30–180] mm, Z: [0–80] mm; the corresponding tool offset is 0.2~1.5 mm, which can be directly used in machining simulation or toolpath optimization software to achieve safe and high-precision machining trajectory adjustment.
[0053] Preferably, based on the toolpath trajectory, tool control overcut detection is performed on the workpiece model, and the overcut points are recorded, including: Load the workpiece model to determine the overcut detection benchmark; construct the tool sweep body along the toolpath trajectory and record the tool sweep volume; determine the tool overcut area based on the tool sweep volume and the overcut detection benchmark. In one embodiment, a 3D CAD model of the workpiece is first loaded as the overcut detection reference, and a tool sweep volume is constructed along a preset toolpath trajectory, recording the sweep volume information at each tool position point. Subsequently, the tool sweep volume and the workpiece model are subjected to spatial intersection calculation to identify the overlapping part between the tool and the workpiece, determine the area where the tool may overcut, and generate a preliminary tool overcut area.
[0054] In another embodiment, it is assumed that the workpiece model consists of 25,000 mesh elements, and the toolpath contains 3,000 tool positions. After constructing the swept body, 450 tool positions were initially identified as having overcut risk, mainly distributed in the workpiece groove edges and sharp corner areas. For each overcut area, the tool position coordinates (X, Y, Z) and tool attitude angle were recorded. and swept volume (unit) This provides a data foundation for subsequent quantitative analysis.
[0055] Calculate the overcut depth and overcut cross-sectional area based on the overcut area; evaluate the vibration amplitude of the tool tip based on the overcut depth and overcut cross-sectional area; calculate the tool tip load stress based on the tool tip vibration amplitude; determine the tool overload state by comparing the tool tip load stress with the preset load stress; mark the overcut point using the tool overload state.
[0056] In one embodiment, for a defined tool overcutting area, the overcutting depth (DeptofCut) and overcutting cross-sectional area (Cross-sectionalAreaofCut) are calculated for each tool point. Then, the vibration amplitude at the tool tip is estimated based on the overcutting depth and cross-sectional area, and the tool tip load stress is calculated using the vibration amplitude. By comparing the calculated tool tip load stress with a preset material or tool load limit, it can be determined whether the tool is in an overloaded state. Tool points identified as overloaded are marked and referred to as overloaded tool points for subsequent machining path adjustments or tool offset optimization.
[0057] In another embodiment, assuming that among the aforementioned 450 initial overcutting points, the overcutting depth, after calculation, ranges from 0.3 to 1.2 mm, and the overcutting cross-sectional area ranges from... The vibration amplitude at the tool tip was estimated to be 0.05–0.18 mm using a vibration model, corresponding to a load stress range of 180–550 MPa. After comparing the calculated stress with the preset upper limit of 400 MPa, 120 tool points were marked as overloaded tool points.
[0058] Preferably, fixture control interference detection is performed on the workpiece model based on the toolpath trajectory, and the fixture interference tool location points are recorded, including: Based on the toolpath trajectory, the temporal motion is unfolded to form the tool holder spatial sweep body; the workpiece model is used to locate the fixture area; the spatial overlap of the fixture area is determined according to the tool holder spatial sweep body, and the spatial interference area is recorded. In one embodiment, the tool is deployed in a time sequence based on a preset toolpath trajectory to form a continuous sweep volume of the tool shank in the machining space, and the spatial volume information of each tool position point is recorded. Simultaneously, a 3D model of the workpiece and its fixture model are loaded to determine the specific position and orientation of the fixture in the machining space. Spatial overlap between the tool shank sweep volume and the fixture area is determined, and the spatial regions where interference may occur are identified by calculating the intersection volume. The spatial interference information of the corresponding tool position points is recorded.
[0059] In another embodiment, it is assumed that the workpiece model contains 20,000 mesh elements, the fixture model contains 5,000 mesh elements, and the toolpath contains 2,500 tool positions. After obtaining the tool holder sweep body through temporal motion unfolding, a total of 320 tool positions were identified as having fixture interference risks, mainly concentrated near the workpiece fixing groove and support arm. The tool spatial position (X, Y, Z) and tool holder attitude angle were recorded for each interference region. and intersection volume (unit) ).
[0060] Record the interference depth and interference boundary based on the spatial interference region; determine the clamp interference tool position based on the interference depth and interference boundary.
[0061] In one embodiment, for the identified fixture interference region, the interference depth and boundary of interference are calculated for each tool position. The interference depth can be calculated using the minimum distance from the tool holder surface to the fixture surface; the interference boundary is determined by identifying the extreme points and edge points of the intersection volume. Based on the interference depth and boundary, the fixture interference tool positions can be accurately marked, allowing for toolpath adjustments or fixture position optimization during machining to avoid collisions or machining deviations.
[0062] In another embodiment, it is assumed that among the aforementioned 320 interference risk tool locations, the calculated interference depth range is 0.2–1.0 mm, and the interference boundary covers a local area surrounding a 5 mm diameter tool. After screening, 150 tool locations are marked as actual fixture interference tool locations, with the maximum interference depth reaching 0.95 mm. Each marked tool location records the tool position coordinates (X, Y, Z) and tool holder attitude angle. And the interference depth and boundary coordinates.
[0063] Preferably, clamping control collision detection is performed on the workpiece model based on the toolpath trajectory, and the collision tool position points are recorded, including: Obtain the fixed position of the clamping mechanism in the workpiece model; calculate the clamping occupancy range in the X, Y, and Z directions based on the fixed position; obtain the tool occupancy space at each tool position along the toolpath trajectory; In one embodiment, the workpiece model and its clamping mechanism model are first loaded to obtain the fixed position and orientation of the clamping mechanism in the machining coordinate system. Based on this fixed position, the spatial occupancy (ClampingVolume) of the clamping mechanism in the X, Y, and Z directions is calculated, including the space volume occupied by the fixture base, support arm, and fixing pin. Subsequently, the three-dimensional tool occupancy (ToolSweptVolume) at each tool position point is collected along the toolpath trajectory, and the volume information of the tool holder, tool tip, and tool shank at that tool position point is recorded for spatial collision detection.
[0064] In another embodiment, it is assumed that the clamping mechanism is fixed at (X=150mm, Y=75mm, Z=0mm) in the machining coordinate system, occupying a range of X:[145,155]mm, Y:[70,80]mm, Z:[0,50]mm. The toolpath contains 2,000 tool positions. The space occupied by the tool at each tool position is discretized into approximately 1,500 spatial cells through a mesh. Each cell records the tool position (X,Y,Z) and attitude angle. .
[0065] Determine whether there is a spatial intersection between the space occupied by the tool and the clamping area; if yes, record the tool position as a collision tool position; if no, continue processing the next tool position until all tool positions have been detected.
[0066] In one embodiment, for the obtained clamping occupancy range and the tool occupancy space at each tool position, it is determined whether there is a spatial intersection between the two. If an intersection exists, it indicates that the tool may collide with the clamping mechanism at that tool position, and the tool position is marked as a collision tool position; otherwise, it is determined as a safe tool position. This process is repeated until all tool positions have been detected, generating a complete list of collision tool positions for subsequent toolpath optimization or machining safety assessment.
[0067] In another embodiment, it is assumed that the tool space occupied by 180 of the 2,000 tool positions intersects with the clamping mechanism, with an interference depth ranging from 0.1 to 0.8 mm. The maximum interference occurs at tool position number #1,035, with an interference depth of 0.78 mm. Each collision tool position records the tool position coordinates (X, Y, Z) and tool attitude angle. And the intersection volume (unit: mm³). Statistical analysis shows that collision tool points are mainly concentrated in the groove area near the support arm of the workpiece fixture and the edge area of the workpiece, accounting for 9% of the total number of tool points, providing a clear safety warning for subsequent toolpath optimization.
[0068] Preferably, step S3, which involves correcting the toolpath trajectory based on the offset tool position and extracting the tool position height information, includes: Calculate the tool position offset based on the offset tool position; apply the tool position offset to the toolpath trajectory and record the XY plane corrected tool position; use the XY plane corrected tool position to determine the tool position height information.
[0069] In one embodiment, the coordinate information of each tool position point in the original toolpath trajectory is first obtained. The tool geometry parameters are also considered. Based on machining requirements and tool radius compensation rules, the offsets ΔX and ΔY of each tool position are calculated (the offsets can be determined by parameters such as cutting width, tool diameter, and machining allowance). The calculated tool position offsets are then applied to the original toolpath to obtain the corrected XY plane tool position coordinates. Subsequently, based on the workpiece model and the corrected XY coordinates, combined with the contact relationship between the tool and the workpiece, the height information of the tool position point is determined. This ensures that the cutting depth of the tool meets the machining requirements. Finally, the corrected coordinates of each tool position point are recorded. And the corresponding offsets ΔX, ΔY, and ΔZ are used for subsequent toolpath verification and machining simulation.
[0070] In another embodiment, it is assumed that the toolpath trajectory contains 1,000 tool points, and the original coordinates of each tool point are... The range is , , Based on the tool radius compensation rules, the XY offsets ΔX and ΔY are calculated to range from [–0.5, 0.5] mm to [–0.4, 0.6] mm, with an average offset of approximately 0.25 mm. Applying these offsets to the toolpath path yields the XY plane corrected tool position coordinates. Furthermore, the Z-height is calculated based on the workpiece model, assuming... The average depth of cut (DCB) varies within the range of [0.2, 49.8] mm, with an adjustment amount ΔZ ≈ 0.15 mm. The final recorded corrected tool position and offset can be used as input data for toolpath optimization, collision detection, and machining accuracy evaluation.
[0071] Preferably, this specification also provides a three-axis CNC milling machine toolpath generation system based on elevation fitting, used to execute the above-described three-axis CNC milling machine toolpath generation method based on elevation fitting. The three-axis CNC milling machine toolpath generation system based on elevation fitting includes: The elevation fitting module is used to obtain discrete spatial sampling points of the workpiece model and convert the discrete spatial sampling points into a regular mesh; the regular mesh is used to fit the surface elevation of the workpiece model to generate a continuous elevation surface; The toolpath mapping module is used to acquire tool parameters and machining process parameters; arrange tool points using tool parameters and machining process parameters; and map tool points along a continuous elevation surface into a toolpath trajectory. The interference detection module is used to perform control interference detection on the workpiece model based on the toolpath trajectory, record the offset tool position; correct the toolpath trajectory according to the offset tool position, record the height of the corrected tool position point; and generate the toolpath for a three-axis CNC milling machine using the height of the corrected tool position point.
[0072] This application proposes a method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting. The applicable system architecture for this method is as follows: Figure 2 As shown. The system architecture includes: client device 101 and server 102, which are connected via communication network 103; wherein: The aforementioned client device 101 can be a user's smartphone, computer, smart TV, or TV box connected to a traditional TV, on which various application software client software is installed. Users can log in and use the client software of various application software through the aforementioned client device. The client software client can be a multimedia software client, such as a video client.
[0073] The aforementioned server 102 can be a single server or a server cluster, corresponding to the client installed on the client device 101, and can provide corresponding media content services to the client device. For example, server 102 can be a video server that provides video services to video clients.
[0074] The aforementioned communication network 103 can be a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile network, a wired network, a wireless network, a private network, etc.
[0075] Therefore, the embodiments should be considered as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of the equivalents of the application are intended to be included within the invention.
[0076] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.
Claims
1. A method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting, characterized in that, Includes the following steps: Step S1: Obtain discrete spatial sampling points of the workpiece model and convert the discrete spatial sampling points into a regular mesh; use the regular mesh to fit the surface elevation of the workpiece model to generate a continuous elevation surface; Step S2: Obtain tool parameters and machining process parameters; use tool parameters and machining process parameters to arrange tool positions; map tool positions along a continuous elevation surface to form a toolpath trajectory; Step S3: Perform control interference detection on the workpiece model based on the toolpath trajectory and record the offset tool position; correct the toolpath trajectory according to the offset tool position and record the height of the corrected tool position point; generate the three-axis CNC milling machine toolpath using the height of the corrected tool position point.
2. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 1, characterized in that, Step S1 involves obtaining discrete spatial sampling points of the workpiece model and converting these points into a regular mesh, including: Obtain discrete spatial sampling points of the workpiece model, where each discrete spatial sampling point includes X coordinate, Y coordinate, and Z coordinate; perform planar projection based on the X coordinate and Y coordinate to form an XY projection boundary rectangle; Grid lines are divided using XY projection boundary rectangles to form an XY grid structure; X and Y coordinates are assigned to the XY grid structure, and the average value of the Z coordinate falling into the XY grid structure is calculated. The average value is used as the elevation value of the grid node. The missing grid nodes in the XY grid structure are counted, and the elevation values of the grid nodes are used for bilinear interpolation to generate a regular grid.
3. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 2, characterized in that, The process of identifying missing grid nodes in the XY grid structure and then performing bilinear interpolation using the grid node elevation values to generate a regular grid includes: Count the missing grid nodes in the XY grid structure; select four adjacent grid nodes of the missing grid node as interpolation reference points; establish a bilinear interpolation coordinate system, and calculate the interpolation weights based on the X and Y coordinates of the interpolation reference points; The elevation values of four adjacent grid nodes are weighted according to the interpolation weight to generate the elevation values of the missing grid nodes; the missing grid nodes are then filled according to the elevation values of the missing grid nodes to generate a regular grid.
4. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 1, characterized in that, Step S1 involves fitting the surface elevation of the workpiece model using a regular mesh to generate a continuous elevation surface, including: Extract grid elevation values from the regular grid; reconstruct the first elevation surface based on the regular grid; calculate the residual distribution values based on the grid elevation values and the first elevation surface; identify high residual regions on the first elevation surface using the residual distribution values; Add surface control nodes to the high residual region and use the surface control nodes to reconstruct the second elevation surface; eliminate abrupt change points based on the second elevation surface and calculate the fitting residual. Repeat the elimination of abrupt change points until the fitting residual is less than the preset residual threshold to generate a continuous elevation surface.
5. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 1, characterized in that, In step S3, control interference detection is performed on the workpiece model based on the toolpath trajectory, and the offset tool position is recorded, including: Based on the toolpath, perform tool control overcut detection on the workpiece model and record the overcut tool position; based on the toolpath, perform fixture control interference detection on the workpiece model and record the fixture interference tool position. Based on the toolpath trajectory, clamping control and collision detection are performed on the workpiece model, and the collision tool position is recorded; the overcutting tool position, the fixture interference tool position, and the collision tool position are integrated as the offset tool position.
6. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 5, characterized in that, Based on the toolpath trajectory, tool control overcut detection is performed on the workpiece model, and the overcut points are recorded, including: Load the workpiece model to determine the overcut detection benchmark; construct the tool sweep body along the toolpath trajectory and record the tool sweep volume; determine the tool overcut area based on the tool sweep volume and the overcut detection benchmark. Calculate the overcut depth and overcut cross-sectional area based on the overcut area; evaluate the vibration amplitude of the tool tip based on the overcut depth and overcut cross-sectional area; calculate the tool tip load stress based on the tool tip vibration amplitude; determine the tool overload state by comparing the tool tip load stress with the preset load stress; mark the overcut point using the tool overload state.
7. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 5, characterized in that, Based on the toolpath trajectory, fixture control interference detection is performed on the workpiece model, and the fixture interference toolpath points are recorded, including: Based on the toolpath trajectory, the temporal motion is unfolded to form the tool holder spatial sweep body; the workpiece model is used to locate the fixture area; the spatial overlap of the fixture area is determined according to the tool holder spatial sweep body, and the spatial interference area is recorded. Record the interference depth and interference boundary based on the spatial interference region; determine the clamp interference tool position based on the interference depth and interference boundary.
8. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 5, characterized in that, Based on the toolpath trajectory, clamping control and collision detection are performed on the workpiece model, and the collision tool locations are recorded, including: Obtain the fixed position of the clamping mechanism in the workpiece model; calculate the clamping occupancy range in the X, Y, and Z directions based on the fixed position; obtain the tool occupancy space at each tool position along the toolpath trajectory; Determine whether there is a spatial intersection between the space occupied by the tool and the clamping area; if yes, record the tool position as a collision tool position; if no, continue processing the next tool position until all tool positions have been detected.
9. The method for generating toolpaths for a three-axis CNC milling machine based on elevation fitting according to claim 1, characterized in that, Step S3 involves correcting the toolpath trajectory based on the offset tool position and extracting the tool position height information, including: Calculate the tool position offset based on the offset tool position; apply the tool position offset to the toolpath trajectory and record the XY plane corrected tool position; use the XY plane corrected tool position to determine the tool position height information.
10. A toolpath generation system for a three-axis CNC milling machine based on elevation fitting, characterized in that, For executing the elevation fitting-based three-axis CNC milling toolpath generation method as described in claim 1, the elevation fitting-based three-axis CNC milling toolpath generation system comprises: The elevation fitting module is used to obtain discrete spatial sampling points of the workpiece model and convert the discrete spatial sampling points into a regular mesh; the regular mesh is used to fit the surface elevation of the workpiece model to generate a continuous elevation surface; The toolpath mapping module is used to acquire tool parameters and machining process parameters; arrange tool points using tool parameters and machining process parameters; and map tool points along a continuous elevation surface into a toolpath trajectory. The interference detection module is used to perform control interference detection on the workpiece model based on the toolpath trajectory, record the offset tool position; correct the toolpath trajectory according to the offset tool position, record the height of the corrected tool position point; and generate the toolpath for a three-axis CNC milling machine using the height of the corrected tool position point.