Intelligent generation method for CNC (computer numerical control) programming of mold
By using an intelligent generation method for CNC programming of molds, the fully automated generation of CNC machine tool code from the 3D model of the mold is realized, which solves the problems of low efficiency, reliance on experience and fragmented process knowledge in traditional CNC programming of molds, and achieves a highly efficient and optimized machining process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional CNC programming for molds is inefficient, relies on experience for quality, is difficult to adapt to flexible manufacturing of small batches and multiple varieties, has fragmented process knowledge, and is difficult to optimize due to conflicting objectives.
By employing modules for geometric feature analysis, process diagram components, tool parameter matching, tool path planning, G-code generation and optimization, and machining simulation and feedback, the system achieves fully automated generation from 3D mold models to CNC machine tool codes. Combining geometric analysis, process knowledge, and intelligent algorithms, it balances machining efficiency, accuracy, and cost through multi-objective optimization algorithms.
It has achieved full automation of CNC programming for molds, improved processing efficiency, ensured processing quality, systematically accumulated process knowledge, and optimized multi-objective conflicts.
Smart Images

Figure CN121900310A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of CNC programming technology and relates to an intelligent generation method for CNC programming of molds. Background Technology
[0002] CNC programming for molds is a crucial step in converting a 3D mold model into executable code for a CNC machine tool, directly impacting machining accuracy, efficiency, and tool life. Traditional CNC programming relies on manual labor, which presents the following problems: 1. Low efficiency: Programming complex molds requires senior engineers to spend 3-7 days, which is difficult to adapt to the flexible manufacturing needs of small batches and multiple varieties; Second, quality depends on experience: the feed rate, spindle speed and toolpath planning of cutting parameters rely on the subjective judgment of engineers, which can easily lead to overcutting, undercutting or excessive tool wear. Third, fragmented process knowledge: The cutting parameter library and tool selection rules accumulated by enterprises are scattered in manuals or personal experience, making it difficult to standardize and reuse them. IV. Multi-objective conflict: Manual programming makes it difficult to balance the multi-objective optimization of machining efficiency, time, accuracy error, cost, and tool wear.
[0003] In existing technologies, semi-automatic programming based on CAM software still requires manual intervention in feature recognition and parameter setting; some methods that introduce machine learning can only optimize parameters of a single process and have not formed a fully automated process from model to code. Therefore, there is an urgent need for an end-to-end generation method for mold CNC programming that integrates geometric analysis, process knowledge and intelligent algorithms. Summary of the Invention
[0004] The purpose of this invention is to provide a method for intelligent generation of CNC programming for molds, so as to solve the problems mentioned in the background art.
[0005] The objective of this invention can be achieved through the following technical solution: a method for intelligent generation of CNC programming for molds, comprising a geometric feature analysis module, a process diagram component module, a tool parameter matching module, a tool path planning module, a G-code generation and optimization module, and a machining simulation and feedback module, characterized in that the intelligent production method specifically includes the following steps: Step S1: Extract machining features and geometric parameters from the 3D model of the mold using the geometric feature analysis module; Step S2: Construct a six-element knowledge graph of features-tools-parameters-machine tools-materials-constraints through the process graph component module, and realize neural symbol joint reasoning with embedded representation and differentiable rule penalty terms to output the confidence of tool and parameter candidate schemes; Step S3: Based on geometric features and knowledge graph, the tool parameter matching module intelligently selects the tool type, specifications and cutting parameters. It adopts a multi-output Gaussian process proxy model to jointly model uncertainty, and uses chance constraints to ensure that the machine tool, cutting force and speed boundaries are satisfied in an overview sense. Step S4: The toolpath planning module generates a collision-free toolpath based on the feature type and optimized parameters. B-splines are used to predict control points using a neural network, and the toolpath is jointly optimized under time, curvature, acceleration and differentiable collision volume penalty. Step S5: The tool path and cutting parameters are converted into G-code executable by the G-code generation and optimization module, and redundant instructions are reduced by the code compression algorithm. Step S6: The machining simulation and feedback module uses digital twin technology to simulate the machining process, detect overcutting, undercutting, and tool collision problems, and feeds the simulation results back to the parameter matching and path planning module for iterative optimization. The module trains a differentiable simulation agent to predict surface errors, overcutting volume, and tool wear; the errors are used for reverse updating of parameters and paths.
[0006] In the above-mentioned intelligent generation method for CNC programming of molds, the format of the three-dimensional model in step S1 is either STEP or IGES format.
[0007] In the above-mentioned intelligent generation method for CNC programming of molds, the machining features in step S11 specifically include cavities, cores, inclined surfaces and deep holes, and the geometric parameters specifically include curvature, depth and roughness.
[0008] In the above-mentioned intelligent generation method for CNC programming of molds, the feature extraction algorithm in step S1 specifically includes the following steps: Step 1: Patch-level semantic segmentation. Introducing the graph structure 3DTransformer to perform semantic segmentation and feature instance grouping on the mesh / point cloud, given a set of sampling points on the surface of the 3D model. , legal direction Discrete curvature Surface area As input features, construct a graph The edge weights are based on the included angle of the normal and the Euclidean neighborhood;
[0009]
[0010] The classification head outputs the semantic probabilities of the facets:
[0011] Instance grouping is clustered using Laplace embeddings to minimize the discriminative loss between compactness within the same class and separation between dissimilar classes:
[0012] Total loss: ; Step 2: Learning-based determination of complex elements in deep holes; changing the hard threshold of "h / d>5" to a learning-based determination where h is the hole depth and d is the hole diameter:
[0013] by It was determined to be a deep hole. Calibrate using the validation set.
[0014] In the above-mentioned intelligent generation method for CNC programming of molds, the confidence level of the parameter candidate scheme in step S2 specifically includes the following steps: Step 1: Obtain the confidence level of candidate process rules using RotatE (Rotation Embedding Scoring).
[0015] Step 2: Using SWRL / rules as prior constraints, combine differentiable penalty terms:
[0016] Step 3: Final selection of tooling parameter scheme Depend on: .
[0017] In the above-mentioned intelligent generation method for CNC programming of molds, the step S3 acquisition function adopts constraint expectation improvement, specifically including: Risk-sensitive objective function and variables: ; Regression using Gaussian process GP multi-output surrogate model And opportunity constraints are introduced to ensure that the machine tool, cutting force, and vibration boundaries satisfy the following in an overview sense:
[0018] Using constraint expectation improvement as the acquisition function:
[0019] Among them, China The upper bound of the GP confidence for each constraint is given.
[0020] In the aforementioned intelligent generation method for CNC programming of molds, step S4, neural B-spline parameterization, involves path control. Point and node vector definition: .
[0021] Control points are predicted from the geometry and reachability graph by a graph neural network: .
[0022] The joint objective loss function (processing time + curvature / jump + collision volume) is:
[0023] in, It involves differentiable collision volume penalty, feed-curvature adaptive step size, and residual constraints. .
[0024] In the above-mentioned intelligent generation method for CNC programming of molds, the G-code generation rule in step S5 is as follows: Linear interpolation: G01 X[X] Y[Y] Z[Z] F[F] ((X,Y,Z) are the target coordinates, (F) is the feed rate); Circular interpolation: G02 X[X] Y[Y]I[I] J[J]F[F] ((I,J) is the offset optimization module for the center of the circle relative to the starting point; Circular interpolation: G02 X[X] Y[Y]I[I] J[J]F[F] ((I,J) is the offset optimization module for the center of the circle relative to the starting point; The path and parameter sequence is encoded into a constraint sequence, and then decoded using a Transformer to generate G / M instructions. .
[0025] Constraints are applied using a masking mechanism: illegal interpolation / out-of-bounds feeds are masked. The loss function incorporates a mode-switching penalty to reduce redundancy.
[0026] Online compression uses piecewise dynamic programming to merge straight lines and circular arcs of the same mode, achieving a compression ratio of: .
[0027] In the above-mentioned intelligent generation method for CNC programming of molds, step S6 can simulate agent and loss:
[0028] Goals and Updates:
[0029] Parameter optimization and backpropagation of path control points.
[0030] Compared with existing technologies, the advantages of the intelligent generation method for CNC programming of molds in this invention are: to realize full automation from input of mold 3D model to output of executable G code, to balance processing efficiency, accuracy and cost through multi-objective optimization algorithm, and to realize the systematic accumulation and reuse of process knowledge. Attached Figure Description
[0032] Figure 1 This is a flowchart of a CNC programming intelligent generation method for molds according to the present invention. Detailed Implementation
[0033] The following are specific embodiments of the present invention, which are described in conjunction with the accompanying drawings. However, the present invention is not limited to these embodiments.
[0034] This invention discloses an intelligent generation method for CNC programming of molds, comprising a geometric feature analysis module, a process diagram component module, a tool parameter matching module, a tool path planning module, a G-code generation and optimization module, and a machining simulation and feedback module. The intelligent production method specifically includes the following steps: Step S1: Extract machining features and geometric parameters from the 3D model of the mold using the geometric feature analysis module; Step S2: Construct a six-element knowledge graph of features-tools-parameters-machine tools-materials-constraints through the process graph component module, and realize neural symbol joint reasoning with embedded representation and differentiable rule penalty terms to output the confidence of tool and parameter candidate schemes; Step S3: Based on geometric features and knowledge graph, the tool parameter matching module intelligently selects the tool type, specifications and cutting parameters. It adopts a multi-output Gaussian process proxy model to jointly model uncertainty, and uses chance constraints to ensure that the machine tool, cutting force and speed boundaries are satisfied in an overview sense. Step S4: The toolpath planning module generates a collision-free toolpath based on the feature type and optimized parameters. B-splines are used to predict control points using a neural network, and the toolpath is jointly optimized under time, curvature, acceleration and differentiable collision volume penalty. Step S5: The tool path and cutting parameters are converted into G-code executable by the G-code generation and optimization module, and redundant instructions are reduced by the code compression algorithm. Step S6: The machining simulation and feedback module uses digital twin technology to simulate the machining process, detect overcutting, undercutting, and tool collision problems, and feeds the simulation results back to the parameter matching and path planning module for iterative optimization. The module trains a differentiable simulation agent to predict surface errors, overcutting volume, and tool wear; the errors are used for reverse updating of parameters and paths.
[0035] Specifically, it achieves full automation from inputting the 3D model of the mold to outputting executable G-code, balances processing efficiency, accuracy and cost through multi-objective optimization algorithms, and realizes the systematic accumulation and reuse of process knowledge.
[0036] The format of the 3D model in step S1 is either STEP or IGES. The machining features in step S11 specifically include cavities, cores, bevels, and deep holes, and the geometric parameters specifically include curvature, depth, and roughness.
[0037] The feature extraction algorithm in step S1 specifically includes the following steps: Step 1: Patch-level semantic segmentation. Introducing the graph structure 3DTransformer to perform semantic segmentation and feature instance grouping on the mesh / point cloud, given a set of sampling points on the surface of the 3D model. , legal direction Discrete curvature Surface area As input features, construct a graph The edge weights are based on the included angle of the normal and the Euclidean neighborhood;
[0038]
[0039] The classification head outputs the semantic probabilities of the facets:
[0040] Instance grouping is clustered using Laplace embeddings to minimize the discriminative loss between compactness within the same class and separation between dissimilar classes:
[0041] Total loss: ; Step 2: Learning-based determination of complex elements in deep holes; changing the hard threshold of "h / d>5" to a learning-based determination where h is the hole depth and d is the hole diameter: by It was determined to be a deep hole. Calibrate using the validation set.
[0042] Specifically, feature extraction algorithms are used to extract features from the 3D model of the mold in advance, providing a basis for subsequent process planning.
[0043] The confidence level of the candidate parameter schemes in step S2 specifically includes the following steps: Step 1: Obtain the confidence level of candidate process rules using RotatE (Rotation Embedding Scoring).
[0044] Step 2: Using SWRL / rules as prior constraints, combine differentiable penalty terms:
[0045] Step 3: Final selection of tooling parameter scheme Depend on: .
[0046] Specifically, the output parameters are constructed through the process knowledge graph construction module to provide knowledge support for intelligent decision-making.
[0047] Step S3, the acquisition function, employs constraint expectation improvement, specifically including: Risk-sensitive objective function and variables: ; Regression using Gaussian process GP multi-output surrogate model And opportunity constraints are introduced to ensure that the machine tool, cutting force, and vibration boundaries satisfy the following in an overview sense:
[0048] Using constraint expectation improvement as the acquisition function:
[0049] Among them, China The upper bound of the GP confidence for each constraint is given.
[0050] Step S4: Neural B-spline parameterization: Path controlled by Point and node vector definition: .
[0051] Control points are predicted from the geometry and reachability graph by a graph neural network: .
[0052] The joint objective loss function (processing time + curvature / jump + collision volume) is:
[0053] in, It involves differentiable collision volume penalty, feed-curvature adaptive step size, and residual constraints. .
[0054] The G-code generation rule in step S5 is as follows: Linear interpolation: G01 X[X] Y[Y] Z[Z] F[F] ((X,Y,Z) are the target coordinates, (F) is the feed rate); Circular interpolation: G02 X[X] Y[Y]I[I] J[J]F[F] ((I,J) is the offset optimization module for the center of the circle relative to the starting point; Circular interpolation: G02 X[X] Y[Y]I[I] J[J]F[F] ((I,J) is the offset optimization module for the center of the circle relative to the starting point; The path and parameter sequence is encoded into a constraint sequence, and then decoded using a Transformer to generate G / M instructions. .
[0055] Constraints are applied in a masked manner: illegal interpolation / outbound feeds are masked, and loss function superposition mode switching penalties are applied to reduce redundancy;
[0056] Online compression uses piecewise dynamic programming to merge straight lines and circular arcs of the same mode, achieving a compression ratio of: .
[0057] Step S6 Differentiable simulation agent and loss:
[0058] Goals and Updates: Parameter optimization and backpropagation of path control points.
[0059] Contents not described in detail herein are existing technologies known to those skilled in the art. The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art can make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. A method for intelligent generation of CNC programming for molds, comprising a geometric feature analysis module, a process diagram component module, a tool parameter matching module, a tool path planning module, a G-code generation and optimization module, and a machining simulation and feedback module, characterized in that, The intelligent manufacturing method specifically includes the following steps: Step S1: Extract machining features and geometric parameters from the 3D model of the mold using the geometric feature analysis module; Step S2: Construct a six-element knowledge graph of features-tools-parameters-machine tools-materials-constraints through the process graph component module, and realize neural symbol joint reasoning with embedded representation and differentiable rule penalty terms to output the confidence of tool and parameter candidate schemes; Step S3: Based on geometric features and knowledge graph, the tool parameter matching module intelligently selects the tool type, specifications and cutting parameters. It adopts a multi-output Gaussian process proxy model to jointly model uncertainty, and uses chance constraints to ensure that the machine tool, cutting force and speed boundaries are satisfied in an overview sense. Step S4: The toolpath planning module generates a collision-free toolpath based on the feature type and optimized parameters. B-splines are used to predict control points using a neural network, and the toolpath is jointly optimized under time, curvature, acceleration and differentiable collision volume penalty. Step S5: The tool path and cutting parameters are converted into G-code executable by the G-code generation and optimization module, and redundant instructions are reduced by the code compression algorithm. Step S6: The machining simulation and feedback module uses digital twin technology to simulate the machining process, detect overcutting, undercutting, and tool collision problems, and feeds the simulation results back to the parameter matching and path planning module for iterative optimization. The module trains a differentiable simulation agent to predict surface errors, overcutting volume, and tool wear; the errors are used for reverse updating of parameters and paths.
2. The intelligent generation method for CNC programming of molds according to claim 1, characterized in that, The format of the 3D model in step S1 is either STEP or IGES.
3. The intelligent generation method for CNC programming of molds according to claim 2, characterized in that, The machining features in step S11 specifically include cavities, cores, bevels, and deep holes, and the geometric parameters specifically include curvature, depth, and roughness.
4. The intelligent generation method for CNC programming of molds according to claim 3, characterized in that, The feature extraction algorithm in step S1 specifically includes the following steps: Step 1: Patch-level semantic segmentation. Introducing the graph structure 3DTransformer to perform semantic segmentation and feature instance grouping on the mesh / point cloud, given a set of sampling points on the surface of the 3D model. , legal direction Discrete curvature Surface area As input features, construct a graph The edge weights are based on the included angle of the normal and the Euclidean neighborhood; , The classification head outputs the semantic probabilities of the facets: , Instance grouping is clustered using Laplace embeddings to minimize the discriminative loss between compactness within the same class and separation between dissimilar classes: , Total loss: ; Step 2: Learning-based determination of complex elements in deep holes; changing the hard threshold of "h / d > 5" to a learning-based determination where h is the hole depth and d is the hole diameter: , by It was determined to be a deep hole. Calibrate using the validation set.
5. The intelligent generation method for CNC programming of molds according to claim 1, characterized in that, The confidence level of the candidate parameter scheme in step S2 specifically includes the following steps: Step 1: Obtain the confidence level of candidate process rules using RotatE (Rotation Embedding Scoring). , Step 2: Using SWRL / rules as prior constraints, combine differentiable penalty terms: , Step 3: Final selection of tooling parameter scheme Depend on: 。 6. The intelligent generation method for CNC programming of molds according to claim 1, characterized in that, The constraint expectation improvement method used in step S3 of the data acquisition function specifically includes: Risk-sensitive objective function and variables: ; Regression using Gaussian process GP multi-output surrogate model And opportunity constraints are introduced to ensure that the machine tool, cutting force, and vibration boundaries satisfy the following in an overview sense: , Using constraint expectation improvement as the acquisition function: , Among them, China The upper bound of the GP confidence for each constraint is given.
7. The intelligent generation method for CNC programming of molds according to claim 1, characterized in that, Step S4, neural B-spline parameterization: the path is controlled by... Point and node vector definition: ; Control points are predicted from the geometry and reachability graph by a graph neural network: ; The joint objective loss function (processing time + curvature / jump + collision volume) is: ; in, It involves differentiable collision volume penalty, feed-curvature adaptive step size, and residual constraints. 。 8. The intelligent generation method for CNC programming of molds according to claim 1, characterized in that, The G-code generation rule in step S5 is as follows: Linear interpolation: G01 X[X] Y[Y] Z[Z] F[F] ((X,Y,Z) are the target coordinates, (F) is the feed rate); Circular interpolation: G02 X[X] Y[Y] I[I] J[J] F[F] ((I,J) is the offset optimization module for the center of the circle relative to the starting point; Circular interpolation: G02 X[X] Y[Y] I[I] J[J] F[F] ((I,J) is the offset optimization module for the center of the circle relative to the starting point; The path and parameter sequence is encoded into a constraint sequence, and then decoded using a Transformer to generate G / M instructions. ; Constraints are applied using a masking mechanism: illegal interpolation / out-of-bounds feeds are masked. The loss function incorporates a mode-switching penalty to reduce redundancy. Online compression uses piecewise dynamic programming to merge straight lines and circular arcs of the same mode, achieving a compression ratio of: .
9. The intelligent generation method for CNC programming of molds according to claim 1, characterized in that, Step S6 can be differentiable to simulate the agent and loss: ; Goals and Updates: Parameter optimization and backpropagation of path control points.