Path learning-based primitive milling track generation method

By using a path learning-based approach, combined with neural controlled differential equations and primitive feature learning, the optimal milling trajectory sequence is generated. This solves the problem of balancing flexibility and multidimensional performance in trajectory planning in existing CNC milling methods, achieving efficient and high-quality machining results and automated control.

CN121541584AInactive Publication Date: 2026-02-17GUANGZHOU BIJU INTELLIGENT EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511765847.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-02-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing CNC milling methods rely on manually setting tool paths or simple interpolation algorithms, which are difficult to adapt flexibly to different process conditions and lack in-depth utilization of the primitive feature data in the workpiece design file, resulting in a difficulty in balancing machining efficiency, tool life and workpiece surface quality.

Method used

A path-based learning approach is adopted, which integrates improved neural controlled differential equations and primitive feature learning. By acquiring and preprocessing primitive features and historical trajectory data, the optimal milling trajectory sequence is generated. The sequence is then optimized using a multi-objective joint loss function to generate trajectories that meet multi-dimensional performance indicators.

Benefits of technology

It enables efficient machining under complex working conditions, extends tool life and improves workpiece surface quality, ensures the accuracy and adaptability of trajectory generation, and supports full-process automation from design documents to machine tool control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121541584A_ABST
    Figure CN121541584A_ABST
Patent Text Reader

Abstract

The invention discloses a primitive milling track generation method based on path learning, which comprises the following steps of: acquiring primitive feature data and historical milling track data, and respectively preprocessing the primitive feature data and the historical milling track data; inputting to a primitive feature coding module of the improved NCDE model, coding, setting an initial hidden state, and driving time evolution calculation; inputting to a multi-head output module for decoding, constructing a multi-target joint loss function and iteratively updating; inputting to an improved NCDE inference model, and carrying out coding and hidden state evolution decoding; weighting calculation is carried out, and a candidate milling track sequence corresponding to the highest value is screened out; and the optimal milling track sequence is converted into a track instruction file, and a numerical control machine tool is driven to execute milling machining. According to the method, the improved neural controlled differential equation and primitive feature learning are fused, intelligent optimization of the milling track is achieved, and the method has the advantages of being high in efficiency, long in cutter service life and excellent in quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of CNC machining technology, and in particular to a method for generating primitive milling trajectories based on path learning. Background Technology

[0002] Existing CNC milling methods mostly rely on manually setting tool paths or generating machining paths based on simple interpolation algorithms. They typically only consider the geometric contour information of the workpiece, failing to fully utilize the geometric primitive feature data contained in the workpiece design file. Furthermore, traditional path generation methods mostly use fixed rules for trajectory planning, lacking in-depth modeling of historical milling trajectory data. This makes it difficult to flexibly adapt to different process conditions, resulting in a difficulty in balancing machining efficiency, tool life, and workpiece surface quality in the generated trajectory.

[0003] With the development of deep learning and neural differential equation models, some studies have begun to introduce time series modeling methods into trajectory prediction. However, existing models often only optimize for a single metric, lacking multi-objective constraint mechanisms and failing to simultaneously consider multi-dimensional performance requirements such as machining efficiency, tool wear, and surface quality. Furthermore, existing methods are often limited to directly using geometric parameters in feature representation, failing to effectively integrate primitive categories, geometric dimensions, and spatial location information obtained from workpiece design file parsing. This results in insufficient accuracy and generalization ability in trajectory prediction, making it difficult to meet the intelligent machining needs of CNC machine tools under complex working conditions.

[0004] Therefore, how to provide a method for generating primitive milling trajectories based on path learning is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] One objective of this invention is to propose a primitive milling trajectory generation method based on path learning. This invention integrates improved neural controlled differential equations and primitive feature learning to achieve intelligent optimization of milling trajectories, which has the advantages of high efficiency, long tool life and high quality.

[0006] A method for generating primitive milling trajectories based on path learning according to an embodiment of the present invention includes the following steps: Acquire primitive feature data and historical milling trajectory data, perform preprocessing on them respectively, and generate standardized primitive feature sequences and standardized historical trajectory sequences; The standardized primitive feature sequence is input into the primitive feature encoding module of the improved NCDE model for encoding, setting the initial hidden state and driving the time evolution calculation to generate the hidden state sequence. The hidden state sequence is input into the multi-head output module of the improved NCDE model for decoding. A multi-objective joint loss function is constructed by combining the standardized historical trajectory sequence and iteratively updated by the gradient descent method to generate the improved NCDE inference model. The standardized primitive feature sequence of the workpiece to be processed is input into the improved NCDE inference model for encoding and hidden state evolution decoding to generate a candidate trajectory result set. The candidate milling trajectory sequence in the candidate trajectory result set is weighted and calculated with the corresponding machining efficiency data, tool wear data and workpiece surface quality data. The candidate milling trajectory sequence with the highest value is selected as the output to generate the optimal milling trajectory sequence. The optimal milling trajectory sequence is converted into a trajectory instruction file and output to the CNC machine tool control module to drive the CNC machine tool to perform milling operations.

[0007] Optionally, the graphic element feature data is obtained by parsing the workpiece design file, specifically including: identifying geometric elements from the workpiece design file, performing parametric modeling on the geometric elements, extracting element category data, geometric dimension parameters, and spatial position information, and combining them. The workpiece design file includes computer-aided design files and engineering drawing data. The geometric elements include points, lines, arcs, polygons, and curves. The historical milling trajectory data includes milling trajectory point sequences, machining efficiency data, tool wear data, and workpiece surface quality data. The preprocessing includes normalizing and feature encoding the graphic element feature data and cleaning, normalizing, and serializing the historical milling trajectory data.

[0008] Optionally, the generation of the hidden state sequence specifically includes: The standardized primitive feature sequence is input into the primitive feature encoding module of the improved NCDE model. The primitive category data in the standardized primitive feature sequence is vectorized and encoded, the geometric dimension parameters are normalized and numerically mapped, the spatial location information is processed by coordinate embedding, and the encoded results are concatenated into a continuous feature vector sequence in chronological order. The vectorization encoding specifically includes: receiving primitive category data through a category encoding unit, converting different primitive categories into one-hot vectors, and inputting them into an embedding matrix to map them into fixed-length primitive category vectors using matrix multiplication. The normalized numerical mapping specifically includes: receiving geometric dimension parameters through a dimension parameter mapping unit, converting them into normalized values ​​between zero and one according to the range ratio of the maximum and minimum values, and combining them into a dimension parameter vector; The coordinate embedding process specifically includes: receiving spatial position information through a spatial position embedding unit, encoding the three-dimensional coordinate parameters in the spatial position information using sine and cosine functions to generate a corresponding position information vector, and arranging the position information vector according to the coordinate dimension order to obtain a position encoding vector. A continuous feature vector sequence is input to the control signal generation unit. The sequence is segmented according to a preset time step. The feature vectors in each segment are multiplied element by element according to their element positions and added to the corresponding weight coefficients to obtain the weighted sum vector of the corresponding segment. The weighted sum vector is used as the control signal of the corresponding segment. The control signals of all segments are arranged in chronological order to obtain a continuous control signal sequence, which is then input to the dynamic calculation unit. An initial hidden state is set. The initial hidden state and the continuous control signal are input to the parameterized function unit at time increments to obtain the corresponding model parameter function values. The model parameter function values ​​and the continuous control signal are multiplied element-wise and accumulated at the corresponding time increments to obtain the hidden state change. The hidden state change is added to the initial hidden state to update the hidden state. The updated hidden state is used as the current hidden state and input together with the continuous control signal corresponding to the next time increment into the parameterized function unit. The above calculation process is repeated to obtain the hidden states at all times, generating a hidden state sequence.

[0009] Optionally, compared with the original NCDE model, the improved NCDE model adds a primitive feature encoding module at the input end to perform vectorization encoding, normalization mapping and coordinate embedding processing on the standardized primitive feature sequence to generate a continuous feature vector sequence. A control signal generation unit is set in the intermediate layer to perform segmented operation and weighted combination on the continuous feature vector sequence according to the time step to generate a continuous control signal sequence. A multi-head output module is added at the output end to perform linear mapping on the hidden state sequence to generate a predicted milling trajectory point sequence, predicted machining efficiency data, predicted tool wear data and predicted workpiece surface quality data. In addition, a multi-objective joint loss function is introduced during the training process to impose weighted constraints on trajectory deviation, machining efficiency, tool wear and workpiece surface quality to generate an improved NCDE inference model. The primitive feature encoding module includes a category encoding unit, a size parameter mapping unit, and a spatial location embedding unit; The control signal generation unit is composed of a fully connected neural network; The multi-head output module includes a trajectory point output unit, a machining efficiency output unit, a tool wear output unit, and a workpiece surface quality output unit, each of which is composed of a fully connected layer.

[0010] Optionally, the generation of the improved NCDE inference model specifically includes: The hidden state sequence is input into the multi-head output module of the improved NCDE model and linearly mapped to obtain the prediction result vector. The prediction result vector is output as the predicted milling trajectory point sequence in the trajectory point output unit, as the predicted machining efficiency data in the machining efficiency output unit, as the predicted tool wear data in the tool wear output unit, and as the predicted workpiece surface quality data in the workpiece surface quality output unit. The predicted milling trajectory point sequence is compared with the milling trajectory point sequence in the standardized historical trajectory sequence. The sum of squared Euclidean distances is calculated at each time increment of the time series, and the calculation results at all time increments are accumulated to obtain the trajectory deviation loss value. The difference between the predicted processing efficiency data and the processing efficiency data in the standardized historical trajectory sequence is calculated, and the sum of squares of the difference results is calculated to obtain the processing efficiency loss value. The tool wear loss value is obtained by performing a difference calculation between the predicted tool wear data and the tool wear data in the standardized historical trajectory sequence, and then calculating the sum of squares of the difference results. The difference between the predicted workpiece surface quality data and the workpiece surface quality data in the standardized historical trajectory sequence is calculated, and the sum of squares of the difference results is calculated to obtain the workpiece surface quality loss value. Multiply the trajectory deviation loss value by the trajectory deviation weighting coefficient, multiply the machining efficiency loss value by the machining efficiency weighting coefficient, multiply the tool wear loss value by the tool wear weighting coefficient, multiply the workpiece surface quality loss value by the workpiece surface quality weighting coefficient, and add all the calculation results together to obtain the multi-objective joint loss function value. The gradient descent method is used to calculate the gradient of the improved NCDE model parameters based on the multi-objective joint loss function value in each iteration. The improved NCDE model parameters are updated and adjusted based on the gradient until the change of the multi-objective joint loss function value is less than a preset threshold in several consecutive training cycles. The multi-objective joint loss function is then determined to have converged, and the improved NCDE inference model is generated.

[0011] Optionally, the generation of the candidate trajectory result set specifically includes: The standardized primitive feature sequence of the workpiece to be processed is input into the primitive feature encoding module of the improved NCDE inference model, and vectorization encoding, normalization mapping and coordinate embedding are performed to obtain a continuous feature vector sequence. A continuous feature vector sequence is input into the control signal generation unit, and segmented operations are performed according to a preset time step to obtain a continuous control signal sequence. A continuous control signal sequence is input into a parameterized function unit for time evolution calculation to obtain a hidden state sequence. The hidden state sequence is input into the multi-head output module, and linear mapping is performed through a fully connected layer. The predicted milling trajectory point sequence, predicted machining efficiency data, predicted tool wear data, and predicted workpiece surface quality data are output and combined to generate a candidate trajectory result set.

[0012] Optionally, the generation of the optimal milling trajectory sequence specifically includes: For each candidate milling trajectory sequence in the candidate trajectory result set, extract the corresponding machining efficiency data, tool wear data, and workpiece surface quality data, and multiply them element by element with the preset machining efficiency weight coefficient, tool wear weight coefficient, and workpiece surface quality weight coefficient, and then add them to obtain the comprehensive evaluation value of the corresponding candidate milling trajectory sequence. The above weighted calculation is performed sequentially on all candidate milling trajectory sequences in the candidate trajectory result set to obtain multiple comprehensive evaluation values; Multiple comprehensive evaluation values ​​are sorted according to their numerical values. The comprehensive evaluation value with the largest value is determined, and the corresponding relationship in the candidate trajectory result set is retrieved. The candidate milling trajectory sequence corresponding to the largest comprehensive evaluation value is selected as the output to generate the optimal milling trajectory sequence.

[0013] Optionally, the transformation specifically includes: extracting and formatting the milling trajectory points in the optimal milling trajectory sequence in chronological order to obtain a structured data table; mapping the structured data table to CNC machine tool instructions; and encapsulating all instructions into a trajectory instruction file that conforms to the syntax specification of the CNC machine tool control system. The structured data table includes position coordinates, feed rate, and tool posture, and the CNC machine tool instructions include interpolation instructions, feed rate instructions, spindle speed instructions, and tool compensation instructions.

[0014] The beneficial effects of this invention are: This invention proposes a primitive milling trajectory generation method based on path learning. By introducing a primitive feature encoding module, a control signal generation unit, and a multi-head output module to the existing neural controlled differential equation model, it fully utilizes primitive category data, geometric dimension parameters, and spatial position information parsed from the workpiece design file, and combines this with historical milling trajectory data for modeling, achieving a deep fusion of primitive features and machining experience. This structure enables refined expression of primitive features in the time series dimension and drives the evolution of hidden states through control signals. Furthermore, it simultaneously generates a predicted milling trajectory point sequence and multi-dimensional performance indicators at the output, effectively overcoming the limitations of existing technologies that rely solely on geometric parameters for path planning. This significantly improves the model's adaptability to complex working conditions and the accuracy of trajectory generation.

[0015] Furthermore, this invention constructs a multi-objective joint loss function during training. By weighting constraints on trajectory deviation, machining efficiency, tool wear, and workpiece surface quality, the model optimizes trajectory point prediction while considering multi-dimensional machining performance indicators, avoiding the performance imbalance problem caused by traditional single-objective optimization. Combining the weighted evaluation of candidate trajectory result sets with the optimal trajectory selection mechanism, this invention can automatically select the trajectory sequence with the highest comprehensive evaluation value from multiple candidate schemes, achieving synergistic optimization of machining efficiency and machining quality, ensuring that tool life is extended and workpiece surface quality is improved while achieving high-efficiency machining.

[0016] Furthermore, the trajectory instruction file conversion method proposed in this invention formats the information such as tool movement trajectory points, feed rate, and tool posture contained in the optimal milling trajectory sequence into a structured data table, and maps it into interpolation instructions, feed rate instructions, spindle speed instructions, and tool compensation instructions that conform to the syntax specifications of CNC machine tool control systems. This ensures that the generated trajectory results can be directly executed in the CNC machine tool. This not only realizes a closed-loop automation process from design documents to machine tool control, but also improves the feasibility and engineering application value of path learning methods in actual manufacturing scenarios. In summary, this invention effectively overcomes the shortcomings of existing path planning methods in feature utilization, multi-objective optimization, and instruction generation, and has high technical advancement and practical value. Attached Figure Description

[0017] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0018] Figure 1 This is a flowchart of a primitive milling trajectory generation method based on path learning proposed in this invention; Figure 2 This is a schematic diagram of the improved NCDE model structure of a primitive milling trajectory generation method based on path learning proposed in this invention. Detailed Implementation

[0019] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0020] refer to Figure 1-2 A method for generating primitive milling trajectories based on path learning includes the following steps: Acquire primitive feature data and historical milling trajectory data, perform preprocessing on them respectively, and generate standardized primitive feature sequences and standardized historical trajectory sequences; The standardized primitive feature sequence is input into the primitive feature encoding module of the improved NCDE model for encoding, setting the initial hidden state and driving the time evolution calculation to generate the hidden state sequence. The hidden state sequence is input into the multi-head output module of the improved NCDE model for decoding. A multi-objective joint loss function is constructed by combining the standardized historical trajectory sequence and iteratively updated by the gradient descent method to generate the improved NCDE inference model. The standardized primitive feature sequence of the workpiece to be processed is input into the improved NCDE inference model for encoding and hidden state evolution decoding to generate a candidate trajectory result set. The candidate milling trajectory sequence in the candidate trajectory result set is weighted and calculated with the corresponding machining efficiency data, tool wear data and workpiece surface quality data. The candidate milling trajectory sequence with the highest value is selected as the output to generate the optimal milling trajectory sequence. The optimal milling trajectory sequence is converted into a trajectory instruction file and output to the CNC machine tool control module to drive the CNC machine tool to perform milling operations.

[0021] This invention acquires primitive feature data and historical milling trajectory data from workpiece design files, preprocesses them according to standardization, and then inputs them into an improved NCDE model. It utilizes time evolution and multi-objective optimization to generate the final optimal trajectory, which is then output to the CNC machine tool for execution. This process automates the entire process from design file parsing to trajectory instruction generation, avoiding the shortcomings of traditional methods that rely on manual experience for trajectory planning. By incorporating supervised learning with historical trajectory data, this invention improves the accuracy and stability of trajectory prediction, ensuring that the generated trajectory has high applicability and feasibility in terms of geometric rationality, machining efficiency, and surface quality.

[0022] In this embodiment, the geometric feature data is obtained by parsing the workpiece design file. Specifically, it includes: identifying geometric elements from the workpiece design file, performing parametric modeling on the geometric elements, and extracting and combining element category data, geometric dimension parameters, and spatial position information. The workpiece design file includes computer-aided design files and engineering drawing data. The geometric elements include points, lines, arcs, polygons, and curves. The element category is used to identify the type of geometric element, and the geometric dimension parameters are used to characterize the numerical features of the geometric elements, specifically including the length and direction angle of a line, the radius of a circle or arc, and the coordinates of the center. The spatial location information, including the starting and ending angles, the side length, included angle, and number of sides of the polygon, the coordinates of the control points of the curve, the curvature value, and the curve length, is used to represent the positioning relationship of geometric primitives in the three-dimensional coordinate system. Specifically, it includes the reference point coordinates of the primitives in the three-dimensional coordinate system and the relative positional relationship of the primitives in the workpiece. The historical milling trajectory data includes the sequence of milling trajectory points, machining efficiency data, tool wear data, and workpiece surface quality data. The preprocessing includes normalization and feature encoding of primitive feature data and data cleaning, normalization, and serialization of historical milling trajectory data.

[0023] This invention parses workpiece design documents to identify geometric primitives and extract primitive category data, geometric dimension parameters, and spatial location information. After parametric modeling, this data is input into the model along with historical trajectory data. This method systematically converts the geometric information in the design documents into standardized data that can be used for learning, ensuring consistency in the accuracy and completeness of the input data. Compared to traditional methods of manually extracting process parameters, this invention significantly reduces human intervention and error risks, enabling the model to fully perceive the workpiece's geometry and spatial distribution during subsequent trajectory generation, thus improving the fit between the generated trajectory and the actual workpiece characteristics.

[0024] In this embodiment, the generation of the hidden state sequence specifically includes: The standardized primitive feature sequence is input into the primitive feature encoding module of the improved NCDE model. The primitive category data in the standardized primitive feature sequence is vectorized and encoded, the geometric dimension parameters are normalized and numerically mapped, the spatial location information is processed by coordinate embedding, and the encoded results are concatenated into a continuous feature vector sequence in chronological order. The vectorization encoding specifically includes: receiving primitive category data through a category encoding unit, converting different primitive categories into one-hot vectors, and inputting them into an embedding matrix to map them into fixed-length primitive category vectors using matrix multiplication. The normalized numerical mapping specifically includes: receiving geometric dimension parameters through a dimension parameter mapping unit, converting them into normalized values ​​between zero and one according to the range ratio of the maximum and minimum values, and combining them into a dimension parameter vector; The coordinate embedding process specifically includes: receiving spatial position information through a spatial position embedding unit, encoding the three-dimensional coordinate parameters in the spatial position information using sine and cosine functions to generate a corresponding position information vector, and arranging the position information vector according to the coordinate dimension order to obtain a position encoding vector. The sequential concatenation specifically includes: concatenating the position encoding vector and the normalized geometric dimension parameter vector to obtain an enhanced vector that includes spatial position information and geometric dimension parameters, and further concatenating it with the primitive category vector to obtain a continuous feature vector sequence; A continuous feature vector sequence is input to the control signal generation unit. The sequence is segmented according to a preset time step. The feature vectors in each segment are multiplied element by element according to their element positions and added to the corresponding weight coefficients to obtain the weighted sum vector of the corresponding segment. The weighted sum vector is used as the control signal of the corresponding segment. The control signals of all segments are arranged in chronological order to obtain a continuous control signal sequence, which is then input to the dynamic calculation unit. The weight coefficients are parameters set during model training. An initial hidden state is set. The initial hidden state and the continuous control signal are input to the parameterized function unit at time increments to obtain the corresponding model parameter function values. The model parameter function values ​​and the continuous control signal are multiplied element-wise and accumulated at the corresponding time increments to obtain the hidden state change. The hidden state change is added to the initial hidden state to update the hidden state. The updated hidden state is used as the current hidden state and input together with the continuous control signal corresponding to the next time increment to the parameterized function unit. The above calculation process is repeated to obtain the hidden states at all time points, generating a complete hidden state sequence. The initial hidden state is a zero vector or a vector obtained by encoding and calculating a standardized primitive feature sequence. The parameterized function unit is constructed using a neural network structure.

[0025] This invention introduces a primitive feature encoding module, utilizing methods such as categorical encoding, normalized numerical mapping, and spatial location embedding to transform raw primitive data into a continuous sequence of feature vectors. Driven by control signal generation and parameterized function units, a complete hidden state sequence is obtained. This design ensures the consistency of input features in both numerical scale and spatial location, while enhancing the model's ability to express geometric features. Compared to traditional methods based on single-feature modeling, this invention achieves unified representation and time-series modeling of multi-dimensional primitive features, significantly improving the model's ability to generate reasonable trajectories under complex workpiece geometry conditions.

[0026] In this embodiment, the improved NCDE model, compared to the original NCDE model, adds a primitive feature encoding module at the input end to perform vectorization encoding, normalization mapping, and coordinate embedding processing on the standardized primitive feature sequence to generate a continuous feature vector sequence. A control signal generation unit is set in the intermediate layer to perform segmented operations and weighted combination on the continuous feature vector sequence according to the time step to generate a continuous control signal sequence. A multi-head output module is added at the output end to perform linear mapping on the hidden state sequence to generate a predicted milling trajectory point sequence, predicted machining efficiency data, predicted tool wear data, and predicted workpiece surface quality data. In the training process, a multi-objective joint loss function is introduced to impose weighted constraints on trajectory deviation, machining efficiency, tool wear, and workpiece surface quality to generate an improved NCDE inference model. The primitive feature encoding module includes a category encoding unit, a size parameter mapping unit, and a spatial location embedding unit; The control signal generation unit is composed of a fully connected neural network; The multi-head output module includes a trajectory point output unit, a machining efficiency output unit, a tool wear output unit, and a workpiece surface quality output unit, each of which is composed of a fully connected layer.

[0027] This invention introduces a primitive feature encoding module at the input end, which performs vectorization encoding, normalization mapping, and coordinate embedding processing on primitive category data, geometric dimension parameters, and spatial location information, respectively, and concatenates the results into a continuous feature vector sequence. Through this improvement, primitive features of different dimensions are uniformly transformed into fixed-length vector inputs, ensuring the integrity and consistency of data at the representation layer. This module effectively enhances the model's ability to perceive complex geometric structures, making the input data more suitable for the deep learning modeling process, thereby improving the accuracy and robustness of workpiece geometric feature analysis during trajectory prediction.

[0028] The invention adds a control signal generation unit to the intermediate layer, segmenting the continuous feature vector sequence according to the time step, and obtaining a weighted control signal sequence by combining it with weight coefficients through element-wise operations. This design strengthens information modeling in the time dimension, enabling the model to more flexibly capture dynamic changes during trajectory generation. Unlike the original NCDE model, which only relies on the input sequence for evolution, this improvement makes trajectory generation more closely integrated with geometric and temporal features, thereby significantly improving the temporal rationality and smoothness of the milling trajectory and enhancing the model's fitting and generalization ability for complex trajectories.

[0029] This invention adds a multi-head output module to the output end, linearly mapping the hidden state sequence through a fully connected layer, and simultaneously outputting the milling trajectory point sequence, machining efficiency data, tool wear data, and workpiece surface quality data. This improvement overcomes the limitation of traditional models that can only generate a single trajectory result, achieving synchronous output of multi-dimensional prediction results. By modeling trajectory accuracy and process performance indicators in parallel, the model can comprehensively consider path and process requirements during prediction, reducing the deviation between the trajectory and actual machining needs, thereby achieving the unification of trajectory generation and process optimization, and improving practicality and operability in real-world applications.

[0030] This invention introduces a multi-objective joint loss function during training, weighting and combining trajectory deviation loss, machining efficiency loss, tool wear loss, and workpiece surface quality loss, and dynamically constraining each weight coefficient during training. This improvement enables the model to balance the contradictions between different objectives during learning, avoiding overall performance degradation caused by optimizing a single indicator. Through joint optimization, the model not only ensures trajectory accuracy but also considers machining efficiency, tool life, and workpiece quality. This design effectively enhances the model's comprehensive optimization capability under multi-objective conditions, making the generated milling trajectory more in line with the comprehensive needs of industrial production.

[0031] In this embodiment, the generation of the improved NCDE inference model specifically includes: The hidden state sequence is input into the multi-head output module of the improved NCDE model and linearly mapped to obtain the prediction result vector. The prediction result vector is output as the predicted milling trajectory point sequence in the trajectory point output unit, as the predicted machining efficiency data in the machining efficiency output unit, as the predicted tool wear data in the tool wear output unit, and as the predicted workpiece surface quality data in the workpiece surface quality output unit. The linear mapping specifically includes: inputting the hidden state sequence into the fully connected layer in sequence, and performing matrix multiplication and addition operations on the hidden state vector at each time step according to the corresponding weight matrix and bias vector to obtain the prediction result vector; The predicted milling trajectory point sequence is compared with the milling trajectory point sequence in the standardized historical trajectory sequence. The sum of squared Euclidean distances is calculated at each time increment of the time series, and the calculation results at all time increments are accumulated to obtain the trajectory deviation loss value. The difference between the predicted processing efficiency data and the processing efficiency data in the standardized historical trajectory sequence is calculated, and the sum of squares of the difference results is calculated to obtain the processing efficiency loss value. The tool wear loss value is obtained by performing a difference calculation between the predicted tool wear data and the tool wear data in the standardized historical trajectory sequence, and then calculating the sum of squares of the difference results. The difference between the predicted workpiece surface quality data and the workpiece surface quality data in the standardized historical trajectory sequence is calculated, and the sum of squares of the difference results is calculated to obtain the workpiece surface quality loss value. The trajectory deviation loss value is multiplied by the trajectory deviation weight coefficient, the machining efficiency loss value is multiplied by the machining efficiency weight coefficient, the tool wear loss value is multiplied by the tool wear weight coefficient, and the workpiece surface quality loss value is multiplied by the workpiece surface quality weight coefficient. All the calculation results are added together to obtain the multi-objective joint loss function value. The trajectory deviation weight coefficient, machining efficiency weight coefficient, tool wear weight coefficient, and workpiece surface quality weight coefficient are set according to the process requirements before training and participate in gradient update as model parameters during training. The normalization function is used to constrain each weight coefficient so that all weight coefficients are normalized after each training cycle, keeping the weight coefficient values ​​between zero and one and the sum of them equal to one. The gradient descent method is used to calculate the gradient of the improved NCDE model parameters based on the multi-objective joint loss function value in each iteration. The improved NCDE model parameters are updated and adjusted based on the gradient until the change of the multi-objective joint loss function value is less than a preset threshold in several consecutive training cycles. The multi-objective joint loss function is then determined to have converged, and the improved NCDE inference model is generated.

[0032] This invention utilizes a fully connected layer in the multi-head output module to linearly map the hidden state sequence, simultaneously outputting milling trajectory points, machining efficiency, tool wear, and workpiece surface quality. A multi-objective joint loss function is constructed by combining historical trajectory data for iterative training. This design enables the model to not only obtain the trajectory during the prediction phase but also consider multi-dimensional indicators of machining performance, achieving a leap from single output to multi-objective optimization. Through this improvement, the invention can effectively constrain the trajectory prediction results during the training phase, improving the overall performance of the final output and ensuring an overall balance in trajectory accuracy, efficiency, tool life, and surface quality.

[0033] In this embodiment, the generation of the candidate trajectory result set specifically includes: The standardized primitive feature sequence of the workpiece to be processed is input into the primitive feature encoding module of the improved NCDE inference model, and vectorization encoding, normalization mapping and coordinate embedding are performed to obtain a continuous feature vector sequence. A continuous feature vector sequence is input into the control signal generation unit, and segmented operations are performed according to a preset time step to obtain a continuous control signal sequence. A continuous control signal sequence is input into a parameterized function unit for time evolution calculation to obtain a hidden state sequence. The hidden state sequence is input into the multi-head output module, and linear mapping is performed through a fully connected layer. The predicted milling trajectory point sequence, predicted machining efficiency data, predicted tool wear data, and predicted workpiece surface quality data are output and combined to generate a candidate trajectory result set.

[0034] This invention inputs the primitive feature sequence of the workpiece to be processed into an improved NCDE inference model during the inference stage. Through feature encoding, control signal generation, time evolution calculation, and multi-head output, a candidate trajectory result set is finally generated. This method realizes a complete inference process from workpiece geometric features to trajectory prediction, avoiding the tedious operations relying on manual parameter tuning or multi-model combinations. The generation of the candidate result set provides multi-dimensional references for subsequent optimal trajectory selection, improving the flexibility and adaptability of trajectory generation. This invention significantly improves the automation level of the inference stage and the practicality of trajectory prediction.

[0035] In this embodiment, the generation of the optimal milling trajectory sequence specifically includes: For each candidate milling trajectory sequence in the candidate trajectory result set, extract the corresponding machining efficiency data, tool wear data, and workpiece surface quality data, and multiply them element by element with the preset machining efficiency weight coefficient, tool wear weight coefficient, and workpiece surface quality weight coefficient, and then add them to obtain the comprehensive evaluation value of the corresponding candidate milling trajectory sequence. The above weighted calculation is performed sequentially on all candidate milling trajectory sequences in the candidate trajectory result set to obtain multiple comprehensive evaluation values; Multiple comprehensive evaluation values ​​are sorted according to their numerical values. The comprehensive evaluation value with the largest value is determined, and the corresponding relationship in the candidate trajectory result set is retrieved. The candidate milling trajectory sequence corresponding to the largest comprehensive evaluation value is selected as the output to generate the optimal milling trajectory sequence.

[0036] This invention performs a weighted comprehensive evaluation of each candidate trajectory in the candidate trajectory result set, combining corresponding processing efficiency, tool wear, and workpiece surface quality data, and selects the optimal trajectory by comparing the highest evaluation value. This method introduces a constraint mechanism of weighting coefficients, enabling trajectory selection to achieve balanced optimization under multi-dimensional process indicators, avoiding imbalances caused by a single indicator. Through this weighted evaluation method, this invention effectively improves the rationality and interpretability of trajectory selection, ensuring that the final optimal trajectory maintains an optimal balance between efficiency, tool life, and processing quality, better meeting the comprehensive needs of actual production.

[0037] In this embodiment, the transformation specifically includes: extracting and formatting the milling trajectory points in the optimal milling trajectory sequence in chronological order to obtain a structured data table; mapping the structured data table to CNC machine tool instructions; and encapsulating all instructions into a trajectory instruction file that conforms to the syntax specification of the CNC machine tool control system. The structured data table includes position coordinates, feed rate, and tool posture, and the CNC machine tool instructions include interpolation instructions, feed rate instructions, spindle speed instructions, and tool compensation instructions.

[0038] This invention formats the optimal milling trajectory sequence, transforming trajectory points into a structured data table, which is then mapped to a CNC machine tool instruction file and finally output to the machine tool control module. This conversion process ensures the compatibility of the trajectory data with the CNC machine tool control syntax, achieving seamless integration from algorithm prediction to machine tool execution. Compared to traditional manual trajectory translation, this invention automates trajectory instruction generation, effectively reducing manual programming workload and potential error risks, significantly improving the efficiency and accuracy of trajectory execution, and accelerating the actual workpiece machining process.

[0039] Example 1: To verify the feasibility of this invention in practice, it was applied to a large CNC machining workshop in a coastal area. This workshop primarily undertakes milling tasks for ship parts and key components of engineering machinery. The workpieces being machined generally exhibit complex geometries, high dimensional accuracy requirements, and unstable batch sizes. In traditional processes, operators rely on machining experience to determine milling paths and drive the CNC machine tools through manually set instruction files. Due to the lack of a systematic integration of workpiece geometry and historical machining experience, problems such as path redundancy, rapid tool wear, and unstable surface quality often occur, leading to low machining efficiency and increased production costs. These problems are particularly pronounced when rapid order response and shorter delivery cycles are required.

[0040] In practical applications, the workpiece design file is imported into the system, which automatically parses the geometric primitives in the file and extracts data such as primitive category, geometric dimensions, and spatial location to form complete primitive feature data. Simultaneously, historical milling trajectory data accumulated in the workshop over a long period is imported as a reference, including tool movement trajectory points and corresponding efficiency, wear, and surface quality data. After cleaning, normalization, and serialization, this data, along with the primitive feature data, is input into the improved NCDE inference model constructed in this invention. Through primitive feature encoding and time evolution calculation, the system can learn the deep-level correlation between different geometric features and machining trajectories, and generate a candidate trajectory result set during the inference stage.

[0041] In the actual operation of this workshop, the geometric features of the workpieces vary considerably, making it difficult for traditional methods to maintain consistency in path planning across different workpieces. This invention uses a unified encoding method to transform geometric features such as points, lines, arcs, polygons, and curves into standardized vectors, enabling them to be processed and recognized within the same model. When the model receives data from different workpieces, it can quickly infer multiple sets of candidate trajectories and optimize the selection based on performance feedback provided by historical processing data. This process effectively avoids the tedious steps of operators adjusting processing parameters one by one, significantly reducing preparation time.

[0042] Meanwhile, when screening candidate trajectories, the system not only focuses on machining efficiency but also comprehensively considers indicators such as tool wear and workpiece surface quality. This multi-objective weighted evaluation mechanism ensures that the optimal trajectory selected ultimately extends tool life and maintains high surface accuracy while guaranteeing machining speed. During batch processing, the machining workshop found that trajectory switching was smoother and toolpaths more balanced in machining complex curved surfaces and polygonal structures, reducing over-cutting and unnecessary idle movements.

[0043] Furthermore, this invention provides standardized trajectory instruction files in the output stage, enabling direct interface with the control module of CNC machine tools. The instruction files not only include the spatial coordinates and motion path of the tool, but also information such as feed rate, spindle speed, and tool compensation, ensuring that the machine tool requires no additional parameter adjustments during execution. The entire machining process forms a complete closed loop; from data input and path reasoning to machining execution, everything is completed automatically by the system, minimizing errors caused by manual intervention.

[0044] Through practical application in the workshop, this invention has demonstrated strong adaptability and stability. Whether handling single-piece, small-batch, or complex batch tasks, the system maintains the reliability of path generation and the consistency of workpiece processing quality. This capability effectively alleviates the pressure on enterprises when facing complex orders, improves the overall production efficiency of the workshop, and lays a solid foundation for further intelligent manufacturing upgrades.

[0045] Table 1. Performance Comparison of the Invention and Traditional Primitive Milling Trajectory Generation Methods

[0046] As can be clearly seen from Table 1, the method of the present invention is superior to the traditional method in several key indicators.

[0047] Regarding milling trajectory accuracy, the trajectory deviation of the traditional method is 1.12 mm, while the improved NCDE method has a trajectory deviation of 0.41 mm, a reduction of nearly two-thirds. This indicates that the improved method can better model and predict trajectory points, improving the accuracy of trajectory control. This is because the improved NCDE model introduces a primitive feature encoding module at the input end and combines it with a hidden state evolution mechanism, enabling the trajectory generation process to fully utilize workpiece geometric features and historical trajectory data, thereby significantly reducing trajectory deviation.

[0048] In terms of processing efficiency, the traditional method achieves 11.3 pieces / hour, while the improved NCDE method increases this to 17.6 pieces / hour, an increase of over 55%. This demonstrates that the improved model can accelerate the overall milling pace while maintaining processing accuracy. The improvement is attributed to the model's use of a multi-objective joint loss function to constrain efficiency factors, ensuring that trajectory generation not only pursues accuracy but also optimizes the time dimension, thereby achieving higher processing efficiency.

[0049] In terms of tool wear control, the traditional method achieves a tool wear rate of 8.5%, while the improved NCDE method reduces this to 3.9%, effectively decreasing the tool wear rate. This advantage stems from the introduction of a multi-head output module at the output end of the improved model. This module can simultaneously predict trajectory points, machining efficiency, tool wear, and workpiece surface quality, automatically considering tool stress and wear during trajectory planning, thereby optimizing tool usage and extending effective tool life. Furthermore, in terms of tool life extension rate, the traditional method achieves only 6.8%, while the improved NCDE method reaches 24.5%, demonstrating a significant improvement. This not only reduces the frequency of tool replacement and maintenance costs but also ensures the stability of continuous machining processes.

[0050] Regarding workpiece surface quality, the surface roughness Ra of the traditional method is 2.48 μm, while the improved NCDE method significantly reduces it to 1.28 μm, a reduction of nearly half. This indicates that the improved method can effectively control cutting parameters and tool path during the trajectory planning stage, resulting in a smoother and more even machined surface. The fundamental reason for its performance improvement lies in the multi-objective optimization mechanism, which allows the model to simultaneously consider surface quality factors, thereby constraining and optimizing quality parameters during trajectory generation.

[0051] Furthermore, in terms of energy consumption, the traditional method consumes 6.4 kWh per unit, while the improved NCDE method reduces this to 4.2 kWh per unit, a reduction of over 34%. Simultaneously, the overall energy consumption reduction rate is only 4.1% with the traditional method, while the improved NCDE method achieves 21.7%. This indicates that the improved method not only optimizes energy consumption per unit but also has significant advantages in overall energy efficiency management. This is because energy efficiency weights are introduced during trajectory optimization, enabling the generated trajectory to reduce idle travel and ineffective power consumption while ensuring processing performance, thereby effectively reducing overall energy consumption.

[0052] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for generating a graphical milling trajectory based on path learning, characterized in that, The method comprises the following steps: obtaining feature data of a graphic element and historical milling trajectory data, respectively preprocessing to generate standardized feature sequence of the graphic element and standardized historical trajectory sequence; inputting the standardized feature sequence of the graphic element into a graphic element feature coding module of the improved NCDE model to code, set an initial hidden state and drive time evolution calculation to generate a hidden state sequence; inputting the hidden state sequence into a multi-head output module of the improved NCDE model to decode, combining the standardized historical trajectory sequence to construct a multi-objective joint loss function, and iteratively updating through gradient descent method to generate an improved NCDE inference model; inputting the standardized feature sequence of the graphic element of a workpiece to be processed into the improved NCDE inference model to code and evolve the hidden state to decode to generate a candidate trajectory result set; weighting calculation of candidate milling trajectory sequences in the candidate trajectory result set and corresponding machining efficiency data, tool wear data and workpiece surface quality data, screening the candidate milling trajectory sequence corresponding to the highest value as output to generate an optimal milling trajectory sequence; converting the optimal milling trajectory sequence into a trajectory instruction file and outputting to a numerical control machine tool control module to drive the numerical control machine tool to perform milling.

2. The method of claim 1, wherein, The feature data of the graphic element is obtained by analyzing a workpiece design file, specifically including: identifying geometric elements from the workpiece design file, parameterizing modeling the geometric elements, extracting graphic element category data, geometric dimension parameters and spatial position information and combining to obtain, the workpiece design file includes computer aided design file and engineering drawing data, the geometric elements include point, straight line, circular arc, polygon and curve, the historical milling trajectory data includes milling trajectory point sequence, machining efficiency data, tool wear data and workpiece surface quality data, the preprocessing includes normalization processing, feature coding of the graphic element feature data and data cleaning, normalization and sequence processing of the historical milling trajectory data.

3. The method of claim 1, wherein, The generation of the hidden state sequence specifically includes: inputting the standardized feature sequence of the graphic element into the graphic element feature coding module of the improved NCDE model, vectorizing coding the graphic element category data in the standardized feature sequence of the graphic element, normalizing numerical mapping the geometric dimension parameters, and coordinate embedding processing the spatial position information, and concatenating the coded results into a continuous feature vector sequence in time sequence; The vectorization coding specifically includes: receiving the graphic element category data through a category coding unit, converting different graphic element categories into one-hot vectors, and inputting the one-hot vectors into an embedding matrix to map them into fixed-length graphic element category vectors through matrix multiplication operation; The normalization numerical mapping specifically includes: receiving the geometric dimension parameters through a dimension parameter mapping unit, converting the geometric dimension parameters into normalized numerical values between zero and one according to the interval proportion of the maximum value and the minimum value, and combining them into a dimension parameter vector; The coordinate embedding processing specifically includes: receiving the spatial position information through a spatial position embedding unit, performing sine function and cosine function coding on the three-dimensional coordinate parameters in the spatial position information to generate corresponding position information vectors, and arranging the position information vectors in the order of coordinate dimensions to obtain a position coding vector; The continuous feature vector sequence is input into a control signal generation unit, sequence segmentation is performed according to a preset time step, the feature vectors in each segment are multiplied element by element and added with corresponding weight coefficients to obtain a weighted sum vector of the corresponding segment, the weighted sum vector is taken as the control signal of the corresponding segment, and the control signals of all segments are arranged in time sequence to obtain a continuous control signal sequence and input into a dynamic calculation unit; An initial hidden state is set, the initial hidden state and the continuous control signal are input into a parameterized function unit under a time increment to obtain a corresponding model parameter function value, the model parameter function value and the continuous control signal are multiplied element by element and accumulated under the corresponding time increment to obtain a hidden state change amount, the hidden state change amount and the initial hidden state are added to update to obtain an updated hidden state, the updated hidden state is taken as a current hidden state, and the current hidden state is input into the parameterized function unit together with the continuous control signal corresponding to the next time increment to repeatedly perform the above calculation process to obtain hidden states at all time instants in sequence and generate a hidden state sequence.

4. The method of claim 1, wherein, Compared with the original NCDE model, the improved NCDE model adds a graphic element feature coding module at the input end, performs vectorization coding, normalization mapping and coordinate embedding processing on the standardized graphic element feature sequence to generate a continuous feature vector sequence, sets a control signal generation unit at the middle layer, performs segmented operation and weighted combination on the continuous feature vector sequence according to a time step to generate a continuous control signal sequence, adds a multi-head output module at the output end, performs linear mapping on the hidden state sequence to generate a predicted milling trajectory point sequence, predicted machining efficiency data, predicted tool wear data and predicted workpiece surface quality data, and introduces a multi-objective joint loss function in the training process to perform weighted constraint on the trajectory deviation, machining efficiency, tool wear and workpiece surface quality to generate an improved NCDE reasoning model; The graphic element feature coding module comprises a category coding unit, a size parameter mapping unit and a spatial position embedding unit; The control signal generation unit is composed of a fully connected neural network; The multi-head output module comprises a trajectory point output unit, a machining efficiency output unit, a tool wear output unit and a workpiece surface quality output unit, and each output unit is composed of a fully connected layer.

5. The method of claim 1, wherein, The generation of the improved NCDE reasoning model specifically comprises: The hidden state sequence is input into the multi-head output module of the improved NCDE model to perform linear mapping to obtain a prediction result vector, the prediction result vector is output as a predicted milling trajectory point sequence in the trajectory point output unit, as predicted machining efficiency data in the machining efficiency output unit, as predicted tool wear data in the tool wear output unit and as predicted workpiece surface quality data in the workpiece surface quality output unit; The predicted milling trajectory point sequence is compared with a milling trajectory point sequence in the standardized historical trajectory sequence, the Euclidean distance square sum is calculated at each time increment in the time sequence, and the calculation results at all time increments are accumulated to obtain a trajectory deviation loss value. The difference between the predicted processing efficiency data and the processing efficiency data in the standardized historical trajectory sequence is calculated, and the sum of squares of the difference results is calculated to obtain the processing efficiency loss value. The tool wear loss value is obtained by performing a difference calculation between the predicted tool wear data and the tool wear data in the standardized historical trajectory sequence, and then calculating the sum of squares of the difference results. The difference between the predicted workpiece surface quality data and the workpiece surface quality data in the standardized historical trajectory sequence is calculated, and the sum of squares of the difference results is calculated to obtain the workpiece surface quality loss value. Multiply the trajectory deviation loss value by the trajectory deviation weighting coefficient, multiply the machining efficiency loss value by the machining efficiency weighting coefficient, multiply the tool wear loss value by the tool wear weighting coefficient, multiply the workpiece surface quality loss value by the workpiece surface quality weighting coefficient, and add all the calculation results together to obtain the multi-objective joint loss function value. The gradient descent method is used to calculate the gradient of the improved NCDE model parameters based on the multi-objective joint loss function value in each iteration. The improved NCDE model parameters are updated and adjusted based on the gradient until the change of the multi-objective joint loss function value is less than a preset threshold in several consecutive training cycles. The multi-objective joint loss function is then determined to have converged, and the improved NCDE inference model is generated.

6. The method of claim 1, wherein, The generation of the candidate trajectory result set specifically includes: The standardized primitive feature sequence of the workpiece to be processed is input into the primitive feature encoding module of the improved NCDE inference model, and vectorization encoding, normalization mapping and coordinate embedding are performed to obtain a continuous feature vector sequence. A continuous feature vector sequence is input into the control signal generation unit, and segmented operations are performed according to a preset time step to obtain a continuous control signal sequence. A continuous control signal sequence is input into a parameterized function unit for time evolution calculation to obtain a hidden state sequence. The hidden state sequence is input into the multi-head output module, and linear mapping is performed through a fully connected layer. The predicted milling trajectory point sequence, predicted machining efficiency data, predicted tool wear data, and predicted workpiece surface quality data are output and combined to generate a candidate trajectory result set.

7. The method of claim 1, wherein, The generation of the optimal milling trajectory sequence specifically includes: For each candidate milling trajectory sequence in the candidate trajectory result set, extract the corresponding machining efficiency data, tool wear data, and workpiece surface quality data, and multiply them element by element with the preset machining efficiency weight coefficient, tool wear weight coefficient, and workpiece surface quality weight coefficient, and then add them to obtain the comprehensive evaluation value of the corresponding candidate milling trajectory sequence. The above weighted calculation is performed sequentially on all candidate milling trajectory sequences in the candidate trajectory result set to obtain multiple comprehensive evaluation values; Multiple comprehensive evaluation values ​​are sorted according to their numerical values. The comprehensive evaluation value with the largest value is determined, and the corresponding relationship in the candidate trajectory result set is retrieved. The candidate milling trajectory sequence corresponding to the largest comprehensive evaluation value is selected as the output to generate the optimal milling trajectory sequence.

8. The method of claim 1, wherein, The transformation specifically includes: extracting and formatting the milling trajectory points in the optimal milling trajectory sequence in chronological order to obtain a structured data table; mapping the structured data table to CNC machine tool instructions; and encapsulating all instructions into a trajectory instruction file that conforms to the syntax specification of the CNC machine tool control system. The structured data table includes position coordinates, feed rate, and tool posture, and the CNC machine tool instructions include interpolation instructions, feed rate instructions, spindle speed instructions, and tool compensation instructions.