What's new
What's new

Fanuc Workshift/Datum Reset Lathe Question

EndlessWaltz

Cast Iron
Joined
Jun 18, 2016
Location
Midwest
So I do not want to get into macros. Yes, I have used them. However this is a very simple program and I want to know if it is POSSIBLE to reset my zero point at my last cut off point. So I want to cut 4 spacers out of one pull. I have done this back in the day with the old G92 and done it on another lathe but forgot how with G10. As you can see that is what I am trying now. However I feel safer with the G52 because it will reset if I stop mid program with reset button. Some code is redundant safety spacing or trying to "activate" the new offset/datum while trying to figure this out.

Please let me know your thoughts if your so kind. G52, G10??? FANUC 18i


(FACE-SKIM-CD-DRILL-MPO)
G28U0.0W0.0
T0101
G54
G50S900
G96S400
M3
M8

G0X1.020Z.1
G1Z0.0F.010
G1X-.050F.008
G0G42Z.1
G0X.970
G1X.995Z-.020F.008
G1Z-.972F.012
M9
G40G28U0.0W0.0
M01

T0404(CD)
G97S750
M3
M8
G00G99X0.0Z1.0
G0G40Z.1
G1Z-.075F.006
G0Z.1
M9
G28U0.0W0.0
M01

T0606(DRILL)
G97S900
M3
M8
G0X0.0Z1.0
G0Z.1
G83Z-.960Q2000F.008
G80G0Z2.0
M9
G28U0.0W0.0
M01

The Good Stuff


T0505(MDT)
G50S1500
G96S200
M3
M8
G0X1.020Z.1
G1X1.010Z0.0F.02

G10L2P1Z0.0
M98Q44L4

N45
G97S650
G28U0.0W0.0
M30

N44(spacer sub)
G1Z.000F.02
G1X.950F.002
G1X.990Z-.020
G1Z-.223F.006
G1X.950Z-.243F.002
M10
G1X0.0
M11
G0X1.010
G10P1W-.243
G1Z0.0F.020
M99
 
I would put the G10 as the first line of the program. Use the actual Z of G54. Worst case if you reset and restart, it will cut air til it reaches the stock.

The G10 in the sub looks good but I don’t know if W is valid syntax. You could try G10 G91 L2 P1 Z-.243
 
If you have G54, why not simply use additional work offsets for your cutoff step? kinda like you have now but loop the sub after each G54, G55, G56 and G57. AFAIK, G10 is useful if you run out of work offsets, although it could be used to increment your G54.
 
That program makes my head hurt.
I would use G54 only, keep the program of the first spacer (without the silly G10), then copy and paste the same operations 3 times for the next 3 pieces. Change the Z values for the each of the next 3 spacers for the start and end points.
Example
First piece starts at Z0 and ends at Z-.243
Second piece start by finishing the face at Z-.373 (assuming .120 cutoff tool and .01 for face finish) and cutoff at z-.616
Do the same with third and fourth piece.

Or mabe I am misunderstanding what you are trying to do.
 
Walz, if your machine can use G52 then that should be the end of the discussion in my opinion.
No, without a tiny amount of macro programming you probably won't be able to use the M98 L4 call as you're doing it there, but you CAN
call it independently 4 times with the G52 in-between:

(program header)
G52 Z0 <----- make sure you put this here, so you can always stop anywhere, anytime and RESET safely.
blah
blah
blah
now the good stuff
M98 Q44 L1 (part#1)
M01
G52 Z-.243
M98 Q44 L1 (part#2)
M01
G52 Z-.486
M98 Q44 L1 (part#3)
M01
G52 Z-.729
M98 Q44 L1 (part#4)
G52 Z0 <---- put this here also, so when the program finishes, you're back to where you've started.
(end of program stuff )
M30
N44
( your part code here)
M99

Again, this is just my preference if there aren't enough workoffsets available on the lathe.
The M01-s are in there just in case you want to check the finished parts before making 3 more crappy ones.
 
Thanks for the feed back guys. Most of your suggestions I was trying to avoid and here is why. The simpler the program the easier to adapt for novice operators. Imagine if you will going from one identical spacer to another and all are doing is changing the length. You literally may change drill depth and then one number for the space length. Easy and super fast. As long as the person know they may need to stick out a farther amount to clear chuck.

I think I have been trying what BoozeDaily suggested and am not getting to work but will try again since that is what I would rather have, cut air if need be.

The other options add in more numbers to change and line blocks to add if necessary. The beauty of doing this style with a G92 was I could go from 2-5 spacers and set the L value and just make my stickout enough and off to the races pretty much. This is key to job shops and going from similar parts to similar parts at the control.

If I can't get it to work I will try to use a simple macro I developed and will show that to get the concept across on two styles of trying to simplify spacer/bar pull programs.

Any other suggestions let me hear it.
 
I might consider staying with the W for all of the z moves

Z0
M98P44
W-.243
M98P44
W-.243
M98P44

With ALL of the Z moves in the sub in W instead of Z
 
Will be switching to macros using #5222 and will post that up for review on Saturday hopefully.

So I do not want to get into macros.
Hello EndlessWaltz,
From not wanting to get into Macros to using the Macro System Variable for Workpiece Offset is quite a turnaround.

Personally, I prefer to use a Macro statement rather than G10, but in function there is not much difference.

If you're willing to dabble into using a Macro statement, it would be simple to use G52, as suggested by Seymour, and use a single line Macro Statement to incrementally add the Z Shift to use with G52. This would allow you to use your M98 Q44 L4 logic. When using G52, you don't have to remember the original Workpiece Coordinate System Value, just reset it with a Zero value for the axis address involved, or depending on parameter setting, with Reset.

Regards,

Bill
 
Bill and others,

I did the turn around because from my standpoint I cannot RESET zero on a Fanuc temporarily with one G-code. We are always telling it to shift an amount compared to G54 etc. I didn't like the G10 and potentially getting lost if you stopped midprogram. I will post the code below using more common macros replacing an older program that was verified to work but using other ones. I hope you see the simplicity in it and understand why I am not going with a G52 like Seymour suggested in this instance.

This is for a .125 spacer using a .118 cutoff , ran 4 times. This machine may not be able to run #500 macros, and I know #100s work.

WHERE I BOLDED I AM UNSURE. IN OTHER MACHINE THIS IS WHERE I RESET G54 BACK TO ORIGINAL USING ANOTHER CODE NOT AVAILABLE IN THIS MACHINE. CAN THE #5222 ACCOMPLISH THIS BEING USED IN THIS WAY?

%
O0009
(FACE-CD-DRILL-MPO)
G28U0.0W0.0
T0101
G54
#5222=0 Unsure if needed here
G50S900
G96S400
M3
M8

G0 X1.020 Z.1
G1 Z0.0 F.010
G1 X-.050 F.008
G0 Z.1
G0 X.945
G1 X.995 Z-.020 F.004
G1 Z-.243 F.012
M9
G28U0.0W0.0
M01

T0404(CD)
G97S750
M3
M8
G0 X0.0 Z1.0
G0 G40 Z.1
G1 Z-.075 F.006
G0 Z.1
M9
G28U0.0W0.0
M01

T0606(DRILL)
G97S900
M3
M8
G0 X0.0 Z1.0
G0 Z.1
G83 Z-.243 Q2000 F.008
G80 G0 Z2.0
M9
G28U0.0W0.0
M01

T0505(MDT)
G50S900
G96S200
M3
M8
G0 X1.010 Z.1
#103=-.243
M98Q44L4
N45
M9
#100=0
G28U0.0W0.0
M30

N44(sub)
T0505
G1 X.950 Z0.0 F.010
G1 X.990 Z-.020 F.004
G1 Z-.223 F.010
G1 X.950 Z-.243 F.002
M10
G1 X0.0 F.002
M11
G0X1.010
#100=[#100+#103]
#5222=[#5222-#100]
M9
M99
%
 
Best solution in my opinion is what Dan said. Use G54 to G57 offsets.
Lets say your G54 offset is 5.0000. Subtract total machining length for the rest of the work offset from the 5.0.
Lets say it's 0.5" for each additional piece so you would enter 4.5 for G55, 4.0 for G56, and 3.5 for G57.

I would go like this

N1
G54
Rest of program
G28 U0 W0
M01

N2
G55
Repeat the rest of program
G28 U0 W0
M01

N3
G56
Repeat rest of program
G28 U0 W0
M01

N4
G57
Repeat rest of program
G28 U0 W0
M30

I don't see how this not the least complicated way but different strokes for different folks.
 
I didn't like the G10 and potentially getting lost if you stopped midprogram. I will post the code below using more common macros replacing an older program that was verified to work but using other ones.

This is for a .125 spacer using a .118 cutoff , ran 4 times. This machine may not be able to run #500 macros, and I know #100s work.
Hello EndlessWaltz,
Your reasoning is flawed. What you're doing with the following Block:

#5222=[#5222-#100]

is exactly what you would be doing using G10. You're actually changing the value of the G54 Z Workshift. Accordingly, if you have to stop the program midpoint, you will be equally lost with this solution, as you would be using G10 to modify the G54 Workshift.

I don't see your approach as being simple. It requires more work, in the way of recording the original value of the G54 Workshift Offset and restoring it in a manner that is relatively fool proof. You would want to be able to restore the original value under any circumstance of having to abort the program. You really need to be able to restore the original value at the Start of the program, in case the program didn't make it to the End. In this case you would probably have to store the value in a Common, Nonvolatile Variable before the program is started (manual input). Using G52, you simple include G52 Z0.0 at the Start of the program; that's it.

#5222=0 Unsure if needed here

You definitely don't want the above Block there, or anywhere. That will set the G54 Z to Zero, meaning that the Z Zero of the Workpiece will be at the Z Reference return Position of the machine. What happens with the next Motion Move will depend on the parameter settings, ie, whether a change to the Offset is effective in the Next Motion Block, or not until G54 is executed again. What would be more logical is the following:

G28U0.0W0.0
T0101
G54
#105 = #5222 (Store The Original G54 Z Workshift Value)
G50S900
G96S400
M3
M8

Then at the end of your program, restore the original value to your G54 Z Workshift as shown below:

T0505(MDT)
G50S900
G96S200
M3
M8
G0 X1.010 Z.1
#103=-.243
M98Q44L4
N45
M9
#100=0
#5222 = #105
G28U0.0W0.0
M30

But you're still going to be screwed if you have to abort the program before restoring the G54 Z Workshift; it will be whatever value it was when you aborted. However, this may work in your favor, if you wanted to start where you left off, but based on your comment in an earlier Post
EndlessWaltz said:
what I would rather have, cut air if need be.
, that won't happen.

That's why I stated in my previous Post:
you don't have to remember the original Workpiece Coordinate System Value
when using G52. Simply execute G52 Z0 at the Start of the program and the G52 Offset Shift will be extinguished from the G54 Z Workshift. The G54 Worksfit Offset remains unchanged throughout the machining process.

Your Subprogram could be arranged something like the following:

N44(sub)
T0505
G1 X.950 Z0.0 F.010
G1 X.990 Z-.020 F.004
G1 Z-.223 F.010
G1 X.950 Z-.243 F.002
M10
G1 X0.0 F.002
M11
G0X1.010
#100=[#100+#103]
G52 Z#100

M9
M99

For safety, G52 Z0.0 would appear before G54 at the Start of your program. This would ensure that No Offset Shift was being applied to your Workshift Offset. Similarly, depending on parameter setting, G52 will be reset to Zero when Reset is Pressed. For G52 to be set to Zero with Reset is the default parameter setting.

The way in which you have applied the Offset Shift is also flawed. Your following code:

#100=[#100+#103]
#5222=[#5222-#100]

will compound the Shift Offset. First Loop of the Subprogram, -0.243 will be applied to the G54 Z Workshift, on the Second Loop -0.486, the Third Loop -0.729 and so on. These Offset Shifts would be applied to that previously modified G54 Workshift, Accordingly, your code as is, will modify the G54 Z Workshift Offset by 2.43" after four cycles of the Subprogram, instead of only 0.972" and it will be applied in the wrong direction.

Also, you would have to specify G54 in the Subprogram so that the New Workshift value is applied. You could do this as follows:

N44(sub)
T0505
G1 G54 X.950 Z0.0 F.010

With regards to Offset Shift being applied in the wrong direction, the logic of subtracting #100 is incorrect. In the First Loop of the Subprogram:

#100=[#100+#103]

would have #100 = -0.243, the Second Loop, #100 = -0.486 and so on. As #5222 will be a negative value to start off, subtracting a minus value is the same as adding a positive value. The net result of your algorithm is a G54 Workshift value that is less negative than it was and therefore, the Z zero of the Workpiece move in a Positive direction, instead of the desired Negative direction. Its always preferable to add a variable and allow the sign of the variable to determine direction its applied (+ or -). Adding a Minus value is the same as Subtracting a Positive value.

Fancuku solution will allow you to restart from where you left off, without air cutting, but the program is more verbose and it relies on the operator knowing where he got up to if a restart is required. The above G52 solution is very safe, but will cut air for the parts that have already been parted off; it doesn't require any thinking by the operator.

Regards,

Bill
 
Last edited:
Bill,

Thanks man! You figured it out. I thought maybe the #5222 would reset the G54 back somehow by that one block I was unsure about. I also had seen the mistake you are talking about shifting the wrong direction, and still made it so thanks for pointing that out. You nailed it when you said "..it doesn't require any thinking by the operator" with the G52.

I will report back on monday or tuesday.
 
This is the test program I ran and it worked. Will move on to making a bar pull one later. As you see at most you may change 10 lines of code, but if going from same diameter and width, different hole size you would change RPM/SFM and maybe drill depth. Different width , maybe 3 lines of code, etc. This would be the same number I would change or less in a full "fill in the blank" macro only program. Most operators fresh out of school don't even know what macros are, the less they have to change the better in my eyes. Again, this isn't the same in all shops, but wanted to post a different way and perspective of doing something that work for someone else and now proven.


%
Plastic Washers
(FACE-CD-DRILL-MPO)
G52Z0.0
G28U0.0W0.0
T0101
G54
#105=#5222
G50S1200
G96S400
M3
M8

G0X1.020Z.1
G1Z0.0F.015
G1X-.050F.008
G0 Z.1
M9
G28U0.0W0.0
M01

T0404(CD)
G97S750
M3
M8
G0X0.0Z1.0
G0G40Z.1
G1Z-.075F.006
G0Z.1
M9
G28U0.0W0.0
M01

T0606(DRILL)
G97S900
M3
M8
G0X0.0Z1.0
G0Z.1
G83Z-.972Q2000F.008
G80G0Z2.0
M9
G28U0.0W0.0
M01

T0505(MDT)
G50S900
G96S200
M3
M8
G0X1.010Z.1(clearance)
#103=-.243
M98Q44L4
N45
M9
#100=0
#5222=#105
G28U0.0W0.0
M30

N44
T0505
G54
G1X.950Z0.0F.010
G1X.990Z-.020F.004
G1Z-.223F.010
G1X.950Z-.243F.002
M10
G1X0.0 F.002
M11
G0X1.010
#100=[#100+#103]
G52Z#100
M9
M99
%
 
This is the test program I ran and it worked. Will move on to making a bar pull one later. As you see at most you may change 10 lines of code, but if going from same diameter and width, different hole size you would change RPM/SFM and maybe drill depth. Different width , maybe 3 lines of code, etc. This would be the same number I would change or less in a full "fill in the blank" macro only program. Most operators fresh out of school don't even know what macros are, the less they have to change the better in my eyes. Again, this isn't the same in all shops, but wanted to post a different way and perspective of doing something that work for someone else and now proven.

Hello EndlessWaltz.
Still your thinking is flawed. I take it that your "fill in the blank" comment refers to changing the Macro Variables where they may occur throughout a program. Changing actual NC values at the various location in a program always has the potential of making a mistake. The code to change is camouflaged and looks similar to the code around it and can be easily missed. At least Macro Variables stand out and are less easily missed. However, typically when Macro Variables are used to define data in Family Part environment (Diameter, Length etc.), the Variables will be grouped together at the Start of the program where there is even less chance of missing them when changes are necessary.

When using the G52 Method, there is no requirement to Save and Restore the original G54 Z Workshift Value.

A program something like the following would work, with all the Variables Grouped at the beginning. Its poor form to use Global Scoped Variables when Local Variables will suffice.

%
Plastic Washers
(FACE-CD-DRILL-MPO)
#1 = 1.020
#2 = -0.972
#3 = [#1 - 0.010]
#4 = -0.243
#5 = 0
#6 = X.950

G52Z0.0
G28U0.0W0.0
T0101
G54
G50S1200
G96S400
M3
M8

G0X#1Z.1
G1Z0.0F.015
G1X-.050F.008
G0 Z.1
M9
G28U0.0W0.0
M01

T0404(CD)
G97S750
M3
M8
G0X0.0Z1.0
G0G40Z.1
G1Z-.075F.006
G0Z.1
M9
G28U0.0W0.0
M01

T0606(DRILL)
G97S900
M3
M8
G0X0.0Z1.0
G0Z.1
G83Z#2Q2000F.008
G80G0Z2.0
M9
G28U0.0W0.0
M01

T0505(MDT)
G50S900
G96S200
M3
M8
G0X#3 Z.1(clearance)
(#103=-.243) Not Needed
M98Q44L4
N45
M9
(#100=0) Should be Specified Earlier - Replaced with #5

(#5222=#105) Not Needed
G28U0.0W0.0
M30


N44
T0505
G54
G1X#6Z0.0F.010
G1X[#6+0.040]Z-.020F.004
G1Z[#4 +0.020]F.010
G1X#6Z#4F.002
M10
G1X0.0 F.002
M11
G0 X#3
#5=[#5+#4]
G52Z#5
M9
M99
%

Regards,

Bill
 
G28 U0.0 W0.0
G52 Z0 (I would put this in there as well)
M01


Regards,

Bill

Bill
Maybe a Haas driven suggestion, but having been bitten by the G52 registers not getting cleared at RESET or M30 I always close the program with zeroing it out explicitly.
Don't know if the G52 can be made "sticky" on a Fanuc, but on a Haas one can set parameters so the only "automatic" way for G52 to be cleared is a power-up.
So, in cases like that if you don't clear it at the end, and you perhaps start running another program it ( or any other workoffset ) will remain shifted.
 
Bill
Maybe a Haas driven suggestion, but having been bitten by the G52 registers not getting cleared at RESET or M30 I always close the program with zeroing it out explicitly.
Don't know if the G52 can be made "sticky" on a Fanuc, but on a Haas one can set parameters so the only "automatic" way for G52 to be cleared is a power-up.
So, in cases like that if you don't clear it at the end, and you perhaps start running another program it ( or any other workoffset ) will remain shifted.
Hello Seymour,
With a HAAS machine, via Setting 33, if Yasnac Mode is selected, G52 becomes another Workshift Offset like G54 etc. When set to Fanuc Mode, the value set via G52 is added to all Workshift Offsets and is set to Zero by pressing Reset, executing M30, or by specifying G52 in conjunction with a Zero Value with a specified axis. HAAS mode functions in much the same way as Fanuc Mode, except that its cancelled by specifying G52 and a Zero Value with a specified axis.

With a Fanuc control, a value specified with G52 is added to all Workshift Offset and will be cancelled by pressing Reset, or executing M30 when either parameter bit 3402.6 or parameter bit 1202.3 is set to 1, or by specifying G52 and a Zero value for the specified axes.

Although specifying G52 and a Zero value for specified axes at the end of the program makes it a little more safe, it has no affect if the program is aborted before the end of the program and via parameter, the control is set to not set the G52 Offset to Zero when a Reset condition is invoked. Accordingly, to be totally safe G52 (plus a Zero Value with available axes) would have to be included in a safety block at the Start of each and every program.

Regards,

Bill
 








 
Back
Top