Knowledge-enhanced 3D mold modeling code generation method and system

CN122816609APending Publication Date: 2026-09-25BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611009656.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-08
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0005]本发明的目的是提供一种知识增强3D模具建模代码生成方法及系统,旨在解决或改善上述技术问题中的至少之一

Benefits of technology

本发明公开了一种知识增强3D模具建模代码生成方法及系统,所述方法包括首先采集多模态模具工程数据,并将分散在不同载体和格式中的模具知识转化为统一的中间数据表示;随后进行模具知识抽取,建立知识图谱与向量索引库;在此基础上解析用户设计需求,通过检索增强生成获取相关知识,并与设计意图共同输入大语言模型生成3D模具建模代码;同时利用知识图谱与规则约束对生成代码进行校核与优化,并通过反馈实现持续学习。本发明能够对多源模具知识进行统一管理,并通过知识检索与模型生成相结合,提高模具代码生成的准确性和自动化水平。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122816609A_ABST
    Figure CN122816609A_ABST
Patent Text Reader

Abstract

The application discloses a knowledge-enhanced 3D mold modeling code generation method and system, and relates to the technical field of intelligent manufacturing. The method comprises the following steps: firstly, collecting multi-modal mold engineering data, and converting mold knowledge scattered in different carriers and formats into unified intermediate data representation; then, performing mold knowledge extraction, establishing a knowledge graph and a vector index library; on the basis, analyzing user design requirements, obtaining related knowledge through retrieval enhancement generation, and inputting the design intent into a large language model to generate 3D mold modeling code; meanwhile, the generated code is checked and optimized by using the knowledge graph and rule constraints, and continuous learning is realized through feedback. The application can uniformly manage multi-source mold knowledge, and improve the accuracy and automation level of mold code generation by combining knowledge retrieval and model generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent manufacturing technology, and in particular to a knowledge-enhanced 3D mold modeling code generation method and system. Background Technology

[0002] Molds are an important basic equipment for realizing mass production of products. Due to the complex structure and diverse processes of molds for complex parts, a lot of 3D modeling and simulation work is required. Therefore, the construction of 3D mold models currently mainly relies on CAD / CAM software. Modeling and process codes are written through geometric APIs or scripting languages. Designers need to manually write a large number of instructions, which is labor-intensive and has a high technical threshold.

[0003] Over the long term, enterprises accumulate a large amount of engineering data, such as 2D engineering drawings, 3D models (STEP, 3DXML), process specifications, simulation reports, and historical script code. This data is typically stored in a scattered manner using PDFs, images, and CAD files, lacking unified structured management. Engineers often need to manually retrieve data and rely on past experience to make judgments in new projects, resulting in a low reuse rate of historical knowledge. In existing technologies, knowledge engineering (KE)-based mold design methods achieve partial automation through pre-coded rules and parametric templates. However, this method suffers from rigid rules and high maintenance costs, low adaptability to complex non-standard molds, and difficulty in utilizing multimodal data such as engineering drawings, 3D models, and simulation reports.

[0004] With the development of generative artificial intelligence, code generation technology based on large models is gradually being applied to CAD modeling. However, general large models lack knowledge in the fields of mold design and forming processes. Without constraints and external knowledge support, the generated modeling code is prone to semantic or parameter errors, making it difficult to meet the requirements of engineering applications. Retrieval-enhanced generation (RAG) technology can improve the accuracy of the generated results by retrieving relevant knowledge and providing it to the model before generation. However, existing RAG methods are mainly geared towards text applications and lack sufficient support for engineering graphics, 3D models, and process data. There is still a lack of systematic methods for the automatic generation of 3D modeling code for molds. Summary of the Invention

[0005] The purpose of this invention is to provide a knowledge-enhanced 3D mold modeling code generation method and system, which aims to solve or improve at least one of the above-mentioned technical problems.

[0006] To achieve the above objectives, the present invention provides the following solution: A knowledge-enhanced 3D mold modeling code generation method, comprising: Step S1: Collect multimodal mold engineering data and transform the mold knowledge scattered in different carriers and formats into a unified intermediate data representation; Step S2: Based on the unified intermediate data representation, multimodal knowledge extraction is performed according to the mold design feature classification system to construct a multimodal mold knowledge graph and a corresponding vector library; the multimodal mold knowledge graph is a multi-level knowledge graph that includes a concept layer graph, a common knowledge graph, a historical best instance graph, and a 3D code generation graph; Step S3: Parse the user's design intent, perform cross-modal retrieval enhancement in the multimodal mold knowledge graph and the vector library based on the parsing results, obtain relevant knowledge, and construct the relevant knowledge, user design intent and design constraints together as the input context of the large model, and call the large language model to generate preliminary 3D mold code; Step S4: The preliminary 3D mold code is hierarchically generated into meta-operation code and low-level execution code. Based on the multimodal mold knowledge graph and the pre-set rule engine, the generated code is automatically checked for geometric and process constraints. If a violation of constraints is detected, diagnostic adjustment suggestions are generated and sent back to the large model for closed-loop iterative optimization until the code passes the check. Step S5: Feed the incremental experience after manual review and verification back to the multimodal mold knowledge graph and vector library, and realize the continuous evolution of the system through a mechanism combining fast and slow loops.

[0007] Optionally, the specific processing procedure of step S1 includes: Multimodal mold engineering data is collected from 2D engineering drawings, 3D digital model files, process documents, simulation analysis documents, historical mold design cases and verified 3D mold modeling code, mold API manuals and geometric operation instructions; The collected data is cleaned, transformed, and normalized to form unified preprocessed data; The unified preprocessed data is subjected to parallel analysis of document layout and content extraction, OCR and geometric element alignment of 2D engineering drawings, geometric analysis of CAD / 3D digital models, named entity recognition and relationship extraction of process / simulation documents, and static analysis and syntax parsing of historical code, resulting in five types of parsing results; The five types of analysis results are merged to generate a unified intermediate data representation.

[0008] Optionally, the mold design feature classification system in step S2 includes: basic geometric features, function or performance-related features, assembly and structural features, and precision-related features; the multimodal knowledge extraction includes: joint parsing of two-dimensional engineering drawings to obtain feature association information; decomposition of three-dimensional digital model files based on boundary representation and topology analysis to obtain multiple feature entities; named entity recognition and relationship classification of process documents and simulation analysis documents; lexical analysis and syntax tree construction of historical code to extract mapping relationships; and feature alignment of different modal entities and relationships through heterogeneous contrastive learning and multimodal self-supervised learning to obtain a multimodal mold knowledge graph and a corresponding vector library.

[0009] Optionally, the specific processing procedure of step S3 includes: User design intent is parsed from multimodal input to obtain a structured task description dictionary; Based on vector similarity retrieval and knowledge graph traversal retrieval, preliminary candidate knowledge unit packages corresponding to relevant knowledge are obtained, and then the final candidate knowledge unit packages are formed through reordering and filtering. Based on the final candidate knowledge unit package, the structured task description dictionary, and design constraints, an input context containing "standardized task description, domain-specific prompts and guidance, and structured knowledge retrieval" is constructed. A large language model adjusted by the mold professional corpus is then called to generate preliminary 3D mold code.

[0010] Optionally, the hierarchical generation in step S4 specifically includes: first guiding the large model to generate abstract meta-operation code corresponding to geometric features and process steps; then, through the underlying translation engine, mapping the abstract meta-operation code line by line into executable underlying scripts or macro command sequences according to the application programming interface specifications of the target CAD / CAM or simulation system; the automatic verification includes geometric topology verification and process rationality assessment; wherein the geometric topology verification is used to detect interference of component features, insufficient material thickness, excessively small transition fillet radius, and excessive fit clearance; the process rationality assessment is used to determine whether the drawbead resistance parameters and blank holder force exceed the rated range of the equipment; the closed-loop iterative optimization is used to send diagnostic adjustment suggestions back to the large model, combine the initial task input and the defective code to form a new error correction context, and trigger secondary or multiple iterative generation.

[0011] Optionally, the specific processing procedure of step S5 includes: After the incremental experience, which has been manually reviewed and verified, is fed back into the multimodal mold knowledge graph and vector library, the initial automatically generated code and the final confirmed code are parsed into an abstract syntax tree. The tree comparison algorithm is used to extract parameter changes and operational logic. The difference results, process background, adjustment motivation and compliance simulation report are transformed into standard knowledge elements and written into the instance nodes of the knowledge graph. At the same time, the applicable conditions and safety parameter windows of the corresponding code templates in the 3D code generation graph are updated. The fast loop is used to update the embedding representation in the vector library in real time, and the slow loop is used to periodically collect paired data and perform incremental training or low-rank adaptive adjustment.

[0012] Optionally, it also includes: Step S6: Establishing a multi-agent collaborative architecture; the multi-agent collaborative architecture includes at least a user interaction agent, a task deconstruction agent, a knowledge retrieval agent, a code generation agent, and a verification and optimization agent, and each agent exchanges data through a shared blackboard communication bus; The system comprises the following components: a user interaction agent that receives multimodal user input, identifies potential design intents through interactive guidance, and completes parameter standardization review and global task decomposition and prediction; a task deconstruction agent that breaks down design instructions into directed acyclic graph subtasks with dependencies based on the three-dimensional structural logic and multi-station process flow in the knowledge graph; a knowledge retrieval agent that calls the retrieval enhancement generation module to cross-search in the vector library and knowledge graph for each subtask; a code generation agent that generates code for the corresponding subtask based on a large language model; and a verification and optimization agent that calls geometric interference checking tools and process rule constraintors in a sandbox environment for pre-compilation and automatic verification, and returns repair and diagnostic prompts to the code generation agent, achieving multi-round closed-loop iterative optimization and high-concurrency parallel processing for subtasks without dependencies.

[0013] This invention also provides a knowledge-enhanced 3D mold modeling code generation system, comprising: The multimodal engineering data processing module is used to collect multimodal mold engineering data and transform mold knowledge scattered in different carriers and formats into a unified intermediate data representation. The knowledge graph and vector construction module is used to extract multimodal knowledge based on the unified intermediate data representation and the mold design feature classification system, and to construct a multimodal mold knowledge graph and a corresponding vector library; the multimodal mold knowledge graph is a multi-level knowledge graph that includes a concept layer graph, a common knowledge graph, a historical best instance graph, and a 3D code generation graph; The retrieval enhancement and generation task modeling module is used to parse the user's design intent, perform cross-modal retrieval enhancement in the multimodal mold knowledge graph and the vector library based on the parsing results, obtain relevant knowledge, and construct the input context of the large model together with the relevant knowledge, user design intent and design constraints, and call the large language model to generate preliminary 3D mold code; The 3D code generation and auxiliary verification module is used to generate the preliminary 3D mold code into meta-operation code and low-level execution code in a hierarchical manner. Based on the multimodal mold knowledge graph and the pre-set rule engine, the generated code is automatically verified for geometric and process constraints. If a violation of constraints is detected, diagnostic adjustment suggestions are generated and sent back to the large model for closed-loop iterative optimization until the code passes the verification. The knowledge feedback and evolution module is used to feed incremental experience, which has been manually reviewed and verified, back to the multimodal mold knowledge graph and vector library, and realize the continuous evolution of the system through a mechanism that combines fast and slow loops.

[0014] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects: This invention discloses a knowledge-enhanced 3D mold modeling code generation method and system. The method includes: firstly, collecting multimodal mold engineering data and transforming mold knowledge scattered across different carriers and formats into a unified intermediate data representation; subsequently, extracting mold knowledge and establishing a knowledge graph and vector index library; based on this, analyzing user design requirements, acquiring relevant knowledge through retrieval and enhancement generation, and inputting this knowledge along with the design intent into a large language model to generate 3D mold modeling code; simultaneously, using the knowledge graph and rule constraints to verify and optimize the generated code, and achieving continuous learning through feedback. This invention enables unified management of multi-source mold knowledge and improves the accuracy and automation level of mold code generation by combining knowledge retrieval and model generation. Attached Figure Description

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

[0016] Figure 1 This is the overall flowchart of the 3D mold code generation method in this embodiment; Figure 2 This is a flowchart of the multimodal mold engineering data acquisition and preprocessing process in this embodiment; Figure 3 This is a schematic diagram of the joint architecture of the multi-level mold knowledge graph and vector library in this embodiment; Figure 4 This is a schematic diagram of the four-layer core execution architecture for 3D mold code generation in this embodiment. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] The purpose of this invention is to provide a knowledge-enhanced 3D mold modeling code generation method and system, which aims to solve or improve at least one of the above-mentioned technical problems.

[0019] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] As a first aspect, such as Figure 1 As shown, this invention provides a knowledge-enhanced 3D mold modeling code generation method. This invention performs automated knowledge extraction and structured representation of multimodal data in the mold field, thereby establishing a multi-level mold knowledge graph and vector index. Based on this, the RAG framework is used to accurately retrieve and combine professional knowledge, and the retrieval results, along with user design requirements, are input into a domain-fine-tuned large language model to generate 3D mold code that meets the requirements of enterprise geometric APIs and process simulation environments. Simultaneously, the knowledge graph and rule engine are combined to complete automatic verification and iterative optimization, achieving a closed-loop process of "mold features → intelligent parsing → code generation → knowledge feedback".

[0021] The specific steps include: Step S1: Collect multimodal mold engineering data and transform the mold knowledge scattered in different carriers and formats into a unified intermediate data representation.

[0022] As one specific implementation method, the specific processing procedure of step S1 includes: Multimodal mold engineering data is collected from 2D engineering drawings, 3D digital model files, process documents, simulation analysis documents, historical mold design cases and verified 3D mold modeling code, mold API manuals and geometric operation instructions; The collected data is cleaned, transformed, and normalized to form unified preprocessed data; The unified preprocessed data is subjected to parallel analysis of document layout and content extraction, OCR and geometric element alignment of 2D engineering drawings, geometric analysis of CAD / 3D digital models, named entity recognition and relationship extraction of process / simulation documents, and static analysis and syntax parsing of historical code, resulting in five types of parsing results; The five types of analysis results are merged to generate a unified intermediate data representation.

[0023] Step S2: Based on the unified intermediate data representation, multimodal knowledge is extracted according to the mold design feature classification system to construct a multimodal mold knowledge graph and a corresponding vector library; the multimodal mold knowledge graph is a multi-level knowledge graph that includes a concept layer graph, a common knowledge graph, a historical best instance graph, and a 3D code generation graph.

[0024] As a specific implementation method, the mold design feature classification system in step S2 includes: basic geometric features, function or performance-related features, assembly and structural features, and precision-related features; the multimodal knowledge extraction includes: joint parsing of two-dimensional engineering drawings to obtain feature association information; decomposition of three-dimensional digital model files based on boundary representation and topology analysis to obtain multiple feature entities; named entity recognition and relationship classification of process documents and simulation analysis documents; lexical analysis and syntax tree construction of historical code to extract mapping relationships; and feature alignment of different modal entities and relationships through heterogeneous contrastive learning and multimodal self-supervised learning to obtain a multimodal mold knowledge graph and a corresponding vector library.

[0025] Step S3: Parse the user's design intent, perform cross-modal retrieval enhancement in the multimodal mold knowledge graph and the vector library based on the parsing results, obtain relevant knowledge, and construct the relevant knowledge, user design intent and design constraints together as the input context of the large model, and call the large language model to generate preliminary 3D mold code.

[0026] As a specific implementation method, the specific processing procedure of step S3 includes: User design intent is parsed from multimodal input to obtain a structured task description dictionary; Based on vector similarity retrieval and knowledge graph traversal retrieval, preliminary candidate knowledge unit packages corresponding to relevant knowledge are obtained, and then the final candidate knowledge unit packages are formed through reordering and filtering. Based on the final candidate knowledge unit package, the structured task description dictionary, and design constraints, an input context containing "standardized task description, domain-specific prompts and guidance, and structured knowledge retrieval" is constructed. A large language model adjusted by the mold professional corpus is then called to generate preliminary 3D mold code.

[0027] Step S4: The preliminary 3D mold code is hierarchically generated into meta-operation code and low-level execution code. Based on the multimodal mold knowledge graph and the pre-set rule engine, the generated code is automatically checked for geometric and process constraints. If a constraint violation is detected, diagnostic adjustment suggestions are generated and sent back to the large model for closed-loop iterative optimization until the code passes the check.

[0028] As a specific implementation method, the hierarchical generation in step S4 specifically includes: first, guiding the large model to generate abstract meta-operation code corresponding to geometric features and process steps; then, through the underlying translation engine, mapping the abstract meta-operation code line by line into executable underlying scripts or macro command sequences according to the application programming interface specifications of the target CAD / CAM or simulation system; the automatic verification includes geometric topology verification and process rationality assessment; wherein the geometric topology verification is used to detect interference of component features, insufficient material thickness, excessively small transition fillet radius, and excessive fit clearance; the process rationality assessment is used to determine whether the drawbead resistance parameters and blank holder force exceed the rated range of the equipment; the closed-loop iterative optimization is used to send diagnostic adjustment suggestions back to the large model, combine the initial task input and the defective code to form a new error correction context, and trigger secondary or multiple iterative generation.

[0029] Step S5: Feed the incremental experience after manual review and verification back to the multimodal mold knowledge graph and vector library, and realize the continuous evolution of the system through a mechanism combining fast and slow loops.

[0030] As a specific implementation method, the specific processing procedure of step S5 includes: After the incremental experience, which has been manually reviewed and verified, is fed back into the multimodal mold knowledge graph and vector library, the initial automatically generated code and the final confirmed code are parsed into an abstract syntax tree. The tree comparison algorithm is used to extract parameter changes and operational logic. The difference results, process background, adjustment motivation and compliance simulation report are transformed into standard knowledge elements and written into the instance nodes of the knowledge graph. At the same time, the applicable conditions and safety parameter windows of the corresponding code templates in the 3D code generation graph are updated. The fast loop is used to update the embedding representation in the vector library in real time, and the slow loop is used to periodically collect paired data and perform incremental training or low-rank adaptive adjustment.

[0031] In addition, as a specific implementation method, this method also includes: Step S6: Establishing a multi-agent collaborative architecture; the multi-agent collaborative architecture includes at least a user interaction agent, a task deconstruction agent, a knowledge retrieval agent, a code generation agent, and a verification and optimization agent, and each agent exchanges data through a shared blackboard communication bus.

[0032] The system comprises the following components: a user interaction agent that receives multimodal user input, identifies potential design intents through interactive guidance, and completes parameter standardization review and global task decomposition and prediction; a task deconstruction agent that breaks down design instructions into directed acyclic graph subtasks with dependencies based on the three-dimensional structural logic and multi-station process flow in the knowledge graph; a knowledge retrieval agent that calls the retrieval enhancement generation module to cross-search in the vector library and knowledge graph for each subtask; a code generation agent that generates code for the corresponding subtask based on a large language model; and a verification and optimization agent that calls geometric interference checking tools and process rule constraintors in a sandbox environment for pre-compilation and automatic verification, and returns repair and diagnostic prompts to the code generation agent, achieving multi-round closed-loop iterative optimization and high-concurrency parallel processing for subtasks without dependencies.

[0033] Based on the above technical solution, the following is provided: Figures 2-4 The example shown.

[0034] In step S1, as Figure 2 As shown, the process of data acquisition and preprocessing for multimodal mold engineering is described. The process of data acquisition and preprocessing for multimodal mold engineering starts from the start and specifically covers core steps such as multi-source heterogeneous data acquisition, data preprocessing and format normalization, and parallel multimodal parsing.

[0035] In the multi-source heterogeneous data acquisition phase, the system collects various types of heterogeneous data related to mold design from the enterprise's existing information systems and design processes. This data specifically includes, but is not limited to: Two-dimensional engineering drawings of mechanical parts and molds, including 2D vector graphics exported from CAD, converted or cropped engineering bitmaps, and images embedded in documents; Three-dimensional digital model files of molds and parts, such as 3DXML, STEP, IGES, enterprise-customized formats, etc., can reflect the complete geometry and topology of the parts; Process documents and technical standards specifically cover process specifications, processing routes, stamping / injection molding process parameter tables, enterprise standards, and national or industry standards, such as dimensional and geometric tolerance specifications, etc. Simulation analysis related documents, including important data such as forming simulation result reports, mesh models, stress and strain field distribution diagrams, and springback analysis reports; Historical mold design case studies and verified, usable 3D mold modeling code, process script code, and associated design specifications; The mold API manual and geometric operation instructions mainly cover the interfaces related to geometric entities, feature operations, coordinate transformations, and Boolean operations in CAD / CAM systems.

[0036] Once data from the aforementioned multiple sources is acquired, the system will begin data preprocessing and format standardization. It will perform cleaning, transformation, and normalization operations on different types of data to form unified preprocessed data, thus laying the foundation for subsequent multimodal analysis.

[0037] Based on normalized data, the system performs parallel multimodal analysis processing on five types of data: Document layout analysis and content extraction: Recognize the layout of PDFs, office documents, etc., extract the core information, and store the text, tables, and images in a structured manner according to pages and logical paragraphs; OCR Alignment of 2D Engineering Drawings with Geometric Elements: High-precision optical character recognition is performed on the bitmap of 2D engineering drawings to identify dimensions, symbols, text descriptions, surface roughness, geometric tolerances, etc. Then, combined with the extracted geometric lines, the correspondence between geometric elements in the drawing is established. CAD / 3D Digital Model Geometry Analysis: This function analyzes the geometric structure and feature information of CAD engineering files and 3D digital models, extracts the boundary representation B-rep and topological structure of parts, that is, the adjacency relationship between faces, edges and vertices, and extracts feature types such as holes, bosses, ribs, grooves, chamfers, and fillets, as well as feature parameters such as size, position and direction. Named Entity Recognition (NER) and Relationship Extraction for Process / Simulation Documents: Perform named entity recognition on simulation reports and process documents to obtain semantic information such as material grade, sheet thickness, forming equipment, mold steps, process window, parameter range, and failure mode, and extract the business relationships between each entity; Historical code static analysis and syntax parsing: Static analysis and syntax parsing are performed on historical mold design-related code files to identify geometric API calling methods, parameter passing patterns, control flow structures, and their correspondence with specific parts and steps.

[0038] Through the parallel parsing described above, the system will further integrate these five types of results to generate a unified intermediate data representation, aligning the data of different modalities in terms of format and semantics. Subsequently, the unified intermediate data will be output to the knowledge graph and vector library construction module, thus completing the entire collection and preprocessing process and providing support for subsequent knowledge modeling and retrieval (i.e., step S2).

[0039] In step S2, the specific process of establishing the multimodal mold knowledge graph and vector library mainly includes the establishment of a mold design feature classification system, multimodal knowledge extraction and heterogeneous knowledge modeling, and the joint construction of the knowledge graph and vector library, such as... Figure 3 The diagram shows the joint architecture and data flow of the multi-level mold knowledge graph and vector library.

[0040] Based on the analysis of typical mold design processes and engineering drawing representation habits, a multi-dimensional feature classification system for mold design is established, such as... Figure 3 As shown, this system includes the following aspects: First, basic geometric features, used to describe the basic morphological parameters of parts and molds, covering outer contours and boundaries, datum planes and datum axes, solid geometries such as blocks and shells, and the relationship between solids and projections; Second, functional or performance-related features, used to reflect the influence of structure on forming function and mechanical properties, such as round holes, oblong holes, threaded holes, bosses, flanges, stiffeners, reinforcing rib grooves, venting grooves, and drawing ribs; Third, assembly and structural features, used to reflect the assembly relationships and connection methods between mold parts, including features such as guide pillars and guide sleeves, locating pins, fastener holes, parting surfaces, stripper plates, and blank holders, as well as their assembly constraints; Fourth, precision-related features, established based on the quality constraints such as dimensional tolerances, geometric tolerances, and surface roughness specified in national and industry standards, and can be extended to the precision control specifications within enterprises. The above feature classification system serves as the basic schema for mold knowledge graphs and vector representations, used to unify the semantic tags of geometric and process features from different data sources.

[0041] Guided by this feature classification model, multimodal feature extraction is employed for multimodal knowledge extraction and heterogeneous knowledge modeling. The specific process is as follows: For 2D engineering drawings, OCR is combined with a geometric understanding model to jointly analyze primitives such as lines, arcs, and symbols, as well as dimension annotations and text descriptions. This identifies the geometric dimensions, positional relationships, and correlations with process requirements of various features. For 3D digital models, based on B-rep and topology analysis algorithms, the model is decomposed into multiple feature entities, extracting their shape types, parameter information, and adjacency relationships. Assembly information is then combined to identify assembly features between parts. For process documents and simulation reports, a small-sample NER model and a relationship classification model are used to identify process entities such as steps, forming equipment, lubrication conditions, mold temperature, and blank holder force, as well as their causal relationships, constraint relationships, and applicable conditions. For historical code, lexical analysis and syntax tree construction are used to extract the mapping relationships between code fragments and geometric features and process entities, such as the drawing bead modeling operation corresponding to a certain code segment or the mesh generation script corresponding to a specific step. Furthermore, it can employ strategies such as heterogeneous contrastive learning and multimodal self-supervised learning to perform feature alignment and similarity modeling for entities and relationships from different modalities, thereby establishing a consistent semantic space across modalities.

[0042] Based on the above extraction results, the system further jointly establishes a knowledge graph and a vector library to form a multi-level mold knowledge graph, specifically: The first is a concept-level graph, used for conceptual modeling of mold-related terms, part types, feature types, and processes, unifying terminology differences under different standards, and forming a domain ontology. The second is a commonality knowledge graph, which abstracts common mold structures and process rules; examples include the structural combinations and parameter ranges of typical drawing dies, punching dies, and bending dies. The third is a historical best-in-class instance graph, which uses historically successful mold projects as nodes, linking part features, process routes, simulation results, and final code to achieve instance-level knowledge reuse. The fourth is a 3D code generation graph, which uses geometric APIs, script interfaces, and code snippets as core nodes, establishing associations between these nodes and corresponding geometric features, process conditions, and simulation conclusions, providing searchable templates and references for code generation. In addition, using a text encoder and a graph structure encoder, the above multimodal nodes and edges are mapped into vector representations to establish a mold-related vector library. By using modal alignment technology to maintain the ternary correspondence of "graph entity - vector representation - original document / code", the retrieval module can perform similarity retrieval in the vector space and perform structure-based reasoning and expansion in the graph.

[0043] In step S3, modeling in conjunction with RAG's 3D mold code generation task is a crucial step in realizing the conversion of natural language into machine-executable code, specifically including the following steps: Step S3.1 Multi-dimensional Task Input and Intelligent Intent Parsing: In engineering application scenarios, the input sources for 3D mold code generation tasks are quite diverse. They can typically be a combination of one or more complex pieces of information, such as the original part product model, or a simplified description after preliminary feature recognition, including imported 3D digital model files and their parsed key geometric envelope parameters; they can also be the enterprise's expected target process and specified mold classification type, such as drawing dies, punching dies, compound dies, multi-station progressive dies, etc.; they can also be strict design constraints and physical process boundary conditions, such as stamping material grades, allowable thickness fluctuation ranges, allowable forming limit coefficients, rated tonnage of workshop equipment, and selected standard mold base specifications; in addition, they include design intent descriptions and local special requirements given by the user through natural language. The system uses a professional user interaction intelligent agent to perform semantic intent recognition and engineering parameter standardization alignment on all multi-modal inputs, converting the relatively loose natural language into a structured task description dictionary with fixed fields, thereby accurately determining the type of code to be generated, such as geometric modeling code, mesh generation script, or load boundary condition script, as well as the corresponding target system environment. Figure 4As shown in the first layer of the input task area, the input received by the system can be intuitively represented as natural language instructions and existing template code fragments.

[0044] Step S3.2 Cross-modal RAG joint retrieval and filtering: For example, in Figure 4 The second layer of the RAG retrieval results area shows that after obtaining the structured task description, the core RAG retrieval module immediately initiates a parallel retrieval mechanism. On one hand, based on the extracted part features and process conditions, the system calls the embedded model to establish a retrieval query vector, and then performs a similarity search in a large-scale mold domain vector library to obtain highly relevant design rules, historical successful cases, and code template fragments. On the other hand, the system uses part type and general mold structure logic as a starting point to perform graph traversal or subgraph isomorphic matching in the knowledge graph, thereby mining instance nodes and rule nodes that have high logical similarity to the current task in terms of spatial structure, stamping process, and precision requirements. Next, based on the comprehensive importance score and diversity index of each retrieval result, re-sorting and filtering operations are performed to form a refined candidate knowledge unit package. Each unit includes original document fragments, local relational subgraphs of the knowledge graph, relevant code fragments, and their context engineering descriptions. Regarding the expert-level context construction and large model call in step S3.3, such as Figure 4 The third-layer generation and verification area displays a large model context construction module that integrates selected candidate knowledge units with standardized task descriptions to construct an input context that fits the processing logic of the large model. The system employs a combination of "standardized task description + domain-specific Prompt guidance + structured knowledge retrieval" to initiate a generation request to the large language model, fine-tuned from a mold-specific corpus. The feature-specific Prompt here primarily functions as an instruction alignment tool, clarifying the correspondence between specific engineering features and low-level code generation rules. For example, it defines which geometric operation API should be called for a certain type of drawn bead feature, or the physical meaning of parameters corresponding to specific process conditions in the simulation pre-processing script. Externally retrieved knowledge is input in a structured form, such as a list of decision rules, algorithm pseudocode, key parameter safety thresholds, and summaries of graph logical relationships, serving as external knowledge support for complex code generation. Based on the integrated current task objective and retrieved knowledge, the large language model performs boundary constraint reasoning to generate syntactically rigorous preliminary 3D mold code that conforms to engineering specifications.

[0045] In step S4, the implementation process of 3D mold code generation and knowledge graph-assisted verification is a key step in ensuring the robustness of industrial-grade code, and specifically includes the following steps: Step S4.1 Hierarchical Generation of Abstract Meta-Operation Code and Low-Level Execution Code: To address cross-software platform compatibility issues, a two-level generation mechanism of "abstract meta-operation code—target system execution code" is preferred during the code synthesis phase. For example... Figure 4 As shown in the process nodes of the third-layer generation and verification area, the system first guides the large model to generate meta-operation codes corresponding one-to-one with specific geometric features and macro-process steps. This type of code has a high degree of abstraction and is more inclined towards business logic expression. For example, it outputs intermediate-layer pseudo-code instructions such as "Construct a drawbead array with a specific cross-section on the specified parting surface A according to the reference line, with cross-sectional parameters as..." or "Arrange unloading holes in the punching area, with a given spacing as...". Based on this, the underlying translation engine then maps the abstract meta-operation code line by line into specific executable scripts or macro command sequences according to the API specifications of the target CAD / CAM system or simulation system specified by the user, and automatically completes the function names, parameter order, and necessary default values. Finally, it generates low-level code that can be directly copied into the target software and correctly compiled and executed. In this way, the reasoning focus of the large language model can be raised to a higher level of abstraction, reducing the interference caused by differences in the syntax of the underlying software, and also reducing the system migration problems caused by binding to specific version APIs. At the same time, it is also convenient to continuously maintain a stable ternary mapping relationship of "business features - abstract operations - underlying API calls" in the knowledge graph engine, enhancing the system's scalability.

[0046] Step S4.2 Automated Geometric and Technological Verification of Graph Reasoning: To reduce potential manufacturing risks in the code, an automated error prevention mechanism is designed for newly generated code, relying on the underlying knowledge graph and pre-built rule engine for multi-level verification. The verification process begins with the geometric topology, using the geometric spatial relationship graph to perform virtual reasoning on the 3D features to be established by the lower-level code. This automatically detects issues such as interference and collision of local component features, insufficient material thickness in stress areas, excessively small transition fillet radii, and single-sided clearance between the forming punch and die not meeting tolerance standards. After the geometric verification is passed, the process rationality assessment stage begins. Based on the process planning rules accumulated in the graph and historical simulation results, the system conducts an industrial manufacturing safety assessment on the design of the forming surface spatial shape, the arrangement of the drawbead cross-section and trajectory, and the division scheme of complex mold steps. For example, it determines whether the currently set drawbead resistance parameters will cause excessive stretching and breakage during subsequent forming, or assesses whether the total pressure force set by the program exceeds the rated load-bearing capacity of the workshop equipment. Once a violation of constraints is detected, the built-in diagnostic module will reverse-search the knowledge graph for the corresponding adjustment rules and similar amendment examples, and output structured diagnostic adjustment suggestions, clearly indicating the parameter names that need to be modified, the suggested adjustment direction, and the verified reasonable reference range.

[0047] Step S4.3 Closed-loop iterative optimization based on diagnostic feedback: To achieve automatic error correction, the system transforms the above-mentioned structured adjustment suggestions into a standardized data stream and directly feeds it back to the large language model. This suggestion, with clear error correction guidance, is combined with the initial task input prompts and preliminary code results with local defects to form a new set of error correction context input instructions. By triggering this targeted secondary or multiple iterative generation mechanism, the system continuously guides the large model to perform local logic correction and low-level parameter optimization on the erroneous code until the code output in the new round meets and passes all preset geometric anti-interference and manufacturing condition tests. Only 3D mold execution code that has truly passed the full-stack system-level verification will be delivered to the front-end user as a high-confidence, high-engineering-availability final result.

[0048] In step S5, the system performs knowledge feedback and self-evolutionary learning, specifically including more refined low-level code comparison and a dual-loop model iteration mechanism. In actual engineering projects, although the large model can complete most of the basic establishment work, designers often still need to manually review the initially automatically generated 3D mold code, or fine-tune boundary conditions, or implement local reconstruction. The code after engineer intervention must undergo CAE forming simulation verification and final physical mold trial verification before it can form a standard mold solution that can be mass-produced. Based on this, an automated implicit knowledge mining process is established to achieve knowledge feedback. Among them, the system internally sets up a high-precision code difference analysis module, which simultaneously parses the "initial automatically generated code" and "final confirmed code" into an abstract syntax tree (AST). Using a tree comparison algorithm, it determines the operation logic of parameter changes, additions, and deletions, and then extracts the implicit process logic behind the engineer's adjustments, such as the extra clearance allowance added for specific high-strength steel materials. On the other hand, the system transforms the extracted discrepancy results, process background, adjustment motivations, and finally achieved simulation reports into standard knowledge elements, writes them into instance nodes in the knowledge graph, and synchronously updates the applicable conditions and safety parameter windows of the corresponding code templates in the 3D code generation graph using graph inference algorithms. Regarding system evolution, a combination of fast and slow loops is used: the fast loop updates the text and code embedding representations in the vector library in real time, and takes effect immediately through the RAG module, allowing subsequent tasks to promptly cover the latest successful cases and adjustment experiences. The slow loop is mainly used to continuously collect anonymized "initial requirements—final high-quality code" paired data, and uses newly added data for small-batch incremental training at certain intervals, or employs fine-tuning methods such as low-rank adaptive LoRA, so that the large model can gradually learn and absorb the enterprise's unique non-standard design styles and optimization preferences while maintaining its original general generation capabilities and preventing catastrophic forgetting. Through the aforementioned multi-dimensional closed-loop mechanism, this invention opens up the data flywheel, enabling mold knowledge to gradually transform from static experience documents into dynamic and evolvable knowledge assets, and continuously improving the first-pass yield, accuracy, and comprehensive adaptability of 3D mold code generation during long-term use.

[0049] Step S6 also includes distributed scheduling and refined execution logic for ultra-large-scale mold digital models: When facing high-end automotive molds or precision electronic molds with complex structures and a large number of geometric surfaces, the inference window of a single large model will be limited; therefore, the method of the present invention can be implemented by a multi-agent collaborative system built on a shared blackboard communication bus, in which each agent exchanges data through a standard interface and is responsible for different processing links. First, the user interaction agent, acting as the front-end interaction entry point, is responsible for receiving multimodal user input, identifying potential design intentions through interactive guidance, and completing parameter standardization review and global task decomposition and prediction. Second, the task deconstruction agent, based on the mold's 3D structural logic and multi-station process flow in the graph, breaks down the macroscopically complex design instructions into multiple dependent directed acyclic graph (DAG) subtasks, such as sequential decomposition into independent execution processes like parting surface design, drawbead parametric modeling, punching layout, and process step division. Third, the knowledge retrieval agent, for each active subtask, calls the RAG module to cross-search the multimodal vector library and knowledge graph for design specifications and historical code templates with high matching degree to the current features. Fourth, the code generation agent receives the fused context, generates the meta-operation code for the corresponding subtask based on the large language model, and further maps it to the specific underlying interface code of the target CAD software. Fifth, the verification and optimization agent, in the sandbox environment, calls external geometric interference checking tools and process rule constraintors to pre-compile and automatically verify each generated code segment. If a rule conflict is detected, the system will automatically block erroneous output and return detailed repair and diagnostic prompts to the generating agent. The two agents will collaborate to complete multiple rounds of closed-loop iterative optimization until the generated result passes verification. The introduction of the multi-agent collaborative architecture not only reduces the tight coupling at the system code level, facilitating independent expansion, upgrades, and maintenance of each technical module, but also enables the system to perform high-concurrency parallel processing on multiple sub-modules that do not have dependencies in the task topology graph, supported by a cloud-based distributed computing cluster. This breaks through the computational bottleneck and further improves the overall efficiency and stability of the entire 3D mold code generation system.

[0050] Through the above implementation methods, the present invention can significantly improve the automation and intelligence level of 3D mold code generation. Relying on knowledge graphs and geometric and process rule engines, it ensures that the generated code has good engineering usability. At the same time, with the help of the hierarchical generation mechanism that separates meta-operations from the underlying system, the system also has strong versatility and scalability.

[0051] As a second aspect, the present invention also provides a knowledge-enhanced 3D mold modeling code generation system, comprising: The multimodal engineering data processing module is used to collect multimodal mold engineering data and transform mold knowledge scattered in different carriers and formats into a unified intermediate data representation. The knowledge graph and vector construction module is used to extract multimodal knowledge based on the unified intermediate data representation and the mold design feature classification system, and to construct a multimodal mold knowledge graph and a corresponding vector library; the multimodal mold knowledge graph is a multi-level knowledge graph that includes a concept layer graph, a common knowledge graph, a historical best instance graph, and a 3D code generation graph; The retrieval enhancement and generation task modeling module is used to parse the user's design intent, perform cross-modal retrieval enhancement in the multimodal mold knowledge graph and the vector library based on the parsing results, obtain relevant knowledge, and construct the input context of the large model together with the relevant knowledge, user design intent and design constraints, and call the large language model to generate preliminary 3D mold code; The 3D code generation and auxiliary verification module is used to generate the preliminary 3D mold code into meta-operation code and low-level execution code in a hierarchical manner. Based on the multimodal mold knowledge graph and the pre-set rule engine, the generated code is automatically verified for geometric and process constraints. If a violation of constraints is detected, diagnostic adjustment suggestions are generated and sent back to the large model for closed-loop iterative optimization until the code passes the verification. The knowledge feedback and evolution module is used to feed incremental experience, which has been manually reviewed and verified, back to the multimodal mold knowledge graph and vector library, and realize the continuous evolution of the system through a mechanism that combines fast and slow loops.

[0052] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0053] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A knowledge-enhanced 3D mold modeling code generation method, characterized in that, include: Step S1: Collect multimodal mold engineering data and transform the mold knowledge scattered in different carriers and formats into a unified intermediate data representation; Step S2: Based on the unified intermediate data representation, multimodal knowledge extraction is performed according to the mold design feature classification system to construct a multimodal mold knowledge graph and a corresponding vector library; the multimodal mold knowledge graph is a multi-level knowledge graph that includes a concept layer graph, a common knowledge graph, a historical best instance graph, and a 3D code generation graph; Step S3: Parse the user's design intent, perform cross-modal retrieval enhancement in the multimodal mold knowledge graph and the vector library based on the parsing results, obtain relevant knowledge, and construct the relevant knowledge, user design intent and design constraints together as the input context of the large model, and call the large language model to generate preliminary 3D mold code; Step S4: The preliminary 3D mold code is hierarchically generated into meta-operation code and low-level execution code. Based on the multimodal mold knowledge graph and the pre-set rule engine, the generated code is automatically checked for geometric and process constraints. If a violation of constraints is detected, diagnostic adjustment suggestions are generated and sent back to the large model for closed-loop iterative optimization until the code passes the check. Step S5: Feed the incremental experience after manual review and verification back to the multimodal mold knowledge graph and vector library, and realize the continuous evolution of the system through a mechanism combining fast and slow loops.

2. The knowledge-enhanced 3D mold modeling code generation method according to claim 1, characterized in that, The specific processing procedure of step S1 includes: Multimodal mold engineering data is collected from 2D engineering drawings, 3D digital model files, process documents, simulation analysis documents, historical mold design cases and verified 3D mold modeling code, mold API manuals and geometric operation instructions; The collected data is cleaned, transformed, and normalized to form unified preprocessed data; The unified preprocessed data is subjected to parallel analysis of document layout and content extraction, OCR and geometric element alignment of 2D engineering drawings, geometric analysis of CAD / 3D digital models, named entity recognition and relationship extraction of process / simulation documents, and static analysis and syntax parsing of historical code, resulting in five types of parsing results; The five types of analysis results are merged to generate a unified intermediate data representation.

3. The knowledge-enhanced 3D mold modeling code generation method according to claim 2, characterized in that, The mold design feature classification system in step S2 includes: basic geometric features, function or performance-related features, assembly and structural features, and precision-related features; the multimodal knowledge extraction includes: joint parsing of two-dimensional engineering drawings to obtain feature association information; decomposition of three-dimensional digital model files based on boundary representation and topology analysis to obtain multiple feature entities; named entity recognition and relationship classification of process documents and simulation analysis documents; lexical analysis and syntax tree construction of historical code to extract mapping relationships; and feature alignment of different modal entities and relationships through heterogeneous contrastive learning and multimodal self-supervised learning to obtain a multimodal mold knowledge graph and corresponding vector library.

4. The knowledge-enhanced 3D mold modeling code generation method according to claim 1, characterized in that, The specific processing procedure of step S3 includes: User design intent is parsed from multimodal input to obtain a structured task description dictionary; Based on vector similarity retrieval and knowledge graph traversal retrieval, preliminary candidate knowledge unit packages corresponding to relevant knowledge are obtained, and then the final candidate knowledge unit packages are formed through reordering and filtering. Based on the final candidate knowledge unit package, the structured task description dictionary, and design constraints, an input context containing "standardized task description, domain-specific prompts and guidance, and structured knowledge retrieval" is constructed. A large language model adjusted by the mold professional corpus is then called to generate preliminary 3D mold code.

5. The knowledge-enhanced 3D mold modeling code generation method according to claim 1, characterized in that, The hierarchical generation in step S4 specifically includes: first, guiding the large model to generate abstract meta-operation code corresponding to geometric features and process steps; then, through the underlying translation engine, mapping the abstract meta-operation code line by line into executable underlying scripts or macro command sequences according to the application programming interface specifications of the target CAD / CAM or simulation system; the automatic verification includes geometric topology verification and process rationality assessment; wherein the geometric topology verification is used to detect interference of component features, insufficient material thickness, excessively small transition fillet radius, and excessive fit clearance; the process rationality assessment is used to determine whether the drawbead resistance parameters and blank holder force exceed the rated range of the equipment; the closed-loop iterative optimization is used to send diagnostic adjustment suggestions back to the large model, combining the initial task input and the defective code to form a new error correction context, triggering secondary or multiple iterative generation.

6. The knowledge-enhanced 3D mold modeling code generation method according to claim 1, characterized in that, The specific processing procedure of step S5 includes: After the incremental experience, which has been manually reviewed and verified, is fed back into the multimodal mold knowledge graph and vector library, the initial automatically generated code and the final confirmed code are parsed into an abstract syntax tree. The tree comparison algorithm is used to extract parameter changes and operational logic. The difference results, process background, adjustment motivation and compliance simulation report are transformed into standard knowledge elements and written into the instance nodes of the knowledge graph. At the same time, the applicable conditions and safety parameter windows of the corresponding code templates in the 3D code generation graph are updated. The fast loop is used to update the embedding representation in the vector library in real time, and the slow loop is used to periodically collect paired data and perform incremental training or low-rank adaptive adjustment.

7. The knowledge-enhanced 3D mold modeling code generation method according to claim 1, characterized in that, It also includes: Step S6: Establish a multi-agent collaborative architecture; the multi-agent collaborative architecture includes at least a user interaction agent, a task deconstruction agent, a knowledge retrieval agent, a code generation agent, and a verification and optimization agent, and each agent exchanges data through a shared blackboard communication bus; The system comprises the following components: a user interaction agent that receives multimodal user input, identifies potential design intents through interactive guidance, and completes parameter standardization review and global task decomposition and prediction; a task deconstruction agent that breaks down design instructions into directed acyclic graph subtasks with dependencies based on the three-dimensional structural logic and multi-station process flow in the knowledge graph; a knowledge retrieval agent that calls the retrieval enhancement generation module to cross-search in the vector library and knowledge graph for each subtask; a code generation agent that generates code for the corresponding subtask based on a large language model; and a verification and optimization agent that calls geometric interference checking tools and process rule constraintors in a sandbox environment for pre-compilation and automatic verification, and returns repair and diagnostic prompts to the code generation agent, achieving multi-round closed-loop iterative optimization and high-concurrency parallel processing for subtasks without dependencies.

8. A knowledge-enhanced 3D mold modeling code generation system, characterized in that, include: The multimodal engineering data processing module is used to collect multimodal mold engineering data and transform mold knowledge scattered in different carriers and formats into a unified intermediate data representation. The knowledge graph and vector construction module is used to extract multimodal knowledge based on the unified intermediate data representation and the mold design feature classification system, and to construct a multimodal mold knowledge graph and a corresponding vector library; the multimodal mold knowledge graph is a multi-level knowledge graph that includes a concept layer graph, a common knowledge graph, a historical best instance graph, and a 3D code generation graph; The retrieval enhancement and generation task modeling module is used to parse the user's design intent, perform cross-modal retrieval enhancement in the multimodal mold knowledge graph and the vector library based on the parsing results, obtain relevant knowledge, and construct the input context of the large model together with the relevant knowledge, user design intent and design constraints, and call the large language model to generate preliminary 3D mold code; The 3D code generation and auxiliary verification module is used to generate the preliminary 3D mold code into meta-operation code and low-level execution code in a hierarchical manner. Based on the multimodal mold knowledge graph and the pre-set rule engine, the generated code is automatically verified for geometric and process constraints. If a violation of constraints is detected, diagnostic adjustment suggestions are generated and sent back to the large model for closed-loop iterative optimization until the code passes the verification. The knowledge feedback and evolution module is used to feed incremental experience, which has been manually reviewed and verified, back to the multimodal mold knowledge graph and vector library, and realize the continuous evolution of the system through a mechanism that combines fast and slow loops.