Pipe thread numerical control machining method, system and device based on macro program
By coordinating loading and unloading with a macro-programmed CNC system and a robot, and combining position compensation and detection with a CNC probe, the problems of low manual efficiency and poor precision in pipe thread processing are solved, achieving automated closed-loop and efficient flexible processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG HUAXING HEAT EXCHANGE EQUIP CO LTD
- Filing Date
- 2026-04-03
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, pipe thread processing relies on manual loading and unloading, resulting in low production efficiency and poor positioning accuracy, making it difficult to achieve efficient and high-precision automated processing.
A macro-program-based CNC system is adopted, which coordinates the loading and unloading actions of the robot, and performs position compensation and detection in combination with the CNC probe. It automatically determines whether it has contact with the pipe, skips unqualified processing steps, and calls the appropriate processing macro program to perform pipe thread processing.
It has achieved an automated closed-loop process for pipe threading, which has improved production efficiency, ensured processing quality, prevented equipment damage, adapted to the processing needs of pipes of different specifications, and enhanced the flexibility of the production line.
Smart Images

Figure CN122007516A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machining technology, specifically to a macro-programmed CNC machining method, system, and apparatus for pipe thread machining. Background Technology
[0002] Due to its advantages such as centralized processes, high automation, high flexibility, and strong capabilities, CNC machining is gradually gaining attention from manufacturing companies. Applying CNC machining to pipe threading can improve production efficiency and precision.
[0003] However, in related technologies, when processing pipe threads, manual loading and unloading is required. Metal pipes such as copper pipes and steel pipes weighing tens of kilograms are repeatedly moved to or away from CNC machine tools. This results in a significant decrease in production efficiency as manual labor strength declines. Furthermore, the loading and positioning rely on manual experience and judgment, which has low accuracy.
[0004] Therefore, there is an urgent need for a pipe threading method that is efficient and precise. Summary of the Invention
[0005] This invention provides a macro-program-based CNC machining method, system, and apparatus for pipe threading, to solve the problems of low efficiency and low precision in related pipe threading solutions.
[0006] In a first aspect, the present invention provides a CNC machining method for pipe threads based on a macro program, executed by a CNC system, the method comprising: Obtain the processing parameters of the pipe to be processed; Run the feeding subroutine to perform feeding interaction actions with the robot in order to feed the pipes to be processed; Run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed; if it is determined that the CNC probe is in contact with the pipe to be processed, then use the CNC probe to perform position compensation on the pipe to be processed, and call the processing macro program to perform pipe thread processing on the pipe to be processed according to the processing parameters; if it is determined that the CNC probe is not in contact with the pipe to be processed, then skip the pipe thread processing step. Run the material feeding subroutine to perform material feeding interaction actions with the robot in order to feed the current pipe material.
[0007] In one optional implementation, determining whether the CNC probe is in contact with the pipe to be processed includes: The CNC probe is controlled to move towards a preset edge-finding position until the CNC probe stops; Read the current absolute coordinate variable of the CNC probe on the Z-axis; Determine whether the current absolute coordinate variable is equal to the preset target contact position value; If the current absolute coordinate variable is equal to the preset target contact position value, it is determined that the CNC probe is not in contact with the pipe to be processed; If the current absolute coordinate variable is not equal to the preset target contact position value, then it is determined that the CNC probe is in contact with the pipe to be processed.
[0008] In one alternative implementation, skipping the pipe threading step includes: Set the workpiece clamping quality difference flag to a valid value; Control the CNC probe to move to a safe position; Jump to execute the steps of the material feeding subroutine.
[0009] In one optional implementation, the position compensation of the pipe to be processed using a CNC probe includes: Based on the difference between the current absolute coordinate variable and the target contact position value, execute the machining coordinate system compensation command to correct the origin of the machining coordinate system; The CNC probe is controlled to move to a safe position for subsequent pipe threading.
[0010] In one optional implementation, the step of calling a machining macro program to perform pipe threading on the pipe to be processed according to the machining parameters includes: Read the processing parameters; Based on the processing parameters, the target processing program to be called is determined using conditional jump logic; The target processing program is invoked and run to perform corresponding pipe thread processing on the pipe to be processed.
[0011] In one optional implementation, the processing parameters include single- or double-end processing requirement information; If the single / double-end processing requirement information is single-end processing, then after running the probe subroutine on the pipe to be processed, the step of running the material feeding subroutine is executed. If the single / double-end processing requirement information is double-end processing, then after running the probe subroutine at one end of the pipe to be processed, an intermediate processing step is executed to run the probe subroutine at the other end of the pipe to be processed.
[0012] In one optional implementation, the intermediate processing step includes: Run the material feeding subroutine to perform material feeding interaction actions with the robot in order to feed the pipes to be processed; The robot is controlled to reverse the direction of the pipe to be processed and run the feeding subroutine to perform feeding interaction actions with the robot in order to re-feed the pipe to be processed.
[0013] In one optional implementation, the method further includes: After the current pipe is cut, return to the step of obtaining the processing parameters of the pipe to be processed, so as to perform pipe thread processing on the next pipe to be processed, until the current batch of pipe thread processing is completed.
[0014] Secondly, the present invention provides a macro-program-based CNC machining system for pipe threads, comprising: CNC machine tools include a worktable for clamping pipes, cutting tools for machining pipes, and CNC probes for detecting the position of pipes; The CNC system is signal-connected to the CNC machine tool and the CNC probe, respectively, and is used to execute the macro-program-based CNC pipe thread machining method of the first aspect or any corresponding embodiment described above, control the CNC probe to perform position compensation, and control the cutting tool to perform pipe thread machining; The robot is connected to the CNC system and is used to transport the pipe to be processed to the worktable for loading, and to remove the processed pipe from the worktable for unloading, according to the control instructions of the CNC system.
[0015] Thirdly, the present invention provides a macro-program-based CNC machining device for pipe threads, applied to a CNC system, the device comprising: The parameter acquisition module is used to acquire the processing parameters of the pipe to be processed; The feeding module is used to run the feeding subroutine and perform feeding interaction actions with the robot to feed the pipes to be processed. The probe operation module is used to run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed. If it is determined that the CNC probe is in contact with the pipe to be processed, the CNC probe is used to perform position compensation on the pipe to be processed, and the processing macro program is called to perform pipe thread processing on the pipe to be processed according to the processing parameters. If it is determined that the CNC probe is not in contact with the pipe to be processed, the pipe thread processing step is skipped. The unloading module is used to run the unloading subroutine and perform unloading interaction actions with the robot to unload the current pipe.
[0016] Fourthly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the macro-program-based CNC machining method for pipe threads described in the first aspect or any corresponding embodiment thereof.
[0017] Fifthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the macro-program-based CNC machining method for pipe threads according to the first aspect or any corresponding embodiment described above.
[0018] In a sixth aspect, the present invention provides a computer program product, including computer instructions for causing a computer to execute the macro-program-based CNC machining method for pipe threads described in the first aspect or any corresponding embodiment thereof.
[0019] The technical solution provided by this invention may include the following beneficial effects: The macro-program-based CNC pipe threading method provided by this invention, through the execution of loading and unloading subroutines, allows the CNC system to coordinate a robot to automatically complete the interactive actions of loading and unloading pipes, effectively replacing manual handling and significantly improving production efficiency. By introducing a probe subroutine for detection and judgment, when the CNC probe is determined to be in contact with the pipe, position compensation is performed using the CNC probe, automatically correcting minor deviations caused by robot loading and ensuring the final processing quality of the pipe. When the CNC probe is determined not to be in contact with the pipe, the pipe threading steps can be intelligently skipped, avoiding empty processing when the pipe is missing or improperly clamped, effectively preventing machine tool damage and tool collision risks. By acquiring the processing parameters of the pipe to be processed and calling the processing macro program, flexible matching of processing parameters is achieved, adapting to the processing needs of different pipe specifications and improving the flexibility of the production line. Therefore, the above solution constructs a complete automated processing logic closed loop, filling the gap in program automation in robot-assisted CNC machining systems and significantly improving the intelligence level of pipe threading. Attached Figure Description
[0020] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of the first type of CNC machining method for pipe threads based on macro programs according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the second process of the CNC machining method for pipe threads based on macro programs according to an embodiment of the present invention; Figure 3 This is a schematic flowchart of a single-end pipe processing method according to an embodiment of the present invention; Figure 4This is a schematic flowchart of a pipe double-end processing method according to an embodiment of the present invention; Figure 5 This is a schematic diagram of a macro-program-based CNC machining system for pipe threads according to an embodiment of the present invention; Figure 6 This is a structural block diagram of a macro-program-based CNC machining device for pipe threads according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0024] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0025] Due to its advantages such as centralized processes, high automation, high flexibility, and strong capabilities, CNC machining is gradually gaining attention from manufacturing companies. Applying CNC machining to pipe threading can improve production efficiency and precision.
[0026] However, in related technologies, when processing pipe threads, manual loading and unloading is required. Metal pipes such as copper pipes and steel pipes weighing tens of kilograms are repeatedly moved to or away from CNC machine tools. This results in a significant decrease in production efficiency as manual labor strength declines. Furthermore, the loading and positioning rely on manual experience and judgment, which has low accuracy.
[0027] According to an embodiment of the present invention, a method for CNC machining of pipe threads based on macro programs is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0028] This embodiment provides a macro-program-based CNC machining method for pipe threads, executed by a CNC system. Figure 1 This is a flowchart of a macro-program-based CNC machining method for pipe threads according to an embodiment of the present invention, as shown below. Figure 1 As shown, the process includes the following steps: Step S101: Obtain the processing parameters of the pipe to be processed.
[0029] These processing parameters indicate the pipe specifications and processing requirements, such as pipe diameter, thread type, and batch number. The CNC system can establish a communication connection with a host computer (industrial computer) via an I / O (input / output) interface. The industrial computer, acting as the central control unit of the production line, sends the specific processing parameters of the pipe to be processed to the CNC system according to the production plan. The CNC system reads these parameters and stores them in designated macro variables, serving as the basis for subsequent program jumps. By setting steps for obtaining the processing parameters of the pipe to be processed, the limitation of traditional CNC machine tools, where a single program can only process one specification of workpiece, can be overcome. This ensures that the machine tool can automatically adjust its processing strategy based on different incoming material parameters, providing a prerequisite for subsequently calling the correct processing program.
[0030] Step S102: Run the feeding subroutine to perform feeding interaction actions with the robot in order to feed the pipe to be processed.
[0031] This loading subroutine is a pre-written program module stored in the CNC system, used to coordinate the action sequence of the machine tool and the robot. The CNC system runs this loading subroutine, communicating with the robot controller via I / O signals to establish interactive logic. After receiving the loading permission signal, the robot grabs the pipe to be processed and moves it to the clamping position on the machine tool. After the pipe is securely placed, the robot sends a loading completion signal to the machine tool, which then performs the clamping action. By setting and running the loading subroutine to execute the loading interaction with the robot for loading the pipe to be processed, the high degree of freedom and automation of the robot can solve the problems of low efficiency and high safety hazards associated with manual loading and unloading of heavy pipes. Simultaneously, it prepares the workpiece for subsequent precision machining by automating material flow using the robot, improving processing efficiency and accuracy.
[0032] Step S103: Run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed; if it is determined that the CNC probe is in contact with the pipe to be processed, the CNC probe is used to perform position compensation on the pipe to be processed, and the processing macro program is called to perform pipe thread processing on the pipe to be processed according to the processing parameters; if it is determined that the CNC probe is not in contact with the pipe to be processed, the pipe thread processing step is skipped.
[0033] First, the CNC system calls the probe subroutine to control the CNC probe (a high-precision contact sensor) mounted on the machine tool to move towards the end face of the pipe to be processed for edge detection. It then determines whether the CNC probe is in contact with the pipe. If the probe is in contact, the pipe is properly clamped, and the subsequent threading process can proceed. If the probe is not in contact, the pipe is missing or the clamping is severely inadequate, and the threading process must be skipped to prevent collisions. Since robot clamping can still have some deviation when faced with changes in the blank, target workpiece, etc., a clamping offset compensation capability is needed to adapt to the robot's CNC machining system. By setting up a CNC probe, the dimensions and position of the workpiece can be measured directly during processing without human intervention, and the workpiece offset can be automatically corrected based on the measurement results, enabling the same machine tool to process parts with higher precision.
[0034] During the pipe threading process, the measured position obtained by the CNC probe is compared with the theoretical position. Position compensation is performed on the pipe to be processed based on the difference between the two, eliminating minor deviations caused by robot loading and improving processing accuracy. Next, the acquired processing parameters are analyzed, and the corresponding pipe threading operation is executed on the pipe to be processed using macro program logic.
[0035] Step S104: Run the material feeding subroutine and perform the material feeding interaction with the robot to feed the current pipe material.
[0036] This unloading subroutine is run by the CNC system to coordinate the timing of the machine tool and the robot's actions. After the pipe threading step is completed or skipped, the CNC system controls the machine tool to release the clamps, return to standby mode, and send a request for unloading signal to the robot via the I / O interface. Upon receiving the request for unloading signal, the robot performs a gripping action, removing the current pipe material (including finished pipes that have undergone the pipe threading step and pipes to be processed that skipped the pipe threading step) from the machine tool's worktable and placing it in the designated unloading area. After placement, the robot sends a completion signal to the CNC system, confirming the end of the unloading process. By setting and running the unloading subroutine to perform unloading interactions with the robot to unload the current pipe material, the process can correspond with the loading step, forming a complete material flow closed loop. The macro-program-based CNC pipe threading method provided in this embodiment, through the execution of loading and unloading subroutines, allows the CNC system to coordinate with the robot to automatically complete the interactive actions of loading and unloading pipes, effectively replacing manual handling and significantly improving production efficiency. By introducing a probe subroutine for detection and judgment, when the CNC probe is determined to be in contact with the pipe, position compensation is performed using the CNC probe, automatically correcting minor deviations caused by robot loading and ensuring the final processing quality of the pipe. When the CNC probe is determined not to be in contact with the pipe, the pipe threading steps can be intelligently skipped, avoiding empty processing when the pipe is missing or improperly clamped, effectively preventing machine tool damage and tool collision risks. By acquiring the processing parameters of the pipe to be processed and calling the processing macro program, flexible matching of processing parameters is achieved, adapting to the processing needs of different pipe specifications and improving the flexibility of the production line. Therefore, the above solution constructs a complete automated processing logic closed loop, filling the gap in program automation in robot-assisted CNC machining systems and significantly improving the intelligence level of pipe threading.
[0037] This embodiment provides a macro-program-based CNC machining method for pipe threads, executed by a CNC system. Figure 2 This is a flowchart of a macro-program-based CNC machining method for pipe threads according to an embodiment of the present invention, as shown below. Figure 2 As shown, the process includes the following steps: Step S201: Obtain the processing parameters of the pipe to be processed.
[0038] Please see details Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0039] Optionally, after obtaining the processing parameters of the pipe to be processed, the system parameters and macro variables are also reset.
[0040] Step S202: Run the feeding subroutine to perform feeding interaction actions with the robot in order to feed the pipe to be processed.
[0041] Please see details Figure 1 Step S102 of the illustrated embodiment will not be described again here.
[0042] Step S203: Run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed; if it is determined that the CNC probe is in contact with the pipe to be processed, the CNC probe is used to perform position compensation on the pipe to be processed, and the processing macro program is called to perform pipe thread processing on the pipe to be processed according to the processing parameters; if it is determined that the CNC probe is not in contact with the pipe to be processed, the pipe thread processing step is skipped.
[0043] Optionally, when determining whether the CNC probe has contacted the pipe to be processed, the CNC probe is first controlled to move towards a preset edge-finding position until it stops. The CNC probe stops upon contacting the object (pipe) or upon reaching the preset edge-finding position. This preset edge-finding position indicates the coordinates of the CNC probe's endpoint as set in the program. The CNC probe performs an edge-finding action during its movement, providing a basis for subsequent contact determination. Next, the current absolute coordinate variable of the CNC probe on the Z-axis is read, and then it is determined whether this current absolute coordinate variable is equal to the preset target contact position value. If the CNC probe touches the pipe during its movement, the machine tool movement is immediately interrupted. At this time, the actual position of the CNC probe is recorded in the system variable (current absolute coordinate variable). The CNC system compares the current absolute coordinate variable with the preset target contact position value (i.e., the edge-finding position). If the current absolute coordinate variable is equal to the preset target contact position value, it means that the CNC probe has successfully completed its movement and reached the preset endpoint, that is, there are no obstacles blocking the movement path. It is possible that the pipe to be processed is missing or the clamping is seriously inadequate. In this case, it is determined that the CNC probe has not contacted the pipe to be processed. If the current absolute coordinate variable is not equal to the preset target contact position value, it means that the CNC probe touched the pipe during the movement, triggering a signal that caused the movement to stop. The position of the CNC probe will remain halfway. In this case, it is determined that the CNC probe has contacted the pipe to be processed, confirming that the pipe to be processed exists and is within the detectable range.
[0044] Optionally, when skipping the pipe threading step, due to the failure of this clamping, the CNC system first sets the workpiece clamping quality difference flag to a valid value (e.g., set it to 1) to record the abnormal state of the current pipe; then, it controls the CNC probe to move to a safe position to prevent interference or collision in subsequent actions and damage to the CNC probe; finally, it jumps to the step of running the unloading subroutine and executes the unloading subroutine to remove the current pipe that failed to clamp from the machine tool, ensuring that the production line can continue to operate and avoiding machine tool idling or damage.
[0045] Optionally, when using a CNC probe to perform position compensation on the pipe to be processed, the difference between the stopping position (current absolute coordinate variable) when the CNC probe contacts the pipe and the theoretical position (target contact position value) reflects the positional deviation of the robot loading. Therefore, based on the difference between the current absolute coordinate variable and the target contact position value, a machining coordinate system compensation command is executed to correct the origin of the machining coordinate system, eliminate the physical deviation caused by the robot's repetitive positioning error, and ensure that the subsequent machining reference is consistent with the actual position of the pipe to be processed. Then, since the CNC probe has completed the measurement, it is controlled to move to a safe position to make room for subsequent pipe threading, prevent the CNC probe from colliding with the cutting tool or the pipe, and ensure that the cutting tool can safely enter the machining area for subsequent pipe threading.
[0046] When the macro program is called to perform pipe threading on the pipe to be processed based on the processing parameters, the processing parameters stored in the macro variable are read first. Then, based on the processing parameters, the conditional jump logic in the macro program is used to determine the target processing program to be called. The target processing program is then called from memory and run. The pipe to be processed is then threaded according to the predetermined process path, such as thread cutting, to achieve automated and precise processing.
[0047] Optionally, if the processing parameter variable is equal to a first preset value, the program jumps to and calls the first processing program; if the processing parameter variable is equal to a second preset value, the program jumps to and calls the second processing program; if the processing parameter variable is equal to a third preset value, the program jumps to and calls the third processing program.
[0048] Optionally, the processing parameters include single-end and double-end processing requirements. After parsing the single-end and double-end processing requirements, it is necessary to determine whether the pipe to be processed will undergo single-end or double-end processing. If the single-end and double-end processing requirements indicate single-end processing, it means that the pipe to be processed needs to undergo single-end processing. In this case, after running the probe subroutine on the pipe to be processed and completing the pipe threading step on one end of the pipe or skipping the pipe threading step, the processing flow for the other end is directly skipped, and the step of running the unloading subroutine is executed. If the single-end and double-end processing requirements indicate double-end processing, it means that the pipe to be processed needs to undergo double-end processing (e.g., threading on one end and chamfering on the other end). In this case, after running the probe subroutine on one end of the pipe to be processed, an intermediate processing step is executed to change the clamping state of the pipe to be processed so that the probe subroutine can be run on the other end of the pipe.
[0049] Optionally, during the intermediate processing steps, the unloading subroutine is run first to perform the unloading interaction with the robot to unload the pipe to be processed. Since the other end has not yet been processed, the robot does not put the pipe back into the unloading area. Instead, the robot is controlled to reverse the direction of the pipe to be processed and the loading subroutine is run to perform the loading interaction with the robot to reload the pipe to be processed, thereby realizing the automatic turning of the pipe in the machine tool and completing the continuous operation of double-end processing without manual intervention.
[0050] Step S204: Run the material feeding subroutine and perform the material feeding interaction action with the robot to feed the current pipe.
[0051] Please see details Figure 1 Step S104 of the illustrated embodiment will not be described again here.
[0052] Step S205: After the current pipe is cut, return to the step of obtaining the processing parameters of the pipe to be processed, so as to perform pipe thread processing on the next pipe to be processed, until the current batch of pipe thread processing is completed.
[0053] Since steps S201 to S204 are complete processing steps for a single pipe, by setting step S205, after the single pipe is unloaded and removed from the machine tool, the machine tool is not shut down. Instead, the process jumps back to the step of obtaining the processing parameters of the pipe to be processed (step S201), the system is reset, and the processing parameters of the next pipe to be processed are read. That is, steps S201 to S204 are re-executed, thereby realizing continuous automated production of batch pipes until the industrial control computer sends an end signal to complete the current batch of pipe thread processing, which greatly improves the automation level and processing efficiency of the production line.
[0054] The macro-program-based CNC machining method for pipe threads provided in this embodiment can automatically reverse and reload the pipe material through intermediate processing steps to meet different processing requirements of single and double ends, thus completing complex processes without manual intervention. By cyclically executing the steps, a complete closed-loop logic for batch automated processing is constructed, filling the gap in program automation in robot-assisted CNC machining systems and significantly improving the intelligence level and production efficiency of pipe thread machining.
[0055] As one or more specific application embodiments of the present invention, the optimal implementation scheme or the scheme that the inventors most want to embody is described in combination with the specific application scenario.
[0056] In this embodiment, taking welded copper pipe as an example, the CNC machining method for pipe threads based on macro programs is described in detail. The blank of the welded copper pipe is a copper pipe of roughly the same length cut by a CNC sawing machine. The processing of the welded copper pipe is mainly divided into the following two cases: (1) thread processing is performed on one end; (2) thread processing is performed on one end, and internal and external chamfering is performed on the other end, and the length of the copper pipe is controlled. The blank diameter of the welded copper pipe is 75mm, 76mm and 80mm, and the thread type of the finished product is R2, 1 / 2, M72×2 and NPT2, 1 / 2.
[0057] Figure 3 This is a schematic flowchart of a single-end pipe processing method according to an embodiment of the present invention. Figure 4 This is a flowchart illustrating a pipe double-end machining method according to an embodiment of the present invention. The method utilizes CNC machine tool parameters and macro variables to write macro programs, achieving logical selection of the machining program and positioning compensation for robot clamping. The main steps include: S1: Read the processing parameters corresponding to the pipe to be processed from the industrial control computer through the I / O interface; S2: System parameters and macro variables reset; S3: Run the feeding subroutine and complete the feeding interaction with the robot; S4: Run the probe subroutine to compensate for minor deviations in robot feeding; The macro program corresponding to S4 (corresponding to the probe subroutine) is as follows: N10G00 X70 Z20 Initial Positioning G98 G31 Z-8 F200 CNC Probe Edge Finder IF[#5042 EQ-8] GOTO20 determines whether the CNC probe is in contact with the pipe to be machined. #5042 represents the current absolute coordinate of the tool's Z-axis. G50 Z1 Machining Coordinate System Compensation G0 X150.0 Z100.0 CNC probe leaves the workpiece M99 exits the probe subroutine. N20#105 = 1 Probe not touched marker count (clamping quality poor marker count) set to 1 G0 Z200 CNC probe leaves the workpiece M99 exits the probe subroutine. S5: Determine the steps of the automatic processing cycle based on the single or double end processing requirements of the pipe (if it is single end processing, skip steps S6, S7, and S8). S6: Chamfer the non-threaded ends according to the blank pipe diameter; S7: Run the material feeding subroutine and complete the material feeding interaction with the robot; S8: After the robot reverses the direction of the copper tube, run the feeding subroutine to complete the feeding interaction with the robot; S9: Perform corresponding pipe threading on the pipe according to the processing parameters input by the industrial control computer; The macro program corresponding to S9 (the corresponding machining macro program) is as follows: IF[#103EQ8]GOT010 Machining parameter judgment, #103 is the machining parameter transmitted by the industrial control computer. IF[#103EQ16]GOTO20 IF[#103EQ32]GOTO30 ... N10G65 P2000 Select machining program O2000 M99 N20G65 P2010 Select machining program O2010 M99 N30G65 P2020 Select machining program O2020 M99 S10: Run the material feeding subroutine and complete the material feeding interaction with the robot; S11: Repeat steps S2-S10 above until the entire batch of pipe threads is processed.
[0058] This embodiment provides a macro-program-based CNC machining system for pipe threads. Figure 5 This is a schematic diagram of a macro-program-based CNC machining system for pipe threads according to an embodiment of the present invention, as shown below. Figure 5 As shown, it includes: CNC machine tools include a worktable for clamping pipes, cutting tools for machining pipes, and CNC probes for detecting the position of pipes; The CNC system is connected to the CNC machine tool and the CNC probe via signals, and is used to execute... Figure 1 An embodiment or any of its corresponding implementation methods Figure 2 The embodiment or any of its corresponding implementations of the macro-program-based CNC pipe thread machining method controls the CNC probe to perform position compensation and controls the cutting tool to perform pipe thread machining. The robot is connected to the CNC system and is used to transport the pipe to be processed to the worktable for loading, and to remove the processed pipe from the worktable for unloading, according to the control instructions of the CNC system.
[0059] This embodiment also provides a macro-program-based CNC machining device for pipe threads, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0060] This embodiment provides a macro-program-based CNC machining device for pipe threading, which is applied to a CNC system, such as... Figure 6 As shown, it includes: The parameter acquisition module 601 is used to acquire the processing parameters of the pipe to be processed; The feeding module 602 is used to run the feeding subroutine and perform feeding interaction actions with the robot to feed the pipes to be processed. The probe operation module 603 is used to run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed. If it is determined that the CNC probe is in contact with the pipe to be processed, the CNC probe is used to perform position compensation on the pipe to be processed, and the processing macro program is called to perform pipe thread processing on the pipe to be processed according to the processing parameters. If it is determined that the CNC probe is not in contact with the pipe to be processed, the pipe thread processing step is skipped. The unloading module 604 is used to run the unloading subroutine and perform unloading interaction actions with the robot to unload the current pipe.
[0061] In an optional implementation, the probe operation module is further configured to: Control the CNC probe to move towards the preset edge-finding position until the CNC probe stops; Read the current absolute coordinate variable of the CNC probe on the Z-axis; Determine whether the current absolute coordinate variable is equal to the preset target contact position value; If the current absolute coordinate variable is equal to the preset target contact position value, it is determined that the CNC probe is not in contact with the pipe to be processed; If the current absolute coordinate variable is not equal to the preset target contact position value, it is determined that the CNC probe is in contact with the pipe to be processed.
[0062] In an optional implementation, the probe operation module is further configured to: Set the workpiece clamping quality difference flag to a valid value; Control the CNC probe to move to a safe position; Jump to execute the steps of the material feeding subroutine.
[0063] In an optional implementation, the probe operation module is further configured to: Based on the difference between the current absolute coordinate variable and the target contact position value, execute the machining coordinate system compensation command to correct the origin of the machining coordinate system; Control the CNC probe to move to a safe position for subsequent pipe threading.
[0064] In an optional implementation, the probe operation module is further configured to: Read the processing parameters; Based on the processing parameters, the target processing program to be called is determined using conditional jump logic; Call and run the target machining program to perform the corresponding pipe threading on the pipe to be processed.
[0065] In one alternative implementation, the processing parameters include single- or double-end processing requirement information; If the single / double-end processing requirement is single-end processing, then after running the probe subroutine on the pipe to be processed through the probe running module, the steps of running the material unloading subroutine are executed through the material unloading module. If the single / double-end processing requirement is double-end processing, then after the probe subroutine is run at one end of the pipe to be processed through the probe running module, the intermediate processing steps are executed through the intermediate module so that the probe subroutine can be run at the other end of the pipe to be processed through the probe running module.
[0066] In one alternative implementation, the intermediate module is used for: The unloading module runs the unloading subroutine to perform unloading interaction actions with the robot in order to unload the pipes to be processed. The robot is controlled to reverse the direction of the pipe to be processed, and the feeding module runs the feeding subroutine to perform feeding interaction actions with the robot in order to re-feed the pipe to be processed.
[0067] In an alternative embodiment, the device further includes a circulation module for: After the current pipe is cut, return to the step of obtaining the processing parameters of the pipe to be processed, so as to perform pipe thread processing on the next pipe to be processed, until the current batch of pipe thread processing is completed.
[0068] The macro-program-based CNC pipe thread machining device provided in this embodiment of the invention can execute the macro-program-based CNC pipe thread machining method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units are the same as in the corresponding embodiments described above, and will not be repeated here.
[0069] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0070] The following is a detailed reference. Figure 7 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 701, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 702 or a program loaded from memory 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the electronic device. The processor 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0071] Typically, the following devices can be connected to I / O interface 705: input devices 706 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 707 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 709. Communication device 709 allows electronic devices to exchange data via wireless or wired communication with other devices. Although Figure 7 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0072] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 709, or installed from a memory 708, or installed from a ROM 702. When the computer program is executed by the processor 701, it performs the functions defined in the macro-program-based CNC threading method of the embodiments of the present invention.
[0073] Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0074] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the macro-program-based CNC thread machining method shown in the above embodiments is implemented.
[0075] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0076] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the invention.
Claims
1. A CNC machining method for pipe threads based on macro programs, characterized in that, The method, executed by a CNC system, includes: Obtain the processing parameters of the pipe to be processed; Run the feeding subroutine to perform feeding interaction actions with the robot in order to feed the pipes to be processed; Run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed; if it is determined that the CNC probe is in contact with the pipe to be processed, then use the CNC probe to perform position compensation on the pipe to be processed, and call the processing macro program to perform pipe thread processing on the pipe to be processed according to the processing parameters; if it is determined that the CNC probe is not in contact with the pipe to be processed, then skip the pipe thread processing step. Run the material feeding subroutine to perform material feeding interaction actions with the robot in order to feed the current pipe material.
2. The method according to claim 1, characterized in that, The step of determining whether the CNC probe is in contact with the pipe to be processed includes: The CNC probe is controlled to move towards a preset edge-finding position until the CNC probe stops; Read the current absolute coordinate variable of the CNC probe on the Z-axis; Determine whether the current absolute coordinate variable is equal to the preset target contact position value; If the current absolute coordinate variable is equal to the preset target contact position value, it is determined that the CNC probe is not in contact with the pipe to be processed; If the current absolute coordinate variable is not equal to the preset target contact position value, then it is determined that the CNC probe is in contact with the pipe to be processed.
3. The method according to claim 2, characterized in that, The skipping of the pipe threading process includes: Set the workpiece clamping quality difference flag to a valid value; Control the CNC probe to move to a safe position; Jump to execute the steps of the material feeding subroutine.
4. The method according to claim 2, characterized in that, The method of using a CNC probe to perform position compensation on the pipe to be processed includes: Based on the difference between the current absolute coordinate variable and the target contact position value, execute the machining coordinate system compensation command to correct the origin of the machining coordinate system; The CNC probe is controlled to move to a safe position for subsequent pipe threading.
5. The method according to claim 1, characterized in that, The step of calling the processing macro program according to the processing parameters to perform pipe threading on the pipe to be processed includes: Read the processing parameters; Based on the processing parameters, the target processing program to be called is determined using conditional jump logic; The target processing program is invoked and run to perform corresponding pipe thread processing on the pipe to be processed.
6. The method according to claim 1, characterized in that, The processing parameters include single- or double-end processing requirements; If the single / double-end processing requirement information is single-end processing, then after running the probe subroutine on the pipe to be processed, the step of running the material feeding subroutine is executed. If the single / double-end processing requirement information is double-end processing, then after running the probe subroutine at one end of the pipe to be processed, an intermediate processing step is executed to run the probe subroutine at the other end of the pipe to be processed.
7. The method according to claim 6, characterized in that, The intermediate processing steps include: Run the material feeding subroutine to perform material feeding interaction actions with the robot in order to feed the pipes to be processed; The robot is controlled to reverse the direction of the pipe to be processed and run the feeding subroutine to perform feeding interaction actions with the robot in order to re-feed the pipe to be processed.
8. The method according to claim 1, characterized in that, The method further includes: After the current pipe is cut, return to the step of obtaining the processing parameters of the pipe to be processed, so as to perform pipe thread processing on the next pipe to be processed, until the current batch of pipe thread processing is completed.
9. A CNC machining system for pipe threads based on macro programs, characterized in that, include: CNC machine tools include a worktable for clamping pipes, cutting tools for machining pipes, and CNC probes for detecting the position of pipes; The CNC system is signal-connected to the CNC machine tool and the CNC probe, respectively, and is used to execute the CNC pipe thread machining method based on macro program as described in any one of claims 1 to 7, control the CNC probe to perform position compensation, and control the cutting tool to perform pipe thread machining; The robot is connected to the CNC system and is used to transport the pipe to be processed to the worktable for loading, and to remove the processed pipe from the worktable for unloading, according to the control instructions of the CNC system.
10. A CNC machining device for pipe threads based on macro programs, characterized in that, The device, applied to a numerical control system, includes: The parameter acquisition module is used to acquire the processing parameters of the pipe to be processed; The feeding module is used to run the feeding subroutine and perform feeding interaction actions with the robot to feed the pipes to be processed. The probe operation module is used to run the probe subroutine to determine whether the CNC probe is in contact with the pipe to be processed. If it is determined that the CNC probe is in contact with the pipe to be processed, the CNC probe is used to perform position compensation on the pipe to be processed, and the processing macro program is called to perform pipe thread processing on the pipe to be processed according to the processing parameters. If it is determined that the CNC probe is not in contact with the pipe to be processed, the pipe thread processing step is skipped. The unloading module is used to run the unloading subroutine and perform unloading interaction actions with the robot to unload the current pipe.