Edit Startup GCode outside Bambu Studio (solved)

When I open Bambu Studio, and I select the little box next to the “advanced” setup switch, Bambu Studio hangs, then eventually crashes.

Is there a way to change the default startup GCode outside of Bambu studio?

If I were writing the code, I’d create a template for starting up and ending, copy the startup code, generate the GCode to print the part, then copy the ending template to wrap up the project.

I’d put the start and end GCode in text files and simply copy them into the GCode when I slice plate.

Did Bambu do something similar? If so, where would I find those files?

(Linux Mint V21, running Cinnamon)

Thanks, Mark.

Move the cursor to the upper right of the printer selection box, and a pencil icon will appear. Click that to edit the preset and the Machine G-code.

The G-code editor is very crude. I usually “Copy All”, paste into a real text editor to make changes, then copy/paste everything back into the Studio editor.

1 Like

Hi Mark,

Those g-code(s) are all stored in the printer JSON profiles (or filament profiles for that code). All the profiles are in your Studio user config folder – defaults in “system” and custom ones in “user” subfolders. (The default ones actually pull in shared code files via includes, eg. Bambu Lab H2C 0.4 nozzle template machine_start_gcode.json, but with a custom profile which modifies g-code, the new code would be completely inline.) Editing directly in the JSON isn’t practical however… for one thing it’s all one long string with line breaks replaced by \n. Doable with a decode/encode step, but not ideal.

If you can’t switch to “advanced” mode this is going to be quite limiting anyway going forward. You could try enabling Preferences → Develop mode (Ikraus’ original suggestion). Failing that, you could try editing BambuStudio.conf (in your user config folder, with Studio not running) and changing (or adding) user_mode value to “develop” or “advanced” (or “simple” to revert back).

"user_mode": "advanced",

(If enabling “develop” mode this way, probably a good idea to also change
"developer_mode": true,
)

Lastly, which Studio build are you running on Mint 21? If Ubuntu build, perhaps try the Flatpack version (from flatpack repos), or vice-versa. I noticed they act quite differently in various ways, some subtle and some less so (like honoring system colors).

-Max

Thank you Ikraus:

That worked.

I was clicking the wrong thing, that little button does not show up until you hover the printer selection button, and even then, it is quite low contrast (at least on my machine.)

At least I can edit the codes as in the video.

Mark.

1 Like

Thanks MaxThreeD:

After I posted what I said about storing the start and end codes blah, blah, I realized each of these startup GCodes would have to be different for each printer, filament, and what not.

The permutations would be pretty large for a simple single file.

However, thanks for pointing out where these files reside, I do like knowing how things work under the hood.

I can switch to advanced mode OK.

As for where I got Bambu Studio, I can’t really remember as I have played with different installation techniques with FreeCad and other stuff. For FreeCad, I finally downloaded the AppImage from their site as Mint’s repo was out dated. I forget where I got Bambu Studio.

Mark.