a blog of ideas and improvements for tormach cnc mills
articles | for sale | about | contact

WCS Adder

G-Code G54/G55 Converter -- Overview

This tool is designed for CNC programmers who have G-code written for a single work coordinate system (WCS), typically G54, but want to run the same toolpaths on a second fixture location, G55.

Why Use It?

If your program only uses one tool, duplicating the code for another WCS is easy -- just copy the original code, paste it below, and insert:

G30
G55

However, things get more complex when tool changes are involved. You usually want to cut both G54 and G55 with the same tool before changing tools -- this minimizes tool swaps and increases efficiency.

What This Script Does

This converter automatically reorganizes your G-code to:

  • Group code blocks by tool
  • Insert appropriate G54 and G55 markers around each block
  • Ensure the same tool cuts both WCS locations before moving on
  • Remove all existing M5 and M30 commands
  • Insert a single M5 and M30 at the end

Example

Go From This To This
M6 T13 H13 G43

M3 S7500
G1 F50 X10
G1 F50 Y10
M5
G30

M6 T11 H11 G43

M3 S3000
G1 F50 X20
G1 F50 Y20
M5
G30

G54

M6 T13 H13 G43
M3 S7500
G1 F50 X10
G1 F50 Y10
G30

G55

M6 T13 H13 G43
M3 S7500
G1 F50 X10
G1 F50 Y10
G30

G54

M6 T11 H11 G43
M3 S3000
G1 F50 X20
G1 F50 Y20
G30

G55

M6 T11 H11 G43
M3 S3000
G1 F50 X20
G1 F50 Y20
G30

M5
M30

This transformation ensures that the same tool cuts all fixtures before the next tool change, reducing idle time and keeping your operations efficient and predictable.