Workpiece compensation machining method, digital control machine tool and computer program product

By constructing a multi-level mapping mechanism of feature surface-probe point-tolerance range in CNC machine tools, combined with real-time power monitoring and Bayesian estimation algorithm, automated workpiece compensation machining is realized, solving the problems of low machining efficiency and excessive manual intervention in existing technologies, and improving the robustness and accuracy of the machining process.

CN122322945APending Publication Date: 2026-07-03WEIFANG GOERTEK ELECTRONICS CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WEIFANG GOERTEK ELECTRONICS CO LTD
Filing Date
2026-06-08
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

During the machining process, existing CNC machine tools cause deviations between actual dimensions and theoretical design values ​​due to tool wear, cutting thermal deformation, and repeated positioning errors during clamping. They cannot automatically determine whether the points of features of different accuracy levels are qualified, and rely heavily on manual intervention, resulting in low machining compensation efficiency.

Method used

By obtaining the tolerance range of the workpiece feature surface and the theoretical machining dimensions of the probe points, and combining the Bayesian estimation algorithm to fuse static and dynamic tool parameters for thermal drift compensation, the spindle power signal is monitored in real time for pre-compensation, a rework island area is constructed and a compensation machining program is automatically generated, thus achieving automated judgment and compensation.

Benefits of technology

It significantly improves the processing efficiency and first-pass yield of CNC machine tools, reduces manual intervention, ensures the robustness and accuracy of the processing, and avoids the risk of rework paths intruding into the qualified area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122322945A_ABST
    Figure CN122322945A_ABST
Patent Text Reader

Abstract

This application provides a workpiece compensation machining method, a numerically controlled machine tool, and a computer program product, relating to the field of CNC machine tool machining technology. It aims to solve the problem of low compensation efficiency caused by the disconnect between measurement, judgment, and compensation stages. The method includes: obtaining workpiece tolerances and theoretical dimensions of probe points; fusing static and dynamic tool parameters and performing thermal compensation to generate optimal tool parameters; performing pre-compensation based on spindle power during machining; measuring actual dimensions after machining to determine deviations and identifying out-of-tolerance points as target compensation points; clustering target compensation points to construct a rework island region isolated from the qualified area; adjusting G-code program segments within the rework island based on dimensional deviations and optimal tool parameters to generate a rework program; and executing compensation machining after simulation inspection. This application achieves closed-loop automated compensation, improving machining efficiency and workpiece pass rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of CNC machine tool processing technology, and in particular to workpiece compensation processing methods, numerical control machine tools and computer program products. Background Technology

[0002] In the fields of mold manufacturing and precision parts machining, during CNC (Computer Numerical Control) machine tool processing, factors such as tool wear, cutting thermal deformation, and clamping repeatability errors can all cause deviations between actual dimensions and theoretical design values. Therefore, to ensure the pass rate of parts, post-machining inspection of critical dimensions has become an essential process.

[0003] Currently, some machine tools are equipped with in-machine measurement functions, which can use integrated probes to perform contact or non-contact measurements on specific points on the workpiece surface to obtain the actual coordinates or simple geometric dimensions of the measured points. However, these measurement functions only acquire the coordinates or simple geometric dimensions of the points and cannot automatically determine whether points with different accuracy levels are qualified or not, thus failing to compensate for abnormal points. Because the measurement, judgment, and compensation processes are disconnected, the entire inspection and rework process heavily relies on manual intervention, resulting in low processing compensation efficiency.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a workpiece compensation machining method, a digital control machine tool, and a computer program product, aiming to solve the technical problem of how to improve the machining efficiency of digital control machine tools.

[0006] To achieve the above objectives, this application proposes a workpiece compensation machining method, comprising the following steps: Obtain the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point, and determine the tolerance range of each probe point according to the feature surface to which each probe point belongs; The static tool parameters from the external tool setting device and the dynamic tool parameters measured inside the machine tool are obtained. The static and dynamic tool parameters are fused based on the Bayesian estimation algorithm, and thermal drift compensation is performed in combination with the machine tool thermal deformation model to generate the optimal tool parameters under the current state. When the machine tool executes the allowance machining program, the cutting state is identified based on the real-time collected spindle power signal. When the state of excessive allowance is identified, the actual allowance offset value is calculated based on the preset power-allowance mapping model, and an adaptive compensation command is sent to the machine tool CNC system for pre-compensation. After processing is completed, the actual processing dimensions of each probe point are measured, and the dimensional deviation of each probe point is determined based on the difference between the actual processing dimensions and the theoretical processing dimensions. The probe points whose size deviation exceeds the tolerance range but is less than the preset deviation threshold are identified as target compensation points. Spatial clustering is performed on the target compensation points to form non-compliant NG clusters. Each NG cluster is expanded outward by a preset expansion distance to generate a safety envelope. The safety envelope is then compared with the three-dimensional model of the surrounding compliant area within the tolerance range using Boolean subtraction to construct a rework island area isolated from the compliant area. Based on the preset association relationship, the machining tool and G-code program segment corresponding to the target compensation point are determined, wherein the association relationship is the association relationship between the feature surface and the G-code program segment and tool information for machining the feature surface; Based on the optimal tool parameters and the dimensional deviation of the target compensation point, the path offset value of the machining tool is determined, and under the boundary constraints of the rework island area, the G-code program segment is adjusted according to the path offset value to obtain the rework program; The rework procedure is simulated and checked. If the simulation check passes, the workpiece to be inspected is compensated and processed based on the rework procedure.

[0007] In some embodiments, the step of obtaining the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point includes: Based on the workpiece drawing of the workpiece to be inspected, determine the tolerance range of each feature surface; The probe points of the workpiece to be inspected are determined by automatically placing points according to the tolerance range and area of ​​each feature surface. Based on the workpiece drawing, determine the theoretical machining dimensions of each probe point.

[0008] In some embodiments, the step of fusing the static and dynamic tool parameters based on a Bayesian estimation algorithm and performing thermal drift compensation in conjunction with a machine tool thermal deformation model to generate the optimal tool parameters for the current state includes: Using the static tool parameters of the external tool setting instrument as the prior distribution and the dynamic tool parameters measured inside the machine tool as the observed values, a covariance matrix of the measurement error is constructed. The posterior probability distribution of tool length and radius under the current state is calculated using the Bayesian estimation algorithm, and the expected value is extracted as the fused tool parameters. The machine tool spindle's current operating temperature or time data is obtained, and then substituted into a preset thermal drift compensation coefficient function to dynamically correct the fused tool parameters, thereby obtaining the optimal tool parameters.

[0009] In some embodiments, the step of calculating the actual margin offset value based on a preset power-margin mapping model and issuing an adaptive compensation command to the machine tool CNC system for pre-compensation when an excessive margin is identified includes: The real-time acquired spindle power signal is filtered and denoised to extract power fluctuation characteristics. When the power fluctuation characteristics exceed the preset standard cutting power threshold, it is determined to be an excessive margin state. Based on the mapping model between cutting force and material removal cross-sectional area, the actual allowance offset value is calculated by back-calculating the current power deviation. Based on the actual margin offset value, a feed rate reduction command or a Z-axis negative fine-tuning command is generated and sent to the machine tool CNC system.

[0010] In some embodiments, the step of performing a simulation check on the rework procedure includes: The rework procedure is subjected to overcutting and interference checks; If the virtual cut-off amount does not intrude into the preset tolerance zone and there is no collision error, the simulation check is considered to have passed. If the simulation check fails, an alarm message will be output to trigger manual intervention.

[0011] In some embodiments, prior to the step of measuring the actual machining dimensions of each of the probe points, the method further includes: The water gun device is controlled to rinse the workpiece to be inspected; The air gun device is controlled to blow and clean the workpiece to be inspected after rinsing.

[0012] In some embodiments, after the step of performing compensation processing on the workpiece to be inspected, the method further includes: The actual machining dimensions of each of the probe points are remeasured, and the step of determining the dimensional deviation of each of the probe points based on the difference between each of the actual machining dimensions and each of the theoretical machining dimensions is performed. If the dimensional deviation of each probe point is within the tolerance range corresponding to each probe point, and the number of compensation processing operations does not exceed the preset number, the workpiece is deemed qualified. An alarm message is output if the dimensional deviation of at least one probe point is not within the corresponding tolerance range, or if the number of compensation processes exceeds the preset number.

[0013] Furthermore, this application provides a digitally controlled machine tool, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is configured to implement the steps of the workpiece compensation machining method described above.

[0014] Furthermore, embodiments of this application provide a storage medium, which is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the workpiece compensation machining method described above.

[0015] Furthermore, this application provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the workpiece compensation machining method described above.

[0016] This application proposes a workpiece compensation machining method. By constructing a multi-level mapping mechanism of "feature surface - probe point - tolerance range," this method solves the problem that traditional in-machine measurement can only obtain coordinates but cannot correlate with design accuracy. By refining the macroscopic tolerances at the drawing level to microscopic point positions, the system can automatically adapt differentiated judgment thresholds based on the functional attributes of the feature surfaces (such as mating surfaces and non-mating surfaces). This provides a quantifiable mathematical benchmark for subsequent automated qualification judgment, avoiding overly strict or lenient judgments caused by uniform thresholds, and significantly reducing the workload and risk of misjudgment caused by manual subjective judgment based on drawings.

[0017] At the machining execution level, this application's embodiments introduce a pre-compensation mechanism for allowance based on the spindle power signal, transforming the traditional "post-process rework" into "in-process adjustment." By monitoring power fluctuation characteristics in real time and inferring the actual allowance offset value based on the power-allowance mapping model, the system can immediately issue feed rate adjustment or Z-axis fine-tuning commands the moment excessive allowance is detected. This mechanism effectively alleviates sudden changes in cutting load caused by uneven blank allowance, prevents tool deflection and dimensional divergence, and thus completes dynamic buffering before irreversible dimensional deviations form, improving the robustness of the machining process and the first-pass yield.

[0018] For the rework process, this application's embodiment constructs a strict rework safety boundary through a three-level process: "deviation threshold screening—spatial clustering—Boolean difference." First, a deviation threshold is set to filter out severely out-of-tolerance points that are unrepairable, avoiding invalid processing. Second, spatial clustering transforms discrete points into continuous NG clusters, which are then expanded into a safety envelope at a preset distance. Finally, Boolean difference is performed with the 3D model of the qualified area to construct an isolated rework island completely isolated from the qualified area. This mechanism ensures that subsequent compensation processing is strictly confined to a closed 3D region, fundamentally eliminating the risk of rework paths intruding into the qualified area, achieving precise control of "repairing the bad without damaging the good."

[0019] Finally, based on the preset "feature surface-tool-G code" association, this embodiment automatically inherits the original machining process resources. It only needs to calculate the path offset value based on the optimal tool parameters and the dimensional deviation of the target point to reconstruct the rework program under the rework island constraint. This adaptive adjustment mechanism avoids process disconnect and tool connection marks caused by manual reprogramming, ensuring consistency between the rework area and the original machining area in terms of tool and cutting parameters. Combined with the pre-verification of overcutting and interference through simulation inspection, this embodiment forms a complete closed loop of "perception-decision-execution-verification," significantly improving the machining efficiency and rework success rate of CNC machine tools without relying on manual reprogramming and remeasurement. Attached Figure Description

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

[0021] Figure 1 This is a flowchart illustrating the first embodiment of the workpiece compensation processing method of this application.

[0022] Figure 2 This is a schematic diagram of the system architecture of a workpiece compensation processing method provided according to an embodiment of this application. Figure 3 This is a schematic flowchart of a workpiece compensation processing method provided according to an embodiment of this application. Figure 4 yes Figure 2 The detailed data flow diagram of step S102 shows the process of generating optimal tool parameters.

[0023] Figure 5 yes Figure 2 The detailed flowchart of step S106 shows the construction process of the repair island area.

[0024] The image includes the following annotations: 101. Numerical Control Machine Tool; 102. Controller; 103. Machine Tool Body; 104. External Tool Setter; 105. Workstation; 301. Static Tool Parameters; 302. Dynamic Tool Parameters; 303. Bayesian Estimation Module; 304. Fusion Tool Parameters; 305. Temperature Sensor Data; 306. Thermal Drift Compensation Module; 307. Optimal Tool Parameters; 401. Target Compensation Point; 403. NG Cluster; 405. Safety Envelope; 406. 3D Model of Qualified Area; 407. Boolean Subtraction; 408. Rework Island Area. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application. Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by those skilled in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application. Before further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application are explained, and the nouns and terms involved in the embodiments of this application are subject to the following interpretations.

[0026] Static tool parameters refer to the inherent geometric parameters of the tool when it is not in operation, measured by external specialized equipment (such as an external tool setter), such as the tool's length and radius. These parameters are usually used as reference values ​​and have high measurement accuracy, but they cannot reflect the real-time status of the machine tool in the actual working environment, such as thermal deformation and clamping errors.

[0027] Dynamic tool parameters refer to the parameters measured by an in-machine measurement system (such as a contact probe mounted on the machine tool body) within the machine tool coordinate system when the tool is mounted on the machine tool spindle. Although the measurement accuracy of these parameters may be slightly lower than that of a dedicated tool setter, they include the machine tool's clamping errors and some thermal effects, and can more realistically reflect the actual position and state of the tool in the current machining cycle.

[0028] Optimal tool parameters: These refer to the most accurate and reliable tool compensation values ​​used to guide the execution of the machining program, obtained by combining high-precision static tool parameters with dynamic tool parameters reflecting real-time status through a specific data fusion algorithm (such as Bayesian estimation in the embodiments of this application), and further performing thermal drift compensation based on the real-time operating conditions of the machine tool (such as spindle temperature or running time). These parameters aim to be as close as possible to the actual effective size of the tool at the moment of cutting.

[0029] Pre-compensation refers to the proactive, preventative intervention during the machining process by dynamically identifying the cutting state through real-time monitoring of physical signals (such as spindle power). This is done before deviations cause excessive allowance, overcutting, or excessive wear or even damage to the tool. This contrasts with the traditional "post-machining" compensation method that involves measurement and compensation after machining.

[0030] The rework island region refers to an independent geometric region in the 3D model space that requires compensation processing. This region is formed by expanding one or more spatially adjacent target compensation points with out-of-tolerance dimensions (forming a cluster of non-compliant (NG) points) into a safety envelope, and then performing a Boolean difference operation between this envelope and the surrounding dimensionally compliant region's theoretical 3D model. This region precisely defines the scope of secondary processing, avoiding repeated processing of already compliant regions.

[0031] G-code program segments are collections of instruction codes in CNC machining programs (usually G-code files) used to control a specific machining tool to complete the machining of a specific feature surface (such as a plane, a curved surface, or a hole). In complex machining programs, different G-code program segments typically correspond to different tools and machining strategies.

[0032] This application provides a workpiece compensation machining method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the workpiece compensation processing method of this application.

[0033] In this embodiment, the workpiece compensation machining method is applied to a digitally controlled device, including steps S100~S800: Step S100: Obtain the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point, and determine the tolerance range of each probe point according to the feature surface to which each probe point belongs.

[0034] In this context, a feature surface refers to a functional surface on a workpiece's 3D model that has specific geometric shapes and precision requirements, such as planes, curved surfaces, hole walls, or stepped surfaces. These surfaces are assigned independent tolerance attributes during the design phase. The tolerance range refers to the allowable dimensional variation within this feature surface, typically indicated as upper and lower deviation values ​​in the product manufacturing information of engineering drawings or the 3D model. A probe point refers to the specific coordinate location of a measurement point taken using a machine tool probe; each point corresponds to a clearly defined measurement target. The theoretical machining dimension refers to the ideal dimensional value corresponding to a specific probe point on the workpiece's design model.

[0035] One implementation of this step is to directly read the product manufacturing information integrated into the 3D model of the workpiece, extract the tolerance attributes of each feature surface from the information, and automatically associate these tolerances with the corresponding geometric surfaces. Then, the measurement program synchronously writes the tolerance values ​​into the attribute fields of each measuring point when planning the points, thereby establishing a digital association of "point-theoretical value-tolerance zone". Another implementation is for production line upgrade scenarios with existing inspection benchmarks. By interfacing with the manufacturing execution system or quality management system, the first-piece inspection report of the batch of workpieces is obtained. The tolerance definitions of each feature surface and the theoretical values ​​of each measuring point are parsed and inherited from the report, completing the information import. Through this step, the accuracy requirements on the 2D drawing can be transformed into structured data that can be directly accessed by the 3D measurement points, laying the data foundation for fully automated differential tolerance judgment and eliminating the inefficient process of manually reading drawings and manually assigning tolerances to measuring points.

[0036] In step S200, when the machine tool is executing the allowance machining program, the cutting state is identified based on the real-time collected spindle power signal. When the state of excessive allowance is identified, the actual allowance offset value is calculated based on the preset power-allowance mapping model, and an adaptive compensation command is sent to the machine tool CNC system for pre-compensation.

[0037] The allowance machining program specifically refers to the G-code program used to remove the allowance of the workpiece blank or semi-finishing allowance. It has a large cutting load, and load changes can reflect the allowance status. The spindle power signal is a signal that is acquired in real time by the spindle driver or an external sensor, characterizing the changes in the output power of the spindle motor. Cutting state identification is the process of identifying the tool's state (normal cutting, no-load, or excessive allowance) through real-time analysis of the characteristics of this power signal. Excessive allowance refers to an abnormal state where the current actual cutting allowance exceeds the preset value of the CNC program, manifested as a continuously high power signal exceeding the normal fluctuation range. The power-allowance mapping model is a mathematical model or data table established based on the relationship between cutting force and depth of cut and width of cut, used to describe the physical relationship between the increment of cutting power and the increment of material removal volume, i.e., the allowance offset value. Adaptive compensation instructions refer to CNC system instructions that adjust machining parameters online without interrupting the current machining process. Pre-compensation refers to immediately adjusting the parameters of the current or immediately following toolpath during the same operation of machining the current toolpath, eliminating deviations in the current machining.

[0038] This step typically involves filtering and denoising the real-time acquired spindle power signal and extracting power fluctuation characteristics. When these characteristics exceed a preset standard cutting power threshold, it is determined that the allowance is too large. Subsequently, the actual allowance offset value is calculated based on the current power deviation, and a feed rate reduction command or a Z-axis negative fine-tuning command is generated and sent to the CNC system based on this offset value. Through this step, quality control is shifted from post-process inspection to real-time process control. Non-intrusive power sensing is used to compensate for abnormal allowances in real time, avoiding overcutting, tool breakage, or irreparable undercutting due to excessive allowances, ensuring a high first-pass yield and reducing the number of workpieces requiring downtime for rework.

[0039] Step S300: After processing is completed, the actual processing size of each probe point is measured, and the size deviation of each probe point is determined based on the difference between each actual processing size and each theoretical processing size. The probe points whose size deviation exceeds the tolerance range but is less than the preset deviation threshold are determined as target compensation points.

[0040] Actual machined dimensions refer to the dimensional values ​​actually measured and calculated using the in-machine probe at the probe points. Dimensional deviation is the algebraic difference between the actual machined dimension and the theoretical machined dimension; a positive value indicates the dimension is too large, and a negative value indicates it is too small. The deviation threshold is a preset upper limit value for deviations exceeding the tolerance range. It is used to define the process boundary between compensable rework and uncompensable scrap. Defects exceeding this threshold are no longer processed using this method because the removal amount is too large or has damaged the structure.

[0041] In implementing this step, the deviation threshold can be set in different ways. One approach is a fixed threshold setting based on process capability. This involves setting a fixed limit value as a uniform threshold based on the material removal characteristics of the part, the allowable depth of cut of the finishing tool used for rework, and the surface heat treatment depth. Only points with deviations between this fixed threshold and the upper tolerance limit are identified as reworkable points. Another approach is an adaptive threshold setting based on features. This involves setting different deviation thresholds for different feature surfaces. For example, a smaller threshold is set for high-hardness precision curved surfaces, while a larger threshold is set for general assembly planes. When making a judgment, the point is selected not only based on its own deviation but also based on the threshold of the feature it belongs to, achieving hierarchical rework decisions. Through this step, efficient and accurate screening of rework objects is automatically achieved, replacing manual experience. This ensures that the system only processes minor deviations that are economically worthwhile and processably repairable, excluding acceptable points and points that are directly scrapped, making subsequent rework path planning highly focused.

[0042] Step S400: Spatial clustering of target compensation points to form non-compliant NG clusters; expansion of each NG cluster outward by a preset expansion distance to generate a safety envelope; Boolean difference between the safety envelope and the three-dimensional model of the surrounding compliant area within the tolerance range to construct a repair island area isolated from the compliant area.

[0043] Spatial clustering is a 3D spatial data analysis technique that automatically groups spatially adjacent points into independent sets based on the coordinates of each target compensation point. Each set is called an NG cluster, where NG stands for "Not Good." The preset expansion distance is a process safety parameter that defines the length of outward offset from the NG cluster boundary, used to generate a safe operating space. The safety envelope is a closed 3D geometry formed by uniformly expanding outward from the NG cluster as its core, completely enclosing the NG cluster. The 3D model of the qualified area is the surface geometry model of the accepted area retained after removing non-target point areas from the overall 3D model of the workpiece. Boolean subtraction is a basic operation in 3D solid modeling, subtracting the portion intersecting with the safety envelope from the qualified area. The rework island area is an independent material area cut from the safety envelope after Boolean subtraction, physically isolated from adjacent qualified surfaces; it is the redundant part that needs to be precisely removed.

[0044] This step can be implemented based on different envelope generation strategies. One approach is to first convert the target point set into a triangular mesh model, then perform 3D offset expansion on the mesh using a fixed or varying physical distance based on the curvature of the points to generate an envelope, and finally perform Boolean subtraction with the surrounding qualified models to obtain the rework island. Another approach is to directly simulate a scanning volume along the theoretical path using the corresponding machining tool based on the G-code path determined in step S600, then radially expand this scanning volume to serve as a safety envelope, and finally perform Boolean subtraction. This approach is more adaptable to complex surfaces. Through this step, scattered defects are regularized into block defects using spatial clustering, and protective boundaries are generated through computational geometry. This strictly confines rework within the rework island, fundamentally solving the risk of accidentally damaging adjacent qualified surfaces during micro-compensation. It provides safe boundary conditions without overcutting risk for automatically generated rework programs, ensuring the safe implementation of unmanned automated rework.

[0045] Step S500: Perform compensation processing on the workpiece to be inspected based on the rework island area.

[0046] For example, step S500, which involves performing compensation processing on the workpiece to be inspected based on the rework island area, includes: Step S510: Obtain the static tool parameters from the external tool setter and the dynamic tool parameters measured inside the machine tool. Based on the Bayesian estimation algorithm, perform data fusion on the static and dynamic tool parameters, and combine the machine tool thermal deformation model to perform thermal drift compensation to generate the optimal tool parameters under the current state.

[0047] An external tool setter is an offline tool measurement device independent of the machine tool. It accurately measures parameters such as the length and radius of the tool through optical projection or contact methods. While the measurement results are highly accurate, they reflect the offline state at room temperature and are called static tool parameters. In-machine measurement, on the other hand, utilizes the machine tool's built-in contact or laser tool setter to measure tool parameters in real time. The obtained data is called dynamic tool parameters, which includes the influence of actual operating conditions such as current machine tool temperature rise and spindle tension. Bayesian estimation is a probabilistic data fusion method that uses high-precision static parameters as prior knowledge, combined with real-time but potentially noisy dynamic observations, to calculate the posterior estimate with the highest probability of the tool's true state. A thermal deformation model is a mathematical model describing the thermal displacement of key machine tool components with temperature or operating time. Thermal drift compensation uses this model to reverse-correct measured parameters, eliminating measurement errors caused by thermal expansion.

[0048] During implementation, different fusion strategies can be selected depending on the application scenario. In scenarios emphasizing rapid tool changes, the values ​​measured on the external tool setter after each tool change can be used as a stable prior distribution. The values ​​quickly remeasured by the in-machine tool setter before the first cut after the tool change can be used as observations for Bayesian fusion, quickly outputting the optimal parameters for the current tool holder position. In scenarios emphasizing long-term continuous machining, the static parameters at the start of the machining cycle can be used as a priori basis, and the dynamic parameters as a sequence of observations acquired periodically. Simultaneously, the thermal deformation model provides continuous compensation based on real-time readings from the spindle temperature sensor, and the optimal tool parameters are iteratively updated over time through sequential estimation. This step overcomes the limitation of a single data source failing to accurately reflect the current physical state of the tool. After algorithmic fusion and physical correction, high-confidence tool parameters are generated, refining tool size presets from the machining source, effectively reducing batch machining deviations caused by inaccurate tool parameters, and lowering the rework frequency.

[0049] This application employs a Bayesian estimation algorithm to deeply fuse the static high-precision parameters of the external tool setter with the dynamic operating parameters measured inside the machine tool, and combines this with a thermal deformation model for real-time correction. This data fusion mechanism mathematically effectively suppresses random noise and systematic drift from a single data source, ensuring that the generated optimal tool parameters reflect both the true physical state of the tool and the current cutting environment. Therefore, the system reduces the accumulation of machining errors caused by inaccurate tool parameters at the source, laying a reliable physical foundation for subsequent high-precision compensation machining.

[0050] Step S520: Based on the preset association relationship, determine the machining tool and G-code program segment corresponding to the target compensation point, wherein the association relationship is the association relationship between the feature surface and the G-code program segment and tool information of the machining feature surface.

[0051] This association is a process knowledge base that clarifies which specific cutting tool and which one or more G-code program segments were used to machine each feature surface on the workpiece. The cutting tool refers to the identification information of the cutting tool used in the original process flow to finish the feature surface at the target location. The G-code program segment refers to the part of the original machining program that specifically generates the toolpath and control instructions for the out-of-tolerance feature surface; it may be represented by a subroutine number or several consecutive lines of G-code.

[0052] The key to this step lies in the method of establishing the correlation. One approach is to automatically embed feature identifiers and tool identifiers as comments or variables before the program segment of each machining feature during software post-processing to generate G-code. During machining, the CNC system parses these and establishes a mapping relationship library. Another approach is to utilize the machining simulation function built into the CNC system, loading the workpiece model and the entire set of G-code to simulate the complete machining process. The system automatically records which tool and which program segment shaped each triangular mesh on the workpiece model, thereby generating a correlation relationship database in reverse engineering. Through this step, the data link between rework decisions and the original machining process is established, enabling the system to automatically and accurately locate the tools and program segments required to repair defects. This completely replaces the tedious process of manually analyzing the process, searching for programs and tools, and achieves seamless integration from defect identification to repair execution.

[0053] Step S530: Based on the optimal tool parameters and the dimensional deviation of the target compensation point, determine the path offset value of the machining tool, and under the boundary constraints of the rework island area, adjust the G-code program segment according to the path offset value to obtain the rework program.

[0054] The path offset value is a vector value set to cause a slight movement of the tool cutting edge in the compensation direction. Its magnitude is determined by factors such as the actual dimensional deviation and the tool radius in the optimal tool parameters, and its direction is usually along the negative normal direction of the machined surface. The boundary constraint is the three-dimensional geometric boundary of the rework island area generated in step S500. It serves as a constraint on the tool path adjustment in the G-code program segment, ensuring that the modified path does not exceed this boundary. During implementation, under the rigid constraint of the rework island boundary, the optimal tool compensation and quantitative deviation compensation are integrated into a single path offset value. Based on this, the tool position coordinates in the original G-code are offset and modified, generating a rework program specifically for this repair, with the path limited to a safe area. Through this step, precise quantitative repair is achieved, ensuring no overcutting risk throughout the process.

[0055] Step S540: Perform simulation check on the rework procedure. If the simulation check passes, perform compensation processing on the workpiece to be inspected based on the rework procedure.

[0056] Simulation inspection is a graphical simulation of the entire rework process in a virtual environment using 3D models and machine tool kinematic models. It specifically includes overcutting and interference checks. Overcutting checks verify whether the cutting part of the tool intrudes into any surface on the workpiece except for the rework island area, especially surfaces within the tolerance zone that are already acceptable. Interference checks verify whether moving parts such as the tool, tool holder, and spindle end face will collide with stationary parts such as the workpiece and fixtures. During implementation, if the virtual removal amount does not intrude into the preset tolerance zone and there are no collision errors, the simulation check is considered passed; otherwise, an alarm message is output to trigger manual intervention. This step provides a final virtual verification line for the fully automated rework program. By rehearsing the rework process using digital twin technology, the safety and correctness of the program are ensured, eliminating the possibility of machine collisions or workpiece scrap due to oversights in program generation logic or extreme conditional coupling, thus enabling the automated process to have the reliable closed loop required for industrial applications.

[0057] Please see Figure 2 and Figure 3 This application provides a workpiece compensation machining method to solve the technical problems in existing CNC machining where the measurement, judgment, and compensation processes are disconnected, leading to low machining efficiency, excessive manual intervention, and a low first-pass yield. This method achieves intelligent identification and adaptive compensation of machining deviations by constructing a closed-loop automated process of "measurement-diagnosis-decision-execution-verification." Figure 2 As shown, this method can be implemented in a system consisting of a CNC machine tool 101, an external tool setter 104, and a workstation 105. The controller 102 of the CNC machine tool 101 is the core execution unit of the entire method.

[0058] In a basic implementation, the method first performs the step of obtaining the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point. This is the data foundation for the entire compensation process. The controller 102 receives the workpiece drawing containing the three-dimensional model and tolerance information from the workstation 105, and parses out the design requirements of different feature surfaces (such as planes, curved surfaces, and holes). At the same time, based on these feature surfaces, the probe points used for subsequent measurements and their precise coordinates and dimensions on the theoretical model are determined. By assigning the tolerance information of the feature surfaces to the probe points, each measurement point has a clear acceptance criterion, solving the problem of the disconnect between measurement points and accuracy requirements in the prior art.

[0059] Next, to ensure initial machining accuracy, the method acquires static tool parameters from an external tool setter and dynamic tool parameters measured within the machine tool, and fuses these two data to generate optimal tool parameters for the current state. Static tool parameters are provided by a high-precision external tool setter 104, while dynamic tool parameters are measured by a probe on the machine tool body 103 under the current operating conditions. The controller 102 uses a data fusion algorithm to combine the accuracy of static parameters with the real-time performance of dynamic parameters, and incorporates the machine tool's thermal deformation model for thermal drift compensation. In this way, optimal tool parameters that best reflect the true state of the tool at the moment of cutting can be obtained, laying the foundation for subsequent precise machining and compensation, and effectively overcoming dimensional drift caused by factors such as tool wear and thermal expansion.

[0060] To prevent machining abnormalities caused by uneven blank allowances during machining operations, this method introduces a pre-compensation mechanism. The controller 102 acquires the power signal of the spindle of the machine tool body 103 in real time and identifies the cutting state based on this signal. When an excessive allowance is detected, such as an abnormal increase in spindle power, the system calculates the actual allowance offset value based on a preset power-allowance mapping model. Subsequently, the controller 102 immediately sends adaptive compensation commands to the machine tool CNC system, such as reducing the feed rate or fine-tuning the toolpath, to perform pre-compensation. This proactive intervention avoids overcutting, tool damage, or workpiece scrap that may result from excessive allowances, improving the stability and safety of the machining process.

[0061] After the initial machining is completed, the in-machine measurement and post-compensation stage begins. The controller 102 controls the probes on the machine tool body 103 to accurately measure preset probe points and obtain the actual machining dimensions of each probe point. Then, by comparing the actual machining dimensions with the theoretical machining dimensions, the dimensional deviation of each probe point is calculated. This step enables rapid, in-situ evaluation of the workpiece machining quality.

[0062] Subsequently, according to preset rules, the system identifies probe points whose dimensional deviations exceed the tolerance range but are less than a preset deviation threshold (usually the maximum allowable rework amount) as target compensation points requiring compensation processing. This screening process ensures that only areas that are necessary and potentially repairable are processed, avoiding ineffective operations on minor, acceptable deviations or huge deviations that exceed repair capabilities.

[0063] To generate accurate and safe rework procedures, this method performs spatial geometric processing on the identified target compensation points. First, spatially adjacent target compensation points are clustered to form one or more non-compliant (NG) clusters. Then, each NG cluster is expanded outwards by a preset expansion distance to generate a safety envelope. Finally, a Boolean difference operation is performed between this safety envelope and the 3D model of the surrounding compliant areas within tolerance. Through this series of operations, one or more independent rework island regions completely isolated from the compliant areas are constructed. This method ensures that compensation processing is strictly limited to the areas requiring rework and does not affect already compliant surfaces, thus guaranteeing the safety of the rework process.

[0064] After identifying the geometric area requiring rework, the corresponding machining program segment needs to be located and modified. The controller 102 determines the original machining tool and G-code program segment corresponding to each target compensation point based on a preset association. This association is typically established during the programming phase, binding each feature surface of the workpiece to its machining process (tool used, cutting parameters, G-code block). In this way, the system can quickly locate the original machining command causing the deviation.

[0065] Next, based on the previously calculated optimal tool parameters and the specific dimensional deviations of the target compensation points, the system determines a precise path offset value for each machining tool requiring compensation. Then, under the strict boundary constraints of the previously constructed rework island region, the system adjusts the located G-code program segment according to this path offset value, automatically generating a new rework program. The adjustment process may include modifying the tool radius compensation value, the tool length compensation value, or directly fine-tuning the toolpath coordinates.

[0066] Finally, to improve reliability, the newly generated rework program is simulated and checked before the actual compensation machining is performed. The system simulates the rework process in a virtual environment, checking for overcutting (cutting into the acceptable area or below the tolerance zone) or interference (collision between the tool / tool ​​holder and the workpiece / fixture). Only when the simulation check passes completely will the controller 102 instruct the machine tool body 103 to perform the final compensation machining on the workpiece based on the rework program. This series of closed-loop steps, through automated data flow and intelligent decision-making, significantly improves machining accuracy and efficiency, achieving high-quality, unmanned compensation machining of complex workpieces.

[0067] Furthermore, the steps for obtaining the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point include: determining the tolerance range of each feature surface based on the workpiece drawing of the workpiece to be inspected; The probe points are automatically placed based on the tolerance range and area of ​​each feature surface to determine the probe points on the workpiece to be inspected; the theoretical machining dimensions of each probe point are determined based on the workpiece drawing.

[0068] This embodiment refines the steps described above for obtaining the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point. Specifically, this step first involves the controller 102 loading the workpiece drawing file of the workpiece to be inspected from the workstation 105, such as a three-dimensional solid model in STEP, IGES, or Parasolid format. The software module of the controller 102 can automatically parse the drawing file, identify the individual geometric feature surfaces contained therein, and read the tolerance information (PMI, Product and Manufacturing Information) associated with these feature surfaces.

[0069] After determining the tolerance range of each feature surface, the system performs automatic point placement to determine the probe positions on the workpiece to be inspected. This automatic point placement algorithm can be based on preset strategies. For example, for planar features, a uniform grid can be used; for curved features, points can be placed according to the rate of curvature change, with denser points in areas of high curvature and sparser points in flat areas. Simultaneously, the point density can also be correlated with the tolerance level of the feature surface; the higher the tolerance requirement, the denser the point placement. This automated point placement method replaces tedious manual operations, ensuring the scientific nature and repeatability of the point placement.

[0070] Finally, based on the workpiece drawing, the system accurately calculates the three-dimensional coordinates of each probe point in the theoretical model coordinate system, i.e., the theoretical machining dimension. Through this automated process, abstract tolerance requirements are transformed into a concrete, measurable set of points and their theoretical values, providing a precise data foundation for subsequent deviation calculations and conformity assessments. The technical advantage of this solution lies in its close and automated linking of design intent (tolerances) with manufacturing inspection (probe points), avoiding errors and inconsistencies that may arise from manual interpretation of drawings and manual specification of measurement points, significantly improving the efficiency and reliability of preliminary preparation work.

[0071] Furthermore, the steps for generating the optimal tool parameters under the current state by fusing static and dynamic tool parameters based on the Bayesian estimation algorithm and combining them with the machine tool thermal deformation model for thermal drift compensation include: constructing the covariance matrix of measurement error using the static tool parameters from the external tool setter as the prior distribution and the dynamic tool parameters measured inside the machine tool as the observed values; calculating the posterior probability distribution of tool length and radius under the current state using the Bayesian estimation algorithm and extracting the expected values ​​as the fused tool parameters; obtaining the current operating temperature or time data of the machine tool spindle, substituting it into the preset thermal drift compensation coefficient function, and dynamically correcting the fused tool parameters to obtain the optimal tool parameters.

[0072] This embodiment describes in detail the steps for generating optimal tool parameters, such as... Figure 4 As shown. The core of this step is to use a Bayesian estimation algorithm to fuse tool parameters from two different sources. Specifically, the Bayesian estimation module 303 in the controller 102 uses the high-precision static tool parameters 301 measured by the external tool setter 104 as the "prior distribution" in Bayesian statistics. This prior distribution represents the initial best estimate of the true tool size. At the same time, the dynamic tool parameters 302 measured by the in-machine probe of the machine tool body 103 are used as the "observation" or "likelihood function".

[0073] In terms of algorithm implementation, the system constructs a covariance matrix of measurement errors for both static and dynamic measurement processes. This matrix quantifies the uncertainty of each measurement method. Then, using Bayes' theorem, combined with the prior distribution (static parameters) and the likelihood function (dynamic parameters), the "posterior probability distribution" of the tool length and radius in the current state is calculated. This posterior distribution represents the updated understanding of the tool parameters after fusing the two information sources. The system extracts the expected value (mean) of this posterior distribution and uses it as the fused tool parameter 304. This fusion method is mathematically optimal; it weights the results based on the confidence levels of the two measurement methods (represented by the covariance matrix), yielding a more reliable result than any single measurement.

[0074] However, simply fusing static and dynamic parameters is insufficient, as the machine tool experiences thermal deformation during operation due to spindle heating and ambient temperature changes, causing the actual cutting point of the tool to drift. Therefore, this implementation also introduces thermal drift compensation. The controller 102 acquires temperature sensor data 305 in real time from temperature sensors installed on the machine tool spindle or at key locations, or substitutes this data into a preset thermal drift compensation coefficient function based on the cumulative spindle running time. This function can be a polynomial fitted based on a large amount of experimental data, or a lookup table (LUT). The thermal drift compensation module 306 uses this function to calculate the compensation amount for the tool length and radius at the current temperature and dynamically corrects the fused tool parameters 304, ultimately obtaining the optimal tool parameters 307. The technical advantage of this solution lies in achieving optimal fusion of multi-source heterogeneous measurement data through Bayesian estimation and further eliminating time-varying errors through a real-time thermal compensation model, thereby obtaining high-precision tool parameters that dynamically reflect the actual working conditions of the machine tool, making high-precision compensation possible.

[0075] Furthermore, when an excessive allowance is identified, the steps of calculating the actual allowance offset value based on the preset power-allowance mapping model and issuing an adaptive compensation command to the machine tool CNC system for pre-compensation include: filtering and denoising the real-time acquired spindle power signal to extract power fluctuation characteristics; when the power fluctuation characteristics exceed the preset standard cutting power threshold, it is determined to be an excessive allowance state; calculating the actual allowance offset value based on the mapping model of cutting force and material removal cross-sectional area, according to the current power deviation; and generating a feed rate reduction command or a Z-axis negative fine-tuning command based on the actual allowance offset value and issuing it to the machine tool CNC system.

[0076] This embodiment specifically implements the pre-compensation step in the machining of allowance. The key to this step lies in the accurate interpretation and rapid response of the real-time acquired spindle power signal. The controller 102 acquires the power signal from the machine tool spindle driver at a high sampling rate (e.g., 1kHz) and first performs filtering and noise reduction processing on it, such as using a moving average filter or a Kalman filter, to eliminate high-frequency noise and transient glitches, and extract the power fluctuation characteristics that can truly reflect the changes in cutting load.

[0077] The system internally presets a standard cutting power threshold or a dynamic power baseline, which is the theoretical power calculated based on the current tool, material, and nominal cutting parameters (feed, spindle speed, depth of cut). When the filtered real-time power fluctuation characteristics continuously exceed the standard cutting power threshold for a certain period of time (e.g., more than 100 milliseconds), or significantly deviate from the dynamic baseline, the system determines that it has entered a "too much margin" state. This signal processing-based judgment mechanism is more reliable than simple peak detection.

[0078] Once the system determines that the allowance is too large, it needs to quantify the degree of this "excess." This is achieved through a pre-defined power-allowance mapping model, which is typically based on the physical mapping relationship between cutting force and material removal cross-sectional area (MRR). Specifically, the system can use this mapping model to inversely calculate the actual allowance offset value on the toolpath based on the deviation between the current measured power and the theoretical power. For example, a power exceeding the theoretical power by 20% might correspond to an additional allowance of 0.2 mm.

[0079] After calculating the actual allowance offset value, the controller 102 must take immediate action. Based on this offset value, it generates specific compensation instructions and sends them to the machine tool's CNC system. The instructions can take various forms; for example, for small allowance offsets, a feed rate reduction instruction can be generated, decreasing the feed rate from 100% to 50% to reduce cutting force. For larger allowance offsets, in addition to reducing the feed rate, a negative fine-tuning instruction for the Z-axis (or tool normal) can be generated, causing the tool to lift upwards (or outwards) by a distance equal to the allowance offset value in the subsequent path. The technical advantage of this scheme lies in establishing a rapid closed-loop feedback from "power signal" to "physical allowance" and then to "control instructions," achieving "online" adaptive control of unknown allowance changes during machining. This effectively prevents overload, overcutting, and tool damage caused by uneven workpiece or clamping errors, significantly enhancing the robustness of the machining process.

[0080] Furthermore, the steps for performing simulation checks on the rework procedure include: performing overcut checks and interference checks on the rework procedure; if the virtual cut-off amount does not intrude into the preset tolerance zone and there is no collision error, the simulation check is deemed to have passed; if the simulation check fails, an alarm message is output to trigger manual intervention.

[0081] This embodiment provides more specific details on the simulation inspection steps of the rework program. After the controller 102 automatically generates the rework program, it is not executed directly, but a built-in or interface-called virtual machining simulation module is launched. This module loads a complete digital machining environment, including: a three-dimensional model representing the current real state of the workpiece (this model is updated based on the actual measurement data after machining and before compensation), the rework program to be executed, the accurate three-dimensional model of the tools used (including the insert, tool holder, and extension rod), and the fixture and worktable models on the machine tool.

[0082] The core functions of the simulation module are overcutting and interference checks. During simulation, the virtual tool moves strictly according to the G-code instructions of the rework procedure. Overcutting check refers to the system's real-time monitoring of whether the cutting edge of the tool has encroached on the lower limit of the preset workpiece tolerance zone. In other words, it checks whether the rework process will cause the workpiece size to become too small, making it irreversible. If the volume of material virtually removed causes the workpiece model to fall below the lower boundary of its design tolerance at any point, the system determines that overcutting has occurred.

[0083] Interference checking refers to the system's real-time monitoring of all parts of the tool model (not just the cutting edge), the tool holder, the spindle, and other moving parts to check for non-cutting collisions with stationary parts such as the workpiece model and the fixture model. This type of check is particularly important for complex five-axis machining or deep cavity machining, as it can prevent catastrophic collisions.

[0084] After the simulation is complete, the system will make a judgment based on the inspection results. If the virtual cut-off amount does not violate the preset tolerance zone lower limit throughout the entire simulation process, and there are no collision errors, the simulation check is deemed passed, the rework procedure is considered safe, and can be authorized for execution. Conversely, if the simulation check fails, whether overcutting or interference is detected, the system will immediately stop the subsequent process, lock the rework procedure, and output detailed alarm information to the operation terminal. For example, it may highlight the overcut area on the workpiece model, or mark the G-code line number where interference occurred on the timeline, and trigger manual intervention. Operators can analyze the cause of the problem based on the alarm information and decide whether to adjust the compensation strategy, modify safety parameters, or scrap the workpiece. The technical effect of this solution is that it adds a crucial safety barrier to the automated compensation process. By using "digital twin" technology to simulate risks, it ensures that only verified and highly safe procedures can be executed on the equipment and workpiece, thereby guaranteeing production safety.

[0085] In another implementation, to further improve measurement accuracy, especially after roughing or semi-finishing with coolant, a workpiece cleaning step is added before measuring the actual machining dimensions of each probe point. Specifically, the controller 102 first controls the integrated or external water gun device on the machine tool body 103 to thoroughly rinse the surface of the workpiece to be measured, especially the critical feature areas, using high-pressure coolant or a special cleaning fluid. The purpose of this is to wash away chips, oil, and viscous coolant residue adhering to the workpiece surface.

[0086] Following rinsing, controller 102 switches and controls the air gun device, using clean, dry compressed air to powerfully blow clean the surface of the rinsed workpiece. The blowing focuses on the point where the probe will contact the workpiece and its surrounding area, as well as grooves or blind holes where liquid may accumulate. This step aims to quickly remove residual liquid from the surface, creating a dry and clean measurement surface. The technical advantage of this approach is that the combined rinsing and blowing cleaning process effectively eliminates measurement errors caused by chips, oil films, or droplets adhering to the measurement points. These contaminants can cause the probe to trigger prematurely or deviate, introducing errors at the micrometer or even tens of micrometer level, which is unacceptable for high-precision compensation machining. Therefore, while adding this cleaning step slightly increases the cycle time, it ensures the authenticity and accuracy of the measurement data, a necessary prerequisite for achieving high-precision closed-loop compensation, significantly improving the reliability of the entire compensation system and the final workpiece pass rate.

[0087] In another embodiment, after the step of compensating the workpiece to be inspected, the method further includes: re-measuring the actual machining dimensions of each probe point, and performing the step of determining the dimensional deviation of each probe point based on the difference between each actual machining dimension and each theoretical machining dimension; determining the workpiece as qualified if the dimensional deviation of each probe point is within the tolerance range corresponding to each probe point and the number of compensation machining operations does not exceed a preset number; and outputting an alarm message if the dimensional deviation of at least one probe point is not within the corresponding tolerance range or the number of compensation machining operations exceeds the preset number.

[0088] This embodiment refines the process after compensation machining, forming a complete quality closed-loop verification and decision-making logic. The method does not end after the workpiece is compensated based on the rework procedure. The controller 102 restarts the measurement program to remeasure all previously determined probe points, especially the actual machining dimensions of those target compensation points that have undergone compensation machining. Then, it again executes the step of determining the dimensional deviation of each probe point based on the difference between each actual machining dimension and each theoretical machining dimension.

[0089] At this point, the system enters the final qualification determination stage. Controller 102 checks two conditions: first, whether the latest dimensional deviation of all probe points is within their respective tolerance ranges; second, whether the number of compensation processing operations for the workpiece exceeds a preset upper limit (e.g., a maximum of 2 compensations are allowed). Only when both conditions are met simultaneously will the system ultimately determine that the workpiece is qualified and display a "qualified" status on the control interface, allowing the next process to proceed or the workpiece to be unloaded.

[0090] Conversely, if, after compensation processing and remeasurement, at least one probe point still has a dimensional deviation outside the corresponding tolerance range, or if the workpiece has reached the preset upper limit for compensation processing but still fails to pass inspection, the system will determine the workpiece as unqualified or require manual arbitration. In this case, the system will lock the workpiece, prohibit further automatic cycling, and output detailed alarm information to the operating terminal or the enterprise MES system. The alarm information may include "Rework failed: Dimensions still out of tolerance" or "Rework failed: Maximum number of rework attempts exceeded," along with the final inspection report. The technical effect of this solution is that it establishes a final, automated quality acceptance checkpoint, ensuring that only truly qualified workpieces can be released. Simultaneously, by setting an upper limit for the number of compensation attempts, it avoids endless and ineffective rework attempts for workpieces with fundamental problems (such as material stress deformation, unstable clamping, etc.), thereby stopping losses in time and providing decision-making data for process analysts, achieving closed-loop quality control throughout the entire process.

[0091] This application also provides a digitally controlled machine tool 101, such as... Figure 2 As shown, the CNC machine tool 101 can be a three-axis, four-axis, or five-axis machining center. Its internal structure includes, but is not limited to, a processor, a memory, and a machine tool body 103. The memory stores a computer program designed to, when executed by the processor, implement all or part of the steps of the workpiece compensation machining method described in any of the foregoing embodiments. Specifically, the controller 102 (integrating a processor and memory) of the CNC machine tool 101 serves as its core, responsible for receiving workpiece drawings and initial G-codes from the workstation 105, acquiring static tool parameters 301 from the external tool setter 104, and controlling the probes and sensors on the machine tool body 103 to acquire dynamic tool parameters 302, spindle power, and temperature sensor data 305. The software program running inside the controller 102 implements functions such as a Bayesian estimation module 303, a thermal drift compensation module 306, a rework island region construction algorithm, a G-code automatic adjustment module, and a virtual simulation inspection module. Finally, the controller 102 generates and executes control commands, driving the machine tool body 103 to complete the entire process from preliminary machining, online measurement, compensation machining to final verification. This type of digitally controlled machine tool, due to its built-in intelligent compensation logic, boasts higher machining accuracy, a higher level of automation, and a higher first-pass yield compared to traditional machine tools.

[0092] To achieve all the above technical solutions, this application also provides a computer-readable storage medium. This storage medium can be non-volatile, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), or it can be volatile, such as random access memory (RAM). The storage medium stores a series of computer program instructions. When these instructions are loaded and executed by the processor in the controller 102 of the CNC machine tool 101, the CNC machine tool 101 can perform workpiece compensation machining according to the steps described in any of the foregoing method embodiments. For example, it can perform a series of operations such as obtaining tolerances and theoretical dimensions, fusing tool parameters, performing pre-compensation, measuring deviations, constructing rework island areas, generating and simulating rework programs, and performing compensation machining and final verification.

[0093] Furthermore, this application also provides a computer program product. This product can exist in various forms, such as a software package, which can be downloaded via a network (e.g., from a developer's server) or distributed by storing it on physical media (e.g., a USB flash drive or optical disc). The computer program product contains a computer program (i.e., software code) designed to implement the workpiece compensation machining method of any of the aforementioned method embodiments when executed by a processor. Installing this computer program product onto a compatible CNC machine tool 101 enables it to perform closed-loop adaptive compensation machining.

[0094] In one specific implementation, all the above-mentioned preferred technical solutions are combined to achieve better technical results. This implementation describes a fully automated process from receiving a task to producing a qualified workpiece. First, the system receives a workpiece drawing with PMI information from workstation 105. Based on the workpiece drawing, the system determines the tolerance range of each feature surface. Based on the tolerance range and area of ​​each feature surface, the system automatically places the probe points to determine the workpiece to be inspected. Based on the workpiece drawing, the system determines the theoretical machining dimensions of each probe point, automatically determines the tolerances of all feature surfaces, and intelligently arranges the probe points. In the machining preparation stage, the system constructs a covariance matrix of measurement error using the static tool parameters of the external tool setter 104 as the prior distribution and the dynamic tool parameters measured in-machine as the observation values. Bayesian estimation is used to fuse the high-precision static tool parameters 301 of the external tool setter 104 and the dynamic tool parameters 302 measured in-machine, and thermal drift compensation is performed by combining the temperature sensor data 305 to generate high-precision optimal tool parameters 307.

[0095] During the machining of the allowance, the system activated the pre-compensation function. By monitoring the spindle power in real time, it successfully performed online adaptive feed rate adjustment for an unexpected machining allowance of 0.5mm thickness, avoiding accidental tool damage. After the initial machining was completed, a cleaning step was performed, using a high-pressure water gun and an air gun to rinse and blow away the workpiece surface, creating ideal conditions for high-precision measurement. Subsequently, the in-machine probe began working, and the measured data showed that there were dimensional deviations in some areas. The system identified the out-of-tolerance points as target compensation points 401, and through spatial clustering, outward expansion, and Boolean difference 407, accurately constructed multiple independent rework island areas 408, such as... Figure 5 As shown.

[0096] Next, the system automatically links to the original G-code program segment causing the deviation and calculates the path offset value based on the specific deviation value of each target compensation point and the optimal tool parameters, generating a rework program. This rework program is immediately sent to the simulation module for rigorous overcut and interference checks. Simulation results show that during high-speed transitions in one of the rework paths, there is a potential interference risk of 0.1mm between the tool holder and a protruding feature on the workpiece. The system immediately issues an alarm and automatically fine-tunes the transition method of that path segment. Only after passing another simulation is the adjusted, safe rework program submitted for execution. The machine tool body 103 performs the compensation machining.

[0097] Finally, the system enters the final verification loop. After the compensation machining is completed, the probe performs a comprehensive measurement of the workpiece again. Data shows that the dimensional deviations at all points are controlled within 50% of the tolerance. At the same time, the compensation counter inside the system shows that the current compensation is the first time, which has not exceeded the preset limit of two times. Therefore, the system finally determines that the workpiece is qualified and displays a green "PASS" mark on the screen, while uploading a detailed machining and inspection report to the factory's MES system. This embodiment, which integrates all the optimal solutions, achieves "near-unmanned," high-quality, and high-efficiency machining of complex and precision workpieces in a single clamping operation through the synergistic effect of multiple error suppression methods (optimal tool parameters, pre-compensation, and post-compensation) and multiple safety assurance mechanisms (rework island constraints, simulation checks, and number of times limit), significantly improving the first-pass yield of workpieces and shortening the single-piece machining cycle.

[0098] This invention has a wide range of applications, including CNC machining fields that demand high precision and efficiency. In the aerospace field, it can be used to machine complex, expensive aircraft engine turbine disks or integral bladed disks. These components are typically made of high-temperature alloys or titanium alloys, making machining difficult and requiring stringent dimensional accuracy. The method of this invention, through closed-loop compensation, effectively controls deformation caused by cutting heat and tool wear, ensuring the dimensional accuracy and surface integrity of the final parts and significantly reducing scrap rates. In the mold manufacturing field, particularly for automotive body panel molds or precision electronic product injection molds, the surfaces are complex and require high precision. This invention enables on-machine measurement and automatic compensation of mold surfaces, eliminating the tedious process of repeated inspection and rework using coordinate measuring machines, thus helping to shorten the mold delivery cycle.

[0099] In the medical device industry, this invention can be used to manufacture customized artificial joints, orthopedic implants, and other products. These products need to be highly compatible with the patient's physiological structure, requiring extremely high levels of personalization and precision. The method of this invention ensures that each customized product strictly conforms to its unique design dimensions, achieving high-precision and high-efficiency personalized manufacturing.

[0100] It should be noted that the digital control machine tool 101, storage medium, and computer program product in this application are based on the same inventive concept, and their problem-solving principles are similar to those in the method embodiments. Therefore, their implementation methods can be referred to the description of the method embodiments, which will not be repeated here. The above are merely preferred embodiments of this application and are not intended to limit this application. For those skilled in the art, this application can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A workpiece compensation machining method characterized by, Includes the following steps: Obtain the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point, and determine the tolerance range of each probe point according to the feature surface to which each probe point belongs; When the machine tool executes the allowance machining program, the cutting state is identified based on the real-time collected spindle power signal. When the state of excessive allowance is identified, the actual allowance offset value is calculated based on the preset power-allowance mapping model, and an adaptive compensation command is sent to the machine tool CNC system for pre-compensation. After processing is completed, the actual processing dimensions of each probe point are measured, and the dimensional deviation of each probe point is determined based on the difference between the actual processing dimensions and the theoretical processing dimensions. The probe points whose size deviation exceeds the tolerance range but is less than the preset deviation threshold are identified as target compensation points. Spatial clustering is performed on the target compensation points to form non-compliant NG clusters. Each NG cluster is expanded outward by a preset expansion distance to generate a safety envelope. The safety envelope is then compared with the three-dimensional model of the surrounding compliant area within the tolerance range using Boolean subtraction to construct a rework island area isolated from the compliant area. The workpiece to be inspected is compensated based on the rework island area.

2. The workpiece compensation machining method as described in claim 1, characterized in that, The step of performing compensation processing on the workpiece to be inspected based on the rework island area includes: The static tool parameters from the external tool setting device and the dynamic tool parameters measured inside the machine tool are obtained. The static and dynamic tool parameters are fused based on the Bayesian estimation algorithm, and thermal drift compensation is performed in combination with the machine tool thermal deformation model to generate the optimal tool parameters under the current state. Based on the preset association relationship, the machining tool and G-code program segment corresponding to the target compensation point are determined, wherein the association relationship is the association relationship between the feature surface and the G-code program segment and tool information for machining the feature surface; Based on the optimal tool parameters and the dimensional deviation of the target compensation point, the path offset value of the machining tool is determined, and under the boundary constraints of the rework island area, the G-code program segment is adjusted according to the path offset value to obtain the rework program; The rework procedure is simulated and checked. If the simulation check passes, the workpiece to be inspected is compensated and processed based on the rework procedure.

3. The workpiece compensation machining method as described in claim 2, characterized in that, The steps for obtaining the tolerance range of each feature surface of the workpiece to be inspected and the theoretical machining dimensions of each probe point include: Based on the workpiece drawing of the workpiece to be inspected, determine the tolerance range of each feature surface; The probe points of the workpiece to be inspected are determined by automatically placing points according to the tolerance range and area of ​​each feature surface. Based on the workpiece drawing, determine the theoretical machining dimensions of each probe point.

4. The workpiece compensation machining method as described in claim 2, characterized in that, The steps of fusing static and dynamic tool parameters based on a Bayesian estimation algorithm, and combining this with a machine tool thermal deformation model for thermal drift compensation to generate the optimal tool parameters for the current state include: Using the static tool parameters of the external tool setting instrument as the prior distribution and the dynamic tool parameters measured inside the machine tool as the observed values, a covariance matrix of the measurement error is constructed. The posterior probability distribution of tool length and radius under the current state is calculated using the Bayesian estimation algorithm, and the expected value is extracted as the fused tool parameters. The machine tool spindle's current operating temperature or time data is obtained, and then substituted into a preset thermal drift compensation coefficient function to dynamically correct the fused tool parameters, thereby obtaining the optimal tool parameters.

5. The workpiece compensation machining method as described in claim 2, characterized in that, The steps of calculating the actual margin offset value based on a preset power-margin mapping model and issuing an adaptive compensation command to the machine tool CNC system for pre-compensation when an excessive margin is identified include: The real-time acquired spindle power signal is filtered and denoised to extract power fluctuation characteristics. When the power fluctuation characteristics exceed the preset standard cutting power threshold, it is determined to be an excessive margin state. Based on the mapping model between cutting force and material removal cross-sectional area, the actual allowance offset value is calculated by back-calculating the current power deviation. Based on the actual margin offset value, a feed rate reduction command or a Z-axis negative fine-tuning command is generated and sent to the machine tool CNC system.

6. The workpiece compensation machining method as described in claim 2, characterized in that, The step of performing a simulation check on the rework procedure includes: The rework procedure is subjected to overcutting and interference checks; If the virtual cut-off amount does not intrude into the preset tolerance zone and there is no collision error, the simulation check is considered to have passed. If the simulation check fails, an alarm message will be output to trigger manual intervention.

7. The workpiece compensation machining method according to any one of claims 2 to 6, characterized in that, Prior to the step of measuring the actual machining dimensions of each of the probe points, the method further includes: The water gun device is controlled to rinse the workpiece to be inspected; The air gun device is controlled to blow and clean the workpiece to be inspected after rinsing.

8. The workpiece compensation machining method according to any one of claims 2 to 6, characterized in that, After the step of performing compensation processing on the workpiece to be inspected, the method further includes: The actual machining dimensions of each of the probe points are remeasured, and the step of determining the dimensional deviation of each of the probe points based on the difference between each of the actual machining dimensions and each of the theoretical machining dimensions is performed. If the dimensional deviation of each probe point is within the tolerance range corresponding to each probe point, and the number of compensation processing operations does not exceed the preset number, the workpiece is deemed qualified. An alarm message is output if the dimensional deviation of at least one probe point is not within the corresponding tolerance range, or if the number of compensation processes exceeds the preset number.

9. A digitally controlled machine tool, characterized in that, The digitally controlled machine tool includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the workpiece compensation machining method as described in any one of claims 1 to 8.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the workpiece compensation machining method as described in any one of claims 1 to 8.