Update Work Offsets with G Code

More
2 years 3 months ago #305188 by Joz
Hi all!
I have a custom program in which I really need the ability to update a work offset with G code. On my Haas, I can use G90 G10 L2 P2 X1 Y1 Z1 to change G55 XYZ to 1. If I change to using G91 it'll add 1 to G55 XYZ instead of setting G55 XYZ to 1. On my Linux router G90 and G91 both set G55 to 1 instead of G91 updating it. Does anybody know how I can update work offsets with G code? TIA!

Please Log in to join the conversation.

More
2 years 3 months ago #305189 by Joz
Replied by Joz on topic Update Work Offsets with G Code
Also for a second I thought I might be able to make it work with L20 instead of L2 but I don't think that's the case.

Please Log in to join the conversation.

More
2 years 3 months ago #305218 by Aciera
see below

Please Log in to join the conversation.

More
2 years 3 months ago #305219 by Aciera
I think this would require a custom Gcode using a remap. I made an example remap for a command 'G10.1 Xn Yn Zn'

Try this:

Add this to the [RS274NGC] section of your ini file:
Code:
          REMAP = G10.1  modalgroup=1   argspec=xyz  ngc=g10_increment

Create a new file with the Gcode below and save as 'g10_increment.ngc' to a folder in your
[RS274NGC] SUBROUTINE_PATH   
Code:
o<g10_increment>sub M66 L0 E0                    ;force sync, stop read ahead     o100 if [EXISTS [#<X>]]      ;check for X-word, set to zero if missing                        o100 else     #<X> = 0                                                   o100 endif o101 if [EXISTS [#<Y>]]     ;check for Y-word, set to zero if missing   o101 else     #<Y> = 0                                                   o101 endif o102 if [EXISTS [#<Z>]]     ;check for Z-word, set to zero if missing   o102 else     #<Z> = 0                                                   o102 endif ; calculate which parameter contains the current X,Y,Z offset values #<x_current> = [5201 + #5220 * 20] #<y_current> = [5202 + #5220 * 20] #<z_current> = [5203 + #5220 * 20] ; add the passed X,Y,Z words to the current offset values G10 L2 P0 X[#[#<x_current>] + #<X>] Y[#[#<y_current>] + #<Y>] Z[#[#<z_current>] + #<Z>] M66 L0 E0                   ;force sync, stop read ahead o<g10_increment>endsub m2

Note:
This will always apply to the currently active offset system.

You could use another unallocated  GCODE :
linuxcnc.org/docs/2.9/html/remap/remap.h...:unallocated-g-codes

You could extend this to query the state of G90/91 and/or add a  'P' word to pick an offset system other then the currently active one.

Please Log in to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum