G-code automatic multiplexing generation method for encrypted DXF file, electronic device and medium

CN122924764APending Publication Date: 2026-10-16SINOTRUK HUBEI HUAWIN SPECIAL VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611129334.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0004]企业使用的DXF文件通常经过加密处理,使得程序无法直接读取其内部轮廓图形信息,仅能读取文件整体二进制数据

Benefits of technology

突破了现有技术中加密DXF图纸无法自动识别、匹配的技术限制,可自主区分复用零件图纸与全新零件图纸;通过建立标准化的匹配库,且程序自动完成匹配库维护、扩充,不会出现人工遗漏归档G代码的情况,历史成熟G代码可长期留存,为后续订单程序复用提供数据基础。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122924764A_ABST
    Figure CN122924764A_ABST
Patent Text Reader

Abstract

The application discloses a G code automatic multiplexing generation method for encrypted DXF files, and comprises the following steps: S0, an MD5 matching library is established in advance; S1, for the encrypted DXF file to be processed, the global MD5 value of the file is calculated based on the overall byte stream of the file; S2, the MD5 matching library is called, and for the encrypted DXF file to be processed, it is searched whether there is a folder named by the MD5 value of the encrypted DXF file in the MD5 matching library, if yes, step S3a is entered, otherwise, step S3b is entered; S3a, the G code TXT file stored in the matched folder is read; S3b, the G code TXT file corresponding to the encrypted DXF file is generated by the staff operation, after the staff operation is completed, a folder named by the MD5 value of the encrypted DXF file is automatically established in the MD5 matching library, and the G code TXT file is stored in the folder; S4, the processing instruction is automatically extracted based on the G code TXT file corresponding to the encrypted DXF file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer-aided manufacturing technology, specifically to a method for automatically reusing and generating G-code in encrypted DXF files, an electronic device, and a medium. Background Technology

[0002] In the sheet metal processing and manufacturing industry, plasma cutting is a key process for processing sheet metal into parts, and its material preparation efficiency directly affects the smooth operation of subsequent production processes. Therefore, improving the efficiency of plasma cutting preparation has always been a key focus of optimization in this stage. Efficient material preparation not only speeds up the production pace but also lays a solid foundation for subsequent processes.

[0003] Currently, in plasma cutting processes, only G-code can be read for cutting, while the design end typically provides DXF drawing files. This requires the process team to manually convert each DXF program into G-code using CAM (Computer-Aided Manufacturing) software. G-code is a standardized machining instruction text that CNC cutting machine tools can recognize. It is stored as a TXT file and contains machining instructions such as cutting motion coordinates, cutting compensation, and start / stop control. It is the program file for the machine tool to execute the part cutting operation and is generated by CAM software after processing the DXF file. DXF is a common industrial two-dimensional drawing file format used to carry the internal and external contour graphic data of parts.

[0004] DXF files used by enterprises are typically encrypted, preventing programs from directly reading their internal contour graphics information; only the overall binary data of the file can be read. Therefore, in existing technology, for each part in each order, the DXF file must be manually converted step-by-step using CAM software to generate a TXT file containing G-code. This process relies entirely on manual intervention, including DXF import, setting internal and external contour cutting compensation parameters, arranging the shortest idle path (internal to external), selecting the points for each contour's lead-in and lead-out lines, and exporting the code. This results in a complex and error-prone process, and the program generation is time-consuming. Especially when order volume is large and the number of programs to be converted is high, the programming efficiency of new employees is often low. This process is not only time-consuming and labor-intensive but also significantly increases the risk of human error, thus affecting the overall production schedule.

[0005] Therefore, there is an urgent need for a method to automatically reuse and generate G-code for encrypted DXF files, so as to quickly obtain the G-code corresponding to the encrypted DXF file. Summary of the Invention

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A method for automatically reusing and generating G-code for encrypted DXF files includes the following steps: S0. Pre-establish an MD5 matching library, which contains multiple folders. Each folder is named according to the MD5 value of the DXF file, and the folder stores the corresponding G code TXT file of the DXF file. S1. For the encrypted DXF file to be processed, calculate its global MD5 value based on the overall byte stream of the file. S2. Retrieve the MD5 matching library. For the encrypted DXF file to be processed, search the MD5 matching library to see if there is a folder named with the MD5 value of the encrypted DXF file. If it exists, proceed to step S3a; otherwise, proceed to step S3b. S3a. Read the G code TXT file stored in the folder where the match was successfully completed, and proceed to step S4; S3b: The staff generates the G code TXT file corresponding to the encrypted DXF file. After the staff completes the operation, a folder named after the MD5 value of the encrypted DXF file is automatically created in the MD5 matching library, and the G code TXT file is stored in the folder. Then proceed to step S4. S4. Based on the G-code TXT file corresponding to the encrypted DXF file, automatically extract the processing instructions.

[0007] Furthermore, if there are a batch of encrypted DXF files to be processed, before step S1, the root folder path of the orders to be processed input from the process side is received, and each encrypted DXF file to be processed in the root folder of the orders is automatically traversed to generate a list of DXF files. In subsequent steps S1-S4, each encrypted DXF file to be processed is processed sequentially.

[0008] Furthermore, in step S0, the MD5 matching library is stored in a local fixed path.

[0009] Furthermore, in step S3a, a temporary folder corresponding to the encrypted DXF file is automatically created under the order root folder. The name of the temporary folder contains the information of successful matching, and the encrypted DXF file and the successfully matched G code TXT file are automatically stored in the temporary folder.

[0010] Furthermore, in step S3b, a temporary folder corresponding to the encrypted DXF file is automatically created under the order root folder. The name of the temporary folder contains information about the failed match. The staff stores the encrypted DXF file and the corresponding G-code TXT file in the temporary folder. After the staff completes the operation, a folder named after the MD5 value of the encrypted DXF file is automatically created in the MD5 matching library, and the G code TXT file in the temporary folder is copied to the newly created folder.

[0011] Furthermore, in step S4, a preview thumbnail corresponding to the encrypted DXF file is generated based on the files in the temporary folder, and process parameters are extracted. The encrypted DXF file name, preview thumbnail, and process parameters are all written into the process verification data table to complete the automatic data archiving.

[0012] Another aspect of the present invention provides an electronic device, comprising: A memory that stores computer programs; At least one processor is adapted to implement the method for automatically reusing and generating G-code for encrypted DXF files as described above when executing the computer program.

[0013] In another aspect, the present invention provides a computer-readable storage medium storing a computer program that is executed by a processor using the above-described method for automatically reusing and generating G-code for encrypted DXF files.

[0014] Compared with existing technologies, the method, electronic device, and medium for automatically reusing and generating G-code for encrypted DXF files provided by this invention have at least the following technical advantages: It overcomes the technical limitations of existing technologies that cannot automatically identify and match encrypted DXF drawings, and can autonomously distinguish between reused part drawings and brand new part drawings. By establishing a standardized matching library, and with the program automatically maintaining and expanding the matching library, there will be no situation where manual omission of archived G-codes will occur. Historical mature G-codes can be retained for a long time, providing a data foundation for the reuse of subsequent order programs.

[0015] The manual process of retrieving and filtering DXF drawings one by one is eliminated, significantly reducing the amount of manual work in the preprocessing of drawings for batch orders; the drawings are processed in a unified manner by relying on fixed retrieval logic, eliminating the risk of omissions and misjudgments caused by manual comparison of drawings; the number of manual operation nodes in the overall process is greatly reduced, and the probability of errors caused by human operation is significantly reduced.

[0016] Only brand-new non-standard parts require a complex CAM operation. For reusable standardized parts, the cumbersome manual configuration steps in the CAM software are completely eliminated, and the time required for converting a single part program is significantly reduced. Mature G-code that has been verified by historical orders is reused to avoid program errors caused by repeated manual settings. The program automatically collects and summarizes processing instructions, eliminating the need for manual data processing and verification, and facilitating process check. Attached Figure Description

[0017] Figure 1 A flowchart illustrating a method for automatically reusing and generating G-code for encrypted DXF files provided by the present invention; Figures 2-4This is a screenshot of the software running in a real-world example corresponding to the present invention. Detailed Implementation

[0018] To make the technical means, creative features, objectives and effects of this invention easier to understand, the following description, in conjunction with the accompanying drawings and specific embodiments, further explains how this invention is implemented.

[0019] In one specific embodiment, refer to Figure 1 As shown, this invention provides a method for automatically reusing and generating G-code for encrypted DXF files, comprising the following steps: S0. Pre-establish an MD5 matching library. The MD5 matching library can be stored in a fixed local path. The MD5 matching library contains multiple folders. Each folder is named after the MD5 value of the DXF file and contains the corresponding G code TXT file of the DXF file.

[0020] It is understandable that the global MD5 value of a DXF file can be calculated based on the entire byte stream of the DXF file, without parsing the encrypted content such as the internal outline, layers, and cutting paths of the DXF file. Each DXF file has a unique MD5 value, which serves as the unique identification feature of the corresponding DXF file. When establishing an MD5 matching library, staff can use CAM software to complete operations such as configuring cutting parameters, planning paths, and setting lead-in and lead-out lines for the DXF file. After generating the corresponding G-code TXT file, the G-code TXT file is stored in a folder named after the MD5 code corresponding to the DXF file, thereby establishing a one-to-one correspondence between the MD5 feature code and the G-code of the encrypted DXF file.

[0021] Before officially starting to process encrypted DXF files, if there are a batch of encrypted DXF files to be processed, the system receives the root folder path of the order to be processed from the process side, automatically traverses each encrypted DXF file to be processed in the root folder, generates a DXF file list, and completes the unified loading of batch drawings without the need for manual import of DXF files one by one. Subsequently, each encrypted DXF file to be processed is processed sequentially according to the following steps S1-S4.

[0022] S1. For the encrypted DXF file to be processed, calculate its global MD5 value based on the overall byte stream of the file.

[0023] S2. Retrieve the MD5 matching library. For the currently encrypted DXF file to be processed, search the MD5 matching library to see if there is a folder named after the MD5 value of the encrypted DXF file. If it exists, proceed to step S3a; otherwise, proceed to step S3b.

[0024] Understandably, this matching method does not require parsing and reading the internal contour data of the encrypted DXF file. It only relies on the overall MD5 value of the file to complete feature binding, thus avoiding the limitation that encrypted files cannot be parsed and read. Therefore, it can bypass the limitation that enterprise DXF files are encrypted and their internal contour data cannot be read, and achieve lossless differentiation and identity determination of different DXF files.

[0025] S3a. Read the G code TXT file stored in the folder where the match was successfully matched, and proceed to step S4.

[0026] Furthermore, a temporary folder corresponding to the encrypted DXF file is automatically created under the root folder of the order. The name of the temporary folder includes the information of successful matching, such as "order folder name_DXF file name_success_MD5 value". The temporary folder automatically stores the encrypted DXF file and the successfully matched G code TXT file, eliminating the need for manual copying and pasting of files throughout the process.

[0027] Understandably, if the MD5 matching library contains a folder with the same MD5 value, it can be determined that the encrypted DXF file to be processed is completely consistent with the historical reused DXF file. Therefore, the pre-stored G-code TXT file in the folder can be directly retrieved and put into production without repeating CAM manual programming.

[0028] S3b. The staff generates the corresponding G-code TXT file for the encrypted DXF file. In addition, a temporary folder corresponding to the encrypted DXF file is automatically created in the root folder of the order. The name of the temporary folder includes information about the failure to match, such as "order folder name_DXF file name_fail_MD5 value". The staff stores the encrypted DXF file and the corresponding G-code TXT file in the temporary folder.

[0029] Understandably, if the MD5 matching library does not contain a folder with the same MD5 value, the encrypted DXF file to be processed can be determined to be a brand new DXF file of a new specification, thus requiring the initiation of the complete CAM manual programming process. Workers can use the CAM software to complete operations such as configuring internal and external contour cutting compensation, optimizing cutting paths, and selecting lead-in / lead-out point positions to generate the corresponding G-code TXT file and store it in a temporary folder.

[0030] After the staff completes the operation, a folder named after the MD5 value of the encrypted DXF file is automatically created in the MD5 matching library. The G-code TXT file in the temporary folder is copied to the newly created folder (only the G-code TXT file is extracted from the newly created folder, and other contents in the temporary folder are automatically removed). This completes the update of the MD5 matching library, which can be reused for subsequent orders. Then, the process proceeds to step S4. After the MD5 matching library is updated, if a DXF file of this specification is encountered again, it is not necessary to repeat the above manual operation.

[0031] S4. Based on the encrypted DXF file and the corresponding G-code TXT file in the temporary folder, automatically extract the processing instructions.

[0032] Furthermore, based on the files in the temporary folder, a preview thumbnail corresponding to the encrypted DXF file is generated, and process parameters (such as part size, cutting length, etc.) are extracted. The encrypted DXF file name, preview thumbnail, and process parameters are all written into the process verification data table to complete the automatic data archiving for staff to verify the correctness of the procedure later.

[0033] In this embodiment, the automatic reuse generation method for G-code of encrypted DXF files provided by the present invention can utilize a py script developed in Python to compile into a corresponding exe application. After running the exe, the user can select the order folder to be converted, and the matched DXF files inside can be converted into G-code in batches. The process is simple and the generation speed is fast.

[0034] In a specific case, refer to Figures 2-4 As shown, Figure 2 The diagram shows the interface of the corresponding EXE application for this invention. The program will run in the terminal and display a processing log. (Refer to...) Figure 3 As shown, after steps S2 and S3, the program generates a temporary folder for each encrypted DXF file and uses "fail" or "success" as a prefix to distinguish whether the DXF file has successfully matched the corresponding G-code TXT file. Figure 4 The process verification data table in step S4 is shown. The table contains the encrypted DXF file name, preview thumbnail, and process parameters (part size and cutting length). The data is automatically archived.

[0035] In summary, the automatic reuse and generation method for G-code of encrypted DXF files provided by this invention addresses the technical pain points of existing technologies, such as the inability to directly parse the internal contours of encrypted DXF files, the low efficiency of repeated CAM programming of parts of the same specification, and the susceptibility to errors in manual operation. It achieves the following effects: It overcomes the technical limitations of existing technologies that cannot automatically identify and match encrypted DXF drawings, and can autonomously distinguish between reused part drawings and brand new part drawings. By establishing a standardized matching library, and with the program automatically maintaining and expanding the matching library, there will be no situation where manual omission of archived G-codes will occur. Historical mature G-codes can be retained for a long time, providing a data foundation for the reuse of subsequent order programs.

[0036] The manual process of retrieving and filtering DXF drawings one by one is eliminated, significantly reducing the amount of manual work in the preprocessing of drawings for batch orders; the drawings are processed in a unified manner by relying on fixed retrieval logic, eliminating the risk of omissions and misjudgments caused by manual comparison of drawings; the number of manual operation nodes in the overall process is greatly reduced, and the probability of errors caused by human operation is significantly reduced.

[0037] Only brand-new non-standard parts require a complex CAM operation. For reusable standardized parts, the cumbersome manual configuration steps in the CAM software are completely eliminated, and the time required for converting a single part program is significantly reduced. Mature G-code that has been verified by historical orders is reused to avoid program errors caused by repeated manual settings. The program automatically collects and summarizes processing instructions, eliminating the need for manual data processing and verification, and facilitating process check.

[0038] Another embodiment of the present invention provides an electronic device including a memory and at least one processor adapted to be coupled to the aforementioned memory. The aforementioned memory is adapted to store a computer program, and the aforementioned at least one processor is adapted to implement the G-code automatic reuse generation method for encrypted DXF files as described above when executing the aforementioned computer program. For example, the electronic device may be a server or a terminal device, wherein each processor may be connected to the memory via a universal serial bus.

[0039] Another embodiment of the present invention provides a computer-readable storage medium storing a computer program that is executed by a processor using the method described above for automatically reusing and generating G-code for encrypted DXF files.

[0040] The electronic devices and computer-readable storage media described in the embodiments of the present invention can be found in the detailed description of the implementation and beneficial effects of the method for automatically reusing and generating G-code of encrypted DXF files mentioned above, which will not be repeated here.

[0041] Generally, the computer instructions used to implement the method of the present invention can be carried by any combination of one or more computer-readable storage media. Any storage medium can be temporary or non-temporary, and can include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any combination thereof.

[0042] Computer-readable storage media can be any tangible medium containing a stored program, and more specific examples (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.

[0043] This program can be used, or combined with, an instruction execution system, apparatus, or device, and is written in one or more programming languages ​​or a combination thereof to perform the operations of this invention. The programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. In particular, Python, suitable for neural network computation, and platform frameworks such as TensorFlow and PyTorch can be used. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., via the Internet according to an Internet service provider).

[0044] Finally, it should be noted that the above description is only an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for automatically reusing and generating G-code in encrypted DXF files, characterized in that, Includes the following steps: S0. Pre-establish an MD5 matching library, which contains multiple folders. Each folder is named after the MD5 value of the DXF file and stores the corresponding G-code TXT file in the folder. S1. For the encrypted DXF file to be processed, calculate its global MD5 value based on the overall byte stream of the file. S2. Retrieve the MD5 matching library. For the encrypted DXF file to be processed, search the MD5 matching library to see if there is a folder named with the MD5 value of the encrypted DXF file. If it exists, proceed to step S3a; otherwise, proceed to step S3b. S3a. Read the G code TXT file stored in the folder where the match was successfully matched, and proceed to step S4; S3b: The staff generates the G code TXT file corresponding to the encrypted DXF file. After the staff completes the operation, a folder named after the MD5 value of the encrypted DXF file is automatically created in the MD5 matching library, and the G code TXT file is stored in the folder. Then proceed to step S4. S4. Based on the G-code TXT file corresponding to the encrypted DXF file, automatically extract the processing instructions.

2. The method for automatically reusing and generating G-code for encrypted DXF files according to claim 1, characterized in that, If there are a batch of encrypted DXF files to be processed, before step S1, the root folder path of the orders to be processed input from the process side is received, and each encrypted DXF file to be processed in the root folder of the orders is automatically traversed to generate a list of DXF files. In subsequent steps S1-S4, each encrypted DXF file to be processed is processed sequentially.

3. The method for automatically reusing and generating G-code for encrypted DXF files according to claim 1, characterized in that, In step S0, the MD5 matching library is stored in a local fixed path.

4. The method for automatically reusing and generating G-code for encrypted DXF files according to claim 1, characterized in that, In step S3a, a temporary folder corresponding to the encrypted DXF file is automatically created under the order root folder. The name of the temporary folder contains the information of successful matching, and the encrypted DXF file and the successfully matched G code TXT file are automatically stored in the temporary folder.

5. The method for automatically reusing and generating G-code for encrypted DXF files according to claim 4, characterized in that, In step S3b, a temporary folder corresponding to the encrypted DXF file is automatically created under the order root folder. The name of the temporary folder contains information about the failed match. The staff stores the encrypted DXF file and the corresponding G-code TXT file in the temporary folder. After the staff completes the operation, a folder named after the MD5 value of the encrypted DXF file is automatically created in the MD5 matching library, and the G code TXT file in the temporary folder is copied to the newly created folder.

6. The method for automatically reusing and generating G-code for encrypted DXF files according to claim 5, characterized in that, In step S4, a preview thumbnail corresponding to the encrypted DXF file is generated based on the files in the temporary folder, and process parameters are extracted. The encrypted DXF file name, preview thumbnail, and process parameters are all written into the process verification data table to complete the automatic data archiving.

7. An electronic device, characterized in that, include: A memory that stores computer programs; At least one processor adapted to implement the automatic reuse generation method for G-code of encrypted DXF files as described in any one of claims 1 to 6 when executing the computer program.

8. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by a processor using the automatic reuse generation method for G-code of encrypted DXF files as described in any one of claims 1 to 6.