Method for quickly aligning casting based on macro program

By compiling macro programs and modifying the post-processing program of the programming software, and using trigonometric functions to measure and calculate the linear skew angle, automatic correcting of castings is achieved, solving the problems of inefficiency and difficulty in ensuring accuracy of traditional correcting methods, improving the correcting efficiency and accuracy, and suitable for rapid correcting of large castings.

CN119717689AActive Publication Date: 2025-03-28JIANGSU AUTOMATION RESEARCH INSTITUTE
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202411668953.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-28
Estimated Expiration
2044-11-20

AI Technical Summary

Technical Problem

The traditional casting correcting method is inefficient, has high labor intensity, and is difficult to guarantee the accuracy, making it difficult to adapt to the efficient processing needs of CNC machine tools.

Method used

By compiling macro programs and modifying the programming software post-processing program, the trigonometric function is used to measure and calculate the linear skew angle, and automatic correcting of castings is achieved.

Benefits of technology

It improves the correcting efficiency, ensures the correcting accuracy, reduces manual operation errors, is highly adaptable, and is easy to promote, and is especially suitable for rapid correcting of large castings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119717689A_ABST
    Figure CN119717689A_ABST
Patent Text Reader

Abstract

The invention discloses a method for quickly aligning a casting based on a macro program. The method comprises the following steps: step 1, measuring and calculating a linear deflection angle by adopting a trigonometric function; 2, compiling an alignment macro program; 3, modifying a post-processing program of the programming software; and 4, a program generated after the post-processing program is modified, and the program is called for a cutter for machining. According to the method, automatic calculation and alignment are achieved through a method of compiling a macro program and modifying a post-processing program of programming software, so that rapid clamping is achieved, manual alignment operation errors are avoided, the alignment time is greatly shortened, the machining efficiency is improved, adaptability is high, popularization is easy, and the alignment effect on large castings is particularly remarkable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of mechanical processing, and in particular relates to a method for quickly aligning a casting based on a macro program. Background Art

[0002] In my country's foundry industry, the quality of castings is directly related to the performance and service life of the products. In the production process, alignment is an important link to improve the accuracy of castings. The traditional alignment method mainly relies on the experience and technical level of employees, which is not only inefficient, but also difficult to ensure accuracy. Due to the unevenness of the blank allowance of castings, the castings need to be aligned with the parallel lines of the workpiece and the machine tool in the XY plane according to the bench marking before processing, and then the tool is aligned and processed according to the marked lines on the vertical, horizontal, and gantry machining center machines. This casting is clamped and aligned with a vise, and the upper surface horizontal surface has been processed. Because the workpiece clamped by the vise is a square view workpiece, the workpiece cannot be offset and can only be leveled by an inclined iron or a pad (parallel to the X or Y direction of the workbench). This increases the labor intensity of the operator, requires frequent clamping, requires a relatively high skill level for the workers, and has low alignment efficiency.

[0003] CNC machine tools are increasingly used in the foundry industry, and their high precision and high efficiency have brought revolutionary changes to casting processing. However, in the process of CNC programming, the alignment of castings is still a difficult problem. To this end, we proposed a method for rapid alignment of castings based on macro programs. This method uses the powerful parametric programming function of macro programs to extract and calculate the characteristic parameters of castings to achieve rapid alignment of castings. Macro programs are a type of programmable CNC instructions that allow operators to customize programming elements such as variables, logical judgments, and loops in the CNC system. This method for rapid alignment of castings based on macro programs can improve alignment efficiency, ensure alignment accuracy, has strong adaptability, and is easy to promote. Summary of the invention

[0004] The present invention aims to provide a method for quickly aligning a casting based on a macro program, which realizes automatic alignment of the casting and solves the problems of low alignment efficiency, high labor intensity and frequent clamping of the casting.

[0005] In order to achieve the purpose of the present invention, the present invention provides a method for quickly aligning a casting based on a macro program, comprising the following steps:

[0006] Step 1: Use trigonometric functions to measure and calculate the straight line deflection angle;

[0007] Step 2: Compile the alignment macro program;

[0008] Step 3: Modify the post-processing program of the programming software;

[0009] Step 4: Modify the program generated after the post-processing program, and process the tool calling program.

[0010] Furthermore, the step 1 is specifically to automatically calculate and align using the inverse tangent trigonometric function principle, firstly obtaining the relative coordinates of the two points A and B1 by measuring, and then calculating the deflection angle of the straight line.

[0011] Furthermore, the step 2 specifically utilizes the local variables, public variables, and system variables of the numerical control system to automatically align the coordinate angles, perform variable programming, and automatically store the calculation results in the machine tool memory.

[0012] Further, step 2 includes the following steps:

[0013] 2.1 Main program of the calculation macro program based on FANUC CNC system

[0014] 2.2 Explanation of operation macro program;

[0015] 2.3 The machine tool operates according to the macro program calculation.

[0016] Furthermore, the 2.2 operation macro program is interpreted as:

[0017] The tool moves to the point A, the machine tool program is started, the current machine tool mechanical coordinates X and Y are automatically read, and the corresponding coordinates are read into the public variables of the CNC machine tool system;

[0018] The program is suspended;

[0019] The tool moves to the B1 point, starts the machine tool program, automatically reads the current machine tool mechanical coordinates X and Y, and reads the coordinates into the common variables of the CNC machine tool;

[0020] The program is suspended;

[0021] Starting the machine tool program, subtracting the X-direction value in the common variable and then reading it into the common variable;

[0022] Subtract the Y-direction value in the common variable and read it into the common variable;

[0023] After calculating the angle between the two points, the result is written into the common variable for later use;

[0024] The program ends and the calculation is completed.

[0025] Furthermore, the 2.3 machine tool is operated according to the macro program operation, and the operation is:

[0026] 2.3.1 The machine tool calls a 90-degree sharp chamfering tool, moves the tool to point A with a hand wheel in manual mode, switches the tool to run the alignment program in automatic operation, and the program executes the program segment, and stops automatically when a stop program is encountered;

[0027] 2.3.2 Use the hand wheel to move the tool to the B1 point, continue to run the alignment program, and stop when encountering the stop program;

[0028] 2.3.3 Continue to run the alignment program, and the machine tool automatically writes the calculation results into the public variables of the machine tool.

[0029] Furthermore, the step 3 is specifically to write the angle macro program that needs to be rotated into the software post-processing program to generate an NC code program with its own macro program; the variable in the machine tool is #, which is replaced by & in the program; in the software post-processing program, an automatic call to the variable rotation instruction is added in front of the fixed position program segment of the tool, and the rotation is canceled after the tool program ends.

[0030] Furthermore, in step 4, when machining the casting, the origin coordinates are established by tool alignment, and the alignment program is called out to perform casting machining.

[0031] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for quickly aligning a casting based on a macro program is implemented.

[0032] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned method for quickly aligning a casting based on a macro program.

[0033] Compared with the prior art, the significant progress of the present invention is that: the present invention realizes automatic calculation and alignment by compiling macro programs and modifying the post-processing program of programming software, thereby realizing rapid clamping, avoiding manual alignment operation errors, greatly reducing alignment time and improving processing efficiency, having strong adaptability and easy promotion, and being more significant for the alignment of large castings, and having good application prospects.

[0034] In order to more clearly illustrate the functional characteristics and structural parameters of the present invention, further description is given below in conjunction with the accompanying drawings and specific implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0036] Figure 1It is a flow chart of the method for quickly aligning castings based on a macro program of the present invention;

[0037] Figure 2 It is a mathematical principle model diagram of the present invention;

[0038] Figure 3 It is a macro program calculation result diagram of the present invention. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0040] The invention discloses a method for quickly aligning a casting based on a macro program. Figure 1 , including the following steps:

[0041] Step 1: Use trigonometric functions to measure and calculate the straight line deflection angle: Combine Figure 2 The automatic calculation and alignment adopts the principle of inverse tangent trigonometric function. First, the relative coordinates of points A and B1 are obtained by measurement, and then the deviation angle a of the straight line is calculated.

[0042] Step 2: Prepare the alignment macro program: Use the local variables, public variables, and system variables of the CNC system to automatically align the coordinate angles, perform variable programming, and automatically store the calculation results in the machine tool memory;

[0043] 2.1 Main program of the calculation macro program based on FANUC CNC system:

[0044] %O6666 (main program)

[0045] #500=#5021(X1)#501=#5022(Y1);

[0046] M00;

[0047] #502=#5021(X2)#503=#5022(Y2);

[0048] M00;

[0049] #504=#502-#500;

[0050] #505=#503-#501;

[0051] #506=ATAN[#505] / [#504];

[0052] M30;

[0053] 2.2 Operation macro program explanation:

[0054] The tool moves to the point A, the machine tool program is started, the current machine tool mechanical coordinates X and Y are automatically read, and the corresponding coordinates are read into the public variables of the CNC machine tool system;

[0055] The program is suspended;

[0056] The tool moves to the B1 point, starts the machine tool program, automatically reads the current machine tool mechanical coordinates X and Y, and reads the coordinates into the common variables of the CNC machine tool;

[0057] The program is suspended;

[0058] Starting the machine tool program, subtracting the X-direction value in the common variable and then reading it into the common variable;

[0059] Subtract the Y-direction value in the common variable and read it into the common variable;

[0060] After calculating the angle between the two points, the result is written into the common variable for later use;

[0061] The program ends and the operation is completed;

[0062] 2.3 The machine tool operates according to the macro program calculation:

[0063] 2.3.1 The machine tool calls a 90-degree sharp chamfering tool, moves the tool to point A with the hand wheel in manual mode, switches the tool to run the alignment program O6666 in automatic operation, and the program executes the program segment, and stops automatically when it encounters the stop program M00;

[0064] 2.3.2 Use the hand wheel to move the tool to the B1 point, continue to run the alignment program, and stop when encountering the stop program;

[0065] 2.3.3 Continue to run the alignment program, and the machine tool automatically writes the calculation results into the public variables of the machine tool.

[0066] Combination Figure 3 The result seen in the machine tool background after the macro program calculation, the values ​​in #504 and #505 are the calculated differences, and the value in #506 (0.4442613) is the angle that needs to be rotated.

[0067] Step 3: Modify the programming software post-processor: write the angle macro program that needs to be rotated into the software post-processor to generate an NC code program with its own macro program; the variable in the machine tool is #, which is replaced by & in the program. Since # represents that this line in the machine tool program is just a comment and has no practical significance, but the machine tool variable # needs to be used for calculation in the machine tool program, other symbols need to be used for output in the machine tool program. Therefore, the program & replaces the # in the program in the machine tool program to provide an efficient and stable program; in the software post-processor, an automatic call to the variable rotation instruction is added in front of the fixed position program segment of the tool, and the rotation is canceled after the tool program ends.

[0068] 1) Use Word or Notepad to open the "MPFANUC" post-processing file, search for the program name part "*progno,e", and add two lines of characters after "pbld,n,*t,'M6',e", which are "pbld,n,&506=ATAN[&505] / [&504]',e" and "pbld,n,'G68X0Y0R&506',e" respectively.

[0069] 2) In the tool change part “#Tool change”, add two lines of characters after “pbld, n, *t, “M6”, e” in the same way, namely “pbld, n, “&506=ATAN[&505] / [&504]”, e” and “pbld, n, “G68X0Y0R&506”, e”.

[0070] 3) In the end part of tool change "#End oftool path,toolchange", add a line of characters "pbld, n, "G69", e" in front of "pcanl, pbld, n, "G0Z100.", scoolant, strcantext, e".

[0071] 4) Before the end of the program, add the characters "pbld, n, "&506=0", e" before "n,"m30", e" in the same way.

[0072] Step 4: Modify the program generated after the post-processing program, and process the tool calling program. The modified program is as follows:

[0073] %O0002 (workpiece main program)

[0074] G0G 17G40G49G80G90

[0075] T25M6 (Calling tool)

[0076] #506=ATAN[#505] / [#504] (After calculating the angle between the two points, write the result into the #506 public variable for future use;)

[0077] G68X0Y0R#506 (call the angle value in parameter #506, and then rotate the coordinates around the workpiece zero point;)

[0078] G0G90X-464.695Y-156.531S5000M3

[0079] G43H25Z100.M8

[0080] X-464.07Y-156.218

[0081] ………slightly

[0082] G69 (cancel coordinate rotation function)

[0083] G00Z100.M9

[0084] M01

[0085] T2M6 (Call tool)

[0086] #506=ATAN[#505] / [#504] (After calculating the angle between the two points, write the result into the #506 public variable for future use;)

[0087] G68X0Y0R#506 (call the angle value in parameter #506, and then rotate the coordinates around the workpiece zero point;)

[0088] G0G90X-464.695Y-156.531S5000M3

[0089] G43H2Z100.M8

[0090] G1Z-10.F200.

[0091] X-40.105F2000.

[0092] ………slightly

[0093] G69 (cancel coordinate rotation function)

[0094] G91G28Z0.M9

[0095] M01

[0096] T6M6 (Call tool)

[0097] #506=ATAN[#505] / [#504] (calculate the angle between the two points and write the result into the #506 public variable for future use;)

[0098] G68X0Y0R#506 (call the angle value in parameter #506, and then rotate the coordinates around the workpiece zero point;)

[0099] G0G90X-464.695Y-1 56.531S5000M3

[0100] G43H2Z100.M8

[0101] ………slightly

[0102] G0Z100.M9

[0103] G69 (cancel coordinate rotation function)

[0104] #506=0 (assign the value 0 to the machine tool common variable #506)

[0105] G91G28Y0

[0106] M30 (Program end)

[0107] %

[0108] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0109] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for quickly aligning castings based on a macro program, characterized in that: The following steps are involved: Step 1: Use trigonometric functions to measure and calculate the straight line deflection angle; Step 2: Compile the alignment macro program; Step 3: Modify the post-processing program of the programming software; Step 4: Modify the program generated after the post-processing program, and process the tool calling program.

2. A method for quickly aligning castings based on a macro program according to claim 1, characterized in that: The step 1 is specifically to automatically calculate and align using the inverse tangent trigonometric function principle, firstly obtain the relative coordinates of the two points A and B1 by measuring, and then calculate the deviation angle of the straight line.

3. A method for quickly aligning castings based on a macro program according to claim 2, characterized in that: The step 2 specifically comprises utilizing the local variables, public variables and system variables of the numerical control system to automatically align the coordinate angles, perform variable programming, and automatically store the calculation results into the machine tool memory.

4. A method for quickly aligning castings based on a macro program according to claim 3, characterized in that: Step 2 The following steps are involved: 2.1 Main program of the calculation macro program based on FANUC CNC system 2.2 Explanation of operation macro program; 2.3 The machine tool operates according to the macro program calculation.

5. A method for quickly aligning castings based on a macro program according to claim 4, characterized in that: The 2.2 operation macro program is explained as follows: The tool moves to the point A, the machine tool program is started, the current machine tool mechanical coordinates X and Y are automatically read, and the corresponding coordinates are read into the public variables of the CNC machine tool system; The program is suspended; The tool moves to the B1 point, starts the machine tool program, automatically reads the current machine tool mechanical coordinates X and Y, and reads the coordinates into the common variables of the CNC machine tool; The program is suspended; Starting the machine tool program, subtracting the X-direction value in the common variable and then reading it into the common variable; Subtract the Y-direction value in the common variable and read it into the common variable; After calculating the angle between the two points, the result is written into the common variable for later use; The program ends and the calculation is completed.

6. A method for quickly aligning castings based on a macro program according to claim 4, characterized in that: The 2.3 machine tool is operated according to the macro program operation, and the operation is: 2.3.1 The machine tool calls a 90-degree sharp chamfering tool, moves the tool to point A with a hand wheel in manual mode, switches the tool to run the alignment program in automatic operation, and the program executes the program segment, and stops automatically when a stop program is encountered; 2.3.2 Use the hand wheel to move the tool to the B1 point, continue to run the alignment program, and stop when encountering the stop program; 2.3.3 Continue to run the alignment program, and the machine tool automatically writes the calculation results into the public variables of the machine tool.

7. A method for quickly aligning castings based on a macro program according to claim 1, characterized in that: The step 3 is specifically to write the angle macro program that needs to be rotated into the software post-processing program to generate an NC code program with its own macro program; the variable in the machine tool is #, which is replaced by & in the program; in the software post-processing program, an automatic call variable rotation instruction is added in front of the fixed position program segment of the tool, and the rotation is canceled after the tool program ends.

8. The method for quickly aligning a casting based on a macro program according to claim 1, characterized in that: The step 4 is to establish the origin coordinates by tool setting when machining the casting, and call out the alignment program to perform casting machining.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, a method for quickly aligning a casting based on a macro program as described in any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a method for quickly aligning a casting based on a macro program as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Numerical control macro program-based blank on-machine rapid alignment method

    CN110286650A

  • Dynamic generation method of flexible production line processing coordinate system

    CN114879599A

  • Method for aligning straightness of datum plane of workpiece by adopting horizontal machining center

    CN114918738A

  • Alignment method for boring composite-angle high-precision hole

    CN117358989A

  • Method for aligning plane through three points of five-axis machining center

    CN117564740A