# New here, can a temperature tower be printed?

**URL:** <https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582>\
**Category:** FDM\
**Created:** [February 12, 2022, 1:21pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582 "2022-02-12T13:21:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 1:21pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/1 "2022-02-12T13:21:17Z")

</div>

Hi,

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.

Merci.

Luc

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 3:24pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/2 "2022-02-12T15:24:03Z")

</div>

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).

```auto
; 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

> **[GCode Macros](https://docs.grid.space/projects/kiri-moto/gcode-macros)**
>
> Variable Substitutions and Expressions in GCode Macros

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 3:53pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/3 "2022-02-12T15:53:30Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 4:00pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/4 "2022-02-12T16:00:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 4:07pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/5 "2022-02-12T16:07:40Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 4:20pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/6 "2022-02-12T16:20:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 4:47pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/7 "2022-02-12T16:47:32Z")

</div>

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

> **[Select App Version](https://grid.space/choose)**
>
> Grid.Space Chooser

and select version 3.2 explicitly

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 4:51pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/8 "2022-02-12T16:51:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 4:53pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/9 "2022-02-12T16:53:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 4:56pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/10 "2022-02-12T16:56:41Z")

</div>

Sent. Such a cool feature!

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 5:04pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/11 "2022-02-12T17:04:10Z")

</div>

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](https://forum.grid.space/uploads/default/original/2X/d/db84cb0f957a1e752266c75ffde432f0bc29a45f.png)

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 5:08pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/12 "2022-02-12T17:08:33Z")

</div>

![image](https://forum.grid.space/uploads/default/original/2X/a/ac017e6e3f94afe3cb01b8ed1ab52b9bc959bbd2.png)

Hmmmmm lol this is what I have…

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 5:10pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/13 "2022-02-12T17:10:14Z")

</div>

![image](https://forum.grid.space/uploads/default/original/2X/3/369b17f638b54d31edd554e1ca64893873829a24.png)

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

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 5:13pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/14 "2022-02-12T17:13:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 5:16pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/15 "2022-02-12T17:16:20Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 5:19pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/16 "2022-02-12T17:19:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 5:21pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/17 "2022-02-12T17:21:15Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 5:30pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/18 "2022-02-12T17:30:12Z")

</div>

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.

 ![image](https://forum.grid.space/uploads/default/original/2X/6/6257b8d6a56c0248cbd7f8498b3882a9a73894ce.png)

---

<div class="post-metadata">

**Author:** ![stewart](https://forum.grid.space/user_avatar/forum.grid.space/stewart/32/21_2.png) [@stewart](https://forum.grid.space/u/stewart)\
**Post date:** [February 12, 2022, 5:31pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/19 "2022-02-12T17:31:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Luc\_Lafreniere](https://forum.grid.space/user_avatar/forum.grid.space/luc_lafreniere/32/1050_2.png) [@Luc\_Lafreniere](https://forum.grid.space/u/Luc_Lafreniere)\
**Post date:** [February 12, 2022, 5:33pm UTC](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582/20 "2022-02-12T17:33:21Z")

</div>

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

[Next page](https://forum.grid.space/t/new-here-can-a-temperature-tower-be-printed/582.md?page=2)
