How to Send G-Code To and From OctoPrint? (Detailed Guide)

The most straightforward way of conducting the 3D printing process is, without a doubt, to slice the model with slicer software, copy the G-code file to an SD card, and transfer the SD card to the 3D printer to initiate the printing process from the printer’s interface.

On the other hand, even though they are more technical to set up, 3D printing interfaces such as OctoPrint improve the user experience by an incredible amount, making them a worthwhile addition for anyone who uses their 3D printer frequently.

In today’s article, we will learn about both sending G-code from slicer software for OctoPrint to initiate the printing process and sending G-Code from OctoPrint to the 3D printer, which will allow us to use OctoPrint to manage the entire 3D printing process effortlessly.

So, how to send G-code to OctoPrint from slicer software and through OctoPrint to the 3D printer?

The most straightforward way to send G-Code to OctoPrint from any slicer software is to save the G-Code file to the local disk of your computer, switch to the OctoPrint window, click the Upload button under the Files section, and locate the G-Code file you have saved.

Next up, we will take a deeper look into the process of sending G-code to OctoPrint from various slicer software, find out how to send G-code from OctoPrint to the 3D printer both as a file and line-by-line, and finally, take a quick look at connecting Cura with OctoPrint for direct G-code transfer.

How to Send G-Code to OctoPrint from Slicers?

Sending G-code to OctoPrint from the slicer software is a process that allows us to conduct the 3D printing process through OctoPrint’s interface, allowing us to use the features of OctoPrint to improve the printing experience in various ways.

Here is a detailed step-by-step guide you can follow to send G-Code to OctoPrint from any slicer software:

  1. Launch your favorite slicer software.
  2. Slice the model of your choice in the slicer.
  3. Save the sliced G-Code file to a location on your computer, and note this location.
  4. Bring the OctoPrint interface up.
  5. Click the Upload button, which is located under the Files section (bottom-left by default) of the OctoPrint window.
  6. Find the G-Code file you saved earlier through the opened dialog, and double-click it.

If you have successfully sent the G-Code to OctoPrint, you will see the title of your G-Code file in the Files section of the OctoPrint dashboard, along with details such as upload date and file size.

How to Send G-Code from OctoPrint to the 3D Printer?

Sending the G-code from OctoPrint to the 3D printer is the second step of initiating the printing process through OctoPrint, which allows us to seamlessly transfer the G-code from the slicer to the 3D printer without requiring any physical activity.

You can follow the step-by-step guide we have prepared below to send the G-Code from OctoPrint to your 3D Printer:

  1. Add the G-Code file to OctoPrint if you haven’t already, and ensure that it’s in the Files section of the OctoPrint dashboard.
  2. Locate the G-Code file you would like to print in the Files section.
  3. Click the Load and Print button that corresponds to the G-Code file you would like to print, which is the first button from the right in the row of five small buttons.

Following these steps will send the model to the 3D printer and initialize the printing process without you needing to interact with your 3D printer’s interface directly.

How to Directly Send G-Code from OctoPrint to the 3D Printer on a Line-By-Line Basis?

While the primary way of sending G-code from OctoPrint to the 3D printer for printing purposes is to use G-code files, there are times when the capability to directly send G-code commands to the 3D printer on a line-by-line basis can come in extremely handy.

To directly send G-Code from OctoPrint to your 3D Printer on a line-by-line basis, you can follow the steps we have outlined below:

  1. Bring the OctoPrint dashboard up.
  2. Click the Terminal tab to switch to the interface where you can send inputs to the printer, and receive the outputs.
  3. Type the G-Code of your choice into the input box, and press the Send button.

If successful, you should see the G-code you have sent on the output window above and the printer’s response to your input on the line below.

While this method isn’t suitable for printing models (as you would need to input thousands of G-Code lines even to print a small and uncomplicated model), it is a great way to run configuration and information commands without leaving your computer.

How to Send G-Code from Cura to OctoPrint Directly?

Even though the standard way of sending G-code to OctoPrint from slicer software is also possible with Cura, Cura offers a way to directly connect itself to OctoPrint, making the process of transferring G-code a much smoother experience.

By following the steps below, you can send G-Code from Cura to OctoPrint directly, without the need to save the G-Code file first:

  1. Launch Cura.
  2. Click the Marketplace button on the top-right corner of the Cura window.
  3. Scroll down to find the OctoPrint Connection plugin under the Community Plugins section in the Plugins tab of the Marketplace pop-up.
  4. Click the Install button and follow through with any dialogs that show up.
  5. Restart Cura to allow the plugin to load.
  6. Click the Preferences option on the menu bar of Cura, and choose the Configure Cura option.
  7. Click the Printers entry from the left pane of the Preferences window.
  8. Activate the printer you would like to connect to OctoPrint from the printer list and click the Connect OctoPrint button.
  9. If you are running OctoPrint locally, you will see the local OctoPrint entry on the left pane. Else, click the Add button and fill the form with the necessary information that pertains to your OctoPrint instance.
  10. Switch to the OctoPrint window, and navigate to the Settings by clicking the Wrench icon on the top-right.
  11. Navigate to the API tab from the left pane, and copy the Global API Key.
  12. Switch to the Cura window, and paste the API key you have copied into the API Key input.
  13. Click the Connect button. If successful, the button should say Disconnect instead of Connect.
  14. Close the Connect OctoPrint dialog.
  15. Slice the model you would like to print.
  16. Click the small arrow button next to the Save to Disk button at the bottom-right corner, and choose the Print with OctoPrint option.
  17. Click the Print with OctoPrint button.

This method will pass the G-Code sliced by Cura directly to OctoPrint with a single press of a button and allow you to print your model and track the printing process without ever leaving the Cura window.

Wrapping Up

Sending G-code from the slicer to OctoPrint and sending G-code from OctoPrint to the 3D printer are pretty straightforward processes that considerably improve the 3D printing experience instead of physically transferring the SD card.

To quickly recap, saving the G-Code file to the disk through your slicer software and then uploading the file to OctoPrint by using the Upload button under the Files section of OctoPrint is the quickest way to get a G-Code file to OctoPrint.

Once the G-Code file is in OctoPrint, all you need to do is to click the Load and Print button (first button from the right) located in the Files section, under the title of the G-Code file, to send the G-Code from OctoPrint to your printer and initiate the printing process.

Happy printing!