NX post-processing programming method for realizing NC file automatic organization

By using temporary files to separate and integrate main and subprograms in UG NX systems, the problem of confusing post-processing file structure is solved, and the post-processing program is automatically organized, which improves programming efficiency and quality.

CN119087918APending Publication Date: 2024-12-06西安精雕软件科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310655375.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-05
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The main and subprograms in the post-processing files of UG NX are interspersed with each other, resulting in confusion in the file structure, requiring manual adjustment, which is time-consuming and labor-intensive, affecting programming efficiency and prone to errors.

Method used

By using temporary files to process and integrate the main and subprograms separately, we ensure that the main program and subprograms are output in an orderly manner, the temporary files are used to store the subprogram content, and relevant calling process and process information are written in the main program, and process information is stored using linked lists. , and finally write the content to the complete postprocessor file.

Benefits of technology

It realizes automatic organization of post-processing files, improves programming efficiency and quality, simplifies the operation of process personnel, and ensures the output files are fast, simple, accurate and easy to maintain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119087918A_ABST
    Figure CN119087918A_ABST
Patent Text Reader

Abstract

An NX post-processing programming method for achieving automatic organization of NC files comprises the following steps that (1) a post-processing program group is preset and processed, and before a post-processor traverses each path, a main program file is opened, a corresponding process for calling a subprogram is added to a main program, and the main program file is closed; 2) when traversing the single path, opening the temporary file, writing the content of the subprogram into the temporary file, and after the single path is ended, closing the temporary file; 3) after all paths are traversed, opening the main program file and the temporary file, writing the content of the temporary file into the main program file, and closing the temporary file and the main program file; (4) after all the paths are traversed, data of all the paths are collected, a main program file is opened, and tool information, model information, date information and process information are written into a main program file header, so that machining personnel can rapidly obtain the process information and close the main program file, and (5) the main program file is stored as a post-processing program file, and a temporary file is deleted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of mechanical processing, and in particular relates to an NX post-processing programming method for realizing automatic organization of NC files. Background Art

[0002] In the machining industry, UG (Unigraphics NX) is a product engineering solution produced by Siemens PLM Software, which provides digital modeling and verification methods for users' product design and machining processes. The UG NX machining base module provides a basic framework for connecting all UG machining modules. It provides a same, user-friendly graphical window environment for all UG NX machining modules. Users can observe the movement of the tool along the trajectory in a graphical way and can modify it graphically. All UG software modules can directly generate machining programs on the solid model and keep them fully related to the solid model.

[0003] The post-processing module of UG NX allows users to easily establish their own post-processing programs. This module is suitable for the world's mainstream CNC machine tools and machining centers.

[0004] When the post-processing module processes a program group, it outputs it as a post-processing program file based on the post-processing program group. The single paths in the program group are processed one by one in sequence; the main program needs to set up a calling relationship based on each path, and the subprogram needs to output the processing related information of the single path; when processing a path, the calling relationship is first set up in the main program, and then the subprogram is output. In this way, the main program and the subprogram are interspersed with each other in the post-processing file, which appears to be relatively chaotic in the post-processing file and requires manual adjustment of the order, which is time-consuming and labor-intensive, affects programming and processing efficiency, and is prone to errors. Summary of the invention

[0005] The purpose of the present invention is to provide an NX post-processing programming method for realizing automatic organization of NC files in response to the problems in the above-mentioned prior art, so as to solve the problem that main programs and subprograms are interspersed with each other and post-processing files are messy; the main programs and subprograms are processed separately through temporary files, and then integrated, so as to realize the purpose of orderly output of main programs and subprograms.

[0006] In order to achieve the above-mentioned object, an embodiment of the present invention provides an NX post-processing programming method for realizing automatic organization of NC files, presetting a machining post-processing program group, opening a temporary file at the beginning position of each subroutine of the post-processing program group, and closing the temporary file at the end position of the subroutine; outputting the set post-processing program group to a post-processing program file; the method also includes: 1) At the beginning of the program, verify whether the temporary file in the specified path exists. If it exists, delete it; 2) At the beginning of the program, verify whether the main program file in the specified path exists. If it exists, delete it; 3) When processing a single path of a program group, open the main program file, and add the subroutine calling process related to the path in the program file according to the current path information. The subroutine calling process includes tool changing, opening / closing the probe, calling the subroutine, and listing the path name, but does not include the subroutine content; 4) When calling this subroutine, if you need to call other related auxiliary subroutines, you also need to write the subroutine calling process into the main program; 5) Write other related instructions (such as pause instruction M1) in the main program to assist in subroutine calls; 6) After the current path call and its auxiliary subroutine call are written into the main program, close the main program; 7) Open a temporary file and write the subroutine content and its auxiliary subroutine content into the temporary file. The non-subroutine content must not be included in the writing process. The subroutine number used by the main program to call the subroutine should be consistent with the subroutine number of the subroutine itself to prevent calling errors; 8) When the subroutine ends, the temporary file should be closed. If other operations are performed during the subroutine writing to the temporary file, causing the subroutine to return, the temporary file should be closed; 9) When processing the entire program group, it is necessary to repeat the above steps 3) to 8) until all paths of the program group are processed, open the main program file and the temporary file, and write the temporary file content to the main program file. The temporary file should contain all the subroutines that need to be output, and there should be no other subroutines that have not been written in; 10) When traversing the subroutines in the program group, collect the process information of the relevant path, the process information includes tool name, path name, tool diameter, tool number, tool material, and tool type, and store the process information in a linked list; 11) At the end of the program, open the main program file, write the process information data in the linked list into the file header position in front of the main program in sequence, and close the main program file; 12) Write the subroutine into the main program, open the main program file first, then open the temporary file, copy the temporary file content into the main program file, then close the temporary file, and then close the main program file; 13) After the main program file is output as a complete post-processing program file, delete the temporary file; BRIEF DESCRIPTION OF THE DRAWINGS

[0007] Figure 1 The present invention is based on the NX post-processing builder structure composition diagram; Figure 2 Schematic diagram of practical problems that can be solved by using temporary files in the present invention; Figure 3 Schematic diagram of a specific implementation of the present invention; Implementation

[0008] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages of the present invention from the contents of this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details of this specification can also be modified and changed based on different viewpoints and applications without departing from the main purpose of the present invention.

[0009] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0010] The present invention provides an NX post-processing programming method for realizing automatic organization of NC files, comprising the following steps: 1. Open the NX post-processing builder and create a new post-processing program file, such as Figure 1 As shown, using temporary files can separate the output of the main program and subprograms, making the post-processing files easy to read; 2. If Figure 2 As shown, in the program start sequence, global variables (such as subroutine number, process information array, precision setting, etc.) are defined, and the following steps are also included: 1) Check whether the main program ptp file exists, if so, delete the file; 2) Check whether the temporary file temp exists, if so, delete the file; 3) Define and initialize all global variables; 3. Figure 2 In the process start sequence shown, this is the starting point for processing a single path, defining the variables required by the program group and initializing the variables; 4. Such as Figure 3 As shown, traversing each path of the program group in turn includes the following steps: 1) Open the ptp main program file and add the subroutine call process, such as M98 P5001; 2) Add subroutine auxiliary program calling process, such as M98 P5002; 3) Add auxiliary program instructions to assist in calling subroutines, such as the program pause instruction M1; 4) Set the auxiliary flag variable value to mark whether a subroutine is written, such as a subroutine auxiliary program; 5) Close the ptp main program file and open the temp temporary file; 6) Write the subroutine tool change, movement, milling and other instructions into a temporary file; 7) Write the subroutine auxiliary program to a temporary file; 8) Close temporary files; 9) Record the process information about the path (such as tool name, path name, tool diameter, tool number, tool material, tool type, etc.), and store the process information in the array defined at the beginning of the program; 10) Return to step 4 and continue processing the next path until all paths are processed; 5. Open the main program file and write the process information (such as tool name, path name, tool diameter, tool number, tool material, tool type, etc.) before the main program as a comment for the process personnel to use; 6. Close the main program; 7. Open the main program file, then open the temporary file, and copy the contents of the temporary file to the main program file; 8. Close temporary files and close the main program; 9. Delete temporary files and the program ends.

[0011] To sum up, in the example of the present invention, a temporary file is used to write the subroutine content, and then the subroutine content is written into the main program file, so as to output a complete post-processing program file, thereby achieving the purpose of automatic organization of the output file. In this way, the post-processing program has the characteristics of being fast, simple, accurate, convenient, and easy to maintain, which greatly facilitates the process personnel to perform post-processing output, can improve the programming efficiency and programming quality of the NX system, and is beneficial for the process personnel to perform post-processing inspection and modification.

[0012] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify and change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed by the present invention should still be covered by the claims of the present invention.

Claims

1. A NX post-processing programming method for automatic organization of NC files, It is characterized in that The following steps are involved: 1) Preset the post-processing program group. Before the post-processor traverses each path, open the main program file, add the corresponding process of calling the subroutine to the main program, and close the main program file; 2) When traversing a single path, open a temporary file, write the contents of the subroutine into the temporary file, and close the temporary file after the single path ends; 3) After all paths are traversed, open the main program file and temporary file, write the temporary file content into the main program file, and close the temporary file and main program file; 4) After traversing all paths, collect the data of all paths, open the main program file, write the tool information, model information, date information, and process information into the main program file header to facilitate the processing personnel to quickly obtain the process information, and close the main program file; 5) Save the main program file as a post-processing program file and delete the temporary file.

2. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 1), before opening the main program file for the first time, first check whether the main program file already exists, and if so, delete it to ensure that nothing is written into the main program file.

3. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 1), the process of calling the subroutine includes changing the tool, opening / closing the probe, calling the subroutine, and listing the path name, but does not include the content of the subroutine.

4. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 1), the subroutine number used by the main program to call the subroutine is consistent with the subroutine number of the subroutine itself.

5. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 2), before opening the temporary file for the first time, check whether the temporary file already exists, and delete it if it exists, to ensure that nothing is written into the temporary file; when traversing the subroutine, write all the contents of the subroutine into the temporary file, and the writing process shall not include the contents that are not part of the subroutine.

6. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 3), when the temporary file is written into the main program file, the temporary file should contain all subprograms that need to be output, and there should be no other subprograms that have not been written in.

7. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 3), the order of opening files is: first open the main program file, then open the temporary file, and the order of closing files is: first close the temporary file, then close the main program file.

8. The NX post-processing programming method for realizing automatic organization of NC files according to claim 1, It is characterized in that In the step 4), when traversing the subprograms, the content to be written into the main program file header is stored in a linked list, and when the main program ends, the content of the linked list is written into the main program file header.