Hello Guest it is March 28, 2024, 06:17:11 PM

Author Topic: Gcode offset  (Read 2265 times)

0 Members and 1 Guest are viewing this topic.

Gcode offset
« on: May 17, 2015, 02:45:34 PM »
Hello all,

I having trouble to find a way to automaticly add a number for offset G55 and hope someone can help me. Bellow is the sample of codes.

N1 G49 G80 G40 G90 G00
N2 G21
N3 G10  X0  Y0  Z-442 P1  L2
N4 G10  Z75 P1  L1
N5 G54
N6 T2 M6
N7 G0 X19.311 Y71.415 S18000 M3
N8 G43 Z71.88 H2
N9 G1 G94 Z61.88 F8000.
N10 X17.189 Y73.537
N11 X8.393 Y82.332 F2000.
N12 X19.311 Y71.416
N13 X17.189 Y73.537 Z59.63
N14 X8.393 Y82.332
N15 X19.311 Y71.416
N16 X21.432 Y69.295 F8000.
N17 Z150
N18 M5
N19 M30


N1 G49 G80 G40 G90 G00
N2 G21
N3 G10  X243  Y-21.45  Z-382 P2  L2
N4 G10  Z66 P2  L1
N5 G55
N6 T2 M6
N7 G0 X19.311 Y71.415 S18000 M3
N8 G43 Z71.88 H2
N9 G1 G94 Z61.88 F8000.
N10 X17.189 Y73.537
N11 X8.393 Y82.332 F2000.
N12 X19.311 Y71.416
N13 X17.189 Y73.537 Z59.63
N14 X8.393 Y82.332
N15 X19.311 Y71.416
N16 X21.432 Y69.295 F8000.
N17 Z150
N18 M5
N19 M30

I'm using two spindles in 3 axis machine. G54 is the offset of the first spindle (X0 Y0) and G55 is the offset of the second spindle (X243 Y-21.45).
I want in gcode both offsets (G54 and G55) set to zero and then, if I add any number to that line instead of zero (for X andY) mach3 will automatically add 243 for X and -24.45.

Regards,
Peter

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Gcode offset
« Reply #1 on: May 20, 2015, 04:23:31 AM »
You need to look at using G52

G52 is a local offset from the current fixture offset so you can set G54 to Xnnn Ynnn Znnn and then when you wish to use the second spindle call G52 Xnnn Ynnn Znnn with the offset from the first spindle. then when you want to go back to the first spindle call G52 X0 Y0 Z0

If the position of the spindle changes you can use variables to do this e.g.

(Start of program)

#100=243.0 (X offset)
#101=125.0 (Y offset)
#102=66.0 (Z offset)

G54
G00 G90 G43 X0 Y0 Z25. S2000 M3
Z1.
G01 Z-2. F500.
ETC.....

(CHANGE TO SECOND SPINDLE)

G52 X#100 Y#101 Z#102
G00 X0 Y0 Z25.
ETC.....

G52 X0 Y0 Z0
M30
« Last Edit: May 20, 2015, 04:27:05 AM by Graham Waterworth »
Without engineers the world stops
Re: Gcode offset
« Reply #2 on: May 20, 2015, 12:41:17 PM »
Hello Graham Waterworth,

thank you very much for reply. I think that is exatly what I need. Thanks again.

Best regards,
Peter