## Guide to CNC Lathe Machine

CNC Lathe Machine Programming Examples

Contents:

1. What is a CNC Lathe Machine?
2. CNC Lathe Main Parts
3. CNC Programming Software
4. Examples: Sinumerik 810 Programming Example CNC Mill
5. Examples: CNC Programming Example G Code G02 Circular Interpolation Clockwise
6. Examples: Chamfer and Radius Programming with G01 G code
7. Examples: CNC Mill Program with G41 Cutter Radius Compensation Left
8. Examples: How to Mill Full Circle CNC Program Example Code
9. Examples: Siemens Sinumerik Milling Programming Example
10. Examples: Lathe CNC Programming Example
11. Examples: CNC Mill Programming Exercise using G91 Incremental Programming
12. Examples: CNC Mill G02 G03 Circular Interpolation Programming Example
13. Examples: CNC Programming for Beginners a CNC Programming Example
14. Examples: Simple CNC Lathe Drilling with Fanuc G74 Peck Drilling Cycle
15. Examples: CNC Mill Contour Pecking – Fanuc Subprogram Repeat Example
16. Examples: CNC Mill Programming Exercise using G90 Absolute Programming G91 Incremental Programming
17. Examples: CNC Mill Programming Absolute Incremental G90 G91 Example Code
18. Examples: CNC Programming Example in Inch Simple CNC Lathe Program
19. Examples: CNC Milling Machine Programming Example for Beginners
20. Examples: CNC Lathe Simple G Code Example – G code Programming for Beginners
21. Examples: CNC Programming for Beginners a Simple CNC Programming Example

***********************************
www.appaha.mobi

You can use Excel functions to perform various mathematical, statistical, logical calculations. This tutorial takes you step-by-step through the process.

This tutorial is intended for people who use Excel but are intimidated by the concept of formulas and functions.

• Compatibility Functions
• Cube Functions
• Database Functions
• Function and Description
• Date & Time Functions
• Engineering Functions
• Financial Functions
• Information Functions
• Logical Functions
• Lookup and Reference Functions
• Math and Trigonometric Functions
• Statistical Functions

***********************************
www.appaha.mobi

# Following is a cnc program exmaple code for cnc milling machine.

This cnc example code illustrates the usage of CNC Absolute Programming G90 G-Code and Incremental Programming G91 G-Code, as well as the usage of Circular Interpolation G-Code (G02/G03).
This cnc program draws (machines) cnc mill Arc with R as well as Arc with I.

## CNC Absolute Programming G90 Example Code

CNC Mill Programming Absolute Incremental G90 G91 Example Code
Mill Circular Interpolation G02 G03 with R
```G92 X200 Y40 Z0
G90 G03 X140 Y100 R60 F300
G02 X120 Y60 R50```
Mill Circular Interpolation G02 G03 with I
```G92 X200 Y40 Z0
G90 G03 X140 Y100 I-60 F300
G02 X120 Y60 I-50```

## CNC Incremental Programming G91 Example Code

Mill Circular Interpolation G02 G03 with R
```G91 G03 X-60 Y60 R60 F300
G02 X-20 Y-40 R50```
Mill Circular Interpolation G02 G03 with I
```G91 G03 X-60 Y60 I-60 F300
G02 X-20 Y-40 I-50```

***********************************
www.appaha.mobi

## Fanuc Macro Programming

### Fanuc Lathe Custom Macro for Peck Drilling

Fanuc Peck Drilling Macro

Move the tool beforehand along the X- and Z-axes to the position where a drilling cycle starts. Specify Z or W for the depth of a hole, K for the depth of a cut, and F for the cutting feedrate to drill the hole.
Following Custom Macro works on Fanuc cnc controls like FANUC Series 30i/31i/32i-MODEL A

### Programming

`G65 P9100 Z K F`
OR
`G65 P9100 W K F`
Parameter Description
Z Hole depth (absolute programming)
W Hole depth (incremental programming)
K Cutting amount per cycle
F Cutting feedrate

### Main Program

```G50 X100.0 Z200.0 ;
G00 X0 Z102.0 S1000 M03 ;
G65 P9100 Z50.0 K20.0 F0.3 ;
G00 X100.0 Z200.0 M05 ;
M30```

### Macro program

```O9100;
#1=0; (Clear the data for the depth of the current hole.)
#2=0; (Clear the data for the depth of the preceding hole.)
IF [#23 NE #0] GOTO 1; (If incremental programming, specifies the jump to N1.)
IF [#26 EQ #0] GOTO 8; (If neither Z nor W is specified, an error occurs.)
#23=#5002-#26;         (Calculates the depth of a hole.)
N1 #1=#1+#6;           (Calculates the depth of the current hole.)
IF [#1 LE #23] GOTO 2; (Determines whether the hole to be cut is too deep?)
#1=#23;                (Clamps at the depth of the current hole.)
N2 G00 W-#2;           (Moves the tool to the depth of the preceding hole at the cutting feedrate.)
G01 W- [#1-#2] F#9;    (Drills the hole.)
G00 W#1;               (Moves the tool to the drilling start point.)
IF [#1 GE #23] GOTO 9; (Checks whether drilling is completed.)
#2=#1;                 (Stores the depth of the current hole.)
N9 M99
N8 #3000=1;            (NOT Z OR U COMMAND Issues an alarm.)

```

# U W CNC LATHE CNC PROGRAM EXAMPLES

### Make your own G81 Drilling Cycle through Fanuc Macro and G66 Modal Call

This is a complete Fanuc Macro which works same as Fanuc G81 Drilling Cycle.

## G66 Modal Call

Once Fanuc G66 is issued to specify a modal call a macro is called after a block specifying movement along axes is executed. This continues until G67 is issued to cancel a modal call.

## Macro Call Parameters

`G65 P9110 X x Y y Z z R r F f L l ;`
X: X coordinate of the hole (absolute only) . . . (#24)
Y: Y coordinate of the hole (absolute only) . . . (#25)
Z: Coordinates of position Z (absolute only). . . (#26)
R: Coordinates of position R (absolute only). . . (#18)
F : Cutting feedrate . . . . . . . . . . . . . . . . . . . .. . . (#9)
L: Repetition count

## Program Example

```O0001;
G28 G91 X0 Y0 Z0;
G92 X0 Y0 Z50.0;
G00 G90 X100.0 Y50.0;
G66 P9110 Z–20.0 R5.0 F500;
G90 X20.0 Y20.0;
X50.0;
Y50.0;
X70.0 Y80.0;
G67;
M30;```

## Drilling Macro

```O9110;
#1=#4001;   (Stores G00/G01)
#3=#4003;   (Stores G90/G91)
#4=#4109;   (Stores the cutting feedrate)
#5=#5003;   (Stores Z coordinate at the start of drilling)
G00 G90 Z#18;   (Positioning at position R)
G01 Z#26 F#9;   (Cutting feed to position Z)
G00 Z#18;   (Positioning at position R)
GOTO 2;
N1 G00 Z#5;   (Positioning at position I)
N2 G#1 G#3 F#4;  (Restores modal information)
M99;

```

` `

## CNC Program

```/*Parameters
G65 P9100 Xx Yy Zz Rr Ff Ii Aa Bb Hh
X: X coordinate of the center of the circle (#24)
Y: Y coordinate of the center of the circle (#25)
Z: Hole depth (#26)
R: Coordinates of an approach point (#18)
F: Cutting feedrate (#9)
I: Radius of the circle (#4)
A: Drilling start angle (#1)
B: Incremental angle (Clockwise when negative value) (#2)
H: Number of holes (#11)
*/

O9100
#3=#4003
G81 Z#26 R#18 F#9 K0
IF[#3 EQ 90]GOTO 1
#24=#5001+#24
#25=#5002+#25
N1 WHILE[#11 GT 0]DO 1
#5=#24+#4*COS[#1]
#6=#25+#4*SIN[#1]
G90 X#5 Y#6
#1=#1+#2
#11=#11-1
END 1
G#3 G80
M99

/*Fanuc Bolt Hole Macro Example
Example macro call to drill 5 holes at intervals of 45 degrees
after a start angle of 0 degrees
on the circumference of a circle with radius 4”.
The absolute center of the circle is (10”, 5”).*/
O0002
G90 G92 X0 Y0 Z4.0
G65 P9100 X10.0 Y5.0 R1.0 Z-2.0 F20 I4.0 A0 B45.0 H5
M30

amzn_assoc_tracking_id = "cncmachine05-20";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "SHOP TECH PRODUCTS AT AMAZON";
amzn_assoc_default_search_phrase = "SHOP TECH PRODUCTS AT AMAZON";
amzn_assoc_default_category = "All";
amzn_assoc_rows = "4";

```

` `

## CNC Program

```T1 M6
G0 G90 G40 G21 G17 G94 G80
G54 X0 Y0 S? M3
G43 Z5 H?
G1 Z-? F?
#20 = 2 ; Incremental degree calculation
#21 = 0 ; Start Angle
#22 = 30 ; Y Axis Radius
#23 = 50 ; X Axis Radius
G41 X#23 D? ; Compensation motion to right side of internal pocket
N10 #21 = [#21 + #20] ; Angular Count
#24 = SIN[#21] ; Incremental Y axis calculation
#25 = COS[#21] ; Incremental X axis calculation
#24 = [#24*#22] ; Absolute Y calculation
#25 = [#25*#23] ; Absolute X calculation
X#25 Y#24 ; Movement in X & Y axis
IF [#21 LT 360] GOTO 10 ; Restart if less than 360 degree motion
IF [#21 GT 360] GOTO 20 ; If final angle becomes greater than 360 degrees recalculate
IF [#21 EQ 360] GOTO 30 ; Finish if total angle is equal to 360 degree
N20 #21 = 360
GOTO 10
N30 G40 X0
G0 G90 Z100 M30
```

## CNC Program

```;A = #1 (Start Angle 0 degrees)
;C = #3 (Increment angle for accuracy calculations.)
;I = #4 (Finish Angle)
;K = #6 (Milling feed)

O2222
T5 M6
G0 G90 G40 G21 G17 G94 G80
G54 X35 Y0 S500 M3
G43 Z100 H?
Z5
G1 Z-0.5 F200
G65 P8999 A0 B35 C0.01 I70 J37 K500
G0 G90 Z100 M30

O8999
#7 = #4 / #3 ;1) Total no. of moves 70 / 0.01
#8 = [[#5 - #2] / #7] ;2) Increase in radius 37-35/7000
N1 #2 = #2 + #8 ;3) Next Radius i.e. 35+inc. radius.
#1 = #1 + #3 ;4) Increase in angle
#9 = #2 * COS [ #1 ] ;5) New X axis position
#10 = #2 * SIN [ #1 ] ;6) New Y axis position
G1 X#9 Y#10 F#6 ;7) Feed move to new positions
;8) If new angle is less than finish angle go to line N1.
IF [#1 LT #4] GOTO 1
G0 Z10
M99
```

## CNC Program

```T? M6 (THREADMILL)
G0 G90 G40 G21 G17 G94 G80
G54 X? Y? S? M3 (Move to bore centre)
G43 Z? H?
;
G65 P1002 A? B? D?
(B = PITCH)
M30

O1002
#11=[[#1*0.8]/2]
#12=[[#1/2]-#11]
;
G91 Y#12
G41 X#11 D#7
G3 X-#11 Y#11 R#11 Z#2/4
J-[#1/2] Z#2
X-#11 Y-#11 R#11 Z#2/4
G1 G40 X#11
G0 G90 Z100
M99
```

` `

## CNC Program

```T? M6 (ENDMILL)
G0 G90 G40 G21 G17 G94 G80
G54 X? Y? S? M3 (Move to bore centre)
G43 Z? H?
;
G65 P1001 A? D?
(A = C/BORE DIAMETER)
M30

O1001
#11=[[#1*0.8]/2]
#12=[[#1/2]-#11]
G91 Y#12
G41 X#11 D#7
G3 X-#11 Y#11 R#11
J-[#1/2]
X-#11 Y-#11 R#11
G1 G40 X#11
G0 G90 Z100
M99```
` `
` `
` `
` `

***********************************

# The best system to create your first programming language.

### The eBook

A 100 page PDF detailing core concepts and applying them to a custom language in Ruby
(included: ePub & Mobi formats).

### Exercises & solutions

Proposed extensions to the language with solutions at the end of the book.

### Three languages

Full source code of three languages in Ruby & Java. Easy to extend and play with.

### A screencast

Explaining step by step how to extend the JVM language.
Most books on compilers are priced at more than \$100 and are long and boring. My system, which contains a book (fun and to the point), exercises & solutions, three languages you can use however you want and a screencast, is only \$39.99.
And I even give it to you for free if you're not happy.
Money back guaranteed, no questions.
Instant delivery & awesomeness.

Savage Rubby

# It works or it's free.

## Not sure this system is for you? Try it and if you're not happy, I'll give you your money back and you keep everything.

Money back guaranteed, no questions.
Instant delivery & awesomeness.
***********************************
www.appaha.mobi

# 1. U W CNC Lathe CNC Program Examples

## Fanuc G71 Turning Cycle

Fanuc G71 Turning Cycle G71 turning cycle is used for rough-material removal from a cnc lathe component. G71 turning cycle makes large diameter cutting easy. Cutting can be done in simple…

## CNC Lathe Basic Programming Example ID/OD Turning/Boring Operations (No Canned Cycle Used)

A full CNC programming example with ID/OD (Turning/Boring operations) for cnc machinists who work on a cnc lathe machine. A must to learn/practice for those who are learning cnc programming….

## G71 Rough Turning Cycle Example Code – CNC Lathe Programming

G71 Turning Cycle G71 Rough Turning Cycle example code. This cnc program code works on Fanuc and similar cnc controls. G71 Rough Turning Cycle parameters explanation CNC Fanuc G71 Turning…

## CNC Lathe Simple G Code Example – G code Programming for Beginners

CNC lathe simple g code example for CNC machinists/CNC programmers who just started their journey to learn CNC programming. Simple G Code Example CNC Lathe O0001 N5 M12 N10 T0101…

## Fanuc Circular Interpolation G02 G Code Example

Fanuc Circular Interpolation Fanuc Circular Interpolation commands (G02, G03 G Codes) are used to move a tool along a circular arc. G02 – Circular Interpolation Clockwise. G03 – Circular Interpolation…

## Fanuc G73 Pattern Repeating Cycle CNC Program Example Code

CNC programming example for Fanuc G73 pattern repeating cycle. Fanuc G73 Pattern Repeating Cycle has already been described here CNC Fanuc G73 Pattern Repeating Cycle You might like other Fanuc…

## Fanuc G73 Pattern Repeating Canned Cycle Basic CNC Sample Program

Fanuc G73 pattern repeating cycle helps cnc machinists to program/maintain/debug rough material removal programs easy. Other Fanuc canned cycle like G71 Longitudinal cutting cycle or G72 Facing Cycle removes the…

## G71 Longitudinal Roughing Cycle Mazak CNC Basic Programming Example

CNC basic programming exmaple for cnc programmers/machinists who work on Mazak / Fanuc cnc controls. This cnc code example shows the use of G71 Longitudinal Roughing Cycle. G71 Turning Cycle…

## Fanuc G72 Facing Canned Cycle Example Program

Here is another cnc programming example which shows the use of Fanuc G72 Facing Cycle. Fanuc G72 facing cycle comes in two format for different fanuc cnc controls. Fanuc G72…

## Sample Program Example Fanuc G72 Facing Cycle Single-line-format

As canned cycle for cnc machines looks difficult to learn and program for beginner level cnc machinists, but they pay off in long run. As canned cycle makes cnc machinists…

# 2. Threading CNC Program Examples

## External Thread Cutting with G76 Threading Cycle on Fanuc 21i 18i 16i CNC

Fanuc Series 21i 18i 16i Thread Cutting with G76 Threading Cycle Fanuc G76 cycle can be used for external and internal thread cutting. Fanuc series 21i 18i 16i cnc controls use…

## Taper Threading with G32 a CNC Programming Example

G32 is used for thread cutting, but with G32 we can just make a single threading cut. This all mean that you yourself have to do all the work of…

## CNC Programming Example G92 Taper Threading Cycle

G92 threading cycle is used for threading on a cnc lathe machine. The added benefit of G92 thread cycle is that G92 G-code gives cnc machinist full control over the…

## G76 Thread Cycle a CNC Programming Example

G-code G76 is a cnc cycle which is used for thread cutting on cnc machines. Threading cycle G76 is explained here G76 Thread Cycle. Taper thread cutting with G76 thread cycle…

## Fanuc G76 Thread Cycle for Dummies

Fanuc G76 Thread Cycle for Dummies explains Fanuc G76 threading cycle briefly. Fanuc G76 gives cnc machinist full control over thread turning. Fanuc G76 threading cycle has multiple parameters but the same…

Fanuc cnc controls has no direct threading cycle for cutting multi start threads on cnc. But you can cut multi start threads on a cnc with fanuc control by using…

Taper threading is not a usual practice in cnc machine workshops, but sometimes customer want a component with taper threading, So here is the solution. Taper threading on a cnc…

# 3. Tapping CNC Program Examples

## Fanuc G84 Tapping Cycle

G84 tapping cycle performs tapping operation, tapping is performed by rotating the spindle clockwise, when bottom of the hole has been reached, the spindle is rotated in the reverse direction for…

## Fanuc Subprogram Example

Here is a Fanuc subprogram example which shows, how cnc machinists can make their cnc programs easier to write and maintain by useing sub-programming method. CNC Sub Programs Sub-programming is…

## G81 Drilling Cycle G84 Tapping Cycle CNC Program Example

CNC program which shows the use of G81 Drilling Cycle G84 Tapping Cycle. As G81 drilling cycle has already been briefly explained here G81 Drilling Canned Cycle – CNC Mill…

## G84 Tapping Cycle Example CNC Program

G84 tap cycle is one of the mostly used function of CNC machining centers. This G84 tapping cycle example program illustrates the use of tapping in an easy to understand…

# 4. Taper Threading CNC Program Examples

## Taper Threading with G32 a CNC Programming Example

G32 is used for thread cutting, but with G32 we can just make a single threading cut. This all mean that you yourself have to do all the work of…

## CNC Programming Example G92 Taper Threading Cycle

G92 threading cycle is used for threading on a cnc lathe machine. The added benefit of G92 thread cycle is that G92 G-code gives cnc machinist full control over the…

## Fanuc G76 Thread Cycle for Dummies

Fanuc G76 Thread Cycle for Dummies explains Fanuc G76 threading cycle briefly. Fanuc G76 gives cnc machinist full control over thread turning. Fanuc G76 threading cycle has multiple parameters but the same…

Taper threading is not a usual practice in cnc machine workshops, but sometimes customer want a component with taper threading, So here is the solution. Taper threading on a cnc…

# 5. Subprogram CNC Program Examples

## CNC Mill Subprogram Example Joining Multiple Arcs G02 G03 G41

CNC milling program to describe how two or more radii can be joint together in a cnc mill program. CNC Mill Subprogram Example CNC Part Program N10 T1 H1 M6…

## CNC Pocket Milling Program Example – Peck Milling

CNC milling program example which shows how a cnc program can be made to machine Pockets on a cnc mill. This program example uses Peck milling to cut material to…

## Fanuc G72.1 G72.2 Figure Copy Program Example (Bolt Hole Circle)

This CNC program example shows how both G72.1 and G72.2 figure copy functions can call one-another in one part program, read Programming Notes below carefully. Programming Fanuc G72.1 Rotational Copy Using G72.1…

## Fanuc G72.2 Linear Copy (Figure Copy Function CNC Mill)

Fanuc G72.2 Linear Copy Using G72.2 Linear Copy G-code a figure specified by a subprogram can be repeatedly produced with Linear movement. Programming G72.2 P… L… I… J… Parameters Parameter Description…

## Fanuc G72.1 Rotational Copy Program Example

Fanuc G72.1 Rotational copy programming example, G72.1 G-code is used to repeatedly produce a figure with rotational movement. Fanuc G72.1 Rotational Copy Using G72.1 Rotational Copy G-code a figure specified…

## Fanuc G68 Coordinate Rotation – Subprogram Example

CNC program example code to show how Fanuc G68 Coordinate rotation g-code can be used in a subprogram to take most benefit from it’s functionality. G68 Coordinate Rotation Example Main-program N5…

## CNC Mill Contour Pecking – Fanuc Subprogram Repeat Example

A very simple cnc programming example which shows how a contour can be repeated multiple times with the added benefit of pecking. So like peck drilling this time cnc machinists…

## Fanuc Subprogram Example

Here is a Fanuc subprogram example which shows, how cnc machinists can make their cnc programs easier to write and maintain by useing sub-programming method. CNC Sub Programs Sub-programming is…

Fanuc cnc controls has no direct threading cycle for cutting multi start threads on cnc. But you can cut multi start threads on a cnc with fanuc control by using…

# 6. Step Turning CNC Lathe CNC Program Examples

## Fanuc G71 Turning Cycle

Fanuc G71 Turning Cycle G71 turning cycle is used for rough-material removal from a cnc lathe component. G71 turning cycle makes large diameter cutting easy. Cutting can be done in simple…

## Fanuc G71 G72 G70 Canned Cycle CNC Lathe Internal Machining Example (Boring & Facing )

Fanuc programming example which shows the use of multiple fanuc canned cycle in cnc programming, Following canned cycle are used in this cnc lathe programming example G71 Rough Turning Cycle…

## CNC Lathe Basic Programming Example ID/OD Turning/Boring Operations (No Canned Cycle Used)

A full CNC programming example with ID/OD (Turning/Boring operations) for cnc machinists who work on a cnc lathe machine. A must to learn/practice for those who are learning cnc programming….

## Haas G72 Type I Rough and G70 Finish Facing Cycle Program Example – Fanuc Compatible

Haas lathe programming example to illustrate the use and programming of Haas G72 Type I Rough Facing Cycle/ G70 Finish Cycle. The above code will also work on cnc lathe…

## Fanuc Lathe Programming Example Using G70, G71, G74 for ID Machining

Fanuc lathe programming example which uses Fanuc canned cycle G71 Turning Cycle G70 Finish Cycle G74 Peck Drilling Cycle This Fanuc lathe programming example illustrates who to use G71 Turning…

## G71 Rough Turning Cycle Example Code – CNC Lathe Programming

G71 Turning Cycle G71 Rough Turning Cycle example code. This cnc program code works on Fanuc and similar cnc controls. G71 Rough Turning Cycle parameters explanation CNC Fanuc G71 Turning…

## Newbie CNC Machinists a Basic CNC Canned Cycle Example G90

Basic CNC Canned Cycle Example Program for Newbie CNC Machinists A basic cnc programming exercise for newbie cnc machinists / newbie cnc programmers who have just to start their professional…

## Fanuc G73 Pattern Repeating Cycle CNC Program Example Code

CNC programming example for Fanuc G73 pattern repeating cycle. Fanuc G73 Pattern Repeating Cycle has already been described here CNC Fanuc G73 Pattern Repeating Cycle You might like other Fanuc…

## Fanuc G70 G71 Rough and Finish Turning Cycle Program Example

Here is another cnc lathe program example. This cnc programming example shows the use of Fanuc cnc control G-code for turning canned cycle Fanuc G71 Roughing Cycle. This cnc program…

## CNC Fanuc G73 Pattern Repeating Cycle CNC Program Example

Here is a cnc programming example, I already have posted multiple cnc programming examples. This cnc programming example shows the usage of fanuc G73 pattern repeating cycle. You might read…

## CNC Programming Example with Fanuc G71 Rough Turning Cycle and G70

Here is another cnc programming example, this cnc programming example shows the use of G71 Canned Cycle and G70 for Fanuc CNC Control. G71 Turning Cycle Although I already have…

***********************************
www.appaha.mobi

## [PDF] Threading CNC Program Examples

### CNC ProgramLearn CNC proramming by example

***

Ex1: Internal Threading on Fanuc 21i 18i 16i with G76 Threading Cycle

Ex2: External Thread Cutting with G76 Threading Cycle on Fanuc 21i 18i 16i CNC

Ex3: Taper Threading with G32 a CNC Programming Example

Ex4: CNC Programming Example G92 Taper Threading Cycle

Ex5: G76 Thread Cycle a CNC Programming Example

Ex6: Fanuc G76 Thread Cycle for Dummies

***********************************
www.appaha.mobi

## [PDF] Tapping CNC Program Examples

### CNC ProgramLearn CNC proramming by example

Tapping CNC Program Examples