Hi, for a project I need to edit the G Code of a sliced file to add 6 pause commands in the first layer to it. My method is slicing the File in Bambu Studio, then opening the exported file with 7 zip and editing the .gcode file. I need to add these pause commands at specific moments, e.g after a certain part of the layer is printed I need to change the filament(Basically a manual AMS). I know that when you scroll through a layer in Bambu Slicer, all the gCode is displayed with a line number next to it. But these line numbers don’t match up with the “real” numbers of the exported .gcode file. Also, M400 U1 commands placed using the Pause feature in Bambu Studio don’t appear in the final sliced .gcode file. This makes it very hard to precisely edit the gCode. Why is that? My printer is the P1P. I’m grateful for every answer.
(Look at the Line number in the G Code file, it doesn’
t match up with the studio display. And, you don’t see the M400 U1 command)
The green line numbers are only shown in Studio, they are not exported to the gcode file. If you use a utility like Notepad++ you can “overlay” line numbers onto the gcode file went you open it. You would need to sync the line numbers by adjusting them in Notepad++.
They appear but only at the start of a layer. You cannot place them via Bambu Studio at points during the layer.
I added the 2 pauses and saved the gcode.3mf file and then reopened it in Bambu Studio. I have run this file on one of my printers and it acted exactly as expected. It printed the layer up until the pause, paused (dropped the bed and positioned the head over the poop shoot) and prompted the user to resume. I resumed and it continued printing the layer till the next pause and repeated how it acted on the first pause.
Because editing gcode isn’t something the majority of users should/need to be doing.
In Studio, I prefer to use File> Export to get the g-code for editing. There is no need to mess around with a zip utility.
Or use OrcaSlicer, which lets you export simple g-code from the Print menu:
In the g-code, every layer is preceded with a line “;update layer progress” and “M73 Lxxx” where the xxx is the layer number.
I sliced a primitive cylinder and inserted a pause at layer 99 using a right-click on the vertical layer slider. Searching the exported g-code in my text editor (Notepad++) for “U1”, I found this:
I found the same result using both the plain g-code export and using the plate_1.gcode file extracted from the “Export sliced plate file” .3mf.
Finding the exact spot for a mid-layer pause could be very challenging. Searching the g-code, I could only rarely find coordinates matching the nozzle positions shown in Preview. Maybe someone knows an easier way?
The advantage of using the zip utility and .3mf is that it allows you to reopen the file gcode in Bambu Studio and simulate it. It also allows you to remotely send the file to the printer instead of having to physically transfer it to the sd card and start it from the display.
First of all, thanks for your fast answers!
I know that Bambu Studio only allows placing pauses at a layer change, and I previously read JonRaymond’s method of how to edit G Code.
After checking my files again, it turns out that the .gCode file I inspected wasn’t the current file open in Bambu Studio. I sliced the .gCode file and exported it but then changed some settings in Bambu Studio. Somehow I forgot to update the .gCode file and that’s how I got so confused. After slicing a second model and inspecting it’s gCode, everything matches up.
I currently don’t have access to my printer(I’m on a holiday), but I can test everything on Monday.