Showing posts with label CNC Tips. Show all posts
Showing posts with label CNC Tips. Show all posts

[CNC Tips] Tips for CNC Users

CNC Tips

CNC Concepts, Inc. accepts no responsibility for the use or misuse of techniques shown in these web pages. We simply publish information we feel will be of interest to CNC users. In all cases, the reader is totally responsible for considering the implications, good and bad, of implementing one or more of the techniques we show.

* Best ebooks for CNC programming: 
CNC Programming Basics 
G-Code and M-Code 
CNC programming 
G-Code Reference 
CNC Machine Tutorial 
Tips for CNC Users
Tips for CNC Users

Tips for CNC Users:

A date engraving custom macro
 to engrave the current day in a workpiece!
Programming a horizontal machining center from a central origin
 If you have a horizontal machining center , this is a "must read"!
Two great articles on machine utilization and costing
 by Roger Kern
A serial number engraving custom macro
Submitted by Steve Woods
How to program a bar puller
Here's how you can program the bar puller from The Duhnam Tool Company
How the heck does G28 work?
We attempt to explain one of Fanuc's most confusing commands.
How can you tell if you're control has Custom Macro B?
Good question!
DNC software that tracks cycle time and time that each tool is cutting
by Dan Fritz of Suburban Machinery
A pallet check for Mori Seike horizontals
by Brian Cox of Ellison Machinery
Simplifying the task of jaw placement on three-jaw chucks
Minimize the time it takes to mount jaws on three-jaw chucks!
A bolt hole machining parametric program in three different versions (Fanuc's custom macro B, Okuma's user task 2, and Fadal's macro)
Everyone's been asking for this one. It makes an excellent example of what can be done with parametric programming. And you can compare different versions of parametric programming!
When is a five axis machining center required?
Here's a quick rundown on the two types of five axis machining and the two types of five axis machines
A letter engraving custom macro
A quick and easy way to engrave letters!
A custom macro for taper thread milling
This macro makes it possible to mill taper threads!

* Ebooks
[CNC Tips] Tips for CNC Users

10 Tips to Better CNC Turning

10 Tips to Better CNC Turning

No shop wants to see their part ruined and scrapped at the end of CNC turning. And although having a combination of proper technique and the right tools to keep jobs in spec and on time, there are other variables that should be considered before arriving at the finishing stage. Here are some things you can do that will help you get the best surface finish:

10 Tips to Better CNC Turning

Increase Your Speed
This really applies most when using carbide tools. When you increase the surface feet per minute speed (SFM), you will ensure that the material is in contact with the tool tip for a shorter amount of time and will also reduce edge buildup on the tool, which causes poor surface finishes.

Reduce Your Feed Rate
Reducing the feed rate helps to improve surface finish. This will also help to reduce flank wear and prolong the insert’s longevity. In addition, doubling the nose radius will help to improve surface finish. For roughing applications, it’s best to use a tool capable of a high feed rate to remove material quickly. For finishing, it’s best to have a lower feed rate and shallower cut.

Increase the Top Rake Angle
Positive rake angles will lead to a finer surface finish, requiring lower cutting forces. Using a 45° cutter will act downward, possibly making the part flex. As a result, this will cause the back half of the cutter to recut the machined part and create a poor surface finish. Using a 90° cutter will create cutting forces parallel to the part and will not flex it. This will produce a smoother surface finish.

Use a Chip Breaker
A poor surface finish can also be caused by improper chip breaking, downtime to remove chips and higher temperatures at the tool’s cutting edge. A chip breaker can produce smaller chips that are cleared from the cutting area quickly. And because there is no longer a need to clear chips by hand, safety is improved.
If the chip breaker can break the chips into adequate lengths, then vibration will be minimized; the chips will not wrap around the workpiece and tools will not be damaged. Chip breakers also reduce cutting resistance, which can avoid chipping or breaking the cutting edge. A lower cutting resistance can decrease heat and delay tool wear.

Use a Large Nose Radius
The idea is to use a larger nose radius and decrease the feed rate to get a smoother, finer surface finish. This is because the nose radius and depth of cut affects the shape and direction of chips. Therefore, it’s best to use the largest radius possible to achieve the best surface finish and avoid creating chatter (machine vibration). But, on the other hand, a larger nose radius will increase demands on the tool, causing vibration and poor chip breaking, whereas a smaller nose radius produces thinner chips that are easier to clear away from the workpiece, but this will also limit the feed rate.
Here’s a tip: Select a minimum depth of cut two thirds of the nose radius and a maximum of one third of the cutting edge length. For finishing, select cutting depths of less than one third of the nose radius.

Use an Insert with a Wiper
To ensure a good surface finish, use a special wiper insert that has a modified nose radius with larger corners to wipe the surface smooth. This will allow you to cut at a faster feed rate.

Use the Right Technique
Creating a chip that is thick-to-thin is what you want. Your technique plays a vital role in getting smooth surface finishes. Choose a cutter that is smaller than the nose radius so you can program it for a smooth transition from line-to-line.
When you run your final cuts, don’t just limit yourself to checking your workpiece; you should also read your chips. The characteristics of your chips will indicate what machining set up or tooling adjustments are necessary.

Use Different Tools for Roughing and Finishing
Some may say that the same inserts can be used for both roughing and finishing. But it’s best to use separate inserts, one for roughing and one for finishing. For roughing, you can use a course-pitch cutter with a large nose radius, and a large rake angle with a rapid feed rate. For finishing, you can use a fine-pitch finishing tool with the proper lead angle and a wiper flat, which will give you a better surface finish.

Clear the Chips
There is a debate whether to use coolant in milling applications. But it all depends on the type of work you’re doing, such as deep cavity milling, the type of material and which insert you are using. Using coolant, in some cases, should be avoided. It may cause thermal cracking and shorten tool life and could affect the surface finish negatively. But with aluminum, low-carbon steel or nickel-based alloys, using coolant will prevent the tool from sticking to the workpiece.

Check Your Toolholding and Workholding

It’s a good idea to check the condition of your toolholder. An old, worn-out toolholder may cause the insert to move. This will cause chatter and will negatively affect the surface finish of your part. You also want a rigid workholding that is stable, especially with a higher metal removal rate.



[CNC Programming Examples] U W CNC Lathe CNC Program Examples

U W CNC Lathe CNC Program Examples

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 straight line or a complex contour can also be machined very easily.
Through G71 turning cycle parameters cnc machinists can control
  • Depth of cut.
  • Retract height.
  • Finishing allowance in x-axis and z-axis.
  • Cycle cutting-feed, spindle speed.


G71 U... R...
G71 P... Q... U... W... F... S...


First block
Parameter Description
U Depth of cut.
R Retract height.
Second block
Parameter Description
P Contour start block number.
Q Contour end block number.
U Finishing allowance in x-axis.
W Finishing allowance in z-axis.
F Feedrate during G71 cycle.
S Spindle speed during G71 cycle.

G71 Turning Cycle Overview

  • G71 turning cycle cuts the whole contour repeatedly which is given in P Q blocks.
  • Depth of every cut can be controlled by first-block U value.
  • Second-block U W are the finishing allowances which can be given if you want to make a finish cut with G70 finishing cycle.
  • F is cutting feed and S is spindle speed (given in second-block) which are used during G71 turning cycle.
Note – The F and S given inside P Q block will not be used during G71 turning cycle, they are used with G70 finishing cycle if later called.

G71 Turning Cycle Working

N60 G71 U10 R10 
N70 G71 P80 Q90 U3 W0 F0.25
N80 G00 X60
N90 G01 Z-75
When G71 turning cycle is run the whole operation will be done in following sequence,
1 – Tool will move in x-axis U (depth of cut) deep with programmed feed from starting-point.
2 – Tool will travel with feed in z-axis (destination point in z-axis is given in P Q blocks )
3 – Tool rapidly retracts R amount in both x-axis and z-axis (at 45 degrees).
4 – Tool rapidly travel in z-axis to start-point
5 – Tool rapidly moves to last cut depth.
6 – Tool moves with feed in x-axis U deep (first-block U depth of cut).
7 – Tool with feed moves in z-axis (destination point given in P Q blocks).
8 – Tool rapidly retracts in x-axis and z-axis R amount (45 degrees).
9 – Tool rapidly moves to start-point only in z-axis.
This whole sequence of operation keep on going, until the destination point in x-axis is met.
If finishing allowance is given tool will not make the exact diameter and length given in P Q blocks but will leave that much allowance, This finishing allowance can be later machined by calling G70 finishing cycle.

Fanuc G71 Turning Cycle

Fanuc G71 Example

Here is a cnc part-program which shows how G71 turning cycle can be used, this is the program for the drawing given above
N50 G00 X106 Z5 M3 S800
N60 G71 U10 R10 
N70 G71 P80 Q90 U3 W0 F0.25
N80 G00 X60
N90 G01 Z-75
In this program G71 turning cycle will keep repeating the contour given inside P Q blocks shown below
N80 G00 X60
N90 G01 Z-75
These two cnc program blocks tell us that we want to remove material till X60 deep and in Z-75 in length.
The depth of cut is given in first-block U10 retract amount is also given R10.
Finishing allowance in x-axis is U3 but there is no finishing allowance given in z-axis W0.

G70 Finishing Cycle

If you programmed G71 turning cycle with finishing allowances then that finish allowances can be removed with G70 finishing cycle.
G70 finishing cycle repeats the whole contour the G71 way, but in just one-cut removing the finishing allowances.

Why Use G70 Finishing Cycle

As material can be removed with G71 turning cycle, but if you want a different cutting-feed and spindle speed for the last cut, then it is recommended that you use G70 finishing cycle.
G70 finishing cycle use F and S values which are given inside P Q programmed blocks. (G71 use F S values which are given inside G71 second block.)

Fanuc G70 Example

N50 G00 X106 Z5 M3 S800
N60 G71 U10 R10 
N70 G71 P80 Q90 U3 W0 F0.25
N80 G00 X60
N90 G01 Z-75 F0.15
N100 G00 X200 Z100
N110 G92 S1200
N120 T3 G96 S150 M03
N130 G00 X106 Z5
N140 G70 P80 Q90
N150 G00 X200 Z100
N160 M30

G70 G71 Example

G71 Rough Turning Cycle Example

G00 X200 Z10 M3 S800
G71 U2 R1 F200
G71 P80 Q120 U0.5 W0.2
N80 G00 X40 S1200
G01 Z-30 F100
X60 W-30
N120 X100 W-10
G70 P80 Q120


[CNC Programming Examples] Fanuc Macro Programming

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


G65 P9100 Z K F
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

Custom Macro

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 ;

Macro program

#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.)

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

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;
X70.0 Y80.0;

Drilling Macro

#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)
IF[#4010 EQ 98]GOTO 1;  (Return to position I)
G00 Z#18;   (Positioning at position R)
N1 G00 Z#5;   (Positioning at position I)
N2 G#1 G#3 F#4;  (Restores modal information)

Fanuc Bolt Hole Circle Custom Macro (BHC)



CNC Program

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)

G81 Z#26 R#18 F#9 K0
IF[#3 EQ 90]GOTO 1
N1 WHILE[#11 GT 0]DO 1
G90 X#5 Y#6
G#3 G80

/*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”).*/
G90 G92 X0 Y0 Z4.0
G65 P9100 X10.0 Y5.0 R1.0 Z-2.0 F20 I4.0 A0 B45.0 H5

G65 Macro for Internal Elipse



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
N30 G40 X0
G0 G90 Z100 M30

G65 Macro for an Increasing Radius


CNC Program

;A = #1 (Start Angle 0 degrees)
;B = #2 (Start Radius)
;C = #3 (Increment angle for accuracy calculations.)
;I = #4 (Finish Angle)
;J = #5 (Finish radius)
;K = #6 (Milling feed)

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

#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

G65 Macro for Internal Helical

CNC Program

G0 G90 G40 G21 G17 G94 G80
G54 X? Y? S? M3 (Move to bore centre)
G43 Z? H?
G65 P1002 A? B? D?

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

G65 Macro for a Counterbore


CNC Program

G0 G90 G40 G21 G17 G94 G80
G54 X? Y? S? M3 (Move to bore centre)
G43 Z? H?
G65 P1001 A? D?

G91 Y#12
G41 X#11 D#7
G3 X-#11 Y#11 R#11
X-#11 Y-#11 R#11
G1 G40 X#11
G0 G90 Z100