(Minor update Dec. 29, 2020: Added the ability to optionally accept leading zeros in some M commands, so the script should now recognize M03, M05, M06 as equivalent to M3, M5, M6.)
The attachment is a Perl script designed to take g-code produced by Carbide Create or other programs that can only output in the grbl dialect and transform it into something usable by the Snapmaker2. (I’ll put it on GitHub or Heptapod or somewhere eventually.)
Be warned that this is a very early-stage prototype! It has been tested on one file containing a limited set of commands only! (Luban seemed to understand the output, though, so it should be processing the basic G0/G1/M3/M5 commands needed for CNC somewhat correctly.)
Right now what this thing needs is testing. Throw your grbl at it, watch to see if it complains about “Unknown command [foo]”, import the results into Luban (or a more sophisticated simulator, if you have one), and see if the toolpath makes sense.
In order to test this, you will need a Perl interpreter. Mac OSX and Linux should have one preinstalled; for Windows, you’ll need Strawberry Perl (ActiveState Perl should also work if you already have it installed for some reason). I can’t be absolutely certain this will work on Windows as-is—Perl is perfectly portable 90% of the time, and trips over its own feet the other 10%. If it fails to run for you (or produces output with messed-up linebreaks), tell me, and I’ll see if I can sort it out.
Usage: perl grbltomarlin.pl [grbl file]
The output will automatically go to a file called [grblfile].marlin.cnc
grbltomarlin.zip (1.9 KB)
(Not how I expected to be spending my Saturday afternoon. Oh, well.)