CNC Milling and Canned Cycles Tutorial PDF

Summary

This document is a tutorial on CNC milling, covering topics like work offsets, tool length offsets, and canned cycles. It provides diagrams, code examples, and explanations of G-code commands used in CNC programming.

Full Transcript

Here is the converted text from the images into a structured markdown format: # Chapter 6: CNC Milling and Milling Canned Cycles ## Work offsets in CNC milling programs The distance from the machine zero to the part zero is called the work offset. Each axis in the machine will have an offset valu...

Here is the converted text from the images into a structured markdown format: # Chapter 6: CNC Milling and Milling Canned Cycles ## Work offsets in CNC milling programs The distance from the machine zero to the part zero is called the work offset. Each axis in the machine will have an offset value that is stored in the offset registry in the machine controller. The machine controller keeps track of these values and uses them to move the tool to the proper position for machining. Work Offsets allow us to specify new coordinate systems based on the relative distance of a part zero from the Home Position of the machine. Work Offset commands are modal and they remain until another work offset command cancels it. Work offsets are programmed using any of the designated G-codes: G54 through G59. Most machines start up with G54 selected. The image shows a diagram of how machine zero, part zero, and program zero relate, along with G54 offset. There are three labels: * **Machine zero** with an arrow pointing along the Y axis and along the X axis * **Part** which is the name of the part being worked shown in the center of the of the diagram. * **Program zero** with an arrow pointing to the corner of the part Also labeled is **G54 [ Y ]** along the y axis and **G54 [ X ]** along the X axis. At the bottom it says **Axes motion limits** The basic relationship of the work offset method source is: https://en.cncarea.com/cnc-g54-g59-codes-work-offsets/ The image displays a work offset showing X and Y values using G54 Source: [https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/](https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/) X and Y axis offsets signify the distance from the Machine Home to the part zero. Z-Offset value signifies the distance from the part zero to the Machine Home in Z direction. The Machine Home position in Z direction is the spindle nose. The part zero in Z-direction is the top of the workpiece. The image displays a work offset showing X and Y values using G54, G55 and G56 The image contains HAAS ® Edgecam with a work offset showing Z values [https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/](https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/) **WORK ZERO OFFSET** | G CODE | X AXIS | Y AXIS | Z AXIS | | :------- | :--------- | :--------- | :--------- | | G54 | X-806.250 | -147.000 | -530.570 | | G55 | X-556.250 | -197.100 | -530.570 | | G56 | X-306.250 | -247.100 | -530.570 | The image shows a spot drill and tap on three parts loaded on three vises a machine table using G54, G55 and G56 Source: [https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/](https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/) The image shows an example of a Machine Work Offset Table Source: [https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/](https://www.cnctrainingcentre.com/fanuc-mill/work-offsets/) | | | WORK ZERO OFFSET | | | :------------- | :------- | :----------------- | :------- | | **<< WORK PROBE** | | | **WORK PROBE >>** | | G CODE | X AXIS | Y AXIS | Z AXIS | | G52 | 0. | 0. | 0. | | G54 | -12.5680 | -8.4890 | -23.1480 | | G55 | 0. | 0. | 0. | | G56 | 0. | 0. | 0. | | G57 | 0. | 0. | 0. | | G58 | 0. | 0. | 0. | | G59 | 0. | 0. | 0. | | G154 P1 | 0. | 0. | 0. | | G154 P2 | 0. | 0. | 0. | | G154 P3 | 0. | 0. | 0. | ### Gauge Line When a tool holder with a cutting tool is mounted in the spindle of a CNC milling machine, the taper of the holder is mounted against the opposite taper inside the spindle and held in place by a pull bar. Precision of manufacturing allows the tool holder to be located in the spindle at a constant location. This position is called the gauge line is determined by the machine manufacturer and is used for measurement of tool length and any tool motion along the Z-axis. The image contains a diagram of a gauge line at the machine zero. The distance is fixed from the gauge line and the table top face. Source: [https://en.cncarea.com/cnc-tool-length-offsets/](https://en.cncarea.com/cnc-tool-length-offsets/) ### Tool Length Offset Since different tools usually have different lengths, the distance the spindle has to travel from the Machine Home to the top face of the part varies. Tool length offsets (H01 to H99) allow machine control to account for the fact that different tools have different tool lengths. All tool-length offsets entered into the H-registers and is equal to the amount the tool sticks out of the spindle. The H-address character is used to select the tool length offset entry from the offsets memory. (The actual display will vary from one machine controller to another) The image shows the Tool Length Offset Table (displayed as negative values in a HAAS® machine) Source: [https://www.cnctrainingcentre.com/wp-content/uploads/2018/0/toolLength-Haas.jpg](https://www.cnctrainingcentre.com/wp-content/uploads/2018/02/toolLength-Haas.jpg) | | | | H(LENGTH) | | D(DIA) | | | :--------- | :------ | :------ | :-------- | :------ | :-------- | :------ | | IPS ON | COOLANT | | | | | | | TOOL | POSITION | GEOMETRY | WEAR | GEOMETRY | WEAR | | | 1. SPINDLE | 5 | 10.2500 | 0. | 4.0000 | 0. | | | 2 | 7 | -10.2540 | 0. | 2.0000 | 0. | | | 3 | 4 | -6.5235 | 0. | 2.7500 | 0. | | | 4 | 4 | -7.2643 | 0. | 1.3380 | 0. | | | 5 | 5 | -10.2354 | 0. | 1.0000 | 0. | | | 6 | 4 | -5.6250 | 0. | 0.2500 | 0. | | | 7 | 3 | -12.3547 | 0. | 0.5000 | 0. | | | 8 | 3 | -11.2500 | 0. | 0.1560 | 0. | | | 9 | 7 | -9.9904 | 0. | 1.5000 | 0. | | | 10 | 5 | -10.4567 | 0. | 0.7500 | 0. | | When the Tool Length Offset is applied, the machine adds the tool height to the Work Z-Axis Offset. Tool Length Offset is the distance from the spindle nose to the tip of the cutter. Application of Tool Length Offset ensures that programmed depth of the cut matches the actual depth of machine movement into the work piece (or above it). A tool T01 that is 205 mm long and another tool T02 that is 146 mm long will move to exactly 5 mm above the part when commanded **G00 Z5.0** Tool Length Offsets can be either programmed positive or negative with a **G43** or **G44** code respectively, followed by the letter H and then by the address of the length offset in the Machine' Tool Length offset Table. **G49** cancels tool length compensation ### G43 Positive Tool Length Offsets In Positive Tool Offsets, the offset represents the length of the tool measured as a distance from Gage Line of the spindle (typically spindle nose) to the tip of the tool. The longer the tool, the larger the Tool Length offset will be. In this case, Z Work Offset will represent the distance between the same Gage Line to the top of the part. **G43** is commonly used. For example, for Tool No. 10 with tool length offset data entered in H-register H10, a CNC block to program G43 is: N20 G43 H10; The first image displays a Positive Tool Offset, [https://zero-divide.net/?shell\_id=151&article\_id=4768](https://zero-divide.net/?shell_id=151&article_id=4768) The image labels * **Gage Line of the Spindle** * **Tool Length Offset 5.381** * **Z Work Offset -13.178** ### G44 Negative Tool Length Offsets Negative tool offset represents the distance between the tip of the tool to the top of the part. In such case Z Work Offset will equal zero. Application of Tool Length Offset ensures that programmed depth of the cut matches the actual depth of machine movement into the work piece (or above it). The machine control unit subtracts the positive tool length offsets values when G44 is programmed. G44 is hardly used. The image displays a Negative Tool Offset, at [https://zero-divide.net/?shell\_id=151&article\_id=4768](https://zero-divide.net/?shell_id=151&article_id=4768) * **Tool Offset -7.797** * **Z Work Offset = 0** The next image contains an auto tool measuring system used for measuring different tool lengths in a HAAS® CNC milling machine ## CNC Milling Canned Cycles第6章: cnc铣削和铣削循环 ### G81 - Standard Drilling cycle G81 is the most basic hole making canned cycle for drilling holes in a single drill stroke. This cycle is used in drilling a series of holes when a dwell or peck drilling is not needed. In G81, the cutting tool traverse to the top of the hole before moving to the R-plane. The tool feeds to the specified Z position at the programmed feed rate from R-plane. After drilling to the specified depth is completed, the tool retracts in rapid mode to either the initial Z position or R plane, depending on G98 or G99 modes. G98 returns the tool to the initial Z position where the tool is located when G81 is called. G99 returns the tool to the R-plane specified in the canned cycle. The image is of a G81 Canned cycle, Source: [http://www.helmancnc.com/fanuc-g81-drilling-cycle/](http://www.helmancnc.com/fanuc-g81-drilling-cycle/) The diagram has two examples, one labeled G81 with G99 and the other labeled G81 with G98. The images show numbered arrows to show the path of the bit during the 2 cycles and labels such as the intial and R Plane. Programming: **G81 G98(or G99) X\_ Y\_ Z\_ R\_ F\_ K\_** | Machining parameters for G81 | Description | | :--------------------------- | :--------------------------------------- | | X | The X location of the first hole | | Y | The Y location of the first hole | | Z | The depth of the first hole | | R | Retract plane | | F | Feedrate | | K | Number of cycle repetitions (if required) | The image is of a G81 Drilling Cycle example Source: [http://www.helmancnc.com/fanuc-g81-drilling-cycle/](http://www.helmancnc.com/fanuc-g81-drilling-cycle/) The image shows two holes on the top of a block with labeled lengths and labeled coordinates | Sample code | Comments | | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | N10 T01 M06; | The current cutting tool is changed to Tool No. 1 | | N20 G90 G54 G00 X30.0 Y25.0; | Tool No.1 moves to first drilling position at X30.0 Y25.0, taking into account the Zero-offset-no. | | N30 S1200 M03; | The spindle turns ON, rotating clockwise at 1200 rev/min | | N40 G43 H01 Z5.0 M08; | Tool No. 1 moves to Z5.0 taking into account tool length compensation (G43 H01). Coolant is turned on | | N50 G81 G98 Z-10.0 R2 F75.0; | Drilling cycle parameters, drill depth and cutting feed are given. With this command first hole is drilled made at current position: X30.0 Y25.0 to a depth of 10 mm | | N60 X80.0 Y50.0; | Drilling cycle continues. The second hole is drilled at X80.0 Y 50.0 to the same depth of 10 mm | | N70 G80 G00 Z100.0 M09; | Drilling cycle is cancelled with G80 command, Coolant is turned off. Tool No. 1 moves upwards to Z100.0 | | N80 M30 | CNC part-program end with return to program-start | ### G82 - Counter Boring cycle G82 counter boring cycle is a normal drilling cycle with the difference that the cutting tool dwells for specified time at the bottom of the hole at the end of each Z-movement. It is normally used when center drilling, spot drilling or machining a flat bottom hole where the depth of a hole needs accurate drilling. The 'P' Word defines the time of the dwell and is written in milliseconds. In G82, the cutting tool traverse to the top of the hole before moving to the R-plane. The tool feeds to the specified Z position at the programmed feed rate from R-plane position. At the bottom of the hole, the cutting tool dwells for a specified time. After the dwell time is up, the tool retracts in rapid mode to either the initial Z position or R plane, depending on G98 or G99 modes. G98 returns the tool to the initial Z position where the tool is located when G82 is called. G99 returns the tool to the The first image is of aG82 Canned cycle Source: [http://www.helmancnc.com/wp-content/uploads/2013/10/G82-drilling-cycle-working.jpg](http://www.helmancnc.com/wp-content/uploads/2013/10/G82-drilling-cycle-working.jpg) The diagram has two examples, one labeled G82 with G99 and the other labeled G82 with G98. The images show numbered arrows to show the path of the bit during the 2 cycles and labels such as the intial, dwell and R Plane. Programming: **G82 G98(or G99) X\_ Y\_ Z\_ R\_ P\_ F\_ K\_** | Machining parameters for G82 | Description | | :--------------------------- | :---------------------------------------------- | | X | The X location of the first hole | | Y | The Y location of the first hole | | Z | The depth of the first hole | | R | Retract plane | | P | Dwell at bottom of hole (milliseconds) | | F | Feedrate | | K | Number of cycle repetitions (if required) | The image shows a G82 Drilling Cycle example The image shows two holes on the top of a block with labeled lengths and labels of coordinates | Sample code | Comments | | :------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | N10 T02 M06; | The current cutting tool is changed to Tool No. 2 | | N20 G90 G54 G00 X30.0 Y25.0; | (Tool No.2 moves to first drilling position at X30.0 Y25.0 taking into account the Zero-offset-no. | | N30 S1200 M03; | The spindle turns ON and rotates clockwise at 1200 rev/min | | N40 G43 H02 Z5.0 M08; | Tool No. 2 moves to Z5.0 taking into account tool length compensation (G43 H02). Coolant is turned on | | N50 G82 G98 Z-10.0 R2 P1000 F75.0; | Counter Boring cycle parameters, drill depth and cutting feed are given. With this command first hole is drilled made at current position: X30.0 Y25.0 to a depth of 10 mm. The cutting tool dwells for 1 second at hole bottom | | N60 X80.0 Y50.0; | Counter Boring cycle continues. The second hole is drilled at X80.0 Y 50.0 to the same depth of 10 mm. The cutting tool dwells for 1 second at hole bottom | | N70 G80 G00 Z100.0 M09; | Counter Boring cycle is cancelled with G80 command, Coolant is turned off. Tool No. 2 moves upwards to Z100.0 | | N80 M30 | CNC part-program end with return to program-start | ### G83 - Peck Drilling cycle G83 Peck Drilling canned cycle is similar to G81 Standard Drilling canned cycle except that the tool is backed out of the hole at certain intervals throughout drilling to clear the chips and cool the tool. The Q-word is the only new code that specifies the peck depth (i.e. the depth of cut for each cutting feed). The tool will drill to the peck depth and then back out to the R-plane. It will then rapid back to the bottom of the hole and plunge another peck depth in the next peck. This continues until the Z-depth of the hole is reached. G98 returns the tool to the initial Z position where the tool is located when G83 is called. G99 returns the tool to the R-plane specified in the canned cycle. The image is of a G83 Canned cycle The diagram has two examples, one labeled G83(G98) and the other labeled G83 (G99). The images show numbered arrows to show the path of the bit during the 2 cycles and labels such as Point R and Point Z. Programming: **G83 G98(or G99) X \_ Y \_ Z \_ R \_ Q \_ F \_ K\_** | Machining parameters for G83 | Description | | :------------------------------------------------------ | :---------------------------------------------------------------------------- | | X | The X location of the first hole | | Y | The Y location of the first hole | | Z | The depth of the first hole | | R | Retract plane | | Q | Depth of cut for each cutting feed (depth of each peck) | | F | Feed rate | | K | Number of cycle repetitions (if required) | The image shows a G83 Peck Drilling Cycle example Source: [http://www.helmancnc.com/fanuc-g83-drilling-cycle/](http://www.helmancnc.com/fanuc-g83-drilling-cycle/) The image diagram shows the labels for coordinates and lengths and also X0 Y0 Z0 | Sample code | Comments | | :------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | N10 T03 M06; | The current cutting tool is changed to Tool No. 3 | | N20 G90 G54 G00 X12.5 Y10.0; | (Tool No. 3 moves to first drilling position at X12.5 Y10.0, taking into account the Zero-offset-no. | | N30 S1000 M03; | The spindle turns ON and rotates clockwise at 1000 rev/min | | N40 G43 H03 Z12.0 M08; | Tool No. 3 moves to Z12.0 taking into account tool length compensation (G43 H03). Coolant is turned on | | N50 G83 G99 Z-17.0 R2 Q4 F70.0; | Peck Drilling cycle parameters, drill depth and feed rate are given. With this command first hole is drilled made at current position: X12.5 Y10.0 to a depth of 4 mm. The cutting tool then retracts to 2 mm above the workpiece to clear the chips and cool the tool. The tool then plunges back to the bottom of the hole to drills an incremental depth of 4 mm. It then retracts to 2 mm above the workpiece. This continues until a depth of 17 mm is reached. The tool retracts to 2 mm above the workpiece | | N60 Y30.0; | The cutting tool moves to the second hole at X12.5 Y30.0. Peck Drilling cycle continues until the second hole is drilled to a depth of 17 mm | | N70 G98 X57.5 | The tool retracts to initial Z-position. (*Why does the tool retract to G98, not G99?*) It then moves to the third hole at X57.5 Y30.0. Peck drilling cycle continues till the third hole is drilled to 17 mm deep | | N80 G99 Y10 | The tool retracts to R-plane. It then moves to the fourth hole at X57.5 Y10.0. Peck drilling cycle continues till the hole is drilled to 17 mm deep. The cutting tool then retracts to 2 mm above the workpiece | | N90 G80 G00 Z 80.0 M09; | Peck Drilling cycle is cancelled with G80 code. Coolant is turned off. Tool No. 3 moves upwards to Z80.0 | | N100 M30 | CNC part-program end with return to program-start | ### G84 - Right Hand Tapping cycle G84 tapping cycle is used to machine threads into pre-drilled holes in a component. This is a tapping operation that uses a tap that is held in a standard tool holder. This canned cycle can also be used for peck tapping where a portion of the thread is cut and the spindle is reversed to relieve swarf from the tap. The tap is then returned to machine more of the thread. This is repeated until the full depth of thread is completed. The 'P' Word defines the time of the dwell is written in milliseconds. Programming: **G84 G98(or G99) X\_ Y\_ Z\_ R\_ P\_ F\_ K\_** | Machining parameters for G84 | Description | | :----------------------------------------------------- | :----------------------------------------------------------------------- | | X | The X location of the first hole | | Y | The Y location of the first hole | | Z | Tapping depth at bottom of hole | | R | Retract plane | | P | Dwell at bottom of hole (milliseconds) | | F | Feedrate | | K | Number of cycle repetitions (if required) | The federate for tapping must be synchronised with the spindle speed. Since the lead is equal to its pitch in a single start thread, Feedrate (for single start thread) = (Spindle speed x Pitch of thread) mm/min For multi-start threads, the feedrate for threading is calculated by Feedrate (for multi-start thread) = (Spindle speed x Pitch of thread x No. of start) mm/min The first image is of G84 Canned cycle Source: [http://www.helmancnc.com/fanuc-g84-tapping-cycle/](http://www.helmancnc.com/fanuc-g84-tapping-cycle/) The diagram has two examples, one labeled G84 with G 99 and the other labeled G 84 with G 98. The images show numbered arrows to show the path of the bit during the 2 cycles and labels such as Spindle CW and Spindle CCW In **G84**, the cutting tool traverse to the top of the pre-drilled hole before moving to the R-plane. The tap feeds to the specified Z position, in clockwise direction, at the programmed feed rate from R-plane position. At the bottom of the hole, the tap dwells for a specified time. After the dwell time is up, the spindle is rotated counter-clockwise to allow the tap to retract at the programmed feed rate to either the initial Z position or the R plane, depending on **G98** or **G99** modes. If **G98** is programmed, the tap retracts to the R-plane. At R-plane, the direction of the spindle is changed to rotate clockwise after which the tap then moves to the initial Z position. If **G99** is programmed, the tap retracts to R-plane. At R-plane, the direction of the spindle is changed to rotate clockwise and the tapping of this hole ends at the location. The next image shows a G84 Tapping Cycle example Source: [http://www.helmancnc.com/fanuc-g84-tapping-cycle/](http://www.helmancnc.com/fanuc-g84-tapping-cycle/) The diagram shows a diagram with length and coordinate axis. | Sample code | Comments | | :--------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | N10 T04 M06; | The current cutting tool is changed to Tool No. 4 | | N20 G90 G54 G00 X30.0 Y25.0; | Tool No.4 moves to first pre-drilled hole at X30.0 Y25.0 taking into account the Zero-offset-no | | N30 S100 M03; | The spindle rotates clockwise at 100 rev/min | | N40 G43 H04 Z5.0 M08; | Tool No. 4 moves to Z5.0, taking into account tool length compensation (G43 H04). Coolant is turned on | | N50 G84 G98 Z-20.0 R2 P1000 F1.25; | Tapping cycle parameters, tapped depth and tapping feed are given. With this command, first pre-drilled hole at X30.0 Y25.0 is tapped to a depth of 20 mm. The tap dwells for 1 second at hole bottom | | N60 X80.0 Y50.0; | Tapping cycle continues. The second pre-drilled hole at X80.0 Y 50.0 is tapped to a depth of 20 mm. The cutting tool dwells for 1 second at hole bottom | | N70 G80 G00 Z120.0 M09; | Tapping cycle is cancelled with G80 command, Coolant is turned off. Tool No. 4 moves upwards to Z120.0 | | N80 M30 | CNC part-program end with return to program-start | ### G53 Machine coordinates system G53 temporarily cancels work coordinate offsets and uses the machine coordinate system. G53 is non modal and remains only in effect in the block it is commanded. The current work coordinates system is not cancelled. G53 uses the coordinates measured from machine home position. In the machine coordinate system, the zero point for each axis is the position where the machine goes when a Zero Return is performed. When programmed, **G53** will revert to this system for the block in which it is commanded. In complex setups, it is a good practice to establish a fixed position for tool change, regardless of part position. The machine coordinate system can be used to establish this fixed position for tool change whenever automatic tool change is programmed regardless of what work piece is on the machine table and which work offset is active. The tool change position will be determined by the actual distance of the tool from machine zero position, not the program zero. The image is of an Illustration of G53 code. The tool change position is established at 170mm and 50mm away and also labeled is **G54(Y)** along the y axis and **G54(X)** along the X axis. Source: [https://en.cncarea.com/cnc-milling-g53-code-machine-coordinate-system/](https://en.cncarea.com/cnc-milling-g53-code-machine-coordinate-system/) In the above illustration, the position of the tool change is established at 170 mm and 50 mm away from the machine coordinates system. The spindle carrying the current tool will move to this location in X and Y directions (assuming Z is zero) before tool change is performed. The image is of a diagram of a **CNC Milling program example** Source: [http://www.helmancnc.com/circular-interpolation-programming-example-1/](http://www.helmancnc.com/circular-interpolation-programming-example-1/) | CNC Codes | Explanations of codes | | :----------------- | :-------------------------------------------------------- | | O0010 | Program Number 00010 is assigned | | N10 G00 G17 G40 G49 G80; | Safe Start. Cancelled cycles | | N20 G53 X-500.0 YO Z0; | Safe Position for Tool change | | N30 M06 T05; | Changing to Tool No.5 tool | | N40 G90 G56; | Work zero Offset. Absolute programming | | N50 G43 X0 Y0 Z100.0 H05; | Tool length offset | | N60 G00 X-20.0 Y-20.0 Z50.0 | Rapid interpolation to X-20.0, Y-20.0, Z5.0 | | N70 M03 S450; | Spindle ON at 450 rev/min | | N80 G01 Z-5.0 F250.0; | Tool feeds vertically downwards -Z5.0 at 250 mm/min | | N90 G42 X0 Y0 M08; | Cutter compensation. Coolant ON | | N100 X85.0 Y30.0; | | | N110 Y50.0; | | | N120 G03 X70.0 Y65.0 R15.0; | Counter clockwise circular interpolation to X70.0, Y65.0 | | N130 G01 X45.0; | | | N140 G02 X30.0 Y50.0 R15.0; | Clockwise circular interpolation to X30.0, Y50.0 | | N150 G01 X10.0; | | | N160 X0 Y0; | | | N170 G40 X-20.0 Y-20.0; | Cancels Cutter compensation | | N180 G00 Z50

Use Quizgecko on...
Browser
Browser