A method, system and equipment for generating workpiece machining programs
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]在相关技术中,由于刀补防错的判断需要同时考虑加工部位、刀具相对位置及坐标方向等多重因素,工艺人员必须在编程时反复比对零件图纸与机床坐标系,再手工挑选并输入对应的防错子程序号,不仅工作量大、耗时长,且容易因选区或语句输入错误导致防错失效,最终影响软件后处理的加工精度
[0016]本发明的工件加工程序生成方法、系统及设备,通过在工件加工程序的后处理阶段自动识别区域标签并调用对应的防错子程序,省去了人工判断和输入的步骤,大大缩短了程序生成时间。通过防错子程序的自动调用,显著提升了工件加工程序生成的效率与准确度。具体来说,首先获取待加工工件的三维模型及工艺信息,三维模型及工艺信息作为生成加工程序的基础,通过三维模型提供了工件的几何形状和尺寸,同时,工艺信息包括加工策略、刀具选择、切削参数等关键数据。基于上述数据自动生成包含刀轨数据和区域标签的刀轨信息。其中,刀轨数据详细描述了刀具的运动轨迹和加工参数,而区域标签则标识了加工区域的类型。再根据上述数据,生成待加工工件的初始加工程序,再初始加工程序的基础上,进入在工件加工程序生成的后处理阶段,通过解析区域标签,自动匹配并调用预设的防错子程序,通过自动匹配调用的过程,结合初始加工程序,得到最终的工件加工程序。不仅避免了人工查找和输入防错子程序的繁琐操作,还减少了因人为失误导致的错误,确保了加工程序的准确性和可靠性,通过防错子程序的自动调用使得数控程序能够更好地适应不同工件和机床的加工要求,确保了加工过程的稳定性和一致性。通过分析工件的几何形状和工艺要求,自动调整刀具路径和切削参数,使其更加符合实际加工条件,不仅提升了加工效率,还显著减少了因错误而导致的材料浪费和设备损坏风险,避免因刀具损坏或加工失误导致的废品产生,降低了生产成本。
Smart Images

Figure CN121348969B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machining technology, and more specifically, to a method, system, and equipment for generating workpiece machining programs. Background Technology
[0002] In the field of CNC lathe machining, process engineers generally use software such as UG NX to generate toolpath information and then use a post-processor to convert the toolpath information into a workpiece machining program that the machine tool can recognize. In order to further reduce the scrap rate, tool compensation and error prevention statements are usually inserted manually into the workpiece machining program to ensure that the tool compensation parameters match the actual machining area. This is a routine step in the current CNC programming process.
[0003] In related technologies, since the judgment of tool compensation error prevention needs to consider multiple factors such as the machining part, the relative position of the tool and the coordinate direction, process engineers must repeatedly compare the part drawing and the machine tool coordinate system during programming, and then manually select and input the corresponding error prevention subroutine number. This is not only labor-intensive and time-consuming, but also prone to error prevention failure due to selection area or statement input errors, which ultimately affects the machining accuracy of software post-processing. Summary of the Invention
[0004] The problem addressed by this invention is how to improve the efficiency and accuracy of generating workpiece machining programs.
[0005] To address the above problems, the present invention provides a method, system, and device for generating workpiece machining programs.
[0006] In a first aspect, the present invention provides a method for generating a workpiece machining program, comprising: Obtain the 3D model and process information of the workpiece to be processed; Based on the three-dimensional model of the workpiece to be processed and the process information, the toolpath information of the machining tool for the workpiece to be processed is obtained. The toolpath information includes the toolpath data and area labels of the workpiece to be processed. Based on the toolpath data and the area labels, an initial machining program for the workpiece to be processed is generated; Select the error prevention subroutine corresponding to the region label based on the region label; Based on the error prevention subroutine, combined with the toolpath data and the initial machining program, a workpiece machining program for the workpiece to be machined is generated.
[0007] Optionally, obtaining the toolpath information of the machining tool for the workpiece based on the three-dimensional model of the workpiece and the process information includes: Based on the three-dimensional model, the toolpath corresponding to the machining tool is generated; Based on the process information, the tool parameters and feed and speed information corresponding to the machining tool are generated; Based on the tool path, determine at least one machining position of the machining tool; Based on the processing location, the area label corresponding to the processing location is obtained; The toolpath, tool parameters, and feed and speed information are used as the toolpath data, and the toolpath data and the area label are encapsulated together as the toolpath information.
[0008] Optionally, the initial machining program for the workpiece to be machined is generated based on the toolpath data and the area label: Based on the tool path, tool parameters, and feed and speed information in the toolpath data, multiple program segments are generated; Write a segment identifier at the beginning of each of the program segments; The initial processing procedure is generated by writing a region annotation into the segment identifier based on the region label.
[0009] Optionally, the step of selecting the error-proofing subroutine corresponding to the region label based on the region label includes: The region label is parsed to obtain the region code of the workpiece to be processed; The region code is used as a search key to match the preset region-subroutine mapping table to obtain the subroutine number corresponding to the region code. The error prevention subroutine corresponding to the region label is obtained by retrieving the subroutine number from the preset error prevention subroutine library.
[0010] Optionally, generating the workpiece machining program for the workpiece to be machined based on the error prevention subroutine, combined with the toolpath data and the initial machining program, includes: Based on the region label, the initial processing program is positioned to determine the program segment corresponding to the region label; Insert the error prevention subroutine of the region label into the program segment corresponding to the region label; According to the preset format, the initial processing program after inserting the error prevention subroutine is format-converted to generate the workpiece processing program for the workpiece to be processed.
[0011] Optionally, inserting the error-proofing subroutine of the region label into the program segment corresponding to the region label includes: Obtain the starting coordinates of the program segment; Based on the starting coordinate point and the toolpath data of the machining tool, determine the feed vector of the starting coordinate point; Based on the starting coordinate point and the feed vector, the compensation safety point of the machining tool is generated; The location statement of the compensation safety point is concatenated with the error prevention subroutine to obtain a complete error prevention subroutine, wherein the location statement of the compensation safety point is set before the error prevention subroutine; Insert the complete error-proofing subroutine at the beginning of the program segment.
[0012] Optionally, before selecting the error-proofing subroutine corresponding to the region label based on the region label, the method further includes: The tool tip trajectory coordinate sequence of the machining tool is determined based on the tool path, the tool parameters, and the feed and rotation speed information; Based on the tool tip trajectory coordinate sequence, determine the minimum distance between the machining tool and the workpiece to be machined; When the minimum distance is less than a preset distance threshold, the confidence value of the region label corresponding to the processing position is updated based on the difference between the minimum distance and the preset distance threshold. When the confidence value of the region label is less than a preset threshold, the region label is reconfirmed.
[0013] Optionally, after generating the workpiece machining program for the workpiece to be machined based on the error prevention subroutine, the toolpath data, and the initial machining program, the method further includes: Obtain the macro variable values in the workpiece machining program and the corresponding compensation register values of the machining tool; Based on the comparison between the macro variable value and the compensation register value, it is determined whether the program segment corresponding to the macro variable value has a deviation; If so, then an adaptive compensation correction function is used to generate a compensation correction instruction based on the comparison results; The workpiece machining program is updated by inserting the compensation correction instruction at the end of the program segment.
[0014] In a second aspect, the present invention provides a workpiece machining program generation system, comprising: The model and process information acquisition module is used to acquire the three-dimensional model and process information of the workpiece to be processed; The toolpath information generation module is used to obtain the toolpath information of the machining tool of the workpiece to be machined based on the three-dimensional model of the workpiece to be machined and the process information. The toolpath information includes the toolpath data and area labels of the workpiece to be machined. An initial program generation module is used to generate an initial machining program for the workpiece to be machined based on the toolpath data and the area labels. The error prevention subroutine selection module is used to select the error prevention subroutine corresponding to the region label based on the region label; The CNC program generation module is used to generate a workpiece machining program for the workpiece to be machined based on the error prevention subroutine, the toolpath data, and the initial machining program.
[0015] Thirdly, the present invention provides an electronic device, including a memory and a processor; The memory is used to store computer programs; The processor is configured to implement the workpiece machining program generation method as described above when executing the computer program.
[0016] The workpiece machining program generation method, system, and equipment of the present invention automatically identify area labels and call corresponding error-proofing subroutines in the post-processing stage of the workpiece machining program, eliminating the steps of manual judgment and input, and greatly shortening the program generation time. The automatic invocation of error-proofing subroutines significantly improves the efficiency and accuracy of workpiece machining program generation. Specifically, firstly, the three-dimensional model and process information of the workpiece to be processed are obtained. The three-dimensional model and process information serve as the basis for generating the machining program. The three-dimensional model provides the workpiece's geometry and dimensions, while the process information includes key data such as machining strategies, tool selection, and cutting parameters. Based on the above data, toolpath information containing toolpath data and area labels is automatically generated. The toolpath data details the tool's movement trajectory and machining parameters, while the area labels identify the type of machining area. Then, based on the above data, an initial machining program for the workpiece to be processed is generated. Based on the initial machining program, the post-processing stage of workpiece machining program generation is entered. By parsing the area labels, preset error-proofing subroutines are automatically matched and called. Through this automatic matching and calling process, combined with the initial machining program, the final workpiece machining program is obtained. This not only avoids the tedious manual searching and input of error-proofing subroutines, but also reduces errors caused by human negligence, ensuring the accuracy and reliability of the machining program. The automatic invocation of error-proofing subroutines allows the CNC program to better adapt to the machining requirements of different workpieces and machine tools, ensuring the stability and consistency of the machining process. By analyzing the workpiece's geometry and process requirements, the toolpath and cutting parameters are automatically adjusted to better match the actual machining conditions. This not only improves machining efficiency but also significantly reduces material waste and equipment damage risks caused by errors, avoids scrap due to tool damage or machining errors, and lowers production costs. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the workpiece machining program generation method according to an embodiment of the present invention; Figure 2This is a schematic diagram of a subroutine call according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the workpiece machining program generation system according to an embodiment of the present invention. Detailed Implementation
[0018] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the accompanying drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0019] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0020] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to"; the term "based on" means "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; and the term "optionally" means "optional embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first," "second," etc., mentioned in this invention are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0021] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0022] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties. The collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0023] Combination Figure 1As shown, a workpiece machining program generation method according to an embodiment of the present invention includes: Obtain the 3D model and process information of the workpiece to be processed.
[0024] Specifically, firstly, a 3D model of the workpiece needs to be imported from the design software. In embodiments of this invention, the 3D model is typically in formats such as STEP, IGES, or Parasolid to obtain the precise geometry and dimensions of the workpiece. Simultaneously, process information about the workpiece to be processed is collected, including machining strategies (roughing, finishing, etc.), tool specifications, and cutting parameters (spindle speed, feed rate). This information will serve as a crucial basis for generating the subsequent machining program, ensuring that the generated program meets design requirements and machining specifications.
[0025] Based on the three-dimensional model of the workpiece to be processed and the process information, the toolpath information of the machining tool for the workpiece to be processed is obtained. The toolpath information includes the toolpath data and area labels of the workpiece to be processed.
[0026] Specifically, toolpath planning is performed based on the imported 3D model and collected process information. First, the workpiece's geometric features, such as planes, curved surfaces, and holes, are analyzed to determine appropriate machining strategies. Then, according to the tool type and size, the tool's motion trajectory in the machining area is calculated, generating toolpath data. Simultaneously, the tool feed rate and spindle speed are set in conjunction with process parameters. Furthermore, region tags are embedded in the toolpath information to identify different machining areas, providing necessary information for subsequent error-proofing. In embodiments of this invention, region tags can be obtained by operators by inputting only the machining location, such as "outer diameter" and "right end face," when compiling the workpiece machining program.
[0027] Based on the toolpath data and the area labels, an initial machining program for the workpiece to be processed is generated.
[0028] Specifically, the toolpath, tool parameters, and feed and speed information in the toolpath data are converted into machine tool-recognizable instructions, and program segments are divided and annotated using area labels. The toolpath provides the precise movement trajectory of the tool during machining, while the tool parameters and feed and speed information ensure that the cutting conditions meet the process requirements. The introduction of area labels allows the machining program to perform specific processing for different machining areas. By integrating this information, the generated initial machining program not only contains complete machining instructions but also provides a foundation for subsequent error prevention and program optimization.
[0029] Select the error prevention subroutine corresponding to the region label.
[0030] Specifically, by parsing the region labels in the toolpath information, the current machining region type is identified. Based on a preset region-subroutine mapping table, the corresponding error-prevention subroutine is automatically matched and invoked. Each region label corresponds to specific error-prevention logic, such as checking whether the tool is correctly installed or whether the machining allowance is reasonable. By automatically invoking the error-prevention subroutine, manual intervention is reduced, improving the accuracy and reliability of the machining program and avoiding machining errors caused by incorrect toolpath data.
[0031] Based on the error prevention subroutine, combined with the toolpath data and the initial machining program, a workpiece machining program for the workpiece to be machined is generated.
[0032] Specifically, the error-prevention subroutine code block is inserted into the corresponding position of the toolpath data to generate a complete CNC machining program. Combined with process parameter settings, the initial machining program is optimized, such as adjusting the toolpath to reduce idle travel and optimizing cutting parameters to improve machining efficiency. The final output machining program contains detailed toolpaths, cutting parameters, and error-prevention instructions, which can be directly used for CNC machine tool operations, ensuring high efficiency and accuracy in the machining process.
[0033] In this embodiment of the invention, by automatically identifying region labels and calling corresponding error-proofing subroutines during the post-processing stage of the workpiece machining program, the steps of manual judgment and input are eliminated, greatly shortening the program generation time. The automatic invocation of error-proofing subroutines significantly improves the efficiency and accuracy of workpiece machining program generation. Specifically, firstly, the three-dimensional model and process information of the workpiece to be processed are obtained. The three-dimensional model and process information serve as the basis for generating the machining program. The three-dimensional model provides the workpiece's geometry and dimensions, while the process information includes key data such as machining strategies, tool selection, and cutting parameters. Based on the above data, toolpath information containing toolpath data and region labels is automatically generated. The toolpath data details the tool's movement trajectory and machining parameters, while the region labels identify the type of machining area. Then, based on the above data, an initial machining program for the workpiece to be processed is generated. Based on the initial machining program, the post-processing stage of the workpiece machining program generation begins. By parsing the region labels, the preset error-proofing subroutines are automatically matched and called. Through this automatic matching and calling process, combined with the initial machining program, the final workpiece machining program is obtained. This not only avoids the tedious manual searching and input of error-proofing subroutines, but also reduces errors caused by human negligence, ensuring the accuracy and reliability of the machining program. The automatic invocation of error-proofing subroutines allows the CNC program to better adapt to the machining requirements of different workpieces and machine tools, ensuring the stability and consistency of the machining process. By analyzing the workpiece's geometry and process requirements, the toolpath and cutting parameters are automatically adjusted to better match the actual machining conditions. This not only improves machining efficiency but also significantly reduces material waste and equipment damage risks caused by errors, avoids scrap due to tool damage or machining errors, and lowers production costs.
[0034] Optionally, obtaining the toolpath information of the machining tool for the workpiece based on the three-dimensional model of the workpiece and the process information includes: Based on the three-dimensional model, the toolpath corresponding to the machining tool is generated; Based on the process information, the tool parameters and feed and speed information corresponding to the machining tool are generated; Based on the tool path, determine at least one machining position of the machining tool; Based on the processing location, the area label corresponding to the processing location is obtained; The toolpath, tool parameters, and feed and speed information are used as the toolpath data, and the toolpath data and the area label are encapsulated together as the toolpath information.
[0035] Specifically, firstly, a toolpath is generated based on the 3D model, precisely describing the tool's trajectory during machining. The 3D model provides the workpiece's geometry and dimensions, forming the basis for generating an accurate toolpath. Secondly, tool parameters and feed and spindle speed information are generated based on process information, including machining strategies, tool selection, and cutting parameters, which directly affect machining efficiency and quality. Next, at least one machining position is determined by analyzing the toolpath; these positions are the actual machining points where the tool contacts the workpiece. Based on the machining position, corresponding area labels are obtained, identifying the type of machining area, such as "outer diameter," "inner diameter," or "right end face." Finally, the toolpath, tool parameters, feed and spindle speed information are packaged together with the area labels as toolpath data, providing comprehensive data support for subsequent post-processing.
[0036] In this embodiment of the invention, the accuracy of the tool movement trajectory is ensured by generating toolpaths based on a 3D model, reducing machining errors caused by improper path planning. Furthermore, the tool parameters and feed and speed information generated by combining process information optimize cutting conditions during machining, improving machining efficiency and surface quality. By analyzing the toolpath to determine the machining location and assigning area labels, subsequent post-processing can automatically identify the machining area and call the corresponding error-prevention subroutines, reducing manual intervention and lowering the error rate.
[0037] Optionally, the initial machining program for the workpiece to be machined is generated based on the toolpath data and the area label: Based on the tool path, tool parameters, and feed and speed information in the toolpath data, multiple program segments are generated; Write a segment identifier at the beginning of each of the program segments; The initial processing procedure is generated by writing a region annotation into the segment identifier based on the region label.
[0038] Specifically, multiple program segments are generated based on the toolpath, tool parameters, and feed and spindle speed information in the toolpath data. Each program segment represents an independent operation or machining step in the machining process. Next, a segment identifier is written at the beginning of each program segment. These identifiers are used to mark and distinguish different program segments, facilitating subsequent location and modification. Then, area comments are written in the segment identifiers according to area labels. These comments provide additional information about the machining area, such as "outer diameter," "inner diameter," and "right end face," making the program more readable and traceable. Through these steps, the initial machining program is finally generated, providing a foundation for subsequent error-proofing subroutines and format conversion. This process ensures the structure and standardization of the initial machining program, facilitating subsequent automated processing.
[0039] In this embodiment of the invention, by decomposing the toolpath data into multiple program segments and writing a segment identifier at the beginning of each segment, the program structure becomes clearer, facilitating subsequent location and modification. Secondly, by writing region comments in the segment identifiers, the readability and traceability of the program are enhanced, helping to quickly identify and locate specific machining areas. This not only improves program generation efficiency but also reduces errors and debugging time caused by a chaotic program structure.
[0040] Optionally, the step of selecting the error-proofing subroutine corresponding to the region label based on the region label includes: The region label is parsed to obtain the region code of the workpiece to be processed; The region code is used as a search key to match the preset region-subroutine mapping table to obtain the subroutine number corresponding to the region code. The error prevention subroutine corresponding to the region label is obtained by retrieving the subroutine number from the preset error prevention subroutine library.
[0041] Specifically, in CNC machining, to reduce scrap losses caused by human error, process engineers need to add tool compensation and error prevention features to the CNC program. This process is tedious and prone to errors. Therefore, this invention significantly improves the efficiency and accuracy of machining program generation by parsing region labels and automatically matching and calling error-prevention subroutines. Specifically, the region labels are first parsed to extract region codes representing the machining region type, such as "outer diameter" or "end face." Then, using this region code as the search key, a matching process is performed in a preset region-subroutine mapping table to quickly find the corresponding subroutine number. Finally, the corresponding error-prevention subroutine is retrieved from a preset error-prevention subroutine library based on the subroutine number. This process not only avoids the tedious manual searching and input of error-prevention subroutines but also reduces errors caused by human error, ensuring the accuracy and reliability of the machining program. Through automated processing, program generation time is greatly shortened, while machining efficiency and quality are improved.
[0042] In a preferred embodiment of the present invention, the CNC lathe achieves machining of parts through the relative movement of the cutting tool and the workpiece. The spindle axis is taken as the Z-axis (axial direction), and the direction in which the cutting tool moves away from the workpiece is the positive Z-axis direction. The direction perpendicular to the Z-axis and pointing towards the center of the workpiece is the X-axis (radial direction), and the direction in which the cutting tool moves away from the center of the workpiece is the positive X-axis direction. That is, during external diameter machining, the outward movement of the cutting tool is the positive X-axis direction. Combined with... Figure 2As shown, based on the coordinate direction of the CNC lathe, the machining area is defined as four different regions. Different error-proofing subroutines are selected for different machining areas according to the actual situation. For machining the inner hole of the part, i.e. the internal end face, O0003 can be selected. When machining a semi-closed surface or multi-region machining, multiple error-proofing subroutines O0001 and O0003 can be selected. When the tool moves radially away from the center of the workpiece and simultaneously feeds in the negative axial direction, it is determined that the current machining area is the right end face of the outer circle. At this time, the error-proofing subroutine corresponding to region 00004 is called and executed.
[0043] In this embodiment of the invention, region codes are extracted by parsing region labels, ensuring accurate identification of processing regions. A preset region-subroutine mapping table is used for rapid matching, improving the efficiency of finding error-proofing subroutines. By extracting corresponding error-proofing subroutines from a preset error-proofing subroutine library, the accuracy and reliability of the error-proofing subroutines are ensured. This process not only reduces manual intervention and lowers the error rate but also increases the speed of processing program generation, ensuring the stability and consistency of the processing process.
[0044] Optionally, generating the workpiece machining program for the workpiece to be machined based on the error prevention subroutine, combined with the toolpath data and the initial machining program, includes: Based on the region label, the initial processing program is positioned to determine the program segment corresponding to the region label; Insert the error prevention subroutine of the region label into the program segment corresponding to the region label; According to the preset format, the initial processing program after inserting the error prevention subroutine is format-converted to generate the workpiece processing program for the workpiece to be processed.
[0045] Specifically, based on the region labels, the corresponding program segments are precisely located in the initial machining program to ensure that the error-proofing subroutines are accurately inserted into the designated positions. Next, the error-proofing subroutines corresponding to the region labels are inserted into the located program segments; this operation is completed automatically, avoiding errors that might occur due to manual intervention. Finally, the system converts the initial machining program after inserting the error-proofing subroutines according to a preset format to generate the final workpiece machining program, ensuring that it conforms to the execution standards of CNC machine tools. The entire process, through automation and precise positioning technology, achieves efficient integration of error-proofing subroutines, improving the accuracy and reliability of the machining program.
[0046] In this embodiment of the invention, the initial machining program is automatically generated and the program segment corresponding to the area label is accurately located, avoiding the tedious operation of manual searching and input, and saving a lot of time. Automatic insertion of error-proofing subroutines ensures safety during the machining process and effectively avoids the generation of scrap products due to tool damage or machining errors. The generation of machining programs that conform to machine tool execution standards through format conversion ensures the smooth progress of the machining process.
[0047] Optionally, inserting the error-proofing subroutine of the region label into the program segment corresponding to the region label includes: Obtain the starting coordinates of the program segment; Based on the starting coordinate point and the toolpath data of the machining tool, determine the feed vector of the starting coordinate point; Based on the starting coordinate point and the feed vector, the compensation safety point of the machining tool is generated; The location statement of the compensation safety point is concatenated with the error prevention subroutine to obtain a complete error prevention subroutine, wherein the location statement of the compensation safety point is set before the error prevention subroutine; Insert the complete error-proofing subroutine at the beginning of the program segment.
[0048] In an embodiment of the invention, firstly, the starting coordinate point of the program segment is obtained. This coordinate point represents the position of the tool when it begins executing the program segment during machining. Then, based on this starting coordinate point and toolpath data, the feed vector, i.e., the direction and angle at which the tool enters the workpiece, is determined. Next, based on the starting coordinate point and the feed vector, a compensation safety point for the machining tool is calculated. This compensation safety point ensures that the tool is in a safe position before the error-proofing subroutine is called, preventing collisions between the tool and the workpiece or fixture. Then, the positioning statement for the compensation safety point is concatenated with the error-proofing subroutine to form a complete error-proofing subroutine. The positioning statement for the compensation safety point is placed before the error-proofing subroutine to ensure that the tool moves to a safe position first. Finally, the complete error-proofing subroutine is inserted at the beginning of the program segment to ensure that error-proofing checks are performed first during machining, thereby improving the safety and reliability of the machining process.
[0049] In this embodiment of the invention, by accurately obtaining the starting coordinates of the program segment and calculating the feed vector, the accuracy and safety of the tool when entering the machining area are ensured. The introduction of a compensation safety point effectively avoids potential collisions when the tool calls the error-proofing subroutine, protecting both the tool and the machine tool. Finally, the complete error-proofing subroutine is inserted at the beginning of the program segment, ensuring that error-proofing checks are performed first during machining, promptly identifying and correcting potential errors, and preventing machining failures due to incorrect toolpath data.
[0050] Optionally, before selecting the error-proofing subroutine corresponding to the region label based on the region label, the method further includes: The tool tip trajectory coordinate sequence of the machining tool is determined based on the tool path, the tool parameters, and the feed and rotation speed information; Based on the tool tip trajectory coordinate sequence, determine the minimum distance between the machining tool and the workpiece to be machined; When the minimum distance is less than a preset distance threshold, the confidence value of the region label corresponding to the processing position is updated based on the difference between the minimum distance and the preset distance threshold. When the confidence value of the region label is less than a preset threshold, the region label is reconfirmed.
[0051] Specifically, firstly, based on the toolpath, tool parameters, and feed and spindle speed information, the trajectory coordinate sequence of the tool tip is determined. This is equivalent to simulating and confirming the actual movement trajectory of the tool. Then, using the trajectory coordinate sequence, the minimum distance between the tool and the workpiece is calculated to determine whether the tool will get too close to the workpiece during machining, potentially leading to collisions or machining errors. If this minimum distance is less than a preset threshold, the confidence value of the corresponding machining location's area label is dynamically adjusted based on the difference. The confidence value represents the degree of trust in the accuracy and reliability of the area label and is quantified numerically. The confidence value reflects the likelihood that the area label correctly identifies the machining area and is dynamically adjusted in conjunction with the minimum distance calculated from the tool tip trajectory coordinate sequence. During normal machining, if the area label matches the actual machining area, the confidence value is high; when a deviation occurs, the confidence value decreases. When the confidence value falls below the preset threshold, the system initiates a secondary confirmation to ensure label accuracy. This mechanism improves the reliability of the machining program, reduces machining errors caused by labeling mistakes, and enhances the stability and safety of the machining process. This invention introduces an intelligent verification and feedback mechanism into the existing automated process, enabling the system to self-detect potential errors and correct them promptly, thereby improving the overall reliability and accuracy of the machining. Furthermore, after determining the minimum distance between the machining tool and the workpiece based on the tool tip trajectory coordinate sequence, if the minimum distance is greater than or equal to a preset distance threshold, it indicates that the safe distance between the tool and workpiece under the current machining settings is sufficient, and there is no risk of collision. In this case, there is no need to adjust the confidence value of the area label; the corresponding error-proofing subroutine will be selected directly based on the area label. After updating the confidence value of the area label, if the confidence value of the area label is greater than a preset threshold, it indicates that the accuracy of the area label has a high degree of confidence, and it is believed that the area label can correctly reflect the characteristics of the machining area. In this case, the corresponding error-proofing subroutine will be selected directly based on the area label.
[0052] In a preferred embodiment of the present invention, the system calculates the trajectory coordinate sequence of the tool tip during the machining process based on the tool path, tool parameters, and feed and rotational speed information. For example, the trajectory coordinate sequence of the tool tip is: ; Analyze the tool tip trajectory coordinate sequence to calculate the minimum distance between the tool and the workpiece. The calculated minimum distance is: Preset distance threshold ,For example, Millimeters.
[0053] if According to and The difference between the values updates the confidence level of the region label corresponding to the processing location. The update formula is: ; Assumption If the millimeter is the confidence level, then the confidence level is: ; Compare the confidence value with the preset threshold To make a comparison, if the confidence value The system will then perform a secondary verification of the area label. For example, =0.6, If the value is 0.7, then the area label needs to be confirmed a second time.
[0054] In this embodiment of the invention, by introducing the analysis of the tool tip trajectory coordinate sequence, the potential collision risk between the tool and the workpiece can be predicted in advance, avoiding machining errors caused by the tool getting too close to the workpiece. This data-driven dynamic adjustment mechanism not only reduces machining errors caused by labeling errors but also reduces the frequency of manual intervention, saving labor costs. Simultaneously, the secondary confirmation step further ensures the correctness of the area labels, enhancing the stability of the machining process.
[0055] Optionally, after generating the workpiece machining program for the workpiece to be machined based on the error prevention subroutine, the toolpath data, and the initial machining program, the method further includes: Obtain the macro variable values in the workpiece machining program and the corresponding compensation register values of the machining tool; Based on the comparison between the macro variable value and the compensation register value, it is determined whether the program segment corresponding to the macro variable value has a deviation; If so, then an adaptive compensation correction function is used to generate a compensation correction instruction based on the comparison results; The workpiece machining program is updated by inserting the compensation correction instruction at the end of the program segment.
[0056] Specifically, in the post-processing stage, the macro variable values and corresponding tool compensation register values in the workpiece machining program are first acquired. These values represent the preset tool compensation amount in the machining program and the actual tool compensation amount used by the machine tool, respectively. By comparing these two sets of values, it can be determined whether there is a deviation in the program segment corresponding to the macro variable value. Specifically, the comparison result is the deviation value between the macro variable value and the compensation register value. By judging the relationship between the deviation value and the preset deviation value, it is determined whether there is a deviation in the program segment. When the deviation value is less than the preset deviation value, it is determined that there is no deviation in the program segment; when the deviation value is greater than or equal to the preset deviation value, it is determined that there is a deviation in the program segment. If a deviation exists, an adaptive compensation correction function will be used to generate compensation correction instructions based on the comparison result. Finally, these correction instructions are inserted into the end of the corresponding program segment to update the workpiece machining program. The adaptive compensation correction function is specifically defined according to the actual machining requirements and error model, aiming to comprehensively consider multiple error factors and dynamically adjust the tool path and machining parameters to improve machining accuracy and surface quality.
[0057] In a preferred embodiment of the present invention, during the post-processing stage, the value of macro variable #1001 used for external cylindrical machining in the workpiece machining program is read as 10.5, and the value of the corresponding tool compensation register D01 is read as 10.3. A comparison reveals a deviation of 0.2, exceeding the preset deviation value of ±0.05. An adaptive compensation correction function is then invoked to determine the correction value for the macro variable based on the deviation value, and a compensation correction instruction is generated based on the correction value and inserted at the end of the corresponding program segment. Finally, the updated program is format-converted, and a new post-processing program is output to ensure that the tool compensation value is consistent with the actual machine tool value. The compensation correction function, defined according to actual machining requirements and the error model, is used to dynamically adjust the tool path and machining parameters.
[0058] For example, the tool wear compensation model can be expressed as: ,in, It is the tool wear rate. This refers to processing time. The thermal deformation compensation model, based on temperature changes and the material's coefficient of thermal expansion, is expressed as: ; The mechanical vibration compensation model is constructed through frequency domain analysis or time series prediction. The comprehensive compensation correction function can be expressed as: ; in, and These are the initial and actual tool length compensation values, respectively. and These are the initial and actual tool radius compensation values, respectively. It is the processing time. It's a temperature change.
[0059] For example, in machining, the initial tool length compensation value is mm, actual value mm, calculated tool length compensation correction amount mm. (Considering the coefficient of thermal expansion) / °C and temperature change °C, thermal deformation compensation amount Taking all these factors into account, the corrected tool length compensation value is mm. mm.
[0060] In this embodiment of the invention, by acquiring and comparing macro variable values and compensation register values, the system can promptly detect and correct compensation deviations caused by tool wear, manual adjustments, or other factors. Secondly, the introduction of an adaptive compensation correction function enables dynamic generation of compensation correction instructions without manual intervention, significantly improving machining efficiency. By inserting correction instructions at the end of the program segment, the system achieves real-time updates to the machining program, ensuring the stability and consistency of the machining process.
[0061] Combination Figure 3 As shown, another embodiment of the present invention provides a workpiece machining program generation system, comprising: The model and process information acquisition module is used to acquire the three-dimensional model and process information of the workpiece to be processed; The toolpath information generation module is used to obtain the toolpath information of the machining tool of the workpiece to be machined based on the three-dimensional model of the workpiece to be machined and the process information. The toolpath information includes the toolpath data and area labels of the workpiece to be machined. An initial program generation module is used to generate an initial machining program for the workpiece to be machined based on the toolpath data and the area labels. The error prevention subroutine selection module is used to select the error prevention subroutine corresponding to the region label based on the region label; The CNC program generation module is used to generate a workpiece machining program for the workpiece to be machined based on the error prevention subroutine, the toolpath data, and the initial machining program.
[0062] The workpiece machining program generation system of the present invention has the same advantages over the prior art as the workpiece machining program generation method described above, and will not be repeated here.
[0063] An electronic device according to another embodiment of the present invention includes a memory and a processor; The memory is used to store computer programs; The processor is configured to implement the agent registration and service invocation method described above when executing the computer program.
[0064] The electronic device of the present invention has the same advantages over the prior art as the above-described workpiece processing program generation method, and will not be repeated here.
[0065] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.
Claims
1. A method for generating a workpiece machining program, characterized in that, include: Obtain the 3D model and process information of the workpiece to be processed; Based on the 3D model of the workpiece to be processed and the process information, the toolpath information of the machining tool for the workpiece to be processed is obtained. The toolpath information includes the toolpath data and region labels of the workpiece to be processed. Specifically, obtaining the toolpath information of the machining tool based on the 3D model of the workpiece to be processed and the process information includes: generating a toolpath corresponding to the machining tool based on the 3D model; generating tool parameters and feed and speed information corresponding to the machining tool based on the process information; determining at least one machining position of the machining tool based on the toolpath; obtaining the region label corresponding to the machining position based on the machining position; and encapsulating the toolpath, tool parameters, and feed and speed information as the toolpath data, and encapsulating the toolpath data and the region labels together as the toolpath information. Based on the toolpath data and the region label, an initial machining program for the workpiece to be processed is generated; specifically, this includes: parsing the region label to obtain the region code of the workpiece to be processed; using the region code as a search key to match in a preset region-subroutine mapping table to obtain the subroutine number corresponding to the region code; and extracting the subroutine number from a preset error-proofing subroutine library to obtain the error-proofing subroutine corresponding to the region label. Select the error prevention subroutine corresponding to the region label based on the region label; Based on the error prevention subroutine, combined with the toolpath data and the initial machining program, a workpiece machining program for the workpiece to be machined is generated; specifically, this includes: positioning the initial machining program according to the region label, determining the program segment corresponding to the region label; inserting the error prevention subroutine of the region label into the program segment corresponding to the region label; and converting the format of the initial machining program after inserting the error prevention subroutine according to a preset format to generate the workpiece machining program for the workpiece to be machined. Specifically, inserting the error-proofing subroutine of the region label into the program segment corresponding to the region label includes: Obtain the starting coordinates of the program segment; determine the feed vector of the starting coordinates based on the toolpath data of the machining tool; generate a compensation safety point for the machining tool based on the starting coordinates and the feed vector; concatenate the positioning statement of the compensation safety point with the error prevention subroutine to obtain a complete error prevention subroutine, wherein the positioning statement of the compensation safety point is set before the error prevention subroutine; insert the complete error prevention subroutine at the beginning of the program segment.
2. The workpiece machining program generation method according to claim 1, characterized in that, The step of selecting the error prevention subroutine corresponding to the region label based on the region label includes: The region label is parsed to obtain the region code of the workpiece to be processed; The region code is used as a search key to match the preset region-subroutine mapping table to obtain the subroutine number corresponding to the region code. The error prevention subroutine corresponding to the region label is obtained by retrieving the subroutine number from the preset error prevention subroutine library.
3. The workpiece machining program generation method according to claim 1, characterized in that, Before selecting the error-proofing subroutine corresponding to the region label based on the region label, the method further includes: The tool tip trajectory coordinate sequence of the machining tool is determined based on the tool path, the tool parameters, and the feed and rotation speed information; Based on the tool tip trajectory coordinate sequence, determine the minimum distance between the machining tool and the workpiece to be machined; When the minimum distance is less than a preset distance threshold, the confidence value of the region label corresponding to the processing position is updated based on the difference between the minimum distance and the preset distance threshold. When the confidence value of the region label is less than a preset threshold, the region label is reconfirmed.
4. The workpiece machining program generation method according to claim 1, characterized in that, After generating the workpiece machining program for the workpiece to be machined based on the error prevention subroutine, the toolpath data, and the initial machining program, the process further includes: Obtain the macro variable values in the workpiece machining program and the corresponding compensation register values of the machining tool; Based on the comparison between the macro variable value and the compensation register value, it is determined whether the program segment corresponding to the macro variable value has a deviation; If so, then an adaptive compensation correction function is used to generate a compensation correction instruction based on the comparison results; The workpiece machining program is updated by inserting the compensation correction instruction at the end of the program segment.
5. A workpiece machining program generation system for implementing the workpiece machining program generation method as described in claim 1, characterized in that, include: The model and process information acquisition module is used to acquire the three-dimensional model and process information of the workpiece to be processed; The toolpath information generation module is used to obtain the toolpath information of the machining tool of the workpiece to be machined based on the three-dimensional model of the workpiece to be machined and the process information. The toolpath information includes the toolpath data and area labels of the workpiece to be machined. An initial program generation module is used to generate an initial machining program for the workpiece to be machined based on the toolpath data and the area labels. The error prevention subroutine selection module is used to select the error prevention subroutine corresponding to the region label based on the region label; The CNC program generation module is used to generate a workpiece machining program for the workpiece to be machined based on the error prevention subroutine, the toolpath data, and the initial machining program.
6. An electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to implement the workpiece machining program generation method as described in any one of claims 1-4 when executing the computer program.
Citation Information
Patent Citations
Error-proofing method for tool utilization in process of numerical control machining
CN106610627A
Craft mistake proofing method and device and intelligent terminal
CN109407529A
Simulation device
CN110320861A