Numerical control code generation method and device, equipment and medium
By parsing drawing files, identifying geometric entities and machining features, generating structured representations and assessing complexity, and using inference models to generate CNC code, this technology solves the problems of long programming cycles and code quality dependence on engineer skill levels in existing technologies, achieving efficient and accurate CNC code generation.
Patent Information
- Application Number
- CN202511569207.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2045-10-30
AI Technical Summary
Existing CNC code generation methods struggle to fully understand the machining intent and process logic of drawings, leading engineers to spend a significant amount of time on repetitive operations and process decisions. This results in long programming cycles, and the quality of the generated code is highly dependent on the engineer's skill level, making it prone to flaws in process logic.
By acquiring drawing files, the geometric entities are parsed and processing features are identified. Feature types are matched, structured representations are generated, processing complexity is evaluated, and a processing instruction sequence is generated using an inference model. Finally, a processing code file is generated to execute the processing.
It achieves end-to-end automatic generation from drawings to geometric code, improving programming efficiency, reducing human error, ensuring code quality, and reducing waste of materials and labor time.
Smart Images

Figure CN121050349B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of numerical control programming automation, and in particular to a numerical code generation method and device, equipment and medium. BACKGROUND
[0002] In modern manufacturing, numerical control machining technology is widely used in the field of mechanical manufacturing. The key to numerical control machining is to generate accurate and efficient numerical control codes, which directly determines the quality and production efficiency of the processed products. However, the current numerical code generation method still has many problems.
[0003] Currently, the conversion from computer-aided design drawings to numerical control machine tool executable geometric codes mainly relies on computer-aided manufacturing software. The workflow of mainstream computer-aided manufacturing software is that the engineer imports the computer-aided design model, and then manually or semi-automatically performs a series of operations, including defining the blank, selecting the machining features (such as holes, cavities, and grooves), selecting appropriate machining strategies for each feature (such as cavity milling and contour milling), selecting tools for each strategy, setting cutting parameters (speed, feed rate), planning tool paths and generating tool paths, checking for collisions and overcuts, post-processing, etc., thereby converting abstract tool path data into geometric codes recognized by specific machine tool controllers.
[0004] However, existing computer-aided manufacturing software cannot truly understand the machining intent and process logic of the drawings. Each machining step needs to be manually configured by the engineer, making it difficult to achieve end-to-end automatic generation from computer-aided design drawings to geometric codes. For parts with a large number of features or complex relationships between features (such as aircraft engine impellers), engineers need to spend a lot of time on repetitive operations and process decisions, resulting in long programming cycles and becoming a bottleneck for flexible manufacturing and rapid prototyping. At the same time, the quality of the generated geometric codes is directly related to the level of the engineer, and inexperienced engineers may produce codes with process logic flaws (such as incorrect machining order causing workpiece deformation, improper tool path planning causing collision), which need to be corrected through multiple trial cuts, causing waste of materials and time.
[0005] Therefore, how to comprehensively analyze the geometric information of the drawing file to obtain a structured sequence for machining complexity evaluation and execution of the machining code file has become a problem to be solved. SUMMARY
[0006] Therefore, the embodiments of the present application provide a numerical code generation method and device, equipment and medium to solve the problem of how to comprehensively analyze the geometric information of the drawing file to obtain a structured sequence for machining complexity evaluation and execution of the machining code file.
[0007] In a first aspect, embodiments of the present application provide a numerical control code generation method, comprising:
[0008] Obtaining a drawing file to be processed, parsing the drawing file to obtain N geometric entities, identifying each geometric entity to obtain a machining feature sequence composed of geometric features corresponding to each geometric entity, N being an integer greater than zero;
[0009] Obtaining a preset feature type library, matching a feature type of any geometric feature in the machining feature sequence from the feature type library, extracting attribute information of the geometric feature according to the feature type, generating a structured expression corresponding to the geometric feature according to the feature type and the attribute information, and traversing all geometric features to obtain a structured sequence;
[0010] Evaluating the processing complexity of each geometric feature in the structured sequence to obtain a complexity evaluation result corresponding to each geometric feature;
[0011] For any geometric feature, determining a corresponding inference model according to the complexity evaluation result corresponding to the geometric feature, using the inference model to infer the geometric feature to obtain a machining instruction sequence corresponding to the geometric feature;
[0012] Traversing all geometric features to obtain machining instruction sequences of all geometric features, and generating an execution machining code file according to all machining instruction sequences.
[0013] In a second aspect, embodiments of the present application provide a numerical control code generation device, comprising:
[0014] A geometric entity analysis module is configured to obtain a drawing file to be processed, parse the drawing file to obtain N geometric entities, identify each geometric entity to obtain a machining feature sequence composed of geometric features corresponding to each geometric entity, N being an integer greater than zero;
[0015] A structured sequence generation module is configured to obtain a preset feature type library, match a feature type of any geometric feature in the machining feature sequence from the feature type library, extract attribute information of the geometric feature according to the feature type, generate a structured expression corresponding to the geometric feature according to the feature type and the attribute information, and traverse all geometric features to obtain a structured sequence;
[0016] A complexity evaluation module is configured to evaluate the processing complexity of each geometric feature in the structured sequence to obtain a complexity evaluation result corresponding to each geometric feature;
[0017] a feature reasoning module, configured to determine a corresponding reasoning model for any geometric feature according to a complexity evaluation result corresponding to the geometric feature, and use the reasoning model to reason the geometric feature to obtain a machining instruction sequence corresponding to the geometric feature;
[0018] a file generation module, configured to traverse all geometric features to obtain machining instruction sequences of all geometric features, and generate an execution machining code file according to all machining instruction sequences.
[0019] In a third aspect, an embodiment of the present application provides a computer device, which comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the numerical control code generation method according to the first aspect when executing the computer program.
[0020] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the numerical control code generation method according to the first aspect.
[0021] Compared with the prior art, the embodiment of the present application has the following beneficial effects:
[0022] In the present application, a drawing file to be processed is obtained, the drawing file is parsed to obtain N geometric entities, each geometric entity is identified to obtain a machining feature sequence composed of geometric features corresponding to each geometric entity, N is an integer greater than zero, a preset feature type library is obtained, a feature type of any geometric feature in the machining feature sequence is matched from the feature type library, attribute information in the geometric feature is extracted according to the feature type, a structured expression of the corresponding geometric feature is generated according to the feature type and the attribute information, all geometric features are traversed to obtain a structured sequence, a processing complexity of each geometric feature in the structured sequence is evaluated to obtain a complexity evaluation result corresponding to each geometric feature, a reasoning model corresponding to any geometric feature is determined according to the complexity evaluation result corresponding to the geometric feature, the geometric feature is reasoned using the reasoning model to obtain a machining instruction sequence corresponding to the geometric feature, all geometric features are traversed to obtain machining instruction sequences of all geometric features, and an execution machining code file is generated according to all machining instruction sequences. By obtaining and parsing the geometric entities of the drawing file to be processed to obtain the machining feature sequence composed of geometric features, the feature type is matched from the preset feature type library, the attribute information is extracted to generate the structured sequence, the processing complexity of each geometric feature is evaluated, the reasoning model is determined according to the complexity to reason to obtain the machining instruction sequence, and finally all geometric features are traversed to generate the execution machining code file. Thus, the geometric information of the drawing file is comprehensively analyzed to obtain the structured sequence, so as to evaluate the machining complexity and generate the execution machining code file. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram of an application environment for a numerical control code generation method provided in Embodiment 1 of this application;
[0025] Figure 2 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 2 of this application;
[0026] Figure 3 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 3 of this application;
[0027] Figure 4 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 4 of this application;
[0028] Figure 5 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 5 of this application;
[0029] Figure 6 This is a schematic diagram of the structure of a numerical control code generation device provided in Embodiment Six of this application;
[0030] Figure 7 This is a schematic diagram of the structure of a computer device provided in Embodiment 7 of this application. Detailed Implementation
[0031] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0032] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0033] It should also be understood that the term “and / or” as used herein refers to a conjunction, an association, one or more of each associated listed item, and all possible combinations, and includes these combinations.
[0034] As used in the specification and the appended claims, the term “if’ can be interpreted as meaning “when” or “once” or “in response to a determination” or “in response to detecting” depending on the context. Similarly, the phrase “if it is determined” or “if [the recited condition or event] is detected” can be interpreted as meaning “once it is determined” or “in response to a determination” or “once [the recited condition or event] is detected” or “in response to detecting [the recited condition or event]”, depending on the context.
[0035] In addition, in the description of the present application and the appended claims, the terms “first”, “second”, “third”, etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0036] Reference in the specification to “one embodiment” or “some embodiments” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, the appearance of the phrases “in one embodiment”, “in some embodiments”, “in other embodiments”, “in additional embodiments”, etc. in various places in the specification is not necessarily all referring to the same embodiment, but means that “one or more but not all embodiments”, unless otherwise specifically noted. The terms “include”, “contain”, “have” and their variants mean “including but not limited to”, unless otherwise specifically noted.
[0037] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the use of digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method, technology and application system.
[0038] The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. Several major directions.
[0039] It should be understood that the size of the serial number of each step in the following embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0040] In order to illustrate the technical solutions of the present application, the following will be illustrated by specific embodiments.
[0041] The numerical control code generation method provided by the embodiment of the present application can be applied in the application environment such as Figure 1 , wherein the client and the server are connected for communication, the user can provide the conditions, requirements and operation instructions of the numerical control code generation by operating the client, and the server is used to generate the control instructions of the numerical control code generation method according to the related contents sent by the client.
[0042] The client includes but is not limited to palmtop computer, desktop computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cloud terminal device, personal digital assistant (PDA) and other computer devices. The server can be an independent server, or a cloud server providing cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content distribution network (CDN), and basic cloud computing services such as big data and artificial intelligence platform.
[0043] Referring to Figure 2 , it is a flowchart of a numerical control code generation method provided by the embodiment two of the present application, which can include the following steps:
[0044] In step S201, the drawing file to be processed is obtained, the drawing file is parsed to obtain N geometric entities, each geometric entity is identified to obtain a machining feature sequence composed of geometric features corresponding to each geometric entity, and N is an integer greater than zero.
[0045] The drawing file uploaded by the user includes but is not limited to CAD file (i.e. Computer Aided Design file, computer aided design file), which is created by engineers or designers using computer aided design software. The drawing file records the design information of the part, including the shape, size, relative position of each part, etc. The drawing file is the basis for subsequent processing, and contains the original data required for generating numerical control code.
[0046] The drawing file adopts a specific format to store graphic information. In the parsing process of the drawing file, the graphic information in the drawing file is split into individual basic geometric entities. These geometric entities are the basic elements of the part graphics, and the geometric entities include but are not limited to straight lines, circular arcs, circles, rectangles, polygons. For example, a simple mechanical part can be composed of several straight line segments and circular arcs, and the parsing module will extract these straight line segments and circular arcs as independent geometric entities.
[0047] The geometric entity is the basic element of the part, such as point, line, surface, body, etc. The graphic information in the file can be split into individual independent geometric entities by parsing, and there are complex topological connection relationships and geometric constraint relationships between these entities.
[0048] According to the format standard of the drawing file, the geometric entities in the drawing file are extracted by reading and analyzing. For example, for a two-dimensional CAD drawing, geometric entities such as line segments, circular arcs, and polygons can be extracted, and for a three-dimensional drawing, geometric entities such as cuboids, cylinders, and spheres can be extracted.
[0049] After obtaining the geometric entities, the machining features with specific machining semantics represented by each geometric entity are further identified. The geometric feature is a description of some attributes of the geometric entity, such as shape, size, position, etc., and the machining feature is a classification and definition of the geometric entity from the manufacturing point of view, such as hole, groove, cavity, step, etc. By analyzing the topological connection relationship (adjacency, containment, etc.) and geometric constraint relationship (parallel, perpendicular, concentric, coaxial, etc.) between the geometric entities, and using the preset rules or algorithms (such as graph matching method, body decomposition method), the geometric entities are aggregated and interpreted as machining features, and finally a machining feature sequence is formed.
[0050] Taking a cylindrical geometric entity as an example, if it is on a plane and has no complex connection relationship with the surrounding entities, and at the same time meets the definition rules of the hole (such as having a certain depth, circular cross section, etc.), it will be identified as a hole machining feature. After such identification operation is performed on all geometric entities, the machining features corresponding to each geometric entity are arranged in a certain order, and a machining feature sequence is obtained.
[0051] In step S202, a preset feature type library is obtained, and for any geometric feature in the machining feature sequence, the feature type of the geometric feature is matched from the feature type library, the attribute information in the geometric feature is extracted according to the feature type, the structured expression corresponding to the geometric feature is generated according to the feature type and the attribute information, and the structured sequence is obtained by traversing all geometric features.
[0052] The feature type library stores various possible feature types and related information, like a standard feature dictionary.
[0053] Sequence conversion methods can be used to search for the corresponding standard, readable feature type name in the feature type library for the type or name of any geometric feature in the processing feature sequence. For example, if the feature recognition module identifies a feature of type "001", the standard feature type name corresponding to "001" can be found to be "hole" through the mapping in the feature type library.
[0054] The feature type library not only stores feature type names but also associates each feature type with an attribute information set. This attribute information defines the key attributes of the feature type, which serve as the basis for describing the specific information of the feature and guiding the processing operations. Attribute information extraction refers to extracting the specific values of these attributes. Taking a hole feature as an example, its attribute information includes diameter, depth, position coordinates, tolerance, surface roughness, etc. The specific values of these attributes are extracted from the geometric data of the hole feature (such as the graphic information recorded in the CAD file). For cavity features, key attributes may include length, width, depth, corner radius, etc., and the corresponding attribute values are also extracted from the geometric and topological data of the cavity feature.
[0055] In practical applications, the raw data from which the above attribute information is extracted is usually floating-point numbers or integers. These data lack explicit unit information, which can lead to ambiguity in subsequent processing. Therefore, it is necessary to convert this raw data into strings with units and a uniform format, i.e., structured representation.
[0056] Structured representation is a method of organizing information in a specific format, clearly and accurately presenting all key information about geometric features, facilitating computer processing and understanding. Traversing all geometric features means that the system processes each geometric feature parsed from the drawing file sequentially. Each geometric feature is processed one by one, generating a corresponding structured representation for each.
[0057] Once the system has generated a structured representation for each geometric feature, it combines these individual structured representations into a sequence, known as a structured sequence. A structured sequence is like a complete "part feature list," recording detailed information about all the geometric features on the part.
[0058] Each element in the structured sequence is a structured representation of a geometric feature, arranged in a specific order. With this structured sequence, subsequent processing modules can easily obtain detailed information about each geometric feature, perform operations such as processing complexity evaluation, and inference to generate processing instructions.
[0059] Optionally, the step of generating a structured representation corresponding to the geometric feature based on the feature type and the attribute information, and traversing all geometric features to obtain a structured sequence, may include the following steps:
[0060] The attribute information is processed according to preset format rules to obtain attribute standard information;
[0061] Obtain a preset text template, fill the text template with the attribute standard information and the feature type to obtain the structured expression corresponding to the geometric feature, and traverse all geometric features to obtain a structured sequence.
[0062] The attribute information is processed according to preset formatting rules to obtain standard attribute information. Attribute information extracted from drawing files may have issues such as inconsistent formatting, missing units, or inconsistent data precision. The preset formatting rules are designed to solve these problems by converting the attribute information into a unified and standardized format for subsequent use.
[0063] A preset text template is obtained, and the attribute standard information and feature type are filled into the text template to obtain a structured expression corresponding to the geometric feature. The preset text template is a pre-designed text frame for each feature type, containing a fixed descriptive section and placeholders for inserting attribute values. By filling the attribute standard information and feature type into these placeholders, a complete and standardized structured expression of the geometric feature can be generated. Based on different feature types (such as holes, cavities, etc.), a corresponding text template is selected from a preset template library.
[0064] Accurately fill the processed attribute standard information and feature types into the corresponding placeholders in the text template. After generating the structured representation of a single geometric feature, repeat the above steps for all geometric features extracted from the drawing file, collecting the structured representations of each geometric feature in sequence to form a structured sequence.
[0065] Each geometric feature can be accessed sequentially using a loop structure (such as a for loop in programming), performing attribute information processing and text template filling operations on each feature, and adding the generated structured representation to a list. The final list is the structured sequence, which can be stored, transmitted, or further analyzed as a whole.
[0066] Optionally, in the preceding steps, we have already completed the work of identifying geometric features, extracting attribute information, and generating structured representations and structured sequences from the drawing files. However, relying solely on information from a single geometric feature to identify the drawing files may face the problem of insufficient information when performing deeper reasoning (such as determining the processing sequence).
[0067] In determining the machining sequence, the order is not solely determined by the attributes of individual geometric features, but is also closely related to the overall structure of the part model, the relative positions and dependencies between features, and other factors. For example, in a part, if a hole needs to be machined only after a certain groove has been machined, because the machining of the groove might affect the hole's positioning or accuracy, a large language model would struggle to accurately determine this machining sequence without contextual information about the entire part model.
[0068] The context information is extracted from the entire part model. It provides a comprehensive analysis of the part model represented by the entire drawing file, focusing not only on individual geometric features but also on the relationships between these features and the overall structure of the part.
[0069] The positional relationships of different geometric features within a part are crucial for determining the machining sequence. For example, a feature located at the edge of a part may need to be machined first to avoid damage during subsequent machining. Similarly, the machining sequence of two adjacent features may need to be considered to reduce the number of clamping operations and improve machining efficiency.
[0070] The machining of some features depends on the completion of other features. For example, a drilling operation that needs to be performed on a machined plane must be performed after the plane has been machined. This dependency can be determined by analyzing the geometric and topological data of the features. The overall structure of the part and its intended function also affect the machining sequence. For example, for a part that needs to be assembled, the machining accuracy and surface quality requirements of certain features may be higher and need to be prioritized during machining.
[0071] Adding the extracted contextual information to the previously generated structured representation or structured sequence can be done by adding extra fields to the structured representation of each geometric feature to describe its relationship with other features, or by adding some general information about the entire part model at the beginning or end of the structured sequence.
[0072] Adding contextual information enables more accurate reasoning. For example, when determining the processing order, the LLM model (Large Language Model) can determine a reasonable processing order based on the relative positions and dependencies between features, avoiding situations where a feature is processed first, only to find that subsequent processing would damage that feature. Simultaneously, considering the overall structure and functional requirements of the part can also ensure that the final processed part meets the design requirements.
[0073] Step S203: Evaluate the processing complexity of each geometric feature in the structured sequence to obtain the complexity evaluation result corresponding to each geometric feature.
[0074] Among these, the various attributes of geometric features are important criteria for evaluating complexity. These include, for example, size, shape complexity, accuracy requirements, relationships between features, positional relationships, and dependencies.
[0075] An evaluation index system can be established based on the above criteria, assigning corresponding weights to each index. For example, size, shape complexity, accuracy requirements, positional relationships, and dependencies can all be used as evaluation indicators. Each index is quantified and scored, and a comprehensive score is calculated based on the weights to evaluate the processing complexity of geometric features. Machine learning algorithms, such as decision trees and neural networks, are used to train a complexity evaluation model on a large amount of historical processing data. The model takes the attribute information of the geometric features and the relationships between features as input, and outputs the complexity evaluation result for that feature. This method can more accurately consider the complex relationships between various factors, improving the accuracy of the evaluation. The representation of the complexity evaluation results can include hierarchical classification, numerical scoring, etc.
[0076] Step S204: For any geometric feature, determine the corresponding inference model based on the complexity evaluation result of the geometric feature, and use the inference model to infer the geometric feature to obtain the processing instruction sequence corresponding to the geometric feature.
[0077] Among them, the situations and factors to be considered during the machining process vary greatly depending on the complexity of the geometric features. The machining process of simple geometric features is relatively fixed and conventional, and only some basic rules and general machining strategies are needed to determine the machining instructions. However, complex geometric features may involve special processes, multi-step operations, and complex toolpath planning, requiring more powerful and flexible reasoning capabilities to generate appropriate machining instructions.
[0078] For geometric features with low complexity assessments, such as simple circular through holes, the machining process is relatively standard and common. Rule-based inference models can be used. These models predefine a series of machining rules and logic. When the attribute information of the geometric feature is input, the inference model directly generates the corresponding machining instructions according to the established rules. For example, it can be specified that circular through holes with a diameter less than a certain value are machined by drilling, operating at a specific feed rate and rotational speed.
[0079] For geometric features with high complexity assessments, such as cavities with complex freeform surfaces, rule-based models may not meet their complex reasoning requirements. In such cases, machine learning or deep learning-based reasoning models can be employed. These models can be trained on large amounts of historical processing data to learn the complex mapping relationships between complex features and processing instructions. When information about complex geometric features is input, the model can reason based on its learned knowledge and generate processing instructions adapted to their characteristics.
[0080] The structured representation of geometric features (including feature type, attribute information, etc.) and the complexity evaluation results are used as inputs to the inference model. For example, for a complex groove feature, the inputs include its length, width, depth, tolerance, surface roughness, and other attribute information, as well as its complexity level.
[0081] The inference model performs calculations and inferences based on the input information. If it's a rule-based model, it matches and judges according to preset rules; if it's a machine learning-based model, it uses trained model parameters for calculations and predictions. The inference model outputs a sequence of machining instructions for the geometric feature. This sequence includes a series of specific machining operations, such as tool selection, toolpath planning, and setting cutting parameters (feed rate, spindle speed, depth of cut, etc.).
[0082] Step S205: Traverse all geometric features to obtain the machining instruction sequence for all geometric features, and generate an execution machining code file based on all machining instruction sequences.
[0083] In the preceding steps, we have already generated corresponding machining instruction sequences for each geometric feature. Step S205 requires iterating through all geometric features in the structured sequence. This is analogous to sequentially inspecting each feature on the part, collecting the machining "plans" previously created for each of them. This iteration can be implemented using loops, such as a for loop in programming, to sequentially access each geometric feature in the structured sequence and its corresponding machining instruction sequence.
[0084] Collecting the machining instruction sequences for all geometric features prepares for generating complete machining code later. Each geometric feature's machining instruction sequence contains specific machining information for that feature, such as tool selection, machining path, and cutting parameters. Only by integrating all this information can a complete machining plan be formed, ensuring that each part of the part is correctly machined according to design requirements.
[0085] When generating machining code, the machining instruction sequences of all geometric features need to be integrated in a logical order. This requires considering not only the machining order of each feature itself but also the interrelationships between features, such as the fact that some features may need to be processed only after other features have been processed. For example, if a hole needs to be drilled only after a certain plane has been machined, then when generating the machining code, it must be ensured that the plane machining instructions precede the hole machining instructions. The integrated machining instruction sequence is then converted into a code format that conforms to the requirements of the CNC equipment and saved as a code file.
[0086] This application obtains a drawing file to be processed, parses the drawing file to obtain N geometric entities, identifies each geometric entity to obtain a processing feature sequence composed of the geometric features corresponding to each geometric entity, where N is a positive integer, obtains a preset feature type library, matches the feature type of the geometric feature in the feature type library for any geometric feature in the processing feature sequence, extracts attribute information from the geometric feature according to the feature type, generates a structured representation of the corresponding geometric feature based on the feature type and attribute information, traverses all geometric features to obtain a structured sequence, evaluates the processing complexity of each geometric feature in the structured sequence to obtain a complexity evaluation result for each geometric feature, determines the corresponding inference model for any geometric feature based on the complexity evaluation result, uses the inference model to infer the geometric feature to obtain a processing instruction sequence for the corresponding geometric feature, traverses all geometric features to obtain a processing instruction sequence for all geometric features, and generates an execution processing code file based on all processing instruction sequences. By acquiring and parsing the drawing file to be processed, geometric entities are obtained. Their geometric features are identified to form a sequence of processing features. Then, feature types are matched from a preset feature type library, attribute information is extracted to generate a structured sequence, the processing complexity of each geometric feature is evaluated, and a reasoning model is determined based on the complexity to generate a sequence of processing instructions. Finally, all geometric features are traversed to generate an execution processing code file. In this way, the geometric information of the drawing file is comprehensively analyzed to obtain a structured sequence for processing complexity evaluation and generation of execution processing code files.
[0087] See Figure 3 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 3 of this application. Figure 3 As shown, the step S201 above, which involves parsing the drawing file to obtain N geometric entities, identifying each geometric entity, and obtaining a processing feature sequence composed of the geometric features corresponding to each geometric entity, where N is a positive integer, may include the following steps:
[0088] Step S301: Determine the spatial characteristics of the entities between the geometric entities based on the geometric features.
[0089] Step S302: According to preset rules and combined with the spatial features of the entity, the geometric entities are aggregated to obtain aggregated geometric entities.
[0090] Step S303: Analyze the aggregated geometric entity to determine the processing feature sequence composed of the geometric features corresponding to the geometric entity, where N is an integer greater than zero.
[0091] After extracting geometric entities and identifying their geometric features from the drawing file, the next step is to analyze the relationships and characteristics of these geometric entities in three-dimensional space, which is to determine the spatial features of the entities. Geometric features are abstract descriptions of entities (such as holes and slots), while spatial features focus more on the specific spatial positions, directions, distances, and other relationships between entities.
[0092] Among these, topological connections can be clearly defined to understand the direct relationships between entities. Geometric constraints, such as parallelism, perpendicularity, concentricity, and coaxiality, can also be used. For example, two cylindrical holes...
[0093] They may be coaxial, and one plane may be parallel to another. The specific positional relationship and distance between geometric entities are determined based on their relative positions and distances. For example, the center distance between two holes, or the offset between one boss and another feature.
[0094] Suppose there is a cuboid and a cylinder in the CAD file. By analyzing the geometric features (cube and cylinder), we can determine that the cylinder is located on a face of the cuboid and is parallel to one of the edges of the cuboid. At the same time, we can measure the distance between the center of the cylinder and the edge of the cuboid, as well as other solid spatial features.
[0095] After determining the spatial characteristics between geometric entities, related geometric entities are combined according to preset rules to form aggregated geometric entities. The purpose of this is to treat related entities as a whole, so as to enable more advanced analysis and processing in the future, thereby improving the efficiency and accuracy of processing planning.
[0096] If several geometric entities are functionally related, such as a shaft and a keyway on the shaft, and they work together to achieve a transmission function, then they can be grouped together.
[0097] Based on the processing technology, for some entities that need to be processed together during the processing, such as a group of slots that need to be milled at the same time, they can be aggregated.
[0098] Based on spatial relationships, entities can also be aggregated when they have specific spatial relationships, such as adjacent and interdependent entities. For example, a plane with multiple protrusions can be aggregated into a whole for processing planning.
[0099] For example, regarding the cuboid and cylinder mentioned earlier, if the preset rules stipulate that adjacent entities with specific functional relationships can be aggregated, and the cylinder is used to cooperate with the cuboid to achieve a certain function, then the cuboid and cylinder can be aggregated into a new geometric entity.
[0100] After obtaining the aggregated geometric entity, it is analyzed in depth to clarify the processing sequence and combination method of each geometric feature, thereby determining the processing feature sequence. The processing feature sequence is an ordered list that describes the order in which each geometric feature should be processed during the manufacturing process to ensure that the part can be correctly manufactured according to the design requirements.
[0101] Different geometric features require different machining processes, such as drilling, milling, and turning. The machining sequence needs to be determined based on these process requirements. For example, rough machining is usually performed first to remove most of the excess material, followed by finish machining to ensure the accuracy and surface quality of the part.
[0102] In this embodiment of the application, by further analyzing the interrelationships and characteristics of geometric entities in three-dimensional space, the spatial characteristics of the entities are determined, providing an analytical basis for subsequent steps.
[0103] See Figure 4 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 4 of this application. Figure 4 As shown, the step S203, which involves evaluating the processing complexity of each geometric feature in the structured sequence to obtain the complexity evaluation result for each geometric feature, may further include the following steps:
[0104] Step S401: Analyze the feature type to determine the processing complexity level of the geometric feature.
[0105] Step S402: Extract the dimensional tolerance information from the processing feature sequence, and determine the dimensional tolerance complexity of the geometric feature based on the dimensional tolerance information.
[0106] Step S403: Calculate the feature intrinsic attribute complexity score of the geometric feature based on the processing complexity level and the dimensional tolerance complexity.
[0107] Optionally, evaluating the processing complexity of each geometric feature in the structured sequence to obtain the complexity evaluation result for each geometric feature may include the following steps:
[0108] Extract the spatial positional relationship of the geometric features in the processing feature sequence;
[0109] Based on the spatial positional relationships, determine the spatial relationship complexity of the geometric features;
[0110] The complexity score for each geometric feature is calculated based on the complexity score of its intrinsic attributes combined with the complexity of its spatial relationships, and this is used as the complexity evaluation result.
[0111] Feature type is a fundamental factor determining processing complexity. Different feature types have different processing difficulties and requirements, and the system maintains a basic complexity table to reflect these differences. The system extracts the descriptive text of geometric features from the structured sequence and parses out the feature type. By referring to the basic complexity table, the processing complexity level corresponding to that feature type is determined. For example, a feature type of "simple through-hole" corresponds to low complexity, while a feature type of "freeform surface" corresponds to high complexity.
[0112] Dimensional tolerance information has a significant impact on machining complexity. Narrower tolerance zones, large aspect ratios, and features that are either very large or very small all increase machining difficulty and thus complexity. Dimensional tolerance information, such as tolerance zone range, feature diameter, and depth, is extracted from the description text of the machining feature sequence. This information is then used to assess dimensional tolerance complexity.
[0113] The feature intrinsic complexity score comprehensively considers the complexity of both feature type and size tolerance dimensions. By combining these two factors in calculation, a score reflecting the overall complexity of the feature's intrinsic attributes is obtained. A predefined function or model is used to calculate the feature intrinsic complexity score. This function may be rule-based, weight-based, or a machine learning model.
[0114] The spatial relationships of geometric features affect the complexity of machining, including whether the feature is isolated, adjacent to other features, or forms a feature cluster. Information about spatial relationships is extracted from the descriptive text of the machining feature sequence to determine whether a feature is isolated, adjacent to other features, or belongs to a feature cluster. Different spatial relationships correspond to different levels of complexity. Isolated features have low complexity, while being adjacent to other features or forming a feature cluster increases complexity. Based on the extracted spatial relationship information, the spatial relationship complexity of the geometric features is determined by comparing it with the corresponding complexity evaluation criteria. For example, a hole very close to the edge of a part (thin-walled) has high spatial relationship complexity.
[0115] By comprehensively considering the complexity of the intrinsic attributes of the features and the complexity of spatial relationships, a score is obtained that fully reflects the complexity of geometric feature processing. This is also calculated using predefined functions or models.
[0116] Optionally, when process sequence dependencies exist, machining scheduling requires more careful reasoning and planning. Schedulers cannot arbitrarily arrange the machining sequence of features; they must strictly adhere to the dependencies. For example, in machining, to perform a reaming operation, the drilling of the pilot hole must be completed first. If the scheduling is improper, and the reaming is performed before the pilot hole is machined, the entire machining process will fail. Therefore, the machining sequence needs to be carefully arranged to ensure that each feature is machined at the appropriate time, which undoubtedly increases the complexity of scheduling. Due to this dependency, the machining quality and progress of earlier features directly affect the machining of subsequent features. If there is a deviation in the machining of the pilot hole, the subsequent reaming operation may not meet the expected accuracy and quality requirements. Moreover, once the machining of earlier features is delayed, the machining of subsequent features will also be postponed accordingly, thus affecting the overall machining cycle of the part.
[0117] Optionally, if certain features require workpiece flipping for machining, the complexity of the process increases. Each flip necessitates re-clamping and repositioning, which is not only time-consuming but can also introduce clamping errors. For example, machining six faces of a cube part may require flipping the workpiece to machine two opposite faces. After each flip, it's crucial to ensure the workpiece's positional accuracy matches the previous one; otherwise, machining accuracy will be affected. Furthermore, multiple clamping operations increase the difficulty of operation and the probability of errors. When the feature to be machined is located in a position difficult for the cutting tool to reach, such as the bottom of a deep cavity or in a confined space, the machining complexity increases significantly. Tool selection and use are limited in these locations, potentially requiring specialized tools or machining processes. For instance, machining features at the bottom of a deep cavity mold is challenging; ordinary tools may not be able to reach the bottom effectively, necessitating the use of extended or specially shaped tools. Moreover, the increased tool length or special shape can affect its rigidity and cutting performance, further increasing the difficulty and uncertainty of the machining process.
[0118] In this embodiment, the complexity evaluation result corresponding to each geometric feature is obtained by evaluating the processing complexity of each geometric feature in the structured sequence, so as to make reasonable planning based on the complexity in subsequent processing scheduling and other stages.
[0119] See Figure 5 This is a flowchart illustrating a numerical control code generation method provided in Embodiment 5 of this application. Figure 5 As shown, step S204, which involves determining the corresponding inference model based on the complexity evaluation result of the geometric feature, and using the inference model to infer the geometric feature to obtain the processing instruction sequence corresponding to the geometric feature, may include the following steps:
[0120] Step S501: Based on a preset processing threshold, classify the complexity evaluation results to obtain the processing level;
[0121] Step S502: Determine the inference model level based on the processing level;
[0122] Step S503: Using the reasoning model corresponding to the reasoning model level, reason about the geometric features to obtain the processing instruction sequence corresponding to the geometric features.
[0123] Optionally, the step S205 of generating the execution processing code file based on all processing instruction sequences may include the following steps:
[0124] According to preset processing rules, the processing instruction sequence is compiled to obtain compilation instructions;
[0125] The compilation instructions are then processed to obtain the executable processing code file.
[0126] When machining a part, different geometric features on the part have different levels of complexity. To process these features more efficiently and accurately, we pre-set one or more processing values. This processing threshold acts like a "boundary line," dividing the feature complexity assessment results into different intervals, each interval corresponding to a processing level.
[0127] First, based on the complexity assessment results mentioned in step S203, the results are compared with a preset processing threshold. For example, if a processing threshold T is preset, and the complexity assessment score of a feature is less than T, then the feature is classified as a simple feature, corresponding to a lower processing level; if the complexity assessment score is greater than or equal to T, then the feature is classified as a complex feature, corresponding to a higher processing level. In the processing scenario, the complexity assessment score of a simple hole is usually less than T, thus it is classified as a simple feature with a lower processing level, while the complexity assessment score of an impeller blade is greater than or equal to T, thus it is classified as a complex feature with a higher processing level.
[0128] Features with different processing levels require inference models with different capabilities. The inference model level reflects the model's processing power and complexity. Features with low processing levels can use relatively simple and fast inference models, while features with high processing levels require complex inference models with powerful reasoning capabilities.
[0129] Based on the processing level obtained in step S501, a corresponding inference model level is matched for each feature. Generally, simple features correspond to lower processing levels and are matched with lightweight inference models, while complex features correspond to higher processing levels and are matched with complex inference models.
[0130] For features with low processing levels, such as simple holes, a lightweight LLM model will be used as the inference model. For features with high processing levels, such as impeller blades, a complex LLM model will be used as the inference model.
[0131] After determining the inference model level corresponding to each feature, the inference model corresponding to that level is used to infer the feature. The inference process involves determining the appropriate machining technology, tool selection, machining sequence, etc., based on the feature's geometry, complexity, and other relevant information, ultimately generating a series of machining instructions. These instructions, arranged in sequence, form the machining instruction sequence.
[0132] The relevant information of the features is input into the corresponding inference model, which then performs inference based on its algorithm and training data. For lightweight inference models, it can quickly output standard machining instructions. For complex inference models, it performs deep relational inference and outputs advanced machining instruction sequences containing detailed process sequences, tooling suggestions, and other information.
[0133] The machining instruction sequence output by the inference model is a relatively abstract and high-level instruction description, which CNC machining equipment cannot directly recognize and execute. Therefore, it is necessary to convert these machining instruction sequences into instructions that the CNC system can understand according to preset processing rules; this process is called compilation.
[0134] The preset processing rules are formulated based on the syntax and instruction formats of different CNC systems. The compilation process involves converting information in the machining instruction sequence, such as tool selection, machining position, and machining depth, into specific geometric code instructions according to these rules, resulting in compiled instructions. The organization process includes sorting the compiled instructions, adding necessary comments, and checking for syntax errors. After organization, these instructions are combined into a complete file, namely the machining code file. This file can be directly used for programming and operating CNC machining equipment to realize the machining and manufacturing of parts.
[0135] In this embodiment of the application, by reasonably classifying, selecting appropriate reasoning models, and compiling and organizing, an effective transformation from design to manufacturing is achieved.
[0136] Corresponding to the CNC code generation method in the above embodiments, Figure 6 A structural block diagram of the CNC code generation device provided in Embodiment Six of this application is shown. For ease of explanation, only the parts relevant to the embodiments of this application are shown.
[0137] See Figure 6 The CNC code generation device includes:
[0138] The geometric entity analysis module 61 is used to acquire the drawing file to be processed, parse the drawing file to obtain N geometric entities, identify each geometric entity, and obtain the processing feature sequence composed of the geometric features corresponding to each geometric entity, where N is an integer greater than zero;
[0139] The structured sequence generation module 62 is used to obtain a preset feature type library, match the feature type of the geometric feature from the feature type library for any geometric feature in the processing feature sequence, extract the attribute information in the geometric feature according to the feature type, generate a structured expression corresponding to the geometric feature according to the feature type and the attribute information, and traverse all geometric features to obtain a structured sequence.
[0140] The complexity evaluation module 63 is used to evaluate the processing complexity of each geometric feature in the structured sequence and obtain the complexity evaluation result corresponding to each geometric feature.
[0141] The feature reasoning module 64 is used to determine the corresponding reasoning model for any geometric feature based on the complexity evaluation result of the geometric feature, and use the reasoning model to reason about the geometric feature to obtain the processing instruction sequence corresponding to the geometric feature.
[0142] The file generation module 65 is used to traverse all geometric features, obtain the machining instruction sequence of all geometric features, and generate an execution machining code file based on all machining instruction sequences.
[0143] Optionally, the geometric entity analysis module 61 includes:
[0144] The entity space determination unit is used to determine the entity space features between the geometric entities based on the geometric features.
[0145] The geometric entity aggregation unit is used to aggregate the geometric entities according to preset rules and the spatial features of the entities to obtain aggregated geometric entities;
[0146] The feature sequence determination unit is used to analyze the aggregated geometric entity and determine the processing feature sequence composed of the geometric features corresponding to the geometric entity, where N is an integer greater than zero.
[0147] Optionally, the structured sequence generation module 62 includes:
[0148] The attribute information processing unit is used to process the attribute information according to preset format rules to obtain attribute standard information.
[0149] The structured sequence acquisition unit is used to acquire a preset text template, fill the text template with the attribute standard information and the feature type to obtain the structured expression corresponding to the geometric feature, and traverse all geometric features to obtain a structured sequence.
[0150] Optionally, the complexity evaluation module 63 includes:
[0151] A processing complexity level determination unit is used to analyze the feature type and determine the processing complexity level of the geometric feature;
[0152] The dimension tolerance complexity determination unit is used to extract dimension tolerance information from the processing feature sequence and determine the dimension tolerance complexity of the geometric feature based on the dimension tolerance information.
[0153] The attribute complexity score determination unit is used to calculate the feature intrinsic attribute complexity score of the geometric feature based on the processing complexity level and the dimensional tolerance complexity.
[0154] Optionally, the complexity evaluation module 63 includes:
[0155] A spatial position relationship acquisition unit is used to extract the spatial position relationship of the geometric features in the processing feature sequence;
[0156] A relation complexity determination unit is used to determine the spatial relation complexity of the geometric feature based on the spatial positional relationship.
[0157] The complexity score calculation unit is used to calculate the complexity score corresponding to each geometric feature based on the complexity score of the feature's intrinsic attribute and the complexity of the spatial relationship, and use this as the complexity evaluation result.
[0158] Optionally, the feature reasoning module 64 includes:
[0159] An evaluation and classification unit is used to classify the complexity evaluation results according to a preset processing threshold to obtain a processing level;
[0160] The model level determination unit is used to determine the inference model level based on the processing level.
[0161] The reasoning unit is used to reason about the geometric features using the reasoning model corresponding to the reasoning model level, and obtain the processing instruction sequence corresponding to the geometric features.
[0162] Optionally, the file generation module 65 includes:
[0163] The compilation unit is used to compile the processing instruction sequence according to preset processing rules to obtain compilation instructions;
[0164] The instruction processing unit is used to process the compilation instructions to obtain the processed code file.
[0165] It should be noted that the information interaction and execution process between the above modules, units, and sub-units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0166] Figure 7 This is a schematic diagram of the structure of a computer device provided in Embodiment Seven of this application. Figure 7 As shown, the computer device of this embodiment includes: at least one processor ( Figure 7 Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor. When the processor executes the computer program, it implements the steps of any of the above-described CNC code generation methods or embodiments of CNC code generation methods.
[0167] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 7 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0168] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0169] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of the computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0170] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0171] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, it enables the computer device to execute the steps in the above method embodiments.
[0172] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0173] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0174] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0175] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0176] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for generating numerical control codes, characterized in that, include: Obtain the drawing file to be processed, parse the drawing file to obtain N geometric entities, identify each geometric entity, and obtain the processing feature sequence composed of the geometric features corresponding to each geometric entity, where N is an integer greater than zero; Obtain a preset feature type library; for any geometric feature in the processing feature sequence, match the feature type of the geometric feature from the feature type library; extract the attribute information of the geometric feature according to the feature type; generate a structured representation of the corresponding geometric feature according to the feature type and the attribute information; traverse all geometric features to obtain a structured sequence. The processing complexity of each geometric feature in the structured sequence is evaluated to obtain the complexity evaluation result for each geometric feature. For any geometric feature, a corresponding inference model is determined based on the complexity evaluation result of the geometric feature. The inference model is then used to infer the geometric feature to obtain a processing instruction sequence corresponding to the geometric feature. Traverse all geometric features to obtain the machining instruction sequence for all geometric features, and generate the execution machining code file based on all machining instruction sequences; The step of generating a structured representation corresponding to the geometric feature based on the feature type and the attribute information, and traversing all geometric features to obtain a structured sequence includes: The attribute information is processed according to preset format rules to obtain attribute standard information; Obtain a preset text template, fill the text template with the attribute standard information and the feature type to obtain a structured expression corresponding to the geometric feature, and traverse all geometric features to obtain a structured sequence; The preset text template is a text frame pre-designed for each feature type, including a description section and placeholders; Fill the attribute standard information and feature type into the corresponding placeholders in the text template to generate a structured representation of the geometric features. Add the generated structured representation to a list to obtain a structured sequence. The process of evaluating the processing complexity of each geometric feature in the structured sequence to obtain the complexity evaluation result for each geometric feature includes: Obtain the trained complexity evaluation model, take the attribute information of geometric features and the relationship between features as input, and output the complexity evaluation result of geometric features.
2. The CNC code generation method according to claim 1, characterized in that, The drawing file is parsed to obtain N geometric entities. Each geometric entity is identified to obtain a processing feature sequence composed of the geometric features corresponding to each geometric entity, where N is a positive integer, including: Based on the geometric features, determine the spatial characteristics of the entities between the geometric entities; According to preset rules and combined with the spatial features of the entity, the geometric entities are aggregated to obtain aggregated geometric entities; The aggregated geometric entities are analyzed to determine the processing feature sequence composed of the geometric features corresponding to the geometric entities, where N is an integer greater than zero.
3. The CNC code generation method according to claim 1, characterized in that, The process of evaluating the processing complexity of each geometric feature in the structured sequence to obtain the complexity evaluation result for each geometric feature includes: The feature types are analyzed to determine the processing complexity level of the geometric features; Extract the dimensional tolerance information from the processing feature sequence, and determine the dimensional tolerance complexity of the geometric feature based on the dimensional tolerance information; The feature intrinsic attribute complexity score of the geometric feature is calculated based on the processing complexity level and the dimensional tolerance complexity.
4. The CNC code generation method according to claim 3, characterized in that, The process of evaluating the processing complexity of each geometric feature in the structured sequence to obtain the complexity evaluation result for each geometric feature includes: Extract the spatial positional relationship of the geometric features in the processing feature sequence; Based on the spatial positional relationships, determine the spatial relationship complexity of the geometric features; The complexity score for each geometric feature is calculated based on the complexity score of its intrinsic attributes combined with the complexity of its spatial relationships, and this is used as the complexity evaluation result.
5. The CNC code generation method according to claim 1, characterized in that, The step of determining the corresponding inference model based on the complexity evaluation result of the geometric feature, and using the inference model to infer the geometric feature to obtain the processing instruction sequence corresponding to the geometric feature includes: Based on a preset processing threshold, the complexity assessment results are classified to obtain a processing level; The inference model level is determined based on the processing level. Using the reasoning model corresponding to the reasoning model level, reasoning is performed on the geometric features to obtain the processing instruction sequence corresponding to the geometric features.
6. The CNC code generation method according to any one of claims 1 to 5, characterized in that, The step of generating the execution processing code file based on all processing instruction sequences includes: According to preset processing rules, the processing instruction sequence is compiled to obtain compilation instructions; The compilation instructions are then processed to obtain the executable processing code file.
7. A numerical control code generation device, characterized in that, include: The geometric entity analysis module is used to acquire the drawing file to be processed, parse the drawing file to obtain N geometric entities, identify each geometric entity, and obtain the processing feature sequence composed of the geometric features corresponding to each geometric entity, where N is an integer greater than zero; The structured sequence generation module is used to obtain a preset feature type library, match the feature type of any geometric feature in the processing feature sequence with the feature type library, extract the attribute information of the geometric feature according to the feature type, generate a structured expression corresponding to the geometric feature according to the feature type and the attribute information, and traverse all geometric features to obtain a structured sequence. The complexity evaluation module is used to evaluate the processing complexity of each geometric feature in the structured sequence and obtain the complexity evaluation result for each geometric feature. The feature reasoning module is used to determine the corresponding reasoning model for any geometric feature based on the complexity evaluation result of the geometric feature, and to use the reasoning model to reason about the geometric feature to obtain the processing instruction sequence corresponding to the geometric feature. The file generation module is used to traverse all geometric features, obtain the machining instruction sequence of all geometric features, and generate the execution machining code file based on all machining instruction sequences; The structured sequence generation module includes: The attribute information processing unit is used to process the attribute information according to preset format rules to obtain attribute standard information. The structured sequence acquisition unit is used to acquire a preset text template, fill the text template with the attribute standard information and the feature type to obtain a structured expression corresponding to the geometric feature, and traverse all geometric features to obtain a structured sequence. The preset text template is a text frame pre-designed for each feature type, including a description section and placeholders; Fill the attribute standard information and feature type into the corresponding placeholders in the text template to generate a structured representation of the geometric features. Add the generated structured representation to a list to obtain a structured sequence. The complexity evaluation module includes: Obtain the trained complexity evaluation model, take the attribute information of geometric features and the relationship between features as input, and output the complexity evaluation result of geometric features.
8. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the numerical control code generation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the numerical control code generation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
CAM system for automatically controlling machining center according to drawings
CN117348524A
Code generation task adaptive reasoning method, device and equipment
CN120560664A