What's new
What's new

Gcode, not learning canned cycles very well.

Higgins909

Aluminum
Joined
Nov 19, 2018
Just wondering if anyone knew of a place to learn Gcode for the lathe. I've been trying to understand G71 and just don't understand it. I understand the approach and 1st G72 block, but it starts to lose me in the 2nd G72 block. I'm starting with G72 because rough facing is the first thing that we do in the shop I work in. Haven't bothered with any of the other canned cycles. I've got a book by Peter Smid, CNC Programming Handbook, Third Edition. HAAS lathe book, Mitsubishi lathe book, and Youtube Tom Stikkelman and tried to google other resources... and well It's just not clicking that well. They don't really explain the P and Q blocks that well.

Thanks,
Higgins909
 
When it comes to facing, I find it quicker to just hard code it. I don’t use work offsets personally but here’s an example of what I do, with and without work offsets.


Example is using 2” round
With work offset:
T0202
G97 s500 m3
G50 s3000
G96 s400
G0 g54 x2.1 z.1
Z0
G1 X-.06 f.003
W.01
G0 x2.1
(Continue to turning)


Without work offset:
T0202
G97 s500 m3
G50 s3000
G96 s400
G0 x2.1 z.1
Z0
G1 x-.06 f.003
W.01
G0 x2.1
(Continue to turning)

The only difference is calling the work offset.
If you need help feel free to PM me, everyone has to learn somehow.


Sent from my iPhone using Tapatalk
 
Just wondering if anyone knew of a place to learn Gcode for the lathe. I've been trying to understand G71 and just don't understand it. I understand the approach and 1st G72 block, but it starts to lose me in the 2nd G72 block. I'm starting with G72 because rough facing is the first thing that we do in the shop I work in. Haven't bothered with any of the other canned cycles. I've got a book by Peter Smid, CNC Programming Handbook, Third Edition. HAAS lathe book, Mitsubishi lathe book, and Youtube Tom Stikkelman and tried to google other resources... and well It's just not clicking that well. They don't really explain the P and Q blocks that well.

Thanks,
Higgins909

Hello Higgins,
Unless by "Rough Facing" you mean that a profile is being roughed where the cutting distances is considerably greater in X than Z and you're not just referring to taking an initial facing cut to qualify the start face of the work-piece, then using a G72, Multi-repetitive Cycle is not the best strategy.

Irrespective of whether the cycle being used is G71, or G72, the P and Q referenced Blocks refer to the same thing, that being the first and last blocks respectively of the profile description, in the direction of the tool path of the finish pass. In a nutshell, the Blocks between the P and Q referenced Blocks in the second G71 Block describe the profile shape of the work-piece, where P is the Sequence Number of the First Block in the Profile Description and where Q is the Sequence Number of the Last Block in the Profile Description.

The following picture shows the P and Q Blocks of the profile shown.

G71-Test1.JPG

Following is the code that correspond to the profile above.

G00 X82.400 Z3.000
G01 Z0.15 F1.0 (ROUGH FACE STARTS HERE)
G01 X-1.6 F0.25
G01 Z1.0
G00 X82.000 (ROUGH FACE FINISHES HERE)
G71 U4.0 R0.5
G71 P100 Q101 U0.5 W0.15 F0.25
N100 G00 X28.400
G01 Z0.000
G03 X40.000 Z-5.800 I0.000 K-5.800
G01 Z-20.469
G01 X76.602 Z-38.770
G03 X80.000 Z-42.871 I-4.101 K-4.101
G01 Z-55.000
N101 G01 X82.400
G00 Z3.000

Not all Blocks in the Profile Description have to have Sequence Numbers, only the Blocks referenced by P and Q in the G71 Block. The Sequence Numbers referenced in the G71 Block by P and Q should not occur anywhere else in the program, other than the First and Last Block respectively of the Profile Description.

The above program example is for a Fanuc Control using the Two Block Format. If your control uses the Single Block Format (early Fanuc, Fanuc by parameter setting, Haas and others), then the syntax will be as follows:

G71 P100 Q101 U0.5 W0.15 D4000 F0.25 (Haas allows decimal point for D, Fanuc not)
N100 G00 X28.400
G01 Z0.000
G03 X40.000 Z-5.800 I0.000 K-5.800
G01 Z-20.469
G01 X76.602 Z-38.770
G03 X80.000 Z-42.871 I-4.101 K-4.101
G01 Z-55.000
N101 G01 X82.400
G00 Z3.000



Regards,

Bill
 
I don’t use work offsets personally but here’s an example of what I do, with and without work offsets.

Example is using 2” round
With work offset:
T0202
G97 s500 m3
G50 s3000
G96 s400
G0 g54 x2.1 z.1
Z0
G1 X-.06 f.003
W.01
G0 x2.1
(Continue to turning)


Without work offset:
T0202
G97 s500 m3
G50 s3000
G96 s400
G0 x2.1 z.1
Z0
G1 x-.06 f.003
W.01
G0 x2.1
(Continue to turning)

So how do you get the tool to the coordinate shown in Red above without some type of Work Coordinate System, whether it be set by Work-shift Offsets, or G50? Or the next job where the Work-piece is a difference length and therefore, Z Zero at a different point in space?

Regards,

Bill
 
P and Q tell the control where to look for the code describing the contour to be cut. Example for 3” diameter stock and 0.1” face stock
G0 X3.1 Z0.1
G72 W0.025 R0.015
G72 P101 Q102 U0 W0.0075 F.01
N101 G0 Z0
N102 G1 X-0.062 F0.008
G0 X3. Z0.05
You position the tool, then call the cycle. The cycle calculates tool path from your tool position to the contour described between P and Q blocks. Note that P and Q correspond to the N blocks.
 
Thank you everyone. I was thinking I could manually program it with G01 as it's just a .015" roughing pass, leaving .005" for finish facing. But then I still need to learn G71 and G70. angelw, I'm assuming that is all in metric. That X-1.6 in line 3 threw me off though. Is that facing past X0 for manual TNR comp? Also wondering what program that is. I thought I had a free Gcode simulator, but the lathe part didn't work, just the mill did. I'm a bit confused by the G0 G1 G2 G3 that I see. It's making me thing it's going to rapid all the way Z-. It's still not clicking for me at this time. I'm going to come back in a few.
 
angelw, I'm assuming that is all in metric.
Yes.


That X-1.6 in line 3 threw me off though. Is that facing past X0 for manual TNR comp?
Yes. The Tool Nose Radius used in this example program is 0.8mm. Accordingly, for the TNR to face right to X0.0, it has to go past X0.0 by the TNR, hence the X diameter coordinate of -1.6.

Even if TNR Comp is going to be used at the control (not compensated for in the Part Program) in the machining of the profile shape, its a nonsense to use Control TNR Comp when facing a perpendicular to centre line face of a work-piece for the following reasons:

1. There is no compensation to be calculated if using a typical facing tools such as a RH OD Turning tool.

2. When you reach X0.0, its typical to feed away from the face a small amount. This action in itself will prevent the X Centre of the TNR actually reaching X0.0 when using Control TNR Comp; you would still have to program X-1.6 irrespective of TNR Comp being used, or not.

3. When facing from Outside to Centre, the TNR Comp G code will be different to when OD turning towards the chuck and you need to be mindful of changing from G41 (for the face) to G42 for the OD Turning.

Also wondering what program that is.
My own.

I'm a bit confused by the G0 G1 G2 G3 that I see. It's making me thing it's going to rapid all the way Z-. It's still not clicking for me at this time. I'm going to come back in a few.

These are preparatory codes that set the control to Rapid Traverse, Linear Interpolate, CW Circular Interpolate and CCW Circular Interpolate respectively. If you study the code in the example program, the only Rapid Move specified in the Profile Definition is the First Block (the P Block). Forgetting about roughing for the moment, if you were to simply take a Finish Cut on the specified profile, you would first Rapid to X28.400 and start the Finish operation form there. As the Tool was initially positioned at Z3.0 with the

G00 X82.400 Z3.000

block that precedes the First G71 Block, the move to X28.400 would be through fresh air; no Rapid move to Z-.

From your other Thread on Tool movement, I glean that your control is a Mitsubishi M70. The Multi-repetitive cycles of the M70 control are similar to the Fanuc two Block Format, with the addition of a couple addresses.

With a Fanuc Control there is Type I and Type II G71/G72 cycles. Type I only allows monotonous direction of X coordinates (no pocketing) for the G71 cycle; Type II allow noncontinuous X coordinates (pocketing). Whether Type I, or II is initiated is dependent on whether the P Block of the Profile Description has just a one, or two axis move. With the Mitsubishi M70 control, a H address is used in the First G71 Block to specify Pocketing (H1), or not (H0). Also with the M70 Control, another Profile Shape Program Number can be specified with an address A in the Second G71 Block. If omitted, the current program is used (most usual).

Example:
G00 X82.400 Z3.000
G01 Z0.15 F1.0 (ROUGH FACE STARTS HERE)
G01 X-1.6 F0.25
G01 Z1.0
G00 X82.000 (ROUGH FACE FINISHES HERE)
G71 U4.0 R0.5
G71 A100 P100 Q101 U0.5 W0.15 F0.25
G70 A100 P100 Q101
--------
--------
--------


Shape Program
O100
N100 G00 X28.400
G01 Z0.000
G03 X40.000 Z-5.800 I0.000 K-5.800
G01 Z-20.469
G01 X76.602 Z-38.770
G03 X80.000 Z-42.871 I-4.101 K-4.101
G01 Z-55.000
N101 G01 X82.400
G00 Z3.000


Regards,

Bill
 
Last edited:
Just wondering if anyone knew of a place to learn Gcode for the lathe. I've been trying to understand G71 and just don't understand it. I understand the approach and 1st G72 block, but it starts to lose me in the 2nd G72 block. I'm starting with G72 because rough facing is the first thing that we do in the shop I work in. Haven't bothered with any of the other canned cycles. I've got a book by Peter Smid, CNC Programming Handbook, Third Edition. HAAS lathe book, Mitsubishi lathe book, and Youtube Tom Stikkelman and tried to google other resources... and well It's just not clicking that well. They don't really explain the P and Q blocks that well.

Thanks,
Higgins909

If you have patience to read, and can spare one weekend, here is a resource.
 
So how do you get the tool to the coordinate shown in Red above without some type of Work Coordinate System, whether it be set by Work-shift Offsets, or G50? Or the next job where the Work-piece is a difference length and therefore, Z Zero at a different point in space?

Regards,

Bill

Good question, simple answer, we touch all tools off of the z face of the part and set as zero. Sometimes I’ll be lazy and check the distance from zero and grid shift the machine that much.


Sent from my iPhone using Tapatalk
 
Good question, simple answer, we touch all tools off of the z face of the part and set as zero. Sometimes I’ll be lazy and check the distance from zero and grid shift the machine that much.


Sent from my iPhone using Tapatalk

It amazes me the number of people that exercise the practice of setting each and every tool in each new job when one could simply apply a Work-shift. Its tantamount to having a dog and barking yourself.

When Grid Shift is referred to, it normally means changing the position of the Reference Return Position. Tell me that is not the case, as that would be further convoluted.
 
It amazes me the number of people that exercise the practice of setting each and every tool in each new job when one could simply apply a Work-shift. Its tantamount to having a dog and barking yourself.

When Grid Shift is referred to, it normally means changing the position of the Reference Return Position. Tell me that is not the case, as that would be further convoluted.

That is indeed what I meant. It seems that shop to shop terminology can differ. Yes, it the work shift that is changed.


Sent from my iPhone using Tapatalk
 
That is indeed what I meant. It seems that shop to shop terminology can differ. Yes, it the work shift that is changed.


Sent from my iPhone using Tapatalk
That's got to be the most screwiest suggestion since Johnny Larue, or Deadly Kitten frequented this Forum.

So instead of simply setting a new Work-shift, you have to:

1. Enable Parameter Write

2. Determine the difference in the position of Z Zero relative to the Z Zero of the last job (in microns).

3. Change page to parameter and search for Z Grid Shift parameter.

4. Change value, hoping you make no mistake (you will be changing a number that is in Microns)

5. Change to Setting Page and Disable Parameter Write

6 Extinguish error 100

I can see how that would be better than just setting a Work-shift; NOT.

I don’t use work offsets personally but here’s an example of what I do, with and without work offsets.

The OP of this Thread seems to be struggling enough with CNC programming, than to have the water muddied further by your above comment. It would have been more helpful to have kept it to yourself.
 
Well, everyone is entitled to there own opinion, you included. On my specific machine, there is no requirement to enable write and have alarm 100 on. If the op is that lost why not take some classes at a trade school? It’s a great starting point.
There’s no one way to skin a cat.


Sent from my iPhone using Tapatalk
 
I'm a bit confused by the G0 G1 G2 G3 that I see. It's making me thing it's going to rapid all the way Z-. It's still not clicking for me at this time.
.

Can you explain exactly what isn't clicking?
The Haas manual ( at least the older ones ) did explain G70, 71 and 72 quite nicely.

If you can, post up a quick drawing and we'll write a sample code for it so you can munch on and ask specific questions about each block.
 
That's got to be the most screwiest suggestion since Johnny Larue, or Deadly Kitten frequented this Forum.

So instead of simply setting a new Work-shift, you have to:

1. Enable Parameter Write

2. Determine the difference in the position of Z Zero relative to the Z Zero of the last job (in microns).

3. Change page to parameter and search for Z Grid Shift parameter.

4. Change value, hoping you make no mistake (you will be changing a number that is in Microns)

5. Change to Setting Page and Disable Parameter Write

6 Extinguish error 100

I can see how that would be better than just setting a Work-shift; NOT.



The OP of this Thread seems to be struggling enough with CNC programming, than to have the water muddied further by your above comment. It would have been more helpful to have kept it to yourself.

Hy :) angelw, sounds like the long way around...anywho, remember deadly kitten...had some interesting thoughts that one.
 
Well, everyone is entitled to there own opinion, you included. On my specific machine, there is no requirement to enable write and have alarm 100 on. If the op is that lost why not take some classes at a trade school? It’s a great starting point.
There’s no one way to skin a cat.

If the OP is that lost, why not get him started with Ladder logic and Post pRocessor programming and modification? BECAUSE it's having the cart before the horse. When you make suggestions like that (which are dumb BTW) it only adds to the possible outcomes and adds to the list of possible factors.

OP there are a bunch of Utube videos by a guy Heinz R. Putz that you can watch for free. There are resources to learn, it doesn't happen over night and CNC is not magic. Bill is worthy, listen to what he is telling you and follow the instructions, step by step.

R
 
Hy :) angelw, sounds like the long way around...anywho, remember deadly kitten...had some interesting thoughts that one.


He was not condoning that method, he was pointing out how ridiculous it would be to use it, when there are easier/est solutions. Bringing up DK might be enough to bring him back from the dead, so I don't mention him/it. JL was a different thing all together. I'm pretty sure he is clinically insane.

R
 
He was not condoning that method, he was pointing out how ridiculous it would be to use it, when there are easier/est solutions. Bringing up DK might be enough to bring him back from the dead, so I don't mention him/it. JL was a different thing all together. I'm pretty sure he is clinically insane.

R

Hy lilrob! I was moreso agreeing with his points

I should change my location to aaland islands for sng
 








 
Back
Top