How to remotely print custom G-code with Bambu Studio?

I wrote a simple slicer for my special needs which generates .gcode file to print on my Bambu X1E. And I am trying to figure out if I can remotely print this file.

Luckily, Bambu printers support printing .gcode files with SD card. And following the instruction
We can now connect to FTP on the P1 and A1 Series, I can send .gcode file to SD card through LAN.

However, the custom .gcode file cannot be seen on the Bambu Studio. Therefore, to start the printing, I still need to be in front of the printer, tapping on the screen, and selecting the .gcode file to start print.

Is there a way to start the print with a custom .gcode file remotely on Bambu Studio?

Thanks!

Welcome to the forum.

You might want to look into creating a “dummy” .gcode.3mf file. Export a gcode file for a cube from Bambu Studio so it will generate the .gcode.3mf file structure. Then check out this post about replacing the gcode inside of the 3mf file. This will allow you open this modified .3mf file in studio and remotely send it to your printer. You can then also start it remotely from the SD card.

2 Likes

Thanks for sharing the post!

I am working on a Mac so 7zip is not an option for me. But as Ukdavewood mentioned in the post, Python script with zipfile library works very well.

Here I post my little piece of script in case anyone is interested:

import zipfile
with zipfile.ZipFile('./filename.gcode.3mf', 'a') as z:
    z.write('./path/to/your/new.gcode', 'Metadata/plate_1.gcode')
6 Likes

I found this post while searching for the same solution. Just figured, you can drag the gcode file into the “preview” window in Bambu studio and then send it to the printer. Not sure if this has been enabled by a new software version recently but at least it does the job.

3 Likes

Thanks! That is definitely the quickest solution! Works like a charm. My use case is to merge some .gcode files with different settings into one to enhance a couple of layers instead of all - making the overall result print more quickly.

Literally registered just so I could come here and say thank you. I use a 3rd party filament calibrator and I have to export gcode towers and since changing to bambu thought I had no way to use this app anymore. You are the king!

I’ve just stumbled across this thread on my search for how to generate a GCode script to turn off the toolhead LED on my X1C and send it to the printer for those times when I might stop a print before it gets to the end before it turns the LED off by itself.

I understand the GCode for turning off the toolhead LED is;

M960 S5 P0; Bambu Lab toolhead logo light off

But how is this formatted in GCode? I am guessing there must be a header/footer of some sort rather than just sending this single line?

And excuse my ignorance but how exactly would I actually construct this message? Write it in a Text Edit program or something?

Then how would I get it to the printer? Copy it to the SD Card either directly or send it across the network using FTP?

Reading above maybe I could just write a text file and rename it to *gcode…3mf then could I just drag it into Bambu Studio and hit print to send to the printer and it would it action it as if it were a print?

Or is this wishful thinking on my part and I have misunderstood the whole concept?

Thanks & kind regards,
-=Glyn=-

I’m by no means an expert but basically gcode is just a plain text file so you can edit it with any editor. It will read the file and interpret the given commands line by line.
You could just create your gcode file and add the commands you want the printer to execute.
I think it would be a good idea to check the generated gcode from Bambu Studio to get an idea of what you should be doing.
The ; character starts a comment and everything that follows it in that line will not be interpreted by the printer.
You could copy this to the SD card or sent it via FTP. Maybe you could also get it to run directly through Bambu Studio but I wouldn’t know how.

Thanks for the reply @user_3427321131

I sort of understand the way the gcode file works but still unsure as how to implement it as when I look on the SD Card via FTP I can only see three folders;

cache
ipcam
timelapse

So I could copy the gcode file to any one of these folders or maybe the root but once copied when/how would I actually run it?

Would be ideal if I could run it automatically or manually after every print because not every print shuts off the lamp when it is finished. Bambu Benchy from the SD Card I’m looking at you! :wink:

Thanks & kind regards,
-=Glyn=-

You should put it into the cache directory. You could then run it from the printer directly or from Bambu Studio. This way you would need to run it manually every time I think. There’s also an option somewhere in Bambu Studio to add custom gcode at the end or somewhere in the middle of the print.

Just wanted to confirm Nictas solution but a serious flaw…
It allows the Gcode to be imported into BStudio but thats it. It won’t allow me to slice it or print it

Wont allow me to export it… or any options

Not sure what to do

When opening a .gcode.3mf file in Studio you will not be able to modify any settings or reslice it. You will be able to send it to the printer.

You can open an .gcode file still won’t be able to modify or reslice it but you will also not be able to send it to the printer.

Sorry maybe I didn’t explain myself or read the thread properly

The file i have is only a Gcode it is not a 3MF file

When I drag and drop it into Bstudio it shows up as a image and allows me to slide the slider to view layers.
It has no slicer options
it has no slice option
it has no send to printer option

I went back to the printables listing and found further down a STL file. Not sure if pursa slicers can use Gcode directly like this .

The gcode files from Printables are for Prusa printers.

Use the STL and slice it with Bambu studio for use with Bambu printers.