Can I edit the currently printed gcode

What is the problem?

I generated gcode with a custom script and started printing. Now I noticed that it will print the whole thing 3 or 4 times due to mistake in the script. I can abort the print, but the setup and startup is quite time consuming since I have to print on top of another product.

Can I edit the currently printed gcode so I can remove the code that is NOT necessary to print?
Or: where is Octoprint 'feeded' with the gcode to send to the printer? is that during printing also the gcode file in 'upload' folder? Or does it load the whole file in memory? or in a temp folder?

(I am aware that this would be very dirty hack... : )

What did you already try to solve it?

I can make sure that I am around when the first cycle almost finishes and stop the printer myself.

Additional information about your setup

OctoPrint version 1.9.3

references:
Similar to post G Code Modification
the option there was to use the gcode editor plugin, but
'Adds edit buttons to the items in the file list which let you edit the gcode of any file thatโ€™s not currently printing.'

"[...]but @foosel will have to confirm or deny whether octoprint loads and locks the current print file or just live streams it so whether any changes made would filter through or not."

Just to quickly quote myself here from our conversation earlier (also hey Joris, so nice to see you again :slight_smile: ):

It doesn't lock anything (unless you are on windows, then windows locks access to open files). What could happen is that the progress reporting gets wonky. Apart from that it should work in an emergency, but tbh I never tested this

Just changed and saved the file, lets see if it stops this afternoon... : )
Will keep you posted.

1 Like

It worked....!!!
This saved my day. Good to know that this works.
Using this I can also set/hack the speed or temp at a specific layer when the print is already started.

Keep in mind this is a very dirty hack and you have to know what you are doing.
The print time indications et cetera is not updated. And if you really change gcode make sure that the E values are right.

cheers / joris

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.