Hello Guest it is March 29, 2024, 06:16:46 AM

Author Topic: G54-G59 Work offsets  (Read 52897 times)

0 Members and 1 Guest are viewing this topic.

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: G54-G59 Work offsets
« Reply #20 on: November 26, 2009, 06:04:01 PM »
 :)
Without engineers the world stops
Re: G54-G59 Work offsets
« Reply #21 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.   

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: G54-G59 Work offsets
« Reply #22 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
                        
%
Without engineers the world stops
Re: G54-G59 Work offsets
« Reply #23 on: July 10, 2013, 12:24:46 PM »
Thanks.
Re: G54-G59 Work offsets
« Reply #24 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.
Re: G54-G59 Work offsets
« Reply #25 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
Re: G54-G59 Work offsets
« Reply #26 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


Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: G54-G59 Work offsets
« Reply #27 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
                 
%
Without engineers the world stops
Re: G54-G59 Work offsets
« Reply #28 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.
Re: G54-G59 Work offsets
« Reply #29 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