Skip to main content

Send GCode to 3D Printer from Processing

I've written a minimal example Processing sketch of how to read an ASCII GCode file and send the commands to a 3D printer.  The SerialGCodeSender_c class handles all Serial port transactions, reading from an ASCII GCode file, and handles resend requests.

This has been developed against Marlin 1.1.0-RC4 - 24 3D printer firmware available here:
Which is installed on an arduino mega 2560 ramps1.4 system running a serial interface at 115200 baud.

It has been written so that the transmission process is handled by a Processing thread, which means it happens outside the synchronisation of the Processing draw() loop.  This means that you can do some other jobs in the draw() loop and main window.

One thing to note is that the openPort() routine is checking for a specific string to be received from the 3D printer.  This should be the last string your printer transmits after it has boot up.

Other firmwares will probably require some modification.

The source code is available on GitHub.