Sunday, June 25, 2023

Milling Operation programming

Writing a Milling operation program:

The Milling operation program is written by removing the leftover material through the relative displacement between a rotating cutting tool and a stationary workpiece. This process is carried out to achieve the desired dimensions. To accomplish this, a comparative axis movement command is used, which corresponds to the cutting tool with the spindle in milling programming. The cutting tool and spindle movement, along with the Z-axis drive (in vertical milling operations), are responsible for eliminating material from the workpiece. The Z-axis positions itself at specific locations, while the movements of the X and Y axes shape the workpiece as required. In some cases, the Z-axis movements and interpolation (linear or circular) occur between two axes. The following example demonstrates a step-by-step simple milling operation programming with a CNC Milling machine. Additionally, the provided pictures depict a workpiece blank and the final product after machining operations.     

     

Preparing a 2D workpiece drawing:

Before writing a program, it is necessary to create a two-dimensional drawing of the workpiece, which includes different working parameters. Previously, the drawing was done on a sheet, but now it has become simpler with the use of CAD (Computer-Aided Design) software. The picture below shows a two-dimensional sketch of the finished workpiece.     

Setting the workpiece with the machine coordinate system:

In the previous picture, point P represents the projection of the workpiece, and it serves as the Workpiece Zero point. All axis positions within the program are relative to this point. The distance between this P point and the 'Machine Zero' is considered as the 'Zero offsets' of the machine axes. The picture below illustrates how the workpiece aligns with the machine's Coordinate System.    


In this case, the X and Y axis zero offsets are set as X=50 and Y=25, respectively. Let's assume Z=-500 (not shown in the picture). These values are stored as G54 offset values inside the CNC controller. When a G54 command is executed at the beginning of the program, all the axes (X, Y, and Z) temporarily consider the P point as the zero-point instead of the machine zero point. All axis positions will be shown as 0.000 at this P point. All axis movements and measurements in the program will be based on this temporary zero point at P. If it becomes necessary to cancel the workpiece zero and revert to the machine zero, a G53 code can be used within the program.

 

Selection of cutting tool:

After positioning the workpiece and compensating for the Machine Coordinate System, it is necessary to select the cutting tools for the machining operations. In this case, we are using an 'End-mill Cutter' with a length of 50 mm and a diameter of 10 mm (shown in the following image). These values are stored in the CNC controller's memory as tool offset data. When the program requests the tool offset data (D1 in this case), the actual movement of the Z-axis takes into account the tool length value (50 mm less in this case). Similarly, when the Cutter radius compression command is given (G41 or G42), the actual movement of the X and Y axes considers the tool diameter (10 mm in this case). The dotted line in the following picture represents the exact Cutter path to achieve the accurate dimensions of the workpiece. However, the actual axis movement commands will be relative to the workpiece coordinate system. 


Defining the Coordinate System and Measuring System:

After selecting the cutting tool, it is necessary to define the coordinate system for dimensioning and measuring in the programming process. The Cartesian and Absolute measuring systems are used in this program for all measurements. It is also important to consider the clamping arrangements of the workpiece before initiating the program, ensuring that they do not obstruct the tool-cutting line. If needed, the machining operation can be split into two or three setups. This program does not include any clamping arrangements and is written for convenience and clarity.

Work-piece Programming (with SIEMENS Controller):

This program, marked as %1234, restricts individual blocks by using 'N' followed by a number (N5, N10, etc.) for easy identification of expressions. However, it is unnecessary to represent each program block with N numbers. Each programming block can be distinguished by the symbol '¶' or a line finish symbol. The following example demonstrates the functionality of each program block in the machining process and later provides detailed explanations of all the function blocks.  


 %1234

 (Test work-piece)

 N05 G21 G90 G94 ¶

 N10 T1 M06 ¶

 N15 M03 S1000 M07 ¶

 N20 G00 G54 D1 X-10 Y0 Z5 ¶

 N25 G01 Z-5.5 F150 ¶

 N30 G42 X0 Y0 ¶

 N35 X45 ¶

 N40 Y15 ¶ 

 N45 X75 ¶ 

 N50 Y0 ¶

 N55 X120 ¶

 N60 Y40 ¶

 N65 G03 X100 Y60 I-20 J0 F100 ¶

 N70 G01 X20 F150 ¶

 N75 G03 X0 Y40 I0 J-20 F100 ¶

 N80 G01 Y0 F150 ¶

 N85 Z5 ¶

 N90 G00 G40 G53 X0 Y0 Z0 M05 M09 ¶

 N95 M30 ¶

 

Program blocks:

Writing % 1234 at the beginning of the program represents program number 1234. The text "Test Workpiece" is written inside parentheses to indicate the name or type of program. The CNC controller does not interpret any word written within the first set of parentheses in a program. Sometimes the first set of parentheses is also used to provide special remarks or statements for easy recognition in a long program.

N05 G21 G90 G94 – This block describes some preparatory functions. G21 indicates that all measurements will be in millimeters, G90 identifies the absolute programming system, and the axis feed movements will be in millimeters per minute as specified by the G94 code.

N10 T1 M06 - The tool with number 1 (T1) will be brought to the spindle using the automatic tool changing command M06.

N15 M03 S1000 M07 - The spindle will rotate at 1000 rpm in a clockwise direction (M03 command). The flash coolant will also be activated (M07 command).

N20 G00 G54 X-10 Y0 Z5 D1 – The X, Y, and Z axes will move from the "Machine zero position" to the position X-10, Y0, and Z5, respectively. This movement takes into account the work offset (G54) values, where X=50, Y=25, and Z=-500. The cutting tool offset (D1) includes a radius of 10 mm and a length of 50 mm. To prevent collisions between the cutting tool and the workpiece, the Z-axis is always positioned slightly above the zero position (in this case, 5 mm) before starting the machining operations. The X-axis also stops at -10 mm to simplify the movements and allow for cutter radius compression.

N25 G01 Z-5.5 F150 - The Z-axis will move 10.5 mm in the negative direction (Z-5.5) with a linear movement (G01). The thickness of the workpiece is 5 mm, and to ensure precise machining, an additional 0.5 mm shift of the Z-axis is applied. The programmed feed rate for the Z-axis movement is 150 mm/min (F150). This feed rate will be used for subsequent program blocks, and all subsequent blocks will use the same feed rate until a new feed rate command is given.

N30 G42 X0 Y0 – The cutter compensation in the right direction (G42) is considered in this block. The X and Y axes will move to positions X0.000 and Y0.000, respectively, taking into account the cutter radius and length.

N35 X45 - The actual machining operation, which involves removing material from the workpiece blank, starts from this block. The X-axis will move from the workpiece zero position to position X45 in the positive direction. The movement will follow the previous feed rate command (F150) given in the N25 block.

N40 Y15 – The Y-axis will move 15 mm in the positive direction (Y15).


N45 X75 – The X-axis will move 30 mm in the positive direction, resulting in a final position of X75.

N50 Y0 – The Y-axis will move 15 mm in the negative direction, resulting in a final position of Y0.

N55 X120 – The X-axis will move 45 mm, resulting in a final position of X120.

N60 Y40 – The Y-axis will move an additional 40 mm.

N65 G03 X100 Y60 I-20 J0 F100 - The circular interpolation movement command (G03) is used to move the X and Y axes in an anti-clockwise direction. The starting and ending points of the circular path are X120, Y40 (the last position of the axes), and X100, Y60. The values of 'I' and 'J' for the 20 mm radius circular interpolation are I-20 and J0, respectively. The programmed feed rate for both axes during this circular movement is 100 mm/min (F100).

N70 G01 X20 F150 - Since the previous block set the circular interpolation movement (G03), this block adds the linear movement command (G01) for the X-axis. The X-axis will move 80 mm in the negative direction, resulting in a final position of X20. The programmed feed rate for this movement is 150 mm/min (F150).

N75 G03 X0 Y40 I0 J-20 F100 - This block is similar to the N60 block. The X and Y axes will move in an anti-clockwise direction using circular interpolation (G03). The circular path has a radius of 20 mm, with the final position being X0, Y40. The values of 'I' and 'J' for the circular path are I0 and J-20, respectively. The programmed feed rate for this circular movement is 100 mm/min (F100).

N80 G01 Y0 F150 – The Y-axis will move 40 mm in the negative direction, resulting in a final position of Y0. The programmed feed rate for this movement is 150 mm/min (F150).

N85 Z5 – The Z-axis will move 10.5 mm and return to position Z5 (from the Z-5.5 position).

N90 G00 G53 G40 X0 Y0 Z0 M05 M09 - In this block, the X, Y, and Z axes will return from the workpiece zero position to the machine zero position (X0, Y0, and Z0) using rapid feed movement (G00). The cutter radius compensation (G40) and work offset (G53) will be canceled during this movement. The spindle will be turned off (M05 command), and the cutting coolant will also be turned off (M09 command).

N95 M30 - The program ends here with the M30 command.




No comments:

Post a Comment

Popular Posts