Macro Program Application on Non-circular Curve Machining in CNC Lathe

: A programming method of the macro program is studied in this paper, a part with complex surface contain of a parabola, an ellipse and some lines as a case, it’s CNC machining program is design using macro program, and the part complete machining process is simulated by virtual simulation system of TK 36 CNC lathe is that the accuracy of the program is validated, at the same time proof the macro program can come true the CNC machining of complex surface and program simple and high universality.


Introduction
In CNC lathe machining, external contour is elliptic, parabolic and the non-circular curve of parts are often met.These complex surface parts of the processing, if we adopt the traditional CAD/CAM software programming, not only make the workload and the complexity of the process but also the processing parameters are not easy to modify and the poor of accuracy.But using macro programming, not only can shorten the programming cycle, simplify the calculation, the program easy to understand, improve the processing accuracy and processing efficiency, but also can be repeated machining similar parts of different size in which realize the function of ordinary programming is hard to realize of improve the use function of machine tool.
This paper adopts FAUNC 0i CNC system.The macro program of the non circular curve turning parts with parabola and ellipse, the part machining is verified by the simulation software VERICUT.

The Basic Principle Of A Macro Programming
Macro program is a special programming function of FANUC CNC system, its greatest feature is that the user macro program ontology can be used to programming of variables, and has calculated, assignment, selection, jumps and circulatory functions.
It can be divided into four types of variables: empty variables (#0),local variables (#1-#33), public variables (#100-#199, #500-#599), system variables (#1000-#5335).User macro program is divided into macro program A and B, macro program A is G65 Hxx P#xx Q#xx R#xx; the format of the input, it needs to remember more instruction.Macro program B is based on formulas and direct language input and is similar to C languages, it is mainly used in FANUC 0i system, this paper uses the macro program B programming [1,4].

The Macro Programming Ideas
Macro processing of non-circular curved contour of the basic programming idea is to use a linear approximation method outline node.Specifically, in order to guarantee the accuracy of parts, generally in 0.1 or smaller values for an interval.Using the function of the non circular curve, the definition of a letter in the expression as the independent variable, the other is the dependent varia.Coordinates of each point was determined by the function which the equation, then the points are connected together to form a non-circular contour final.Due to the macro program can define variables and assigned, it also can undertake operation and condition judgment which is constitute a loop transfer, this can be for those use mathematical function relational expression of non-circular curve to continuous "fitting" processing [9], so as to realize the programming.

The Macro Program of Instruction Format
In the program, the use of GOTO statements and IF statements can realize the CNC program logic judgment, comparison, jump and various operation, also can effectively solve the complex of the non-circular curve parts CNC programming problem [3].

The JMP (GOTO statement)
Instruction format: GOTO + target segment number (without N); JMP for unconditional jump to the specified program segment number start executing program section.
For example: GOTO10; (transfer to the serial number for the N10 program section).

The JNE (IF statement) Instruction format: IF + [expression] condition + GOTO target segment number (without N).
When the condition is met, segment that is transferred to the specified procedures section, If the condition is not satisfied, the next program is executed.
For example: N10 IF [#1GT10] GOTO100; Judge whether the value of the variable # 1 is more than 10.N20 G00 X70 Y20; If not, then execute program segment N20. ... N100 G00 X90; If so, then transfer to the serial number for the N100 program section.

Loop (WHILE statement)
Specify a conditional expression after WHILE, when the specified condition is satisfied, the program is executed from DO to END, otherwise, the program is transferred to END.For example: If not If the condition is met ENDm ... ... procedure

Application Examples Of Macro Programs
As shown contains for parabolic and elliptic contour of parts and size for 40×120mm of LY12 in Figure 1.Try the macro programming parts with parabola and ellipse.

Analysis of Programming Ideas
As shown in the above parts, assuming that the workpiece origin is located in intersection point of the right end face of artifacts and axis, then establish workpiece coordinate system that is programmed coordinate system is done by adjustingtool.In order to ensure the machining accuracy, and 0.1 for an interval, and as the independent variables, X as a function of Z.When processing a parabola in which the coordinates of each point is calculated according to the equation.However the center of the ellipse coordinates are not the origin of the coordinate system programming is that need to coordinate transformation in which the coordinates of each point on the elliptic arc transition to the programming system for processing.Determine its coordinates of each point, eventually connecting the points together to form a parabolic and elliptical outline.Therefore, the general idea of programming is to use a fixed cycle instructions G71 rough machining of parabolic, then machining of oval and cylindrical surface, last parts for finishing [2].

Mathematical Model
A mathematical model is established by the standard equation of parabolic and elliptic [5,6].As shown in Figure 2, the Z (#1) value of an arbitrary point D is used in the NC program to express the value of the X (#2) value.By the equation concluded that (unilateral value).Using the straight line fitting for take 0.1mm as a step distance and take Z as the independent variable, the X as a function of Z in which the independent variable range for.The definition of Z and X respectively are

Cutting Parameters And The Coordinates Of The Key Points
T0101 is cylindrical roughing tool, roughing spindle speed of 800r/min, feed rate of 0.2mm/r, engagement of the cutting edge 1.5mm; T0202 is 35diamond finishing tool, finishing spindle speed of 1200r/min, feed rate of 0.1mm/r, X direction finishing allowance of 0.5 mm, Z direction finishing allowance of 0.2 mm.

Program Flow Chart
For the case with parabolic and elliptic contour of programming, the macro program structure flow chart is the same, as shown in Figure 4.

Simulation Verification
By the simulation software VERICUT, application of virtual simulation system of TK 36 CNC lathe to simulation machining of the non-circular curve parts model [7,8].It not only can eliminate the phenomenon of the interference, over cutting and residual in the process of cutting, but also can optimization of cutting parameters and simplify NC code, thus eliminating the process of trial cut test is that can significantly improve the production efficiency and reduce the scrap rate of parts and the production cost in the actual machining process.The technology has wide application prospect.
Through the virtual machining simulation, the parameters are reasonable and achieved the expected goals, as shown in Figure 5, 6 and 7.

Conclusion
Macro programming combined with the mathematical formulas and related knowledge of differential equations to establish mathematical model, in addition combined with graphics size requirements for specific analysis.Macro program can effectively solve the system of traditional G code instructions can't turning the non-circular curve parts processing.The flexibility of the variable, and a significant increase in the scope of programming.For parts with similar structure is that only the value of the variable is changed, which is conducive to the general programming of numerical control program and greatly increases the efficiency of programming.Therefore, the macro program can give full play to the potential function of CNC machine tools, improve the processing efficiency and the economic efficiency of enterprises.It has a wide range of application value in the actual production.

Figure 1 .
Figure 1.Contains The Parabola And Elliptic Contour Parts.

Figure 4 .
Figure 4.. Non-circular Curve Contour Of Program Flow Chart.

3. 5
Write a macro program 3.5.1The Meaning of Independent Variables #1: Z coordinates value of the parabola.#2:single side values of X coordinates in a parabola.#3:bilateral values of X coordinates in a parabola.#4: step size.#101: Z coordinates valueof the ellipse.#102: X coordinates value of the ellipse.

Figure 5 .
Figure 5. Schematic Of Tool Passes Track.