G code formula to compensate for X and Y probe offset

  • I am playing with some macros and I would like to command the probe to the center of the bed. I could manually calculate the position because I know the offsets but if the offset is ever changed I would have to manually update the macro.

    Is it possible to include the probe offset in a G code equation (possibly using G31) of some sort so my macro would adapt if my offsets are changed?

    G1 X112.5 Y112.5 F6000	; Move probe to bed center

    G31 would return my probe offset values but it is unclear to me how to incorporate that into my X and Y values above to compensate. Essentially, I just need to a syntax example or to know if this is possible.

  • Moderator

    I think this could be done with RRF3 and conditional gcode if the G31 offsets were part of the object model.

    As a work around I have macros called nozzlecenter and probecenter which just have an absolute coordinate move to put the head in the right place. Then I call those from other macros when I need that move.

    It doesn't update automatically with G31 changes, but at least then there is only one place I have to change it if I do change the G31 offsets.

  • I just found this today. Sounds promising to automate some configuration wizards:

    G code meta

Log in to reply