I'm trying to combine two different G-code files into one. The reason I'm doing this is that I'd like to print my part with different layer heights. I've managed to combine the two G-codes together, but when it gets to the layer where the layer height changes, it stops moving and keeps extruding for 10-15 seconds, creating a blob of plastic, then moves on destroying the print.

I've tried using with PrusaSlicer's manual layer height feature, but their normal supports are unusable on my part and their organic supports are not compatible with the variable layer heights. Cura simply does not have this capability, and their adaptive layer height feature is not the answer. Here is what I'm trying to do:

  1. Create G-code with layer height set to 0.3 mm
  2. Change layer height to 0.1 mm and create G-code from that
  3. Load 0.1 mm G-code into Notepad++ and find the layer I want to change it at
  4. Delete all G-code past that layer
  5. Load 0.3 mm G-code into Notepad++ and find where that layer would start based on Z height
  6. Copy/Paste the rest of the G-code into the 0.1 mm file
  7. Save and run on the printer

It mostly works but the layer height change stops. Does anyone know what is happening?

Here are a bunch of lines from the g-code before and after where the transition happens. I have it marked in the g-code exactly where:

G1 F2400 E2234.44369
G1 F3600 X105.992 Y179.63 E2234.66835
M204 S2000
G1 F2400 E2233.86835
G1 F300 Z5.8
G0 F9000 X106.068 Y183.796 Z5.8
M204 S500
G1 F300 Z5.4
G1 F2400 E2234.66835
G1 F3600 X99.843 Y190.022 E2234.8704
M204 S2000
G1 F2400 E2234.0704
G1 F300 Z5.8
G0 F9000 X101.42 Y192.688 Z5.8
M204 S500
G1 F300 Z5.4
G1 F2400 E2234.8704
G1 F3600 X106.635 Y187.472 E2235.03967
M204 S2000
G1 F2400 E2234.23967
G1 F300 Z5.8
G0 F9000 X107.871 Y190.479 Z5.8
M204 S500
G1 F300 Z5.4
G1 F2400 E2235.03967
G1 F3600 X104.311 Y194.039 E2235.15521
M204 S2000
G1 F2400 E2234.35521
G1 F300 Z5.8
G0 F9000 X108.544 Y194.049 Z5.8
M204 S500
G1 F300 Z5.4
G1 F2400 E2235.15521
G1 F3600 X109.947 Y192.646 E2235.20075
M204 S2000
G1 F2400 E2234.40075
G1 F300 Z5.8
G0 F9000 X120.783 Y90.912 Z5.8
M204 S500
G1 F300 Z5.4
G1 F2400 E2235.20075
G1 F1978 X120.784 Y92.216 E2235.22798
G1 F1939 X120.794 Y92.736 E2235.23906
G1 F1901.4 X120.794 Y122.763 E2235.89141
G1 F1939 X120.783 Y123.279 E2235.90241
G1 F1978 X120.784 Y124.585 E2235.92968
G1 X120.974 Y124.314 E2235.93659
G1 X121.199 Y123.844 E2235.94748
G1 X121.327 Y123.323 E2235.95868
G1 F1939 X121.362 Y122.774 E2235.9704
G1 F1901.4 X121.362 Y92.736 E2236.62299
G1 F1939 X121.327 Y92.172 E2236.63503
G1 F1978 X121.201 Y91.663 E2236.64598
G1 X120.97 Y91.177 E2236.65722
G1 X120.819 Y90.963 E2236.66269
G0 F1620 X120.783 Y90.912
M204 S2000
G1 F2400 E2235.86269
G1 F300 Z5.8
G0 F9000 X100 Y39.255 Z5.8
;-----------------Transition Happens Here---------------------
G0 X100 Y40.153 Z6.1
G1 F300 Z6.1
G0 F9000 X97.297 Y34.468
M204 S500
G1 F300 Z5.7
G1 F2400 E2715.82188
G1 F1800 X97.297 Y34.468
G1 X97.47 Y35.08 E2715.86566
G1 X97.834 Y36.138 E2715.9427
G1 X98.102 Y36.794 E2715.99148
G1 X98.421 Y37.518 E2716.04595
G1 X98.79 Y38.243 E2716.10196
G1 X98.96 Y38.555 E2716.12642
G1 X99.366 Y39.232 E2716.18077
G1 X99.605 Y39.602 E2716.2111
G1 X100 Y40.153 E2716.25778
G1 X100.057 Y40.232 E2716.26448
G1 X100.343 Y40.609 E2716.29706
G1 X100.73 Y41.147 E2716.34269
G1 X100.934 Y41.458 E2716.3683
G1 X101.342 Y42.136 E2716.42278
G1 X101.476 Y42.382 E2716.44206
G1 X101.861 Y43.147 E2716.50103
G1 X102.193 Y43.913 E2716.55851
G1 X102.303 Y44.19 E2716.57903
G1 X102.602 Y45.029 E2716.64035
G1 X102.687 Y45.297 E2716.65971
G1 X102.939 Y46.186 E2716.72332
G1 X103.19 Y47.204 E2716.79551
G1 X103.692 Y47.104 E2716.83075
G1 X103.724 Y47.394 E2716.85084
G1 X103.799 Y48.272 E2716.91151
G1 X103.818 Y48.652 E2716.9377
G1 X103.839 Y49.553 E2716.99975
G1 X103.839 Y56.239 E2717.46007
G1 X100 Y56.239 E2717.72438
G1 X97.297 Y56.239 E2717.91048
G1 X97.297 Y34.823 E2719.38494
G0 F1620 X97.297 Y34.468
M204 S2000
G1 F2400 E2718.58494
G1 F300 Z6.1
G0 F9000 X100 Y40.153 Z6.1
M204 S500
G1 F300 Z5.7
G1 F2400 E2719.38494
G1 F1800 X100 Y56.239 E2720.49244
M204 S2000
G1 F2400 E2719.69244
G1 F300 Z6.1
G0 F9000 X130 Y89.241 Z6.1
M204 S500
G1 F300 Z5.7
G1 F2400 E2720.49244
G1 F1800 X130 Y125.641 E2722.99852
G1 X127.425 Y125.641 E2723.1758
G1 X127.425 Y89.241 E2725.68189
G1 X135 Y89.241 E2726.20342
G1 X135 Y125.641 E2728.7095
G1 X142.825 Y125.641 E2729.24824
G1 X142.825 Y89.241 E2731.75433
G1 X140 Y89.241 E2731.94882
G1 X140 Y125.286 E2734.43047
G0 F1620 X140 Y125.641
M204 S2000
G1 F2400 E2733.63047
G1 F300 Z6.1
G0 F9000 X100 Y175.345 Z6.1
G1 F300 Z6.1
G0 F9000 X97.278 Y181.097

1 Answer 1


This is completely expected from your description. You just cannot bluntly paste a different section of a G-code file into another without tweaking the interface layer (unless the extruder length is reset at every layer).

You need to make sure that the extruder distance is set to the right value. Usually the extruder length is reset to zero once in a while or at layer change to prevent too large E values (G92 E0), but when you paste a layer with a mismatch in E value between the two, the extruder will extrude (or retract, this is equally valid, but in this case extrude) first before it will move further.

What you need to check for is the E value, look if it is reset or not and set the value by defining the correct value with G92 Exxx, where xxx is the correct value from the pasted layer (this will be the starting point for E extrusion).

From the updated question with the G-code snippet we see that the above described is actually happening, layer 17 has a final move laying down filament in

G1 F2400 E2235.86269

and layer 18 has the first filament deposition with

G1 F2400 E2715.82188.

You can see that almost 500 mm of filament is wasted (2235 -> 2715). This means that you need add

G92 E2715.82188


G1 F2400 E2715.82188.

  • $\begingroup$ Hi 0scar, thank you for the comprehensive answer, I will be looking into this tonight. $\endgroup$
    – Vandel212
    Commented Apr 1, 2023 at 16:49
  • $\begingroup$ Unless I'm misunderstanding, isn't this the Modify settings for overlaps Mesh Type in Cura? Layer Height is not an option there, that was one of the first places I looked. Works great with infill, in fact I use it for most things I print because it's so handy. $\endgroup$
    – Vandel212
    Commented Apr 1, 2023 at 20:03
  • $\begingroup$ @Vandel212 I thought I have done this before, I'll remove it from the answer and test it again. Thanks for letting me know! $\endgroup$
    – 0scar
    Commented Apr 1, 2023 at 22:23
  • $\begingroup$ Haha I just deleted my comment because I saw your edit. That's brilliant! That seems like it would solve that issue. I'll try it out tonight and let you know. $\endgroup$
    – Vandel212
    Commented Apr 1, 2023 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .