<p>I've sorted this out.  <em>IF</em> I include my own heating commands in my start G-Code, Cura knows to NOT add its own heating commands at the start of the G-Code file.</p>
<p>The variables I was referring to have dedicated names.
<code>material_print_temperature_layer_0</code> is the printing (extruder/nozzle) temp set under Material in Cura.
<code>material_bed_temperature_layer_0</code> is the build plate temp set under Material in Cura.</p>
<p>Cura substitutes the values of those variables for the variable names in the G-code file.</p>
<p>So to avoid filament ooze during auto bed leveling, I set the nozzle temp to 150 °C (hot, but lower than the defined printing temp and low enough to avoid ooze).  I set the bed temp to its defined temp.</p>
<p>Then I auto-level the bed.</p>
<p>Then I heat the nozzle up to its defined printing temp and start the print job.</p>
<p>This is my Start G-code:</p>
<pre><code>; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
M104 S150 ; Set Extruder temperature for bed leveling
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M109 S150 ; Wait for Extruder temperature for bed leveling
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
G29 ; Auto Bed Level (CR Touch)
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
</code></pre>
<p>And this is how Cura writes the G-code file:</p>
<pre><code>;FLAVOR:Marlin
;TIME:2888
;Filament used: 1.96332m
;Layer height: 0.2
;MINX:93.266
;MINY:10.195
;MINZ:0.2
;MAXX:126.734
;MAXY:210.658
;MAXZ:4.2
;Generated with Cura_SteamEngine 4.13.1
M82 ;absolute extrusion mode
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
M104 S150 ; Set Extruder temperature for bed leveling
M140 S60 ; Set Heat Bed temperature
M109 S150 ; Wait for Extruder temperature for bed leveling
M190 S60 ; Wait for Heat Bed temperature
G29 ; Auto Bed Level (CR Touch)
M104 S200 ; Set Extruder temperature
M109 S200 ; Wait for Extruder temperature
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
G92 E0
...
</code></pre>
<p>I hope this helps someone with a similar question.</p>
<p>Cheers.</p>

CC BY-SA 4.0
2022-05-22T16:19:26.213Z
2022-05-22T19:21:47.670Z
2022-05-22T19:21:47.670Z
RayW
<p>Go to the <code>Settings</code> -&gt; <code>Printers</code> menu from the top menu,</p>
<p><a href="https://i.sstatic.net/jmivX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jmivX.png" alt="enter image description here" /></a></p>
<p>select your active printer (or <code>Activate</code> it) and manage your printer trough <code>Machine Settings</code>.</p>
<p><a href="https://i.sstatic.net/L3CUC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L3CUC.png" alt="enter image description here" /></a></p>
<p>It will open the printer settings,</p>
<p><a href="https://i.sstatic.net/rBjqg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rBjqg.png" alt="enter image description here" /></a></p>
<p>there you are able to change the lines you want in the <code>Start G-code</code> section.</p>
<p>Note the default Start G-code doesn't include heating up the bed and core, you need to add these after the <code>G29</code> in your case. Personally I use heat up bed and continue (<code>M140</code>), than heat up core and wait till temperature is reached (<code>M109</code>), then heat up and wait until bed temperature is reached (<code>M190</code>).</p>

CC BY-SA 4.0
2022-05-21T17:13:53.523Z
2022-05-24T08:26:29.703Z
2022-05-24T08:26:29.703Z
0scar
<p>Ender 3 Pro, PLA, temps 200 °C and 60 °C.</p>
<p>I want to not heat the nozzle until after Auto Bed Leveling (CR Touch) is complete.  I can do that in the start G-code, but by then, Cura has already heated the nozzle to the temp specified under material and filament starts oozing out during bed leveling.  I'd rather set a variable to that value and call it with <code>M104</code> when I'm ready.</p>
<p>This is the start of Cura's g-code:</p>
<pre><code>;FLAVOR:Marlin
;TIME:2888
;Filament used: 1.96332m
;Layer height: 0.2
;MINX:93.266
;MINY:10.195
;MINZ:0.2
;MAXX:126.734
;MAXY:210.658
;MAXZ:4.2
;Generated with Cura_SteamEngine 4.13.1
M140 S60
M105
M190 S60
M104 S200
M105
M109 S200
M82 ;absolute extrusion mode
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
G29 ; Auto Bed Level (CR Touch)
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
...
</code></pre>
<p>The lines right after &quot;Generated with Cura_SteamEngine&quot; are the ones I'd like to change but I can't find them in the Cura app.  I know that 60 °C and 200 °C are the temps defined for bed and nozzle.  Cura inserts them as constants for the <code>M140</code> and <code>M104</code> commands.  I'd like Cura to set variables to those values (like <code>{bed_temp} = 60</code>) so I can refer to that variable when I insert the <code>M140</code> command in my Custom Start G-code.  Can that be done?</p>
<p>A related question was asked a few years ago and part of the start code example then was:</p>
<pre><code>; Ender 3 Custom Start G-code
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
G28 ; Home all axes
G29 ; BLTOUCH Mesh Generation
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
</code></pre>
<p>The variable <code>{material_bed_temperature_layer_0}</code> was already set but I don't know where or how that was done.</p>

<creality-ender-3><ultimaker-cura><g-code>
Cura variables and initial G-code commands
RayW
# Cura variables and initial G-code commands

(Asked by: username_0 on 2022-05-21)

Ender 3 Pro, PLA, temps 200 °C and 60 °C.

I want to not heat the nozzle until after Auto Bed Leveling (CR Touch) is complete. I can do that in the start G-code, but by then, Cura has already heated the nozzle to the temp specified under material and filament starts oozing out during bed leveling. I'd rather set a variable to that value and call it with `M104` when I'm ready.

This is the start of Cura's g-code:

```
;FLAVOR:Marlin
;TIME:2888
;Filament used: 1.96332m
;Layer height: 0.2
;MINX:93.266
;MINY:10.195
;MINZ:0.2
;MAXX:126.734
;MAXY:210.658
;MAXZ:4.2
;Generated with Cura_SteamEngine 4.13.1
M140 S60
M105
M190 S60
M104 S200
M105
M109 S200
M82 ;absolute extrusion mode
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
G29 ; Auto Bed Level (CR Touch)
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
...

```

The lines right after "Generated with Cura\_SteamEngine" are the ones I'd like to change but I can't find them in the Cura app. I know that 60 °C and 200 °C are the temps defined for bed and nozzle. Cura inserts them as constants for the `M140` and `M104` commands. I'd like Cura to set variables to those values (like `{bed_temp} = 60`) so I can refer to that variable when I insert the `M140` command in my Custom Start G-code. Can that be done?

A related question was asked a few years ago and part of the start code example then was:

```
; Ender 3 Custom Start G-code
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
G28 ; Home all axes
G29 ; BLTOUCH Mesh Generation
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature

```

The variable `{material_bed_temperature_layer_0}` was already set but I don't know where or how that was done.

**Tags:** creality-ender-3, ultimaker-cura, g-code


---

## 2 answers

### Answer by username_0 on 2022-05-22. Score: 4

I've sorted this out. *IF* I include my own heating commands in my start G-Code, Cura knows to NOT add its own heating commands at the start of the G-Code file.

The variables I was referring to have dedicated names.
`material_print_temperature_layer_0` is the printing (extruder/nozzle) temp set under Material in Cura.
`material_bed_temperature_layer_0` is the build plate temp set under Material in Cura.

Cura substitutes the values of those variables for the variable names in the G-code file.

So to avoid filament ooze during auto bed leveling, I set the nozzle temp to 150 °C (hot, but lower than the defined printing temp and low enough to avoid ooze). I set the bed temp to its defined temp.

Then I auto-level the bed.

Then I heat the nozzle up to its defined printing temp and start the print job.

This is my Start G-code:

```
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
M104 S150 ; Set Extruder temperature for bed leveling
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M109 S150 ; Wait for Extruder temperature for bed leveling
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
G29 ; Auto Bed Level (CR Touch)
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish

```

And this is how Cura writes the G-code file:

```
;FLAVOR:Marlin
;TIME:2888
;Filament used: 1.96332m
;Layer height: 0.2
;MINX:93.266
;MINY:10.195
;MINZ:0.2
;MAXX:126.734
;MAXY:210.658
;MAXZ:4.2
;Generated with Cura_SteamEngine 4.13.1
M82 ;absolute extrusion mode
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
M104 S150 ; Set Extruder temperature for bed leveling
M140 S60 ; Set Heat Bed temperature
M109 S150 ; Wait for Extruder temperature for bed leveling
M190 S60 ; Wait for Heat Bed temperature
G29 ; Auto Bed Level (CR Touch)
M104 S200 ; Set Extruder temperature
M109 S200 ; Wait for Extruder temperature
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
G92 E0
...

```

I hope this helps someone with a similar question.

Cheers.


---

### Answer by username_1 on 2022-05-21. Score: 0

Go to the `Settings` -> `Printers` menu from the top menu,

[![enter image description here](https://i.sstatic.net/jmivX.png)](https://i.sstatic.net/jmivX.png)

select your active printer (or `Activate` it) and manage your printer trough `Machine Settings`.

[![enter image description here](https://i.sstatic.net/L3CUC.png)](https://i.sstatic.net/L3CUC.png)

It will open the printer settings,

[![enter image description here](https://i.sstatic.net/rBjqg.png)](https://i.sstatic.net/rBjqg.png)

there you are able to change the lines you want in the `Start G-code` section.

Note the default Start G-code doesn't include heating up the bed and core, you need to add these after the `G29` in your case. Personally I use heat up bed and continue (`M140`), than heat up core and wait till temperature is reached (`M109`), then heat up and wait until bed temperature is reached (`M190`).


---

