Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: TT350 on December 11, 2007, 10:35:52 PM

Title: G54-G59 Work offsets
Post by: TT350 on December 11, 2007, 10:35:52 PM
I am into my 6th month using Mach and have come a long way
 
My question is how do you set up multiples of the same part in Mach?
 
I know how to setup tool offsets and I see the G54-G59 on the offsets page.
 
If G54 is your first part X0 Y0 then G55 must be your next part Wright?
 
 
Attached is a simple hole pattern with two hole.

G00 G43 G40.1 G17 G80 G50 G90
G20
(Deep Drill )
M6 T1
G43 H1
M03 S800
G00 Z0.2655
X0.6250 Y-0.7500
G73 X0.6250 Y-0.7500 Z-0.4595 R0.0 Q0.05 F2.0
G80
G00 Z0.2655
X4.8150 Y-0.7500
G73 X4.8150 Y-0.7500 Z-0.4595 R0.0 Q0.05 F2.0
G80
G00 Z0.2655
G00 Z1
M5 M9
M30

 
Let’s say I have two parts using this pattern and part # 1 is
X0 Y0 and part # 2 is X-5.0 Y0 What would my code look like.
 
Where in the code would the G54-G55 be placed?
 
If you don't mind would you edit my code as an example.
 
Thanks
 
Chris 
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on December 12, 2007, 06:52:21 AM
Hi Chris,

G54 to 59 are machine datums, you use them to set fixture xyz zero points.  To do multiple parts on a fixture you use local datums G52 :-

G00 G43 G40.1 G17 G80 G50 G90
G20
(Deep Drill )
G54 (set fixture offset before any moves)
M6 T1
G43 H1
M03 S800
G00 Z0.2655
X0.6250 Y-0.7500
G73 Z-0.4595 R0.0 Q0.05 F2.0
G80
G00 Z0.2655
G52 X-5. (set local datum offset)
X4.8150 Y-0.7500
G73 Z-0.4595 R0.0 Q0.05 F2.0
G80
G52 X0 (you must always cancel)
G00 Z0.2655
G00 Z1
M5 M9
M30

Graham.
Title: Re: G54-G59 Work offsets
Post by: TT350 on December 12, 2007, 08:34:43 AM
Hi Graham

You seperated the two hole with G54-52, the two hole are in one part mounted on a jig,
the jig has two parts on it that get the same operation.

Chris
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on December 12, 2007, 10:00:17 AM
OK, like this.

G00 G43 G40.1 G17 G80 G50 G90
G20
(Deep Drill )
G54 (set fixture offset before any moves)
M6 T1
G43 H1
M03 S800

G00 X0.6250 Y-0.7500
Z.2655
G73 Z-0.4595 R0.0 Q0.05 F2.0
X4.8150 Y-0.75
G80

G52 X-5.(SECOND PART)
G00 X0.6250 Y-0.7500
G73 Z-0.4595 R0.0 Q0.05 F2.0
X4.8150 Y-0.75
G80
G52 X0 (you must always cancel)
G00 Z1. M9
M5
M30

Graham.
Title: Re: G54-G59 Work offsets
Post by: TT350 on December 12, 2007, 10:17:13 AM
G52 X0 (you must always cancel).............Please explain this for me!
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on December 12, 2007, 10:26:54 AM
G52 X0 Y0 Z0 A0 B0 C0

Cancels any G52 local offset you have set.

If you do not cancel them you will get accumulations of offset and things like go to tool change go to the wrong place. You do NOT want that.

Graham.
Title: Re: G54-G59 Work offsets
Post by: TT350 on December 13, 2007, 07:30:17 AM
When I was looking at the offsets page I see G54-G59.
I was under the impression that G54 would be X0 Y0
or "master part" and G55-G59 would be your clone parts
with G55 having it's X/Y offset's,G56 having it's X/Y's
G57 having it's X/Y's and so-on.

How dose G52 play into this?

Please be a pashunt, I'm still new at this.

There's no holes in my table and I'm trying
to keep it that way! :)

Chris
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on December 13, 2007, 08:39:01 AM
Hi Chris,

If you have a jig with 6 identical parts located on it, you do not want to have to set 6 lots of offsets.

G54 to G59 are global fixture offsets, that is, you can set each one up with a different fixture datum then when you use that fixture again you have to set all six datums again.  We do not want to do that we want to set one datum and all the other parts are in known locations so we can use 1 global and any number of local datums in this case 6.

To program each location on the fixture you use G52, this is a local datum that is relative to the fixture offset in use.

So, we set the fixture datum using G54, then in our program we have G52's that represent the positions of the individual parts on the fixture, these are hard coded into the program as they never change.

This program would drill the 2 holes in each part in the diagram below. Every time we would use this fixture we would set G54 X0 Y0 at the bottom left side and the Z on top of the job and the program sets all the local datums as it needs them.

Before anybody tells me :-

If I wanted to make things even better I could use incremental or absolute subs or macros to make the program even smaller, but lets start simple.

%
(USE FIXTURE OFFSET G54)

G21 G40
T1 M6
G54 G00 G90 G43 X0 Y0 Z25. H1 S750 M3 (MOVE TO FIXTURE DATUM)
(FIXTURE LOCATION 1)
G52 X20. Y20.                                        (SET FIRST LOCAL DATUM)
G00 X-5. Y0                                          (MOVE TO FIRST HOLE)
G81 Z-10. R1. F125.                                 (DRILL FIRST HOLE)
X5.                                                       (DRILL SECOND HOLE)
G80                                                        (CANCEL DRILLING)
G52 X0 Y0                                               (CANCEL LOCAL DATUM)

(FIXTURE LOCATION 2)
G52 X50. Y20.
G00 X-5. Y0
G81 Z-10. R1. F125.
X5.
G80
G52 X0 Y0

(FIXTURE LOCATION 3)
G52 X80. Y20.
G00 X-5. Y0
G81 Z-10. R1. F125.
X5.
G80
G52 X0 Y0

(FIXTURE LOCATION 4)
G52 X80. Y50.
G00 X5. Y0
G81 Z-10. R1. F125.
X-5.
G80
G52 X0 Y0

(FIXTURE LOCATION 5)
G52 X50. Y50.
G00 X5. Y0
G81 Z-10. R1. F125.
X-5.
G80
G52 X0 Y0

(FIXTURE LOCATION 6)
G52 X20. Y50.
G00 X5. Y0
G81 Z-10. R1. F125.
X-5.
G80
G52 X0 Y0
M5
M30
%

I hope this makes things a bit clearer.

Graham.
Title: Re: G54-G59 Work offsets
Post by: TT350 on December 13, 2007, 08:51:41 AM
Graham, thanks so much for your time!!!

I will play with this and cut some air.


Chris
Title: Re: G54-G59 Work offsets
Post by: TT350 on December 13, 2007, 08:42:55 PM
So let me see if I understand this.

The G54-59 are for jig/fixture and the G52'S are for the parts mounted to
the jig/fixture.

Chris
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on December 14, 2007, 06:12:35 AM
That about sums it up.

G54 is set every time the fixture is set up because the fixture may be in a different place on the machine.

G52's are hard coded into the program as the parts on the fixture should/will be in the same place every time relative to the G54.

Graham.
Title: Re: G54-G59 Work offsets
Post by: TT350 on December 14, 2007, 07:59:51 AM
Thanks again Graham.

I'm going to play with it this weekend
wish me luck.

Chirs
Title: Re: G54-G59 Work offsets
Post by: M. Jonas on May 09, 2008, 05:40:59 PM
Dear,

I have made 2 part-program with G54, G55 e G56 function e another with G52.

The toolpath it´s incorrect. See de part-program in anexx.

Thanks
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on May 10, 2008, 07:20:05 AM
Hi M.Jonas,

the code you have written will produce 3 100mm squares at 3 different points, the points are set in the work offset table.

If the squares are in the wrong places then the work offsets are set wrong.

More information will help to solve your problem.

Graham.
Title: Re: G54-G59 Work offsets
Post by: spl888 on November 24, 2009, 07:31:38 PM
How can I store the data for coordinate offset G54-59 in Mach3 ? I have to enter these data every time turn on the Mach 3 program. The tool offset page has the button to save the data but it does not work. Once I exit the mach 3 program it is gone.

Thanks for the help

peter
 
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on November 24, 2009, 07:42:53 PM
On the offsets page click 'Save work offsets', then click 'Save' in the window that pops up.

If that dose not work, go to Config menu, select Fixtures..., click save.

Graham
Title: Re: G54-G59 Work offsets
Post by: spl888 on November 25, 2009, 10:31:21 PM
Graham, It still does not work. I click the "save" button in the save work offset window, nothing happen. I have to click "close" to exit this window. In the Config, fixture, it will pup up the same window, off course  the "save" button is not work either. Once I exit the mach3, the data is gone. Is there anything missing in the mach3 set up ?
Thanks for your help.
Title: Re: G54-G59 Work offsets
Post by: spl888 on November 26, 2009, 11:01:28 AM
Graham,
Never mind. I just found out that the G54 is the default value which can not be saved but G55 to G59 is working.
Thanks
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on November 26, 2009, 04:56:26 PM
What do you have set in general config, is it like this :-
Title: Re: G54-G59 Work offsets
Post by: spl888 on November 26, 2009, 06:01:04 PM
OK, It was not and I change to this setting then the G54 "save" is working.
Thanks, Happy Thanks Givening
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on November 26, 2009, 06:04:01 PM
 :)
Title: Re: G54-G59 Work offsets
Post by: Mountainman on July 09, 2013, 07:54:04 PM
Hi Chris,

If you have a jig with 6 identical parts located on it, you do not want to have to set 6 lots of offsets.

G54 to G59 are global fixture offsets, that is, you can set each one up with a different fixture datum, then when you use that fixture again you can set one datum and the job is set.

To program each location on the fixture you use G52, this is a local datum that is relative to the fixture offset in use.

So, we set the fixture datum using G54, then in our program we have G52's that represent the positions of the individual parts on the fixture, these are hard coded into the program as they never change.

This program would drill the 2 holes in each part in the diagram below. Every time we would use this fixture we would set G54 X0 Y0 at the bottom left side and the Z on top of the job and the program sets all the local datums as it needs them.

Before anybody tells me :-

If I wanted to make things even better I could use incremental or absolute subs or macros to make the program even smaller, but lets start simple.

%
(USE FIXTURE OFFSET G54)

G21 G40
T1 M6
G54 G00 G90 G43 X0 Y0 Z25. H1 S750 M3 (MOVE TO FIXTURE DATUM)
(FIXTURE LOCATION 1)
G52 X20. Y20.                                        (SET FIRST LOCAL DATUM)
G00 X-5. Y0                                          (MOVE TO FIRST HOLE)
G81 Z-10. R1. F125.                                 (DRILL FIRST HOLE)
X5.                                                       (DRILL SECOND HOLE)
G80                                                        (CANCEL DRILLING)
G52 X0 Y0                                               (CANCEL LOCAL DATUM)

(FIXTURE LOCATION 2)
G52 X50. Y20.
G00 X-5. Y0
G81 Z-10. R1. F125.
X5.
G80
G52 X0 Y0

(FIXTURE LOCATION 3)
G52 X80. Y20.
G00 X-5. Y0
G81 Z-10. R1. F125.
X5.
G80
G52 X0 Y0

(FIXTURE LOCATION 4)
G52 X80. Y50.
G00 X5. Y0
G81 Z-10. R1. F125.
X-5.
G80
G52 X0 Y0

(FIXTURE LOCATION 5)
G52 X50. Y50.
G00 X5. Y0
G81 Z-10. R1. F125.
X-5.
G80
G52 X0 Y0

(FIXTURE LOCATION 6)
G52 X20. Y50.
G00 X5. Y0
G81 Z-10. R1. F125.
X-5.
G80
G52 X0 Y0
M5
M30
%

I hope this makes things a bit clearer.

Graham.


sorry to complicate things, but how would you implement that with an M98?  My programs are usually more complex than just 2 holes.   I wann thank you so much, last years I never thought I'd be running a CNC making my own G code just off of the knowledge people like yourself have shared.   
Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on July 10, 2013, 11:03:50 AM
Something along this line will do the job

Graham

%
(USE FIXTURE OFFSET G54)

G21 G40
T1 M6
G52 X0 Y0
G54 G00 G90 G43 X0 Y0 Z25. H1 S750 M3 (MOVE TO FIXTURE DATUM)
(FIXTURE LOCATION 1)
G52 X20. Y20.               (SET FIRST LOCAL DATUM)
M98 P0001                    (CALL SUB PROGRAM)
G52 X0 Y0                     (CANCEL LOCAL DATUM)

(FIXTURE LOCATION 2)
G52 X50. Y20.
M98 P0001
G52 X0 Y0

(FIXTURE LOCATION 3)
G52 X80. Y20.
M98 P0001
G52 X0 Y0

(FIXTURE LOCATION 4)
G52 X80. Y50.
M98 P0001
G52 X0 Y0

(FIXTURE LOCATION 5)
G52 X50. Y50.
M98 P0001
G52 X0 Y0

(FIXTURE LOCATION 6)
G52 X20. Y50.
M98 P0001
G52 X0 Y0
M5
M30

O0001 (SUB PROGRAM)
G00 X-5. Y0                   (MOVE TO FIRST HOLE)
G81 Z-10. R1. F125.        (DRILL FIRST HOLE)
X5.                                (DRILL SECOND HOLE)
G80
M99
                        
%
Title: Re: G54-G59 Work offsets
Post by: Mountainman on July 10, 2013, 12:24:46 PM
Thanks.
Title: Re: G54-G59 Work offsets
Post by: TheSniper on February 13, 2015, 11:29:53 PM
Great post I cant tell you how many times I have come back to this very post!!! Thanks guys.
Title: Re: G54-G59 Work offsets
Post by: TheSniper on February 15, 2015, 08:05:15 PM
Question given your example. What if I want to call 2 different subprograms per fixture. several times.(per G52)
I hope I asked my question correctly.
Sam
Title: Re: G54-G59 Work offsets
Post by: Mountainman on February 15, 2015, 09:34:52 PM
make another subprogram at the end called O0002 give out its commands follwed by a G80 and the M99

and then call that up with M98 P0002  ?  I guess


Title: Re: G54-G59 Work offsets
Post by: Graham Waterworth on March 02, 2015, 02:52:24 PM
You can do this :-

%
(USE FIXTURE OFFSET G54)

G21 G40
T1 M6
G52 X0 Y0
G54 G00 G90 G43 X0 Y0 Z25. H1 S750 M3 (MOVE TO FIXTURE DATUM)
(FIXTURE LOCATION 1)
G52 X20. Y20.               (SET FIRST LOCAL DATUM)
M98 P0001                    (CALL SUB PROGRAM)
G00 X0 Y0 Z1.               (RAPID TO START OF CIRCLE)
M98 P0002 L10              (CALL SUB 2 10 TIMES)
G00 G90 Z1.                  (RAPID BACK TO START)
G52 X0 Y0                     (CANCEL LOCAL DATUM)

(FIXTURE LOCATION 2)
G52 X50. Y20.
M98 P0001
G00 X0 Y0 Z1.
M98 P0002 L5               (ONLY CALL SUB 2 5 TIMES)
G00 G90 Z1.
G52 X0 Y0

(FIXTURE LOCATION 3)
G52 X80. Y20.
M98 P0001
G00 X0 Y0 Z1.
M98 P0002 L10
G00 G90 Z1.
G52 X0 Y0

(FIXTURE LOCATION 4)
G52 X80. Y50.
M98 P0001
G00 X0 Y0 Z1.
M98 P0002 L5
G00 G90 Z1.
G52 X0 Y0

(FIXTURE LOCATION 5)
G52 X50. Y50.
M98 P0001
G00 X0 Y0 Z1.
M98 P0002 L10
G00 G90 Z1.
G52 X0 Y0

(FIXTURE LOCATION 6)
G52 X20. Y50.
M98 P0001
G00 X0 Y0 Z1.
M98 P0002 L5
G00 G90 Z1.
G52 X0 Y0
M5
M30

O0001 (SUB PROGRAM)
G00 X-5. Y0                   (MOVE TO FIRST HOLE)
G81 Z-10. R1. F125.        (DRILL FIRST HOLE)
X5.                                (DRILL SECOND HOLE)
G80
M99
   
O0002(SUB NUMBER 2)
G91                             (INCREMENTAL)
G01 Z-.5 F100.              (FEED DOWN)
G03 I-20.                      (CIRCLE)
M99
                 
%
Title: Re: G54-G59 Work offsets
Post by: TheSniper on March 02, 2015, 03:38:26 PM
Thanks all. got it. already made many parts.
Odd though, sometimes at the end of my code. where the M99 is.
its not recognized by Mach3. the reason I say this.  In a txt editor I can clearly see the M99..... Bu after loading in Mach3. I can scroll down to where the M99 should be.
and its not their. some crazy bug? this is not always the case. I have to fiddle with the file. sometimes adding a break or a return. then it works.
Title: Re: G54-G59 Work offsets
Post by: Overloaded on March 02, 2015, 03:41:15 PM
In that case, you most likely never hit the return key after the last line.
That's why you see where many folks put % as the last line to be assure that the return key was hit.
Try it and you will  not see the % at the end either ... unless you hit the return key afterwards.
Russ
Title: Re: G54-G59 Work offsets
Post by: TheSniper on March 02, 2015, 03:46:51 PM
Try it and you will  not see the % at the end either ... unless you hit the return key afterwards.
Russ
Russ, Excellent info  And I will try it. if not only to remind me. thanks!!!