CN-121480336-B - Three-dimensional CAD automatic modeling method and system based on sequence and retrieval enhancement
Abstract
The invention discloses a three-dimensional CAD automatic modeling method and system based on sequence and retrieval enhancement, belonging to the field of computer aided design and artificial intelligence generated content. The method comprises the steps of constructing a first database for storing standard components and variants thereof and a second database for storing common components by using a unified JSON structure to bear common operation types and parameter constraints of engineering modeling, establishing vector retrieval indexes for the components, retrieving related components and constructing large model prompt words according to a first database priority principle based on user input prompt words, generating a modeling sequence represented by the JSON structure by a large model, preprocessing and analyzing, and sequentially creating a feature history tree through CAD software APIs to generate a parameterized component model meeting user requirements. The method and the system effectively improve the accuracy and stability from the user input of the prompt word to the engineering editable model through standardized intermediate representation and retrieval enhancement, reduce the cost of manual modeling and have cross-platform reusability.
Inventors
- ZHANG XUHONG
- ZHAO YU
- ZHAO XINKUI
- DU TIANYU
- ZHI CHEN
- YIN JIANWEI
Assignees
- 浙江大学
- 浙江大学软件学院(宁波)创新与管理中心
Dates
- Publication Date
- 20260508
- Application Date
- 20260108
Claims (9)
- 1. The three-dimensional CAD automatic modeling method based on sequence and retrieval enhancement is characterized by comprising the following steps: (1) Defining a JSON structure representing modeling sequence of unified field naming, parameter domain and default value strategy, wherein the JSON structure comprises operation type of engineering modeling and parameter constraint thereof; (2) Constructing a part library containing part names, part pictures and modeling sequences thereof, dividing the part library into a first database for storing standard parts and one-step internal parameterized variants thereof and a second database for storing other parts, and attaching appearance descriptions of all parts to the second database; (3) Based on the user input prompt words, retrieving a part library according to a first database priority principle, recalling Top-k related parts, constructing large model prompt words by combining retrieval results, few-shot examples, field definition of a JSON structure, a value range and operation examples, and generating a modeling sequence represented by the JSON structure by a large model, wherein the operation examples refer to operation analysis of each operation type; (4) And preprocessing and analyzing the generated modeling sequence, sequentially creating a characteristic history tree through a CAD software API after analyzing, and generating a parameterized part model meeting the requirements of users.
- 2. The three-dimensional CAD automatic modeling method based on sequence and search enhancement according to claim 1, wherein the parametric constraints for each operation type include: The parameter constraint of the sketch comprises a contour and a plane pose, wherein the contour is formed by a plurality of closed curve rings, and the closed curve rings comprise curve elements and Boolean quantities for indicating inner and outer rings; the parameter constraints of stretching and stretch cutting include Boolean mode, sketch outline and stretching parameters; the rotation and parameter constraints of the rotational resection include rotation axis, rotation angle and sketch profile; The parameter constraint of the fillet comprises curve element sampling point coordinates and distance parameters; the parameter constraints of the chamfer include curve element sampling point coordinates, fillet type and distance parameters.
- 3. The three-dimensional CAD automatic modeling method based on sequence and search enhancement according to claim 2, wherein the parameters constraint of sketch operation is as follows: the profile is formed by a plurality of disjoint closed curve loops, each of which organizes curve elements in a counterclockwise direction; three types of curve elements are defined, including straight line segments, perfect circles and circular arc segments; the plane pose is determined to be a unique position in a three-dimensional space by a rotation matrix and a translation vector; The sketch sequence starts from the bottom left-most point.
- 4. The sequence and search enhancement based three-dimensional CAD automatic modeling method according to claim 1, wherein each standard corresponds to at least one parameterized variant.
- 5. The three-dimensional CAD automatic modeling method based on sequence and search enhancement according to claim 1, wherein step (2) comprises: Collecting three-dimensional part source files containing various engineering modeling operations, deriving multi-view model pictures and modeling history texts, screening standard parts and one-step internal parameterization variants of the standard parts to form a first part set, and forming a second part set by the rest parts; Analyzing modeling history text and converting the modeling history text into a predefined JSON structure to represent a modeling sequence to form basic data comprising part name-modeling sequence-model pictures; And if the part belongs to the second part set, carrying out semantic blocking on the part name and the appearance description, generating vector representations of all the semantic blocks by using the text embedding model, and splicing the vector representations into complete part vector representations to serve as indexes to obtain a second database.
- 6. The three-dimensional CAD automatic modeling method based on sequence and search enhancement according to claim 1, wherein the first database priority principle is specifically: Converting a prompt word input by a user into a prompt word vector, firstly calculating the similarity between the prompt word vector and vector retrieval indexes of all parts in a first database, and if the highest similarity is greater than a threshold value, selecting a part corresponding to the highest similarity as a recalled Top-1 related part; Otherwise, calculating the similarity between the prompt word vector and the vector retrieval index of each part in the second database, synthesizing all calculation results of the first database and the second database, and sequentially selecting k parts corresponding to the highest similarity as recalled Top-k related parts, wherein the value range of k is 2-5.
- 7. The three-dimensional CAD automatic modeling method based on sequence and retrieval enhancement according to claim 1, wherein, The Few-shot sample for constructing the prompt word refers to a complete user input and corresponding standard modeling sequence, a prompt word template is called and inserted from a pre-established sample library, and the calling rule is that the prompt word is inserted by selecting a sample of an associated operation type according to the operation type of the recall part.
- 8. The three-dimensional CAD automatic modeling method based on sequence and search enhancement according to claim 1, wherein step (4) comprises: Performing parameter inverse normalization and pose recovery on the generated modeling sequence based on the type of the target three-dimensional CAD software, wherein the parameter inverse normalization comprises inverse mapping of normalized length and angle parameters in the modeling sequence into actual dimensions of the target three-dimensional CAD software; Analyzing the modeling sequence, identifying the operation type and the dependency relationship thereof, and forming a topological ordering of an operation execution plan and the dependency sequence; And calling an application programming interface of the target three-dimensional CAD software, creating a characteristic history tree according to the topological order, generating a parameterized part model and exporting the parameterized part model into a STEP neutral format file.
- 9. A three-dimensional CAD automatic modeling system based on sequence and search enhancement for implementing the three-dimensional CAD automatic modeling method based on sequence and search enhancement as claimed in claim 1, characterized in that the system comprises: The data definition module is used for defining a JSON structure representation modeling sequence of unified field naming, parameter domain and default value strategy, wherein the JSON structure comprises operation types of engineering modeling and parameter constraints thereof; the part library management module is used for constructing a part library containing part names, part pictures and modeling sequences thereof, dividing the part library into a first database for storing standard parts and one-step parameterized variants thereof and a second database for storing other parts, and attaching appearance descriptions of the parts to the second database; The retrieval enhancement generation module is used for retrieving a part library according to a first database priority principle based on the input of a prompt word by a user, recalling Top-k related parts, constructing a large model prompt word by combining a retrieval result, few-shot examples, field definition of a JSON structure, a value range and an operation example, and generating a modeling sequence represented by the JSON structure by a large model; The automatic modeling execution module is used for preprocessing and analyzing the generated modeling sequence, sequentially creating a characteristic history tree through a CAD software API after analysis, and generating a parameterized part model meeting the requirements of users.
Description
Three-dimensional CAD automatic modeling method and system based on sequence and retrieval enhancement Technical Field The invention relates to the field of computer aided design and artificial intelligence generated content, in particular to a three-dimensional CAD automatic modeling method and system based on sequence and retrieval enhancement. Background Under the background of digitization and intelligent promotion of manufacturing industry, a three-dimensional CAD is expressed by taking B-rep as a main stream, and a B-rep model defines a three-dimensional shape by accurately describing the boundary (including geometric elements such as vertexes, edges, faces and the like and topological relation thereof) of an object, so that a complex geometric structure can be accurately expressed. However, as product development cycles continue to shorten and the demand for customized designs increases, the limitations of the conventional B-rep model are increasingly pronounced. The current B-rep model lacks records of modeling process, which results in difficult model modification, and the design intention and parameter relation are easy to lose, so that the design of other people is difficult to understand and modify in team cooperation. Parameterized features and modeling history (sketch, stretch, rotation, filleting, chamfering, etc.) are key to ensuring editability and manufacturability. With the development of AIGC and large language models, it is desirable to automatically obtain "editable parameterized parts" from text or pictures to shorten the design cycle and precipitate the design knowledge. The mainstream 3D CAD model generation scheme is a text generation 3D method based on implicit field or grid optimization, and is typically implemented by constraining text semantics to three-dimensional representation by using diffusion models or score distillation, and then obtaining the appearance by volume rendering or grid extraction. The method can rapidly produce three-dimensional shapes with visual quality from natural language, and is suitable for conceptual design and content creation. However, most of the output products are triangular grids or implicit bodies, parametric features and modeling histories are not contained, size/geometric constraint, assembly and tolerance analysis cannot be performed in a CAD environment, geometric noise, topology flaws and scale uncertainty are common, and engineering manufacturability and multiplexing requirements are difficult to meet. Another type of solution is the idea of "program generation", i.e. learning to generate CAD command sequences from text or visual cues, and then executing on open source CAD library functions to obtain a result with features. The direction can restore the modeling process to a certain extent and is close to the engineering use scene. However, the existing method is often focused on few operations (more limited to sketch/stretching), has insufficient support on engineering high-frequency features such as rotation, round corners, chamfering and the like, is inconsistent in convention of sketch pose, ring direction, closure and the like, is easy to depend on fragile indexes in edge/face selection, has obvious difference between feature semantics and termination conditions of different CAD, and is lack of commonly accepted cross-platform consistent representation, so that cross-software replay and Boolean structural stability are insufficient. In summary, the key to engineering-oriented parametric CAD model generation is four aspects, 1) the realization that consistent representation and semantic bridging can be robustly replayed across software while bearing design intent and feature constraints. 2) And the engineering high-frequency characteristics and the topology constraint are covered, and the geometric/topology constructability and the Boolean stability are ensured. 3) And (3) fully aligning natural language and image to parameters and characteristics, and integrating standard part knowledge and industry semantics. 4) The end-to-end execution of links requires strict syntax, geometry, topology and abnormal rollback mechanisms, ensuring stability and maintainability. Disclosure of Invention Aiming at the defects of the prior art, the invention provides a three-dimensional CAD automatic modeling method and system based on sequence and retrieval enhancement, which can obviously improve the accuracy and stability from the input of a prompt word by a user to the modeling of an engineering model and reduce the cost of manual modeling while ensuring the editable, manufacturable and reusable model. The technical scheme adopted by the invention is as follows: in a first aspect, the invention discloses a three-dimensional CAD automatic modeling method based on sequence and retrieval enhancement, which comprises the following steps: (1) Defining a JSON structure representing modeling sequence of unified field naming, parameter domain and default va