RWO Post Processor Implementation

In software version 4.8.0, we added a new M code, M254, that can be used to take advantage of G5X work coordinate systems during 3+2 machining. We call it Rotated Work Offsets (RWO). The resulting behavior is similar to Haas’s DWO (Dynamic Work Offsets, G254) or Fanuc’s tilted working plane indexing (G68.2). Its use is different than either of those codes, though. Rather than putting the machine in a special mode, M254 does the following:

  • Looks up the active G5X work offsets.

  • Calculates a new set of offsets that represent the same coordinate relative to the part in the current orientation of the A and B axes.

  • Stores those calculations in the specified G5X work offsets.

The machine can then be changed to the specified G5X work coordinate system to use those calculations. Below is an example of its use.

Prior to v4.8.0 machining operations had to be programmed relative to the center of rotation of the machine. Let’s say one of the machining operations is performed at A45 B0. The posted code would generally look something like:

; Without rotated work offsets, G54 offsets should all be set to 0
G0 A45 B0
; ... Machining operation about center of rotation

Post processors that want to leverage the new M254 code would need to be updated to output something similar to the following instead:

; With rotated work offsets, G54 offsets don't have to be 0
G0 A45 B0
M254 P9 ; Store the rotated offsets into G59.3
G59.3 ; Switch to G59.3
; ... Machining operation relative to defined G54 offset
G54 ; Switch back to our starting work coordinate system

The P argument of the M254 code specifies which G5X work coordinate system to store the rotated offsets in. In the example above, we chose work coordinate system 9 to be used, or G59.3. The P argument can be any number between 1 and 9. G54-G59 are 1-6 and G59.1-G59.3 are 7-9 (see MachineKit’s documentation of the G5X offsets). At the end of the machining operation, we switch back to G54, which is required if a subsequent machining operation is performed at a different A or B angle.

Our simulator can be used to verify the M254 behavior:

After loading a G code program into the simulator, the G5X offsets can be changed by clicking the Stop button, then by clicking the Summary tab and scrolling down until you see the G5X offsets used in your program.