Right-angle head side face machining method, device and equipment and storage medium

By implementing coordinate transformation and automated processing at the post-processor level of Mastercam software, the problems of outdated machine tool systems and complex programming in right-angle head side processing were solved, processing efficiency and accuracy were improved, and the technical threshold was lowered.

CN120762346APending Publication Date: 2025-10-10SHENZHEN TUOZHIZHE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510904537.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

In the existing technology, the side processing of right-angle heads relies on the inclined surface function of the machine tool control system. However, a large number of existing machine tool system versions are outdated and lack advanced functions, resulting in low processing efficiency and complex programming, which is prone to errors.

Method used

By implementing coordinate transformation at the post-processor level of Mastercam software, establishing an axial mapping matrix and feedback correction algorithm, automatically completing the coordinate transformation of the Y-axis and Z-axis and replacing the fmt formatting function, redefining the work plane selection code, and automatically realizing intelligent switching from the G17 plane to the G18 plane, the continuity and accuracy of the arc machining path are ensured. In addition, a multi-objective post-optimization planning algorithm is integrated, and the return to zero instruction is automatically identified and deleted to form a complete automated processing chain.

Benefits of technology

There is no need to upgrade the machine tool control system, and operators can continue to use two-dimensional plane programming, which lowers the technical threshold, improves programming efficiency and processing accuracy, and ensures the continuity and safety of right-angle head side processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120762346A_ABST
    Figure CN120762346A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machining control, and discloses a right-angle head side face machining method, device and equipment and a storage medium. The method comprises the steps that current installation direction information of a right-angle head is obtained, coordinate axis mapping is conducted, a coordinate transformation rule is obtained, and a working plane module of a rear processor is created according to the coordinate transformation rule; performing position exchange of an axis coordinate output formatted statement based on the working plane module to obtain an axis number output module; executing direction remapping of the arc interpolation motion instruction based on the axis number output module to obtain an arc interpolation module; automatically identifying and deleting a program statement containing a preset zero returning instruction in the circular interpolation module to obtain a target post-processor file; and compiling and converting the path data of the two-dimensional plane machining tool by using the target post-processor file to obtain a numerical control machining program, so that the continuity and the machining precision of an arc machining path are ensured, and the overall efficiency from programming to machining is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machining control technology, and in particular to a method, device, equipment and storage medium for machining the side surface of a right-angle head. Background Art

[0002] As an essential machine tool accessory, right-angle heads are widely used in the machining industry, significantly improving machine tool processing capabilities and workpiece precision. Currently, most machining shops use Mastercam software for 2D line drawing programming. This programming method, known for its ease of use and low learning curve, has become the mainstream choice within the industry. However, when it comes to side machining with right-angle heads, traditional 2D programming methods face serious technical bottlenecks.

[0003] Existing technology primarily relies on the tilting function of the machine tool control system to process side surfaces. However, many currently used machine tool systems are relatively old and lack advanced tilting function modules, preventing the right-angle head from fully utilizing its processing advantages. Even some newer machine tool systems with tilting functions still require operators to master complex 3D tilting programming techniques, which not only increases training costs but also easily leads to programming errors due to the complex operation, affecting processing efficiency and product quality. Summary of the Invention

[0004] The present invention provides a right-angle head side processing method, device, equipment and storage medium, which ensure the continuity and processing accuracy of the arc processing path and improve the overall efficiency from programming to processing.

[0005] In a first aspect, the present invention provides a method for processing the side surface of a right-angle head, the method comprising: Obtaining the current installation direction information of the right-angle head and performing coordinate axis mapping to obtain a coordinate transformation rule, and creating a work plane module of the post-processor according to the coordinate transformation rule; Perform position exchange of the axis coordinate output formatting statement based on the work plane module to obtain an axis number output module; Executing direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain a circular interpolation module; Automatically identifying and deleting program statements containing preset zero return instructions in the circular interpolation module to obtain a target post-processor file; The target post-processor file is used to compile and convert the two-dimensional plane machining tool path data to obtain a numerical control machining program.

[0006] In combination with the first aspect, in a first implementation of the first aspect of the present invention, obtaining the current installation direction information of the right-angle head and performing coordinate axis mapping to obtain a coordinate transformation rule, and creating a work plane module of the post-processor according to the coordinate transformation rule, includes: Reading the physical installation position parameters of the right-angle head on the machine tool, performing four-direction installation status judgment on the physical installation position parameters, and obtaining the current installation direction information of the right-angle head; According to the installation direction information, an axial mapping relationship is constructed for the XYZ three-axis coordinate system to obtain an axial mapping matrix in which the original Y axis is mapped to the new Z axis and the original Z axis is mapped to the new Y axis while the X axis remains unchanged; Inputting the axial mapping matrix into a feedback correction algorithm to calculate coordinate transformation parameters to obtain a coordinate transformation parameter set, and performing work plane transformation based on the coordinate transformation parameter set to generate a coordinate transformation rule; The working plane selection code of the post-processor in the Mastercam software is redefined according to the coordinate transformation rule to obtain a working plane module.

[0007] In combination with the first aspect, in a second implementation of the first aspect of the present invention, redefining the work plane selection code of the post-processor in the Mastercam software according to the coordinate transformation rule to obtain a work plane module includes: Input the coordinate transformation rule into the Mastercam software post-processor to locate the work plane code segment, and obtain the original work plane code segment; Performing code extraction on the original working plane code segment to obtain an XY plane code definition; The XY plane code definition is replaced with a G code according to the coordinate transformation rule to obtain a new XY plane code definition, and a working plane module including a modified working plane selection logic is generated based on the new XY plane code definition.

[0008] In combination with the first aspect, in a third implementation of the first aspect of the present invention, the step of performing position exchange of the axis coordinate output formatting statement based on the work plane module to obtain the axis number output module includes: A hierarchical adaptive control strategy is used to locate the fmt formatting function of the working plane module to obtain an original formatting function segment; Match the axis number replacement rule on the original formatting function segment to obtain a Y-axis and Z-axis formatting statement pair; The coordinate output positions are exchanged according to the Y-axis and Z-axis formatting statements to obtain a new axis coordinate output statement combination, and formatting and reconstruction are performed based on the new axis coordinate output statement combination to obtain an axis number output module that ensures that the coordinate accuracy is not lost.

[0009] In combination with the first aspect, in a fourth implementation of the first aspect of the present invention, the direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain the circular interpolation module includes: Inputting the axis number output module into the motion instruction positioning algorithm to perform code segment identification to obtain the original circular interpolation motion instruction segment; Performing geometric feature analysis on the original circular interpolation motion instruction segment to obtain a circular interpolation direction relationship; According to the circular interpolation direction reversal rule after the coordinate axis transformation, the circular interpolation direction relationship is command-exchanged to obtain a reversed circular interpolation instruction combination, and path continuity verification is performed based on the reversed circular interpolation instruction combination to obtain a circular interpolation module that ensures machining accuracy.

[0010] In combination with the first aspect, in a fifth implementation of the first aspect of the present invention, automatically identifying and deleting the program statement containing the preset return to zero instruction in the circular interpolation module to obtain a target post-processor file includes: The circular interpolation module determines the relationship between the axis direction of the right-angle head tool and the zero return direction of the machine tool to obtain a zero return action recognition result; Performing a return-to-zero instruction string retrieval process on the initial post-processor file according to the return-to-zero action recognition result to obtain preset return-to-zero instruction statement location information; Automatically delete the target statement based on the preset return-to-zero instruction statement positioning information to obtain a safety constraint post-processor module; The safety constraint post-processor module is subjected to integrity verification and file reconstruction to obtain a target post-processor file without automatic zero return action and meeting the safety processing requirements of the right-angle head.

[0011] In combination with the first aspect, in a sixth implementation of the first aspect of the present invention, compiling and converting the two-dimensional plane machining tool path data using the target post-processor file to obtain a NC machining program includes: Acquire two-dimensional plane machining tool path data generated by Mastercam software, and extract machining parameters from the two-dimensional plane machining tool path data to obtain a tool path parameter set; Inputting the tool path parameter set into the target post-processor file for post-processing and compilation to obtain an intermediate G-code file; Automatically converting the circular interpolation command based on the intermediate G code file to obtain a side processing G code file; The tool path continuity verification and visual inspection are performed on the side processing G code file to obtain a CNC machining program that ensures the correct connection between the arc and the straight line and is suitable for right-angle head side processing.

[0012] In a second aspect, the present invention provides a right-angle head side processing device, the right-angle head side processing device comprising: An acquisition unit is used to acquire the current installation direction information of the right-angle head and perform coordinate axis mapping to obtain a coordinate transformation rule, and create a work plane module of the post-processor according to the coordinate transformation rule; A position exchange unit, configured to execute position exchange of the axis coordinate output formatting statement based on the work plane module to obtain an axis number output module; a direction remapping unit, configured to perform direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain a circular interpolation module; An automatic identification and deletion unit is used to automatically identify and delete the program statement containing the preset return to zero instruction in the circular interpolation module to obtain a target post-processor file; The compiling and converting unit is used to compile and convert the two-dimensional plane machining tool path data using the target post-processor file to obtain a numerical control machining program.

[0013] The third aspect of the present invention provides a computer device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the computer device executes the above-mentioned right-angle head side processing method.

[0014] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned right-angle head side processing method.

[0015] The technical solution provided by the present invention implements coordinate transformation at the postprocessor level, eliminating the need for hardware or software upgrades to the machine tool control system. Right-angle head side machining can be completed simply by modifying the Mastercam software postprocessor, significantly lowering the economic barrier to technology application. Operators can continue to use familiar two-dimensional plane programming methods, avoiding the need to learn complex three-dimensional inclined surface programming and ensuring the simplicity and efficiency of programming operations. By establishing an axial mapping matrix and feedback correction algorithm, coordinate transformation between the Y and Z axes and replacement of the fmt formatting function are automatically completed, eliminating the complexity and risk of human error in manually calculating coordinate transformations. The postprocessor's work plane selection code is redefined to automatically implement intelligent switching from the G17 plane to the G18 plane, ensuring the accuracy of the work plane definition during right-angle head side machining. An integrated multi-objective post-optimization planning algorithm automatically completes the direction reversal processing of G02 and G03 instructions, ensuring the continuity and machining accuracy of the arc machining path. A safety-critical control strategy is established to automatically identify and delete G28 return to zero instructions that may cause collisions, building a complete right-angle head safety processing protection system. It supports four installation configurations of right-angle heads. By selecting the corresponding post-processor file, it can adapt to the processing requirements of different installation directions. From the input of 2D tool path data to the output of the final CNC machining program, a complete automated processing chain is formed, which greatly improves the overall efficiency from programming to processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0017] Figure 1 Schematic diagram of the steps of the method for processing the side surface of a right-angle head according to an embodiment of the present invention; Figure 2 Schematic diagram of the structure of the right-angle head side processing device in an embodiment of the present invention; Figure 3 It is a schematic block diagram of the structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] Embodiments of the present invention provide a method, apparatus, device and storage medium for processing the side surface of a right-angle head. The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way are interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0019] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the method for processing the side surface of a right-angle head in an embodiment of the present invention includes: Step S1, obtaining the current installation direction information of the right-angle head and performing coordinate axis mapping to obtain a coordinate transformation rule, and creating a work plane module of the post-processor according to the coordinate transformation rule; It is understandable that the execution subject of the present invention may be a right-angle head side processing device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0020] Specifically, a mechanism for identifying the physical installation orientation of the right-angle head is constructed. During the initialization phase of the machining system, the physical installation position parameters of the right-angle head on the machine tool's main or sub-spindle are read. These parameters are determined by a combination of operator preset input, mechanical origin offset, encoder identification information, or port status signals provided by the CNC system. By identifying the angular relationship between the tool axis and the principal coordinate system and the change in the normal projection direction, the mechanism automatically determines whether the right-angle head is in one of four typical installation states: the positive X direction, the negative X direction, the positive Y direction, and the negative Y direction. This determines the coordinate projection direction and axial response logic required for the current machining process. After automatically identifying the current installation orientation of the right-angle head, an axial mapping of the X, Y, and Z axes is constructed based on the relative orientation of the right-angle head's tool axis and the principal coordinate system. For the typical installation situation in Direction 1, the Y axis in the original machining program should be mapped to the new Z axis to represent the tool feed direction, and the original Z axis should be mapped to the new Y axis to represent the depth direction, while the X axis remains unchanged in its original state, thus forming a standardized axial mapping matrix. This mapping matrix includes directional markers and includes information for controlling positive and negative value changes and polarity reversal during coordinate transformation. This constructed axial mapping matrix is ​​fed into a feedback correction algorithm to address coordinate mismatches caused by factors such as actual machine tool installation errors, coordinate zero point offsets, tool offset compensation, and primary and secondary axis linkage. This feedback mechanism calculates a coordinate transformation parameter set with stable compensation performance. This set includes linear scaling coefficients, rotation angle correction values, and inter-axis interference correction vectors for each of the three axes, ensuring reversibility and consistent accuracy for each coordinate transformation. Furthermore, the coordinate transformation parameter set is incorporated into the work plane determination logic, automatically transforming the planes represented by G17, G18, and G19 in the G code. For example, in Direction 1, the traditional XY plane G17 is automatically replaced with the XZ plane G18. A set of coordinate transformation rules applicable to this installation direction is generated. These rules define the plane transformation and integrate the axis number interchange logic with the arc direction correction strategy. According to this coordinate transformation rule, the structure of the work plane selection code in the Mastercam post-processor is redefined. The "sg17 G17 #XY plane code" statement in the original post-processor file is replaced with "sg17 G18 #XY planecode", while the sg18 and sg19 parts remain unchanged. As a result, the G code output originally for the XY plane is automatically recognized as the XZ plane in the program. Without changing the user's programming habits, the coordinate space replacement logic of the post-processor layer is completed, thereby generating a work plane module with coordinate mapping capabilities and multi-directional adaptability.

[0021] Step S2: executing the position exchange of the axis coordinate output formatting statement based on the working plane module to obtain the axis number output module; Specifically, a formatting function parsing mechanism based on the postprocessor's grammatical structure is constructed. Based on this mechanism, a hierarchical adaptive control strategy is introduced to intelligently identify and locate the structure of postprocessor code sections. Using the work plane module as the input, the logical structure block in which it resides is identified and its context is traced back level by level to extract the fmt function definition region. Within this region, a semantic index of the formatting statements is established, resulting in the original formatting function segment containing the output definitions of the X, Y, and Z axes. The original formatting function segment is then matched against the axis number replacement rule. Based on the axial interchange mapping relationship in the coordinate transformation rule, the Y-axis and Z-axis formatting statements are logically paired and identified. Function pairs of the original form, such as "fmt Y 2 yabs #Y position output" and "fmt Z 2 zabs #Z position output," are matched within the statement. Semantic annotation is used to establish their cross-replacement relationship in the axial mapping, and a matching index table is generated. Based on the matching index table, the formatting statement reconstruction operation is performed. Specifically, this involves logically swapping the positions of the Y-axis and Z-axis output functions, regenerating a new coordinate output statement combination. The structure of the original "Y→yabs" and "Z→zabs" is adjusted to "Z→yabs" and "Y→zabs," forming the new combinations "fmt Z 2 yabs #Y position output" and "fmt Y 2 zabs #Z position output." During this reconstruction process, to avoid precision loss due to the replacement, the parameter structure, formatting precision level, and postprocessor constraints of each output function are verified and matched. This ensures that the modified output sequence maintains the original numerical precision during G-code generation. In particular, in high-precision path operations such as radius compensation and slope interpolation, zero-error transmission is achieved during the coordinate replacement process by maintaining the original ABS instruction identifier and the number of bits of numerical precision control. The new axis coordinate output statement combination that has completed formatting and reconstruction is written into the main output module of the post-processor. The system also marks it as the logical exit node of the "axis number output module", so that the coordinate output of all tool paths is carried out according to the rules of this module, and the interchange mapping of Y and Z is automatically completed, thereby realizing the functional linkage from work plane transformation to coordinate output replacement, ensuring the coordinate matching and program compatibility of the right-angle head during the side processing process, while retaining the complete consistency of the programming semantics in the original Mastercam operation interface.

[0022] Step S3: performing direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain a circular interpolation module; Specifically, the axis number output module, after axis number replacement, is input into the motion instruction positioning algorithm. Based on the structural semantics of G-code and the output syntax rules of the Mastercam postprocessor, the algorithm traverses and identifies all code segments containing G02 and G03 circular interpolation motion instructions, thereby extracting the original circular interpolation motion instruction segments. These code segments are defined in the postprocessor as "sg02G2 #Circular interpolation CW" and "sg03 G3 #Circular interpolation CCW" and are the basic components for outputting clockwise and counterclockwise circular paths. After obtaining these original circular interpolation instruction segments, the geometric feature analysis module is called to model and analyze the spatial characteristics of the current tool path. The specific process includes reading key elements such as the interpolation start point, end point, radius parameters, and the type of machining plane (such as G17, G18, G19). The algorithm then determines the actual forward and reverse change pattern of the circular interpolation direction in physical space based on the current coordinate axis transformation relationship. Specifically, in the G18 plane, the circular arc direction originally defined based on the XY axis changes its clockwise (CW) and counterclockwise (CCW) determination criteria after conversion to the XZ plane. This means that the spatial meanings of G2 and G3 become logically opposite. Therefore, these directional relationships are dynamically reconstructed to ensure that the machining trajectory does not deflect. Based on the above geometric analysis results, the original interpolation instructions are reversed. Specifically, the instruction "sg02 G2" is replaced with "sg02 G3," and the instruction "sg03 G3" is replaced with "sg03 G2." This creates a reversed circular interpolation instruction combination. This combination semantically remaps the direction and, at the execution level, ensures that the machining path is correctly output according to the logic of the current coordinate system. To verify the effectiveness of this interpolation instruction combination, a path continuity verification module was introduced. By analyzing the connection between the interpolation segment and the preceding and following linear motion segments (G01), velocity vector consistency, and the smoothness of the circular tangent transition, a path continuity constraint judgment logic was constructed. This ensured that each interpolation operation formed a seamless connection with the adjacent segments at the simulation level, avoiding path interruptions, motion mutations, or machining errors. The interpolation instructions, after reconstructing the reversed instructions and verifying their continuity, were integrated into a circular interpolation module and written into the target postprocessor file to replace the original interpolation module.

[0023] Step S4: automatically identify and delete the program statements containing the preset return to zero instruction in the circular interpolation module to obtain a target post-processor file; Specifically, a safe return to zero judgment mechanism is constructed based on the machining characteristics of the right-angle head and the spatial pointing relationship of the tool axis. This mechanism takes the circular interpolation module as the input object, and combines the axis number output structure after the coordinate axis transformation has been completed to perform spatial analysis on the direction of the right-angle head tool axis after machining is completed. By comparing the geometric relationship between this direction and the default return to zero path direction of the machine tool, it is identified whether there are risks such as direction opposition, path intersection or spatial interference between the two, and a return to zero action recognition result based on the tool direction and the machine tool return to zero behavior is obtained. Based on the results of the return-to-zero action recognition, the initial post-processor file is accurately retrieved for the return-to-zero instruction string. The specific operation includes scanning all G28, G30, and G53 G-code structures that may trigger automatic return to zero, especially typical instruction structures such as "pfbld, n, sgabsinc, *sg28ref, "Z0.", e" and "pfbld, n, *sg28ref, "X0.", "Y0.", e" used for rapid return to the machine tool origin during the spindle tailing phase. The exact location of these statements in the post-processor file is extracted through a string matching algorithm, thereby generating a positioning information set containing all return-to-zero instruction statements. This set records information such as the line number of the target to be deleted, the context scope, and the associated machine tool state switching flag. The safe deletion module targets and deletes each statement marked as posing a return-to-zero risk. This process removes the output statement corresponding to the return-to-zero instruction and eliminates the associated G-code prefix, status flag output logic, and formatted pointer references, ensuring no invalid call traces or interruptions to the original instruction chain structure. This results in a safely pruned postprocessor function fragment, the safety constraint postprocessor module. While retaining all valid machining instructions and coordinate control statements, this module completely eliminates the potential physical interference between the right-angle head and the workpiece or fixture caused by the default return-to-zero at the end of the program, thereby adapting to spatial avoidance constraints in multi-directional installations. The safety constraint postprocessor module undergoes integrity verification, verifying syntactical validity, G-code instruction chain continuity, formatted function reference consistency, variable scope coverage, and output segment structure closure. This ensures that the modified file will not fail to compile or cause machine tool shutdowns due to syntax breaks or undefined variables during execution. Once verification passes, the postprocessor file is automatically reconstructed, integrating the modified segments and outputting a complete, logically closed target postprocessor file without an automatic return-to-zero action.

[0024] Step S5: Use the target post-processor file to compile and convert the two-dimensional plane machining tool path data to obtain a NC machining program.

[0025] Specifically, the tool path data generated by two-dimensional plane machining in Mastercam software is obtained. This data contains key parameters such as the original machining surface information, path motion mode, tool number, feed rate, spindle speed, layer depth, cutting method and process allowance. A structured analysis is performed on the data to extract the core fields describing the path motion control, including the path start and end coordinates, motion instruction type (such as G0 rapid, G1 straight line, G2 / G3 arc), feed rate and coordinate plane label, thereby forming a set of tool path parameter sets. The tool path parameter set is input into the target post-processor file constructed above. Inside the processor file, there is a multi-module control logic for right-angle head machining coordinate transformation, axis number reconstruction, circular interpolation reversal and zero return protection. Therefore, in the post-processing stage, the coordinate transformation rules are automatically executed according to the current direction configuration, and the reconstructed fmt formatting function output logic is dynamically called to replace the X, Y, and Z axis positions to form a coordinate expression after spatial mapping. In conjunction with the machining plane conversion logic from G17 to G18, the geometric surface label of the output path is redirected to generate the first-stage intermediate G-code file. The instruction structure of this intermediate file is basically the same as that of the traditional two-dimensional machining program, but its output coordinates and G-code structure have been matched and adjusted according to the right-angle head direction. After generating the intermediate G-code file, the circular interpolation conversion module is called to perform direction identification and remapping on all G02 and G03 interpolation instructions. Arc curvature information is constructed by analyzing the interpolation start and end points and R values ​​(or I, J, K) in the path. Combined with the directional logic changes caused by axis swapping, it automatically determines whether the original G2 should be converted to G3 or the opposite direction. The interpolation instructions are then replaced, generating a set of circular interpolation instructions that logically adapt to the XZ or YZ plane motion direction, forming a complete side machining G-code file. To ensure path continuity and motion logic correctness during physical execution of this side machining G-code file, a toolpath continuity verification and graphical visualization check mechanism is introduced. The G-code is imported into simulation software or a built-in path analysis engine for path reconstruction. A geometric algorithm compares the tangent direction at the connection between lines and arcs, the feed direction change rate between adjacent segments, and the continuous curvature conditions at the tool entry and exit points to determine whether the path is at risk of interruption, jumps, or repeated cutting. At the same time, dynamic visualization using a 3D isometric view ensures that all side machining segments are correctly aligned with the right-angle head tool axis and verifies whether there are any transition anomalies or boundary errors at the intersection of arcs and straight lines. Once verified, the side machining G-code file is calibrated as an executable NC machining program and exported to a standard NC program format.

[0026] In a specific embodiment, the process of executing step S1 may specifically include the following steps: Read the physical installation position parameters of the right-angle head on the machine tool, make a four-direction installation state judgment on the physical installation position parameters, and obtain the installation direction information of the right-angle head at present; According to the installation direction information, construct the axial mapping relationship of XYZ three-axis coordinate system, and obtain the axial mapping matrix that the original Y axis is mapped to the new Z axis, the original Z axis is mapped to the new Y axis, and the X axis remains unchanged; Input the axial mapping matrix into the feedback correction algorithm to calculate the coordinate transformation parameters, obtain the coordinate transformation parameter set, and convert the working plane based on the coordinate transformation parameter set to generate the coordinate transformation rule; According to the coordinate transformation rule, redefine the working plane selection code of the postprocessor in Mastercam software, and obtain the working plane module.

[0027] Specifically, the physical installation parameters of the right-angle head within the actual machine tool space are obtained and used to determine which standardized installation orientation state it belongs to. In a real-world CNC machining environment, the right-angle head is mounted on the spindle end using a standard connection interface (such as BT or HSK). The output tool axis direction may deflect in the positive, negative, positive, or negative X-directions. During machining initialization, parameter information representing the right-angle head's current installation orientation is read from the machine tool system. This information is derived from feedback from the three-axis position encoder, the spindle installation direction selector switch status, the direction identifier value in the user-set parameter register, or manually set as a G variable in the machining program. The system maps the direction vector or code in this physical parameter to one of four predefined direction states. For example, if the read value is "DIR_Y_NEG," the tool axis is currently pointing in the negative Y-axis direction, which is direction 1. By establishing a static mapping table that maps physical parameters to standard direction labels, the current installation orientation of the right-angle head is identified and a clear installation state number is output. Based on the installation orientation information, a new axial mapping logic is established for Mastercam's default XYZ coordinate system to accommodate the changed motion direction of the right-angle head. Direction 1 is the most typical case, representing a change in the tool spindle's orientation from the vertical Z axis to the negative Y axis. At this point, the machining plane is transformed from G17 (XY plane) to G18 (XZ plane). The coordinate axes are mapped as follows: the original Y-axis motion is projected to the new Z-axis direction to control the tool's main feed, while the original Z-axis motion is projected to the Y-axis direction to represent the tool's axial travel. The X-axis remains unchanged, continuing to represent left-right movement. Therefore, the coordinate axis mapping matrix is ​​represented as a three-dimensional linear transformation matrix. In the case of right-angle head orientation 1, the Y and Z axes are swapped, while the X axis remains unchanged. Similar transformation matrices can be predefined and packaged for directions 2, 3, and 4 to form a set of universal mapping templates. To ensure that the transformation does not produce cumulative errors due to mechanical errors or coordinate offsets during the machining process, the axial mapping matrix is ​​input into a feedback correction algorithm. This algorithm uses the actual tool displacement, fixture position offset, origin compensation value, and current coordinate offset sampled during the machining process to perform difference analysis and construct a correction weight factor. The compensation coefficient and rotational micro-offset are introduced into each matrix item to generate a set of coordinate transformation parameters for practical applications. This set includes the coordinate mapping relationship of the three axes, as well as the G code identifiers corresponding to the plane transformation, axis interchange rules, motion inertia compensation values, and interpolation direction correction parameters, forming a closed-loop transformation control model. Based on the coordinate transformation rules, the work plane selection code of the postprocessor in Mastercam software is redefined. That is, based on the G17 plane of the original 2D machining, the plane machining command output by the postprocessor is redefined so that it outputs the G18 plane. In the Mastercam postprocessor file, plane selection is expressed in the following code form: sg17 G17 # XY plane code sg18 G18 # XZ plane code sg19 G19 # YZ plane code Wherein "sg17" is the plane flag that Mastercam defaults to call under XY plane, when machining occurs in the direction 1 of the right angle head, still call G17 machining path on the software interface, but need to output G18 in the actual generated NC program to adapt to the current coordinate axis mapping relationship. In order to achieve this goal, the "sg17 G17" statement in the above code block is modified to "sg17 G18", and "sg18" and "sg19" remain unchanged, so as to redefine the semantics of G17 as the output action corresponding to XZ plane without changing the user programming logic, and complete the conversion of the working plane module.

[0028] In a specific embodiment, the process of redefining the working plane selection code of the postprocessor in Mastercam software according to the coordinate transformation rule to obtain the working plane module can specifically include the following steps: Input the coordinate transformation rule into the postprocessor of Mastercam software to locate the working plane code segment, and obtain the original working plane code segment; Code extraction is performed on the original working plane code segment to obtain the XY plane code definition; According to the coordinate transformation rule, the G code of the XY plane code definition is replaced to obtain a new XY plane code definition, and a working plane module containing modified working plane selection logic is generated based on the new XY plane code definition.

[0029] Specifically, the coordinate transformation rule is input into the control logic of the Mastercam postprocessor as the input basis through a specific parameter transmission mechanism. The coordinate transformation rule contains the mapping relationship between the original coordinate axes, the corresponding direction exchange identifier and the rotation transformation parameter, and also contains the explicit plane transformation identifier, such as the logical mapping table corresponding to the conversion instructions of G17 to G18, G18 to G19, etc. After the coordinate transformation rule is loaded into the postprocessor, the system triggers the embedded post-processing syntax analysis engine to scan the code segment and locate the key statement of the entire postprocessor file. In the standard post-processing structure of Mastercam, the plane selection code segment is represented by "sg17", "sg18" and "sg19" three labels representing the G code output format of XY, XZ and YZ three basic planes, and its structure block often appears in the variable definition area or initialization module of the header of the postprocessor, and has a fixed syntax pattern, for example: sg17 G17 # XY plane code sg18G18#XZ plane code sg19G19#YZ plane code The system locates the original code line representing the XY plane G code output semantics by matching the "sg17" keyword in the syntax identifier line by line, combined with the "XY plane code" text in the annotation, thereby completing the initial positioning of the work plane code segment. This positioning operation uses a dual confirmation mechanism of regular expression search and key annotation verification to ensure that the recognition result is accurate and without omission, and then marks the entire code segment as the original work plane code segment. The system extracts the XY plane code definition from the original work plane code segment, that is, extracts the G code value "G17" corresponding to "sg17", and performs structured identification and semantic classification on this value, marking its current semantics as "original XY plane binding", and confirming that its usage logic in the user programming environment remains unchanged and is still the default setting for two-dimensional plane path input. After the extraction is completed, the system determines whether the G code definition of the XY plane in the current processing scenario needs to be replaced based on the input coordinate transformation rules. Taking right-angle head direction 1 as an example, if the current machining path was originally defined in the XY plane (i.e., G17), but the actual tool movement space after coordinate mapping should be in the XZ plane, G17 must be replaced with G18. The system applies this mapping rule to the definition statement of the "sg17" variable. Specifically, the original statement "sg17G17#XY plane code" is replaced with "sg17G18#XY plane code." This replacement operation only changes the corresponding G code value without changing the variable identifier. This retains the user's intuitive operation method of modeling and programming in the XY plane in the software logic, while automatically redirecting the actual plane to G18 at the output level, completing the semantic connection between the physical machining surface and the logical control layer. After the G-code replacement is complete, the newly defined "sg17 G18" statement is written to the postprocessor. The semantic updater is called to refresh all references to the "sg17" variable, ensuring that all functions, subroutines, or output sections in the program involving XY plane output automatically apply the new plane code. This ultimately creates a complete workplane module that incorporates the modified workplane selection logic. To ensure the operability and logical integrity of the modified workplane module in actual use, a global consistency check is performed on the postprocessor file to verify that the structural loop between the variable definition area, the call logic section, and the G-code output logic is maintained. The modified results are precompiled and tested, and an intermediate verification version of the postprocessor containing the modified workplane logic is output. This version is applied to a sample toolpath program during a trial run to confirm that the modifications have achieved the desired effect. The user still draws the path in the XY plane, but the postprocessor output is automatically G18, and the axis number mapping and interpolation direction remain correct. Once verified, the postprocessor is finalized as the official version that supports the current right-angle head orientation.

[0030] In a specific embodiment, the process of executing step S2 may specifically include the following steps: A hierarchical adaptive control strategy is used to locate the fmt formatting function of the working plane module to obtain the original formatting function segment; Match the axis number replacement rule to the original formatting function segment to obtain the Y-axis and Z-axis formatting statement pairs; The coordinate output positions are exchanged according to the Y-axis and Z-axis formatting statements to obtain a new axis coordinate output statement combination, and formatting and reconstruction are performed based on the new axis coordinate output statement combination to obtain an axis number output module that ensures that the coordinate accuracy is not lost.

[0031] Specifically, a hierarchical adaptive control strategy is adopted to divide the entire post-processor file into several semantic levels, including the top-level variable definition layer, the middle-level coordinate logic layer, and the bottom-level instruction output layer. The system uses a semantic engine to identify the contents of each level in blocks and classify them according to module labels, locking the working plane modules identified by "sg17" and "sg18" as substructures of the middle-level coordinate logic layer. Within this substructure, the system identifies the formatting function starting with "fmt" by parsing the semantic context, that is, the fmt formatting function definition segment. This segment is the core part of the post-processor that defines the coordinate output format in the G code, and appears in the following form: fmtX2xabs#X position output fmtY2yabs#Y position output fmtZ2zabs#Z position output Here, "fmt" is the formatting function keyword, "X / Y / Z" is the axis number, "2" is the number of formatting precision digits, and "xabs / yabs / zabs" are corresponding variable pointers, representing the numerical output fields of the axis in the G-code. The comments indicate their physical meaning. The system locates the original formatting function segment through this structure and establishes an internal semantic mapping table to identify, index, and record the output variable binding for each fmt statement. The system then matches the axis number replacement rules against the original formatting function segment. Based on the axial mapping relationship defined in the pre-coordinate transformation module, it determines whether the Y and Z axes need to be interchanged in the current machining direction. If the current right-angle head installation direction is Direction 1, the original Y axis must be mapped to the new Z axis, and the original Z axis must be mapped to the new Y axis. Based on this premise, the system traverses the formatting function mapping table, performs a semantic match on the "Y position output" and "Z position output" statements, and identifies their fmt statement pair structure, thereby forming a logically bound "Y↔Z" axis number interchange pair. For example, the system considers the following formatting statements to be interchangeable: fmtY2yabs#Y position output fmtZ2zabs#Z position output The system performs an output position swap operation on the formatting function according to the swap rule, that is, it binds the yabs pointer of the original Y-axis position mapping to the Z-axis position, and binds the zabs pointer of the original Z-axis to the Y-axis position, thereby generating a new axis number output statement combination, the result of which is: fmtZ2yabs#Y position output fmtY2zabs#Z position output The X-axis remains unchanged, retaining the original definition of "fmt X 2 xabs #X position output." During this process, the system performs data accuracy checks on each binding pointer to ensure that the swapped numerical output fields maintain the same precision parameters as the original fmt statement and do not alter its output structure. This prevents precision loss or data truncation in the NC program and ensures consistent output coordinate accuracy throughout the compilation process. After the new axis output statement combination is constructed, the formatting function is restructured. All replaced fmt statements are written to the corresponding locations in the original fmt statement segment in the postprocessor file, replacing the original axis bindings and refreshing the G-code output logic for all variables calling "xabs / yabs / zabs." Furthermore, the affected variable scopes, called functions, and subroutine output structures are compared and verified to prevent potential errors caused by changes in the fmt statement structure, such as broken variable action chains, invalid call targets, or abnormal output formats. To ensure the stability and verifiability of the formatted and reconstructed axis number output module in actual G-code generation, the system introduces an output simulation test mechanism. This mechanism generates a sample program for a standard XY plane machining path, calls the postprocessor for G-code compilation and output, and analyzes whether the XYZ coordinates in the final output conform to the preset interchange logic. Specifically, it identifies the motion direction and reconstructs the geometric trajectory for interpolation paths involving Y and Z swaps, confirming that the numerical output is consistent with the physical direction. It also performs continuity checks on the connection points of each straight and circular path segment to ensure that no numerical errors or logical breakpoints are introduced during the execution of the reconstructed formatting function. The reconstructed and verified formatting function segment is encapsulated as an axis number output module and marked as one of the postprocessor's structural reconstruction nodes. During the compilation process, the system preferentially calls this module to remap the XYZ coordinate data in the tool path, thereby implementing coordinate output adaptation under the side machining logic. This ensures that, while the user is still modeling and programming in the two-dimensional XY plane, the output G-code is adapted to the Z-axis main feed logic and Y-axis auxiliary movement behavior required by the current right-angle head installation orientation.

[0032] In a specific embodiment, the process of executing step S3 may specifically include the following steps: Input the axis number output module into the motion instruction positioning algorithm to identify the code segment and obtain the original circular interpolation motion instruction segment; Analyze the geometric characteristics of the original circular interpolation motion instruction segment to obtain the circular interpolation direction relationship; According to the circular interpolation direction reversal rule after the coordinate axis transformation, the circular interpolation direction relationship is exchanged to obtain a reversed circular interpolation instruction combination. Based on the reversed circular interpolation instruction combination, the path continuity is verified to obtain a circular interpolation module that ensures machining accuracy.

[0033] Specifically, the axis number output module is input into the motion instruction location algorithm, which has the ability to logically identify all structured code segments containing path instructions in the postprocessor. This identification process is based on the syntax structure of the postprocessor file. By parsing statements containing key identifiers such as "sg02" and "sg03", it locates the original motion instruction definition segments in the program used to control circular arc clockwise interpolation (CW) and counterclockwise interpolation (CCW). The standard form is as follows: sg02G2#Circular interpolation CW sg03G3#Circular interpolation CCW Through regular expression matching, comment tag parsing, and reference structure mapping, the system identifies this code segment as belonging to the interpolation motion control section and tracks its specific reference points within the program output structure, such as variable calls such as "*sg02" or "*sg03" in the tool path segment's output module. This establishes a direct binding relationship between this code segment and the output logic, completing the structural location of the original circular interpolation motion instruction segment. Once located, the system extracts the G-code segment containing parameters such as the arc interpolation start point, end point, interpolation radius, and center point offset (I, J, K). Using the geometric feature analysis module, these path parameters are spatially resolved to determine the actual directional relationship of the arc. This directional relationship is independent of the semantics of the G-code tags themselves, but is determined based on the relative motion direction of the path parameters within the current coordinate system. For example, in G17 (XY plane), if interpolation moves clockwise from point A to point B, the corresponding command is G2. However, when the machining plane switches to G18 (XZ plane), the semantics of the direction corresponding to the same coordinate motion change, and the physical motion directions of G2 and G3 are swapped. Without adjustment, the actual machining trajectory will deviate from the designed path. Therefore, the geometric feature analysis module constructs a spatial direction vector for each arc path. By calculating the rotational direction of the line connecting the start and end points, the center of the circle, and the path points, and combining this with the machining plane definition, it outputs a logical judgment result to determine whether the current G-code command is consistent with the actual motion direction. Based on the interpolation direction reversal rule after coordinate axis transformation, a mapping table for arc direction commands is established, and a standard definition of G-code output is established for each machining plane and coordinate interchange rule. For example, in the scenario of switching from G17 to G18, all semantically G2 commands are replaced with G3, and G3 commands are replaced with G2. The mapping logic can be expressed as follows: if the current working plane is the XZ plane and the mathematical direction of the original arc path is clockwise, it should be output as G3 instead of G2. Based on this logic, the system restructures the original interpolation instructions, modifies the original "sg02 G2" definition statement in the post-processor to "sg02G3", and modifies the "sg03 G3" statement to "sg03 G2", forming a circular interpolation instruction combination with reversed direction, thereby ensuring that the interpolation motion can still reflect the original plane programming intention in the new coordinate system. Figure 1The tool movement direction is consistent. After the direction replacement is completed, the system enters the path continuity verification stage to ensure that the reconstructed arc interpolation instruction will not introduce problems such as curvature mutation, tangent discontinuity or trajectory interruption in the actual processing path. To this end, the system performs a transition analysis on the connection between the arc and the adjacent straight line segment and arc segment, including curvature matching detection, tangent direction consistency assessment and velocity vector smoothness judgment. The system measures the tangent angle between the starting point of each arc segment and the end point of the previous straight line segment to determine whether there is a sudden jump phenomenon, and at the same time analyzes whether the end point of the arc and the starting point of the next trajectory segment are in a spatial continuity state, so as to confirm whether the trajectory is physically machinable. If it is found during the verification process that there is a direction break or path reversal between the arc and the line segment, it will be corrected through mechanisms such as interpolation compensation, curvature adjustment or G code output repair until all arc segments are logically and physically continuous and smooth. Through the above steps, an arc interpolation module that ensures processing accuracy is obtained.

[0034] This embodiment also includes: based on the reverse arc interpolation instruction combination, the multi-objective post-optimization planning algorithm is integrated to verify the path continuity and obtain the arc interpolation module, specifically: the reverse arc interpolation instruction combination is input into the geometric parameter parser to extract the arc features and obtain the arc geometric feature data set including the arc start point, end point, center coordinates and radius parameters; the connection point continuity detection is performed on the adjacent processing path segments according to the arc geometric feature data set to obtain the path connection state matrix including the position continuity and tangent continuity judgment results; based on the path connection state matrix, a multi-objective optimization function is established to perform path continuity, processing accuracy, Through comprehensive optimization of tool path smoothness, a multi-objective optimization solution set that meets the stability boundary constraints of closed-loop axis mapping is obtained; the multi-objective optimization solution set is input into the convergence judgment algorithm for iterative solution verification, and the optimal circular interpolation parameter combination that meets the path continuity requirements and the machining error is within the allowable range is obtained; the optimal circular interpolation parameter combination is subjected to machining accuracy verification and path integrity verification, and a verified circular interpolation instruction set that passes the continuity check and ensures machining quality is obtained; based on the verified circular interpolation instruction set, module encapsulation and interface standardization are performed to obtain an arc interpolation module that integrates a multi-objective post-optimization planning algorithm and ensures machining accuracy.

[0035] In a specific embodiment, the process of executing step S4 may specifically include the following steps: The circular interpolation module determines the relationship between the right-angle head tool axis direction and the machine tool zero return direction to obtain the zero return action recognition result; According to the result of the return to zero action recognition, the initial post-processor file is searched for the return to zero instruction string to obtain the preset return to zero instruction statement location information; Automatically delete the target statement based on the preset return-to-zero instruction statement positioning information to obtain a safety constraint post-processor module; The safety constraint post-processor module is integrity verified and the file is reconstructed to obtain the target post-processor file without automatic return to zero action and meeting the safety processing requirements of the right-angle head.

[0036] Specifically, a spatial direction comparison analysis is performed on the circular interpolation module to determine whether the current output direction of the right-angle head's tool axis creates a direct spatial conflict with the CNC machine's default return-to-home direction. In standard three-axis machining systems, automatic return-to-home is implemented using G28, G53, or G30 instructions. These instructions default to executing in the positive Z-axis direction (i.e., spindle lift). However, when the right-angle head is mounted sideways, its tool axis projects in the negative X or Y direction. If a Z-axis return is still called at the end of the program, interference or collision between the right-angle head and the workpiece, fixture, or machine tool structure may occur. Therefore, the system calls the direction determination module to obtain the tool axis vector (such as DIR_Y_NEG or DIR_X_POS) representing the current circular interpolation module's direction. The system then calculates the spatial angle between the two vectors and the default return-to-home direction vector configured for the machine tool system. If the angle between the two vectors approaches 180 degrees, a "direction conflict state" is determined, generating a "return-to-home risk" recognition result, which serves as the trigger for the deletion operation. The system performs a structural scan of the initial post-processor file based on the recognition result of the return-to-zero action and performs an exact match search on the string segments that may contain the automatic return-to-zero instruction. The standard forms include the following categories: pfbld, n, sgabsinc, *sg28ref, "Z0.", e pfbld, n, *sg28ref, "X0.", "Y0.", e pfbld, n, *sg53, "Z0.", e These statements are located in the program end, tool change, or system initialization sections of the Mastercam post-processing structure. Their common characteristic is that they contain calls to G28 or G53 return-to-zero instructions, expressing the return-to-zero target in the form of Z0, X0, and Y0. The system constructs a keyword matching tree and performs efficient string filtering on statements containing keywords such as "sg28ref," "sg53," "Z0.", "X0.", and "Y0.". Combining annotations with semantic context, the system encapsulates all matching results into "preset return-to-zero instruction statement location information." Each record contains the statement line number, module affiliation, execution timing identifier, and the affected G-code output structure. After obtaining the location information, a stripping operation is performed on each statement marked as a "risky return-to-zero instruction." This stripping process involves deleting the statement itself and simultaneously clearing any referenced variable declarations, formatted calls, and intermediate pointers to prevent subsequent instruction errors caused by dangling semantic chains. The stripping operation adheres to a scope checking mechanism to ensure that control statements related to non-return-to-zero operations are not accidentally deleted, forming a precisely controlled "safety-constrained post-processor module." While retaining all valid machining, interpolation, plane transformation, and coordinate mapping logic, this module completely removes automatic zeroing behavior triggered by the Z-axis or other axes. This prevents collisions caused by default command errors at the end of right-angle head machining, effectively integrating spatial avoidance mechanisms with program execution logic. To ensure the module's logical integrity and usability, the safety constraint postprocessor module undergoes structural integrity verification, including variable reference consistency checks, formatted function call integrity verification, G-code output chain closure detection, and program end safety semantic reconstruction. Specifically, after deleting the original trailing zeroing statement, the system inserts an alternative end marker, such as an "M30" program end command or a "G0" conservative move command to a non-interference area, to maintain program structural closure and controllable execution. A difference report is generated before and after the modification, with line numbers and comments for all removed zeroing statements. Through these steps, the target postprocessor file is generated, which prevents automatic zeroing in all right-angle head installation orientations, thereby avoiding spatial interference risks.

[0037] In a specific embodiment, the process of executing step S5 may specifically include the following steps: Obtaining the two-dimensional plane machining tool path data generated by Mastercam software, and extracting machining parameters from the two-dimensional plane machining tool path data to obtain a tool path parameter set; Input the tool path parameter set into the target post-processor file for post-processing and compilation to obtain an intermediate G-code file; Automatically convert arc interpolation instructions based on the intermediate G code file to obtain the side processing G code file; The tool path continuity verification and visual inspection are performed on the side surface processing G code file, and a numerical control machining program is obtained to ensure that the connection between the circular arc and the straight line is correct and suitable for the side surface processing of the right angle head.

[0038] Specifically, the system acquires 2D toolpath data generated by Mastercam software. This data is derived from planar grooving, contouring, and drilling paths defined based on the XY plane. This data contains a series of logical data structures describing the path motion, coordinate control points, motion direction, speed strategy, and tool parameters. This data is stored as *.NC, .NCI, or .PST files and is passed to the processing module as standard vectors during postprocessor calls. The system extracts key information fields from these files, including path point sequence, G-code segment, tool number, spindle speed (S), feed rate (F), cutting mode (e.g., climb or reverse milling), layer depth control (Z depth), and arc definition mode (radius R or center IJK). All of this data is then structured to construct a unified data set, known as the toolpath parameter set. This toolpath parameter set is then input into the target postprocessor file, which has been reconstructed using a Cartesian coordinate mapping and command replacement mechanism. This file includes embedded modules for workplane reorientation, XYZ axis number interchange, arc direction reversal, and return-to-zero command filtering. The postprocessor parses the G-code sequence and coordinate fields in the path parameter set and redirects the G17 machining plane to G18 or G19 based on the orientation configuration. It also performs the Y-Z axis swap in the fmt formatting function to ensure that the tool's primary motion direction is mapped to the Z axis in the output, thus generating the first-stage intermediate G-code file. Based on the intermediate G-code, the interpolation command conversion module is invoked to analyze and identify all path segments containing G02 (clockwise arc) and G03 (counterclockwise arc). This module determines whether the command requires a direction reversal by calculating the spatial relationship between the normal vector of the current machining plane (e.g., G18) and the arc's direction in the original G17 coordinate system. If the directions do not match, G02 is replaced with G03 or G03 with G02, while retaining the original arc's endpoint, radius, or center point offset parameters to ensure the trajectory geometry remains unchanged. Only the directional semantics are adjusted, completing the second-stage G-code semantic adjustment process and generating the side machining G-code file with the correct arc direction definition. Perform tool path continuity verification and visual inspection on the side machining G-code file. By calling the tool path simulation analysis engine, all path segments in the G-code file are restructured and analyzed to see if there are sudden changes in curvature, start-end connection errors, or interpolation path reversal at the connection between arc segments and straight line segments, especially in the transition area between G1 segments and G2 / G3 segments, to ensure that the tangent direction is continuous, the velocity vector has no sudden changes, and the path endpoints are not overlapped or lost. If any trajectory segment is found to have a risk of discontinuity during verification, the system will fall back to the interpolation instruction generation module, recalculate the instruction direction, and adjust the parameter expression of the corresponding segment to ensure that the output trajectory is coherent and complete in both logical structure and geometric structure.After verification, a visual check is performed, importing the G-code path into a 3D view. Animated tool motion simulation is performed using the rectangular coordinate axes as a reference to observe whether the tool moves along the XZ or YZ plane path in the new coordinate system. The consistency of the machining start point, end point, and arc direction with the actual geometric contour is also confirmed. This visualization process is performed within a CAM post-processor plug-in or a third-party simulation platform, visually presenting the path continuity and directional correctness in graphical form, thereby enhancing the reliability verification of the final NC machining program. Following these steps, a NC machining program file calibrated as "suitable for right-angle head side machining" is output.

[0039] The above describes the side processing method of the right angle head in the embodiment of the present invention. The following describes the side processing device of the right angle head in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, a right-angle head side processing device includes: An acquisition unit is used to obtain the current installation direction information of the right-angle head and perform coordinate axis mapping to obtain a coordinate transformation rule, and create a work plane module of the post-processor according to the coordinate transformation rule; A position exchange unit is used to execute the position exchange of the axis coordinate output formatting statement based on the work plane module to obtain the axis number output module; A direction remapping unit is used for performing direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain a circular interpolation module; An automatic identification and deletion unit is used to automatically identify and delete program statements containing preset zero return instructions in the circular interpolation module to obtain a target post-processor file; The compiling and converting unit is used to compile and convert the two-dimensional plane machining tool path data using the target post-processor file to obtain a NC machining program.

[0040] Through the collaborative efforts of these components, coordinate transformation is implemented at the postprocessor level. This eliminates the need for hardware or software upgrades to the machine control system; instead, the side machining of right-angle heads can be accomplished by modifying the Mastercam software postprocessor. This automated postprocessor-based coordinate transformation allows operators to continue using familiar 2D plane programming, eliminating the need to learn complex 3D inclined surface programming and ensuring ease and efficiency of programming. By establishing an axial mapping matrix and feedback correction algorithm, coordinate transformations between the Y and Z axes and the replacement of the fmt formatting function are automatically performed, eliminating the complexity and risk of human error associated with manual coordinate transformation calculations. By redefining the postprocessor's work plane selection code, intelligent switching from G17 to G18 is automatically implemented, ensuring accurate work plane definition during right-angle head side machining. Automated direction reversal of G02 and G03 commands ensures the continuity and accuracy of arc machining paths, avoiding the complexity of arc direction determination in traditional methods. A safety-critical control strategy has been established to automatically identify and remove G28 return-to-zero commands that could cause collisions, creating a complete right-angle head safety protection system and effectively preventing collisions between the workpiece and the right-angle head. The system supports four mounting configurations for the right-angle head, allowing for adaptability to machining requirements in different mounting orientations by selecting the corresponding post-processor file, enhancing the system's versatility and flexibility. From 2D tool path data input to final CNC machining program output, a complete automated processing chain has been formed, significantly improving overall efficiency from programming to machining.

[0041] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, memory, display screen, input device, network interface and database connected via a system bus. The processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the above method is implemented.

[0042] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device to which the solution of the present invention is applied.

[0043] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the above-described method when executed by a processor. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0044] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware using a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media provided herein and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM.

[0045] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0046] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0047] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for processing the side of a right-angle head, characterized in that: include: Obtaining the current installation direction information of the right-angle head and performing coordinate axis mapping to obtain a coordinate transformation rule, and creating a work plane module of the post-processor according to the coordinate transformation rule; Based on the working plane module, position exchange of the axis coordinate output formatting statement is performed to obtain an axis number output module; Executing direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain a circular interpolation module; Automatically identifying and deleting program statements containing preset zero return instructions in the circular interpolation module to obtain a target post-processor file; The target post-processor file is used to compile and convert the two-dimensional plane machining tool path data to obtain a numerical control machining program.

2. The method for processing the side surface of a right-angle head according to claim 1, characterized in that: The method of obtaining the current installation direction information of the right-angle head and performing coordinate axis mapping to obtain a coordinate transformation rule, and creating a work plane module of the post-processor according to the coordinate transformation rule, includes: Reading the physical installation position parameters of the right-angle head on the machine tool, performing four-direction installation status judgment on the physical installation position parameters, and obtaining the current installation direction information of the right-angle head; According to the installation direction information, an axial mapping relationship is constructed for the XYZ three-axis coordinate system to obtain an axial mapping matrix in which the original Y axis is mapped to the new Z axis and the original Z axis is mapped to the new Y axis while the X axis remains unchanged; Inputting the axial mapping matrix into a feedback correction algorithm to calculate coordinate transformation parameters to obtain a coordinate transformation parameter set, and performing work plane transformation based on the coordinate transformation parameter set to generate a coordinate transformation rule; The working plane selection code of the post-processor in the Mastercam software is redefined according to the coordinate transformation rule to obtain a working plane module.

3. The method for processing the side surface of a right-angle head according to claim 2, characterized in that: The working plane selection code of the post-processor in the Mastercam software is redefined according to the coordinate transformation rule to obtain a working plane module, including: Input the coordinate transformation rule into the Mastercam software post-processor to locate the work plane code segment, and obtain the original work plane code segment; Performing code extraction on the original working plane code segment to obtain an XY plane code definition; The XY plane code definition is replaced with a G code according to the coordinate transformation rule to obtain a new XY plane code definition, and a working plane module including a modified working plane selection logic is generated based on the new XY plane code definition.

4. The method for processing the side surface of a right-angle head according to claim 1, characterized in that: The step of performing position exchange of the axis coordinate output formatting statement based on the work plane module to obtain the axis number output module includes: A hierarchical adaptive control strategy is used to locate the fmt formatting function of the working plane module to obtain an original formatting function segment; Match the axis number replacement rule on the original formatting function segment to obtain a Y-axis and Z-axis formatting statement pair; The coordinate output positions are exchanged according to the Y-axis and Z-axis formatting statements to obtain a new axis coordinate output statement combination, and formatting and reconstruction are performed based on the new axis coordinate output statement combination to obtain an axis number output module that ensures that the coordinate accuracy is not lost.

5. The method for processing the side surface of a right-angle head according to claim 1, characterized in that: The direction remapping of the circular interpolation motion instruction is performed based on the axis number output module to obtain the circular interpolation module, including: Inputting the axis number output module into the motion instruction positioning algorithm to perform code segment identification to obtain the original circular interpolation motion instruction segment; Performing geometric feature analysis on the original circular interpolation motion instruction segment to obtain a circular interpolation direction relationship; According to the circular interpolation direction reversal rule after the coordinate axis transformation, the circular interpolation direction relationship is command-exchanged to obtain a reversed circular interpolation instruction combination, and path continuity verification is performed based on the reversed circular interpolation instruction combination to obtain a circular interpolation module that ensures machining accuracy.

6. The method for processing the side surface of a right-angle head according to claim 1, characterized in that: The program statement containing the preset return to zero instruction in the circular interpolation module is automatically identified and deleted to obtain a target post-processor file, including: The circular interpolation module determines the relationship between the axis direction of the right-angle head tool and the zero return direction of the machine tool to obtain a zero return action recognition result; Performing a return-to-zero instruction string retrieval process on the initial post-processor file according to the return-to-zero action recognition result to obtain preset return-to-zero instruction statement location information; Automatically delete the target statement based on the preset return-to-zero instruction statement positioning information to obtain a safety constraint post-processor module; The safety constraint post-processor module is subjected to integrity verification and file reconstruction to obtain a target post-processor file without automatic zero return action and meeting the safety processing requirements of the right-angle head.

7. The method for processing the side surface of a right-angle head according to claim 1, characterized in that: The method of using the target post-processor file to compile and convert the two-dimensional plane machining tool path data to obtain a numerical control machining program includes: Acquire two-dimensional plane machining tool path data generated by Mastercam software, and extract machining parameters from the two-dimensional plane machining tool path data to obtain a tool path parameter set; Inputting the tool path parameter set into the target post-processor file for post-processing and compilation to obtain an intermediate G-code file; Automatically converting the circular interpolation command based on the intermediate G code file to obtain a side processing G code file; The tool path continuity verification and visual inspection are performed on the side processing G code file to obtain a CNC machining program that ensures the correct connection between the arc and the straight line and is suitable for right-angle head side processing.

8. A right-angle head side processing device, characterized in that: Used to perform the right-angle head side processing method according to any one of claims 1 to 7, the right-angle head side processing device comprises: An acquisition unit is used to acquire the current installation direction information of the right-angle head and perform coordinate axis mapping to obtain a coordinate transformation rule, and create a work plane module of the post-processor according to the coordinate transformation rule; A position exchange unit, configured to execute position exchange of the axis coordinate output formatting statement based on the work plane module to obtain an axis number output module; a direction remapping unit, configured to perform direction remapping of the circular interpolation motion instruction based on the axis number output module to obtain a circular interpolation module; An automatic identification and deletion unit is used to automatically identify and delete the program statement containing the preset return to zero instruction in the circular interpolation module to obtain a target post-processor file; The compiling and converting unit is used to compile and convert the two-dimensional plane machining tool path data using the target post-processor file to obtain a numerical control machining program.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the method for processing the side surface of a right-angle head according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the processor is caused to execute the method for processing the side surface of a right-angle head according to any one of claims 1 to 7.

Citation Information

Cited By

  • Method, medium and equipment for quickly scanning and positioning G code specified line of numerical control system

    CN121680934A