Help! Looking for a way to cut the generated gcode of a 3D model into two parts on the Z-axis. Any ideas besides writing a script that amends all the Z values in the gcode?

@fribbledom They don't call it a hacksaw for nothing...

@fribbledom you only have the gcode or also the model? Sound easier to cut the model and generate gcode per part. Is the idea to print a very high (z-axis excess) model in two parts?


I do have the STL model, as well, actually. Sadly a friend has a semi finished print because of a clogged nozzle. The print aborted pretty cleanly on a fairly easy to print rectangular section. We could resume the print at a specific layer, but in the meantime the model has cooled down and popped off the build plate. So I was thinking of resuming at that specific layer and then sanding and gluing the two parts together.

@fribbledom and perhaps missing support structure etc. will not be an issue when printing the second part? I'm asking some friends whether they have an idea.


No support structures luckily. Also, even though it's a fairly huge print, we can accurately count the layer lines since it failed just one layer above a fairly easy to identify feature of the model.

@fribbledom just checked one of my gcode files. Looks like I just need to find the line of the Z-Layer I want to print and delete all the layers before from the file. Then change all the lines with the Z-Axis movement to adjust the new Z-Layer. If you're using CURA, that can load gcode files so you can check whether your edits are still OK.


Sure, but which tool do you use to change the hundreds of Z-axis movements? Doing that manually is probably slower than writing a script.

@fribbledom I'd probably use python. You have to just substract a fixed value (the last printed Z-Layer value) from all of the Z values, right?


I wonder. Might even get away with a bit of command line magic 😂

@fribbledom certainly possible. But at least my brain would hurt more than writing a few lines of Python ;)

@fribbledom @maxheadroom slic3r has i feature for it and it wouldn't surprise me if cura has too. In slic3r (or also prusaSlicer wich is a fork of it) i say gut give it the height you want to cut at and delete the part you don't want to print. If the printed part is still an the printer and you want to continue printing you could also manuelly set hotendvalues and chust resume printing where you stoped by loading the gcode without the part bevore the fail happened.


Wait, where is this feature? I can't seem to find it...


@fribbledom @maxheadroom that's not the most actual slic3r (its the Debian stable one) but the picture may help

I'd oscillate between Python and libreoffice calc plus good text editor (with column editing).
if it's more than a thousand lines, Python wins, if it's less than 200, LO wins, as it's got this nice thing where you can drop text in, and tell it how to split columns, what to ignore etc.. I'm sometimes editing/parsing .stp files with it, and it's faster than writing a custom python script every time.

Does Cura let you move the model down through the build plate with its move tool? I swear that's worked for me in the past but I also remember it snapping back to above the build plate

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!