New here, can a temperature tower be printed?


New here. I’ve been using Cura for a while but I’m working from a Chromebook. Decided to try this out.

I’ve searched the web, the forum, YouTube… and of course the settings. I haven’t been able to find an obvious solution to printing something like a temperature tower besides finding the specific layers in the gcode and entering the command to change the temperature there.

Is there a way to do this? Or a tutorial? Example?

Thanks for the help. I’m quite impressed with all of this regardless. Probably making this my goto for the vast majority of my slicing/printing on my Ender 3 Max. Avoids the Linux based issues on a Chromebook that I keep experiencing.



hi @Luc_Lafreniere and welcome! temperature towers are relatively easy, as are PA towers (pressure advance), etc. They way I recommend is to use a range() function inside the layer gcode macro like this (with a few variations commented out).

; LAYER {layer} of {layers}
M104 S{190 + range(0,30)}
; M104 S{190 + Math.round(range(0,30))}
; M104 S{190 + ((layer/layers)*30)}

variables and conditional flow logic are documented here

1 Like

Well that was fast. lol Thanks.

OK, I’ve been playing around with that Layer gcode macro and found that gcode macros reference material already.

So for a PETG tower for example, start at 265C, 5 deg intervals down to 220C. 50 layers in between each tower section with a 7 layer base.

Are the ranges inclusive or exclusive? Sorry, I do some Python… which excludes the end of the range.

You would do:

M104 S{265 + range(0,56)}
M104 S{260 + range(57,106)}
M104 S{255 + range(107,156)}
M104 S{250 + range(157,206)}
M104 S{245 + range(207,256)}
M104 S{240 + range(257,306)}
M104 S{235 + range(307,356)}
M104 S{230 + range(357,406)}
M104 S{225 + range(407,456)}
M104 S{220 + range(457,506)}

I tried this and it did some odd things like jumping to 260C, then reverted to my default temperature, then back to 260… I stopped it at that point. I’ll continue testing until you respond. Thanks!

the range function takes two values and interpolate between them across all layers. the commented examples show how to calculate this without the range() function, which is just a shortcut.

it’s not providing a step function, which could be done using division and rounding

{230 + (Math.round(layer/50)) * 5}

would increase 5C every 50 layers, for example

as of 3.2, you can also do conditional flow logic. this is being pushed to production later today.

;; IF { layer >= 10 && layer <= 20 }
;; ..... inside 10-20 layer={layer}
;; ELIF { layer >= 15 && layer <= 25 }
;; ..... inside 15-25 layer={layer}
;; ..... did not match previous tests layer={layer}
;; END

Starting to understand… lol.

So to go from 265C (base tower) to 220C (top of the tower)

M104 S{265 - range(0,45)}

Right? 45 being the total temperature range… 265 - 220 = 45.

So this would gradually REDUCE the temperature for each layer as it goes.

I had it in my mind that it would only step after the layers… sorry. Still new to 3D printing. I now realize gradually changing the temperature would serve that purpose too.

Understood on the stepping formula. I would just have to account for that base of 7 layers before the first temp.

I’ll try the gradual approach first. Simple and to the point (if I understood).

I did try the if statements earlier this morning and it didn’t seem to work. So I guess it’s because it’s not quite ready yet?

until 3.2 is pushed as the new default version, you have to go to

and select version 3.2 explicitly

I’ve got some very odd behavior.

I’ve tried different variations and I can see in the code the M104 and correct temperatures.

BUT what I can ALSO see…

When I search for M104 in my gcode, I can see my initial header gcode temperature command, sure. Set to 175C.

Then I see a M104 set to 265 correctly.

The next one is M104 S264.9112426035503, which is good.

BUT, literally two lines in the gcode below, M104 235. That’s the temperature I have my nozzle set to in the “Output” portion of the UI. Should I be setting that to my start temperature to avoid this issue?

For whatever reason, on top of all of that, it goes to 260C at the first layer even though there’s no M104 260 anywhere in the code.

A little confused… lol

right-click export workspace and email to me (sa @ grid . space) – I’m missing some crucial context in your setup

Sent. Such a cool feature!

found it. you had a different “base” temperature set (first layer). this caused it to automatically emit this temperature on layer 0 and then to emit the default temperature (under output) at layer 1 and this conflicted with your gcode layer macro. setting the base nozzle temp to 0 tells it that the base is the same layer as the rest of the print and not to do anything special at layer 0 or 1.

Screen Shot 2022-02-12 at 12.00.53 PM

Hmmmmm lol this is what I have…

But I still have this in my code… 235 is the temp in the output section of the UI.

right. you must change the base nozzle temp to 0 to fix this

Gotcha. lol This would be so much more obvious in person… how do you feel about coming to Ottawa, Canada? :wink:

Just turned it to 0, weird 235C temp is gone in the gcode. I’m going to try and print now and see what happens. Will report back.

235 is the default output temp. so when you set a base output temp, that is emitted at layer 0 and the default is emitted at layer 1. this leads to what looks like a confusing contradiction when you are also setting temps in the layer macro.

when you omit the base temp override, only the default is emitted at the start of the gcode and never again. so you don’t get a layer temp conflict at layer 1.

Makes sense… now that you explain it. I’m still confused as to why I had a 260C that happened… that was nowhere in the the gcode, yet it happened. I have the graph from Octoprint showing it.

It’s about to print (just getting to the initial temp now).

  1. Initial warm up to 175 was good.
  2. Went to 235 since that’s the temperature set in “output” of the UI. Correct.
  3. Went to 260… why? For the first layer.

Watching it as it continues to print… and looking at the graph. You can see these small spikes in the hotend temp. It’s as though it tries to switch temps correctly but then reverts back to 260 each time.

Marlin might be compiled with a 260C temp max for the nozzle. this is actually a standard thing. and your temp tower runs in reverse from 265 down as the print goes up. so that would just be Marlin capping the temp.

That’s exactly my suspicion. lol I’m looking at the firmware code now…