Automatic Generation Method of NC Program for Complex Surface Machining

The convolutional neural network model based on transfer learning is used to generate CNC programs for complex surface machining, which solves the problem of complex and inefficient generation of CNC programs for complex surfaces in the existing technology. It realizes efficient and accurate automatic generation of CNC programs, has strong adaptability, and reduces programming difficulty and cost.

CN120215412BActive Publication Date: 2025-09-23CHANGCHUN INST OF OPTICS FINE MECHANICS & PHYSICS CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510700127.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-09-23
Estimated Expiration
2045-05-28

AI Technical Summary

Technical Problem

Existing technologies make it difficult to quickly and accurately generate CNC programs for complex surface machining, resulting in complex operations, low efficiency, and inconsistent precision, which cannot meet the high precision and high efficiency requirements of modern industry.

Method used

A convolutional neural network model based on transfer learning is used to collect and train complex surface information, process parameters, and NC program data sets, establish a mapping relationship, and generate NC codes for complex surface machining.

Benefits of technology

It achieves the rapid and accurate generation of complex surface machining NC programs, improves machining accuracy and efficiency, reduces programming difficulty and cost, and enhances the model's adaptability to new tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120215412B_ABST
    Figure CN120215412B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of optical processing technology, and in particular to a method for automatically generating a numerical control program for processing complex surfaces. The method comprises: collecting information related to complex surfaces, including information about the complex surfaces, process parameters when the complex surfaces are processed, and numerical control machine tool program information when the complex surfaces are processed; collecting data from several groups of the above steps to obtain a complex surface information dataset and a process information dataset as input datasets, and a numerical control program dataset as output datasets; constructing a transfer learning network; inputting and training the input dataset to obtain a complex surface processing code prediction model; and according to the requirements of the complex surface processing task, obtaining the information about the complex surfaces and the process parameters when the complex surfaces are processed and inputting them into the complex surface processing code prediction model, thereby obtaining the machine tool numerical control code and realizing efficient processing of complex surfaces. The method has the advantages of: less computation time, improved polishing accuracy and efficiency, and enhanced model adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of optical processing, and in particular to a method for automatically generating a numerical control program for processing a complex curved surface. Background Art

[0002] With the development of industrial technologies such as optical instruments, aerospace, and defense, the application of complex surfaces is becoming increasingly widespread. However, these complex surfaces often have extremely stringent requirements for mirror finishes. Traditional polishing methods, such as manual polishing, are unable to meet the high-precision and high-efficiency demands of modern industry for complex surface machining due to inconsistent accuracy and low efficiency. Machine tool polishing has relatively mature CNC program generation software for general surface machining. However, the CNC program generation process for machining complex surfaces and even free-form surfaces is extremely cumbersome and complex. It involves multiple steps, including surface analysis, process planning, path planning, path-surface matching analysis, G-code conversion, and mechanical interference analysis. This not only requires extremely high operator expertise and experience, but also presents certain knowledge barriers, leading to numerous difficulties and challenges for engineers during use. Therefore, there is an urgent need to develop a blind box method that can quickly and accurately automatically generate CNC machine tool code for complex surface machining. Summary of the Invention

[0003] In order to solve the above problems, the present invention provides a method for automatically generating a complex surface machining numerical control program.

[0004] The present invention aims to provide a method for automatically generating a complex surface machining NC program, which specifically comprises the following steps:

[0005] S1. Collect information related to complex curved surfaces, including information about the complex curved surfaces, process parameters when the complex curved surfaces are processed, and CNC machine tool program information when the complex curved surfaces are processed;

[0006] S2 collects several sets of data from step S1 to obtain complex surface information data sets, process information data sets, and NC program data sets; the complex surface information data sets and process information data sets are used as input data sets, and the NC program data sets are used as output data sets;

[0007] S3. Construct a transfer learning network; input the input data set obtained in step S2 and train it to obtain a complex surface processing code prediction model;

[0008] S4. According to the requirements of the complex surface machining task, the information of the complex surface and the process parameters when the complex surface is machined are obtained and input into the complex surface machining code prediction model, so as to obtain the machine tool CNC code and realize efficient machining of the complex surface.

[0009] Preferably, step S1 specifically includes the following steps:

[0010] S11. Complex surface information collection: Collect information about a complex surface, including its shape, size, material, surface equation, and surface error distribution.

[0011] S12. Processing parameter collection: Collecting the process parameters of the complex surface being processed in step S11, including but not limited to the tool type, tool size, abrasive particle size, removal rate distribution, and processing path used in the processing;

[0012] S13. Collection of CNC machine program information: The CNC machine program information when the complex surface described in step S1 is processed includes the actual running time of the CNC machine, the running speed gradient, the CNC program file, and the rationality of the axis system configuration.

[0013] Preferably, in step S2, no less than 200 sets of data from step S1 are collected.

[0014] Preferably, step S3 specifically includes the following sub-steps:

[0015] S31. Normalize the non-normalized initial numerical data in the input dataset; convert the non-numerical data in the input dataset into vector features through one-hot encoding;

[0016] S32. Using a convolutional neural network model to establish a mapping relationship between input data and output data; using the difference between the predicted G code numerical matrix and the actual G code numerical matrix as a loss function for pre-training;

[0017] S33. Using the trained network weight matrix PT for transfer learning of complex surface processing tasks;

[0018] S34. Randomly initialize the output layer weights of the pre-trained convolutional neural network model;

[0019] S35. Use small batches of complex surface processing data to fine-tune the network weight matrix PT obtained from pre-training.

[0020] Preferably, the non-normalized initial numerical data in step S31 include tool size, abrasive particle size, removal rate distribution, and processing path; and the non-numerical data include the type of tool used in the processing technology.

[0021] Preferably, the convolutional neural network model in step S32 includes a convolutional layer, a pooling layer, a fully connected layer and an output layer;

[0022] The formula of the loss function is as follows:

[0023] ;

[0024] Where N represents the total number of predicted G-code lines, Represents the predicted value of the i-th line code, Indicates the actual value of the i-th line of code;

[0025] The Adam algorithm is used as the optimization algorithm, and the initial learning rate is set to 0.001.

[0026] Preferably, step S33 also includes: retaining the weights of the convolutional layer, pooling layer, and fully connected layer in the pre-trained convolutional neural network model, and the weights of the convolutional layer, pooling layer, and fully connected layer are obtained from the weight matrix obtained from the pre-training.

[0027] Preferably, in step S35, the training step size is set to 1 / 100 of that during pre-training.

[0028] Compared with the prior art, the present invention can achieve the following beneficial effects:

[0029] The present invention proposes a method for automatically generating CNC programs for complex surface processing, which uses previously processed complex surfaces, process parameters and CNC programs as data sets, uses neural networks, and is trained with a large amount of diversified data. It has strong generalization capabilities and can handle unknown complex surface types, and transfer learning further enhances the rapid adaptability to new tasks. When a new complex surface processing task arrives, it is only necessary to input the complex surface information and process parameter information into the network to quickly obtain the CNC program. Although the method of the present invention collects a large amount of data sets in the early stage, once the neural network calculation model is built, it is very fast to obtain the machine tool CNC code. Therefore, the method for automatically generating CNC programs for complex surface processing proposed by the present invention has obvious advantages in terms of calculation time and ease of understanding, and improves polishing accuracy and efficiency, enhances model adaptability, and reduces programming difficulty and cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 The present invention provides a flowchart of a method for automatically generating a complex surface machining NC program according to an embodiment of the present invention.

[0031] Figure 2 2 is a schematic diagram of transfer learning training provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the following description, identical modules are denoted by identical reference numerals. In the case of identical reference numerals, their names and functions are also identical. Therefore, their detailed description will not be repeated.

[0033] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not constitute a limitation of the present invention.

[0034] See also Figure 1 The present invention provides a method for automatically generating a complex surface machining NC program, which specifically includes the following steps:

[0035] S1. Collect information related to complex curved surfaces, including information about the complex curved surfaces, process parameters when the complex curved surfaces are processed, and CNC machine tool program information when the complex curved surfaces are processed;

[0036] S11. Complex surface information collection: Collect information about a complex surface;

[0037] Specifically, the information includes but is not limited to the complex surface's shape, size, material, surface equation, and surface error distribution diagram; the above information accurately defines the complex surface from the perspective of geometry and physical properties, providing a detailed basis for the formulation of subsequent processing strategies;

[0038] S12. Processing parameter collection: collecting the process parameters when the complex surface is processed in step S11;

[0039] Specifically, the process parameters include but are not limited to the tool type, tool size, abrasive particle size, removal rate distribution, processing path, etc. used in the processing process.

[0040] S13. CNC machine program information collection: CNC machine program information when the complex surface is processed in step S1;

[0041] Specifically, the CNC machine tool program information includes but is not limited to the actual running time of the CNC machine tool, the running speed gradient, the CNC program file and the rationality information of the axis system configuration.

[0042] S2. Construct a dataset: Repeat step S1 to collect at least N groups (N≥200) of data to obtain a complex surface information dataset, a process information dataset, and a NC program dataset; use the complex surface information dataset and the process information dataset as input datasets, and use the NC program dataset as output dataset.

[0043] S3. Construct a transfer learning network; input the input data set obtained in step S2 and train it to obtain a complex surface processing code prediction model; specifically, the following sub-steps are included:

[0044] S31. Normalize the non-normalized initial numerical data in the input dataset; convert the non-numerical data in the input dataset into vector features through one-hot encoding;

[0045] The non-normalized initial numerical data include process parameters such as tool size, abrasive particle size, removal rate distribution, and machining path; the non-numerical data include the type of tool used in the machining process;

[0046] Specifically, the normalization method is:

[0047] The minimum-maximum normalization method is used to scale the data to the range of [0,1]; the formula is as follows:

[0048] ;

[0049] Where x is the original data point, x min is the minimum value in the feature column, x max is the maximum value in the feature column.

[0050] S32. Use a convolutional neural network (CNN) model to establish a mapping relationship between input data (complex surface information data, process information data) and output data (NC program data). Perform pre-training using the difference between the predicted G-code numerical matrix and the actual G-code numerical matrix as the loss function.

[0051] The convolutional neural network model includes convolutional layers, pooling layers, fully connected layers, and output layers;

[0052] The formula of the loss function is as follows:

[0053] ;

[0054] Where N represents the total number of predicted G-code lines, Represents the predicted value of the i-th line code, Indicates the actual value of the i-th line of code;

[0055] The Adam algorithm is used as the optimization algorithm, and the initial learning rate is set to 0.001; if the validation set loss does not improve for 5 consecutive rounds, the learning rate is multiplied by the decay factor 0.5, and the minimum learning rate threshold is set to 10 -6 In addition, an L2 regularization term (λ=1e -4 ), to prevent overfitting. The batch size is set to 32 and the number of training iterations is set to 100,000.

[0056] G-code is a programming language used to control CNC machine tools. It specifies the machine's motion path, speed, feed rate and other parameters. Each line of code contains multiple instructions for controlling the machine's different axes (such as X, Y, and Z axes) as well as the position and operation of the tool.

[0057] Through this step, the CNN network can fit the mapping relationship between process parameters, surface information and machining procedures during conventional surface machining.

[0058] S33. Model Weight Transfer: The trained network weight matrix PT is used for transfer learning of complex surface processing tasks; the weights of all layers in the pre-trained CNN model except the output layer are retained, and these weights are consistent with the weights obtained from conventional surface shape training (obtained from the pre-trained weight matrix and are not reinitialized or adjusted).

[0059] S34. Output layer weight initialization: Randomly initialize the output layer weights in the pre-trained convolutional neural network model so that the model can adapt to the characteristics of complex surface processing tasks; specifically, the initialization method uses He initialization.

[0060] S35. Fine-tuning training: Use a small batch of complex surface processing data to fine-tune the network weight matrix PT obtained from pre-training. Set the training step size to 1 / 100 of the pre-training step size to ensure that the model has high fitting accuracy while maintaining a certain generalization ability.

[0061] Use the fine-tuning data to train the model, update the model weights, especially the weights of the output layer, and complete the network model training suitable for complex surface processing code output. Figure 2 shown.

[0062] S4. According to the requirements of the complex surface machining task, the information of the complex surface and the process parameters when the complex surface is machined are obtained and input into the complex surface machining code prediction model, so as to obtain the machine tool CNC code and realize efficient machining of the complex surface.

[0063] The key technical points and advantages of the present invention are: the present invention proposes a method for automatically generating CNC programs for complex surface processing, takes previously processed complex surfaces, process parameters and CNC programs as data sets, and uses neural networks to mine the intrinsic relationship between the three. The neural network has a strong generalization ability through training with a large amount of diversified data, and is able to handle unknown types of complex surfaces, and transfer learning further enhances its rapid adaptability to new tasks. When a new complex surface processing task arrives, it is only necessary to input the complex surface information and process parameter information into the network to quickly obtain the CNC program. Compared with traditional complex analysis and generation methods, the method proposed in the present invention has obvious advantages in computational time and ease of understanding, and improves polishing accuracy and efficiency, enhances model adaptability, and reduces programming difficulty and cost.

[0064] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved. This is not limited herein.

[0065] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A method for automatically generating a NC program for machining complex curved surfaces, characterized by: The specific steps include: S1. Collect information related to complex surfaces, including information about the complex surfaces, process parameters for machining the complex surfaces, and CNC machine tool program information for machining the complex surfaces; information about the complex surfaces includes the surface shape, size, material, surface equation, and surface error distribution diagram of the complex surfaces; process parameters for machining the complex surfaces include, but are not limited to, tool type, tool size, abrasive particle size, removal rate distribution, and machining path used in the machining process; and CNC machine tool program information for machining the complex surfaces, including actual CNC machine tool operating time, operating speed gradient, CNC program files, and information on the rationality of axis system configuration; S2 collects several sets of data from step S1 to obtain complex surface information data sets, process information data sets, and NC program data sets; the complex surface information data sets and process information data sets are used as input data sets, and the NC program data sets are used as output data sets; S3. Construct a transfer learning network; input the input data set obtained in step S2 and train it to obtain a complex surface processing code prediction model; specifically, the following sub-steps are included: S31. Normalize the non-normalized initial numerical data in the input dataset; convert the non-numerical data in the input dataset into vector features through one-hot encoding; S32. Using a convolutional neural network model to establish a mapping relationship between input data and output data; using the difference between the predicted G code numerical matrix and the actual G code numerical matrix as a loss function for pre-training; S33. Using the trained network weight matrix PT for transfer learning of complex surface processing tasks; S34. Randomly initialize the output layer weights of the pre-trained convolutional neural network model; S35. Use a small batch of complex surface processing data to fine-tune the network weight matrix PT obtained from pre-training; S4. According to the requirements of the complex surface machining task, the information of the complex surface and the process parameters when the complex surface is machined are obtained and input into the complex surface machining code prediction model, so as to obtain the machine tool CNC code and realize efficient machining of the complex surface.

2. The method for automatically generating a complex surface machining NC program according to claim 1, wherein: In step S2, no less than 200 sets of data from step S1 are collected.

3. The method for automatically generating a complex surface machining NC program according to claim 1, wherein: The non-normalized initial numerical data in step S31 include tool size, abrasive particle size, removal rate distribution, and processing path; the non-numerical data includes the type of tool used in the processing process.

4. The method for automatically generating a complex surface machining NC program according to claim 1, wherein: The convolutional neural network model in step S32 includes a convolutional layer, a pooling layer, a fully connected layer and an output layer; The formula of the loss function is as follows: ; Where N represents the total number of predicted G-code lines, Represents the predicted value of the i-th line code, Indicates the actual value of the i-th line of code; The Adam algorithm is used as the optimization algorithm, and the initial learning rate is set to 0.

001.

5. The method for automatically generating a complex surface machining NC program according to claim 1, wherein: The step S33 also includes: retaining the weights of the convolutional layer, pooling layer, and fully connected layer in the pre-trained convolutional neural network model, and the weights of the convolutional layer, pooling layer, and fully connected layer are obtained from the weight matrix obtained by pre-training.

6. The method for automatically generating a complex surface machining NC program according to claim 1, wherein: In step S35, the training step size is set to 1 / 100 of that during pre-training.

Citation Information

Patent Citations

  • Round turning tool defect identification method based on transfer learning

    CN118781393A

  • CNC control unit with learning ability for machining centers

    US20030187624A1