<p>I have an <a href="https://github.com/Ultimaker/CuraEngine/issues/1010" rel="nofollow noreferrer">open bug report/feature request</a> for this. Apparently Cura doesn't do it because some of Ultimaker's printers have underpowered power supplies that will shut off if you try to do both at the same time. I've been carrying a patch (note this is against CuraEngine not the Cura GUI) that fixes this:</p>

<pre><code>diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp
index de3c771c..ced22017 100644
--- a/src/FffGcodeWriter.cpp
+++ b/src/FffGcodeWriter.cpp
@@ -500,7 +500,7 @@ void FffGcodeWriter::processInitialLayerTemperature(const SliceDataStorage&amp; stor
                 const Temperature bed_temp = scene.current_mesh_group-&gt;settings.get&lt;Temperature&gt;("material_bed_temperature_layer_0");
                 if (bed_temp != 0)
                 {
-                    gcode.writeBedTemperatureCommand(bed_temp, scene.current_mesh_group-&gt;settings.get&lt;bool&gt;("material_bed_temp_wait"));
+                    gcode.writeBedTemperatureCommand(bed_temp, false);
                 }
             }
         }
@@ -547,6 +547,18 @@ void FffGcodeWriter::processInitialLayerTemperature(const SliceDataStorage&amp; stor
                 }
             }
         }
+
+        if (scene.current_mesh_group-&gt;settings.get&lt;bool&gt;("material_bed_temp_prepend"))
+        {
+            if (scene.current_mesh_group-&gt;settings.get&lt;bool&gt;("machine_heated_bed"))
+            {
+                const Temperature bed_temp = scene.current_mesh_group-&gt;settings.get&lt;Temperature&gt;("material_bed_temperature_layer_0");
+                if (bed_temp != 0)
+                {
+                    gcode.writeBedTemperatureCommand(bed_temp, scene.current_mesh_group-&gt;settings.get&lt;bool&gt;("material_bed_temp_wait"));
+                }
+            }
+        }
     }
 }
</code></pre>

CC BY-SA 4.0
2020-03-15T21:44:31.143Z
2020-03-15T21:44:31.143Z
R.. GitHub STOP HELPING ICE
<pre><code>    import os
    
    for filename in os.listdir():
        if filename.endswith(&quot;.gcode&quot;):
            with open(filename, &quot;r&quot;) as file:
                lines = file.readlines()
            for i in range(len(lines)):
                if &quot;M140 S&quot; in lines[i]:
                    lines[i] = &quot;M140 S50\n&quot;
                elif &quot;M104 S&quot; in lines[i]:
                    lines[i] = &quot;M190 S50\n&quot;
                elif &quot;M190 S&quot; in lines[i]:
                    lines[i] = &quot;M104 S185\n&quot;
                elif &quot;M109 S&quot; in lines[i]:
                    lines[i] = &quot;M109 S185\n&quot;
            lines = [line for line in lines if &quot;M105&quot; not in line] # remove first two M105 lines
            with open(filename, &quot;w&quot;) as file:
                file.writelines(lines)
</code></pre>
<p>I wrote the above Python script to edit my G-codes in bulk for a plane I'm creating. This makes both extruder and bed heat up at the same time. It changes the places the code comes up in the order that @0scar listed above. And removes the grab temp <code>M105</code> lines. This makes my prints start at least a few minutes faster which is nice when you have many to do.</p>
<ol>
<li>Install python3 in Windows or Linux,</li>
<li>Create a file called <code>something.py</code></li>
<li>Paste the code above and save</li>
<li>Move the script to the same folder of G-code</li>
<li>Open cmd or PowerShell or Linux terminal and type <code>python3 something.py</code>
or <code>python3 ./something.py</code></li>
</ol>
<p>It will update all G-codes to heat simultaneously. For modifying yourself edit the temps I have <code>S50</code> for the bed and <code>S185</code> for the extruder.</p>

CC BY-SA 4.0
2023-04-29T23:08:28.367Z
2023-04-30T03:50:44.647Z
2023-04-30T03:50:44.647Z
Dr3amer17
<p>It is a little annoying, what <code>Cura</code> is doing for me is forcing to wait. On start G-code I have:</p>
<pre><code>; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
;*** Start Dual Nozzle/Bed Preheating ***
M140 S60 ; start preheating the bed
M104 S200 T0 ; start preheating hotend
G28 ; home
M190 S60 ; heat to Cura Bed setting 
M109 S200
;*** End Preheating ***M420 S1; Load Mesh Bed Level
</code></pre>
<p>But on the generated G-code I have:</p>
<pre><code>;Generated with Cura_SteamEngine 4.9.0
M140 S60
M105
M190 S60
M104 S200
M105
M109 S200
M82 ;absolute extrusion mode
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
;*** Start Dual Nozzle/Bed Preheating ***
M140 S60 ; start preheating the bed
M104 S200 T0 ; start preheating hotend
G28 ; home
M190 S60 ; heat to Cura Bed setting 
M109 S200
</code></pre>
<p>In the end I'm changing it directly on G-code what is a pain</p>

CC BY-SA 4.0
2021-05-01T08:29:44.410Z
2021-05-01T08:29:44.410Z
Luis Fernando Nascimento
<p>This can be achieved with start G-code adaptations, this requires no software changes. Cura, and most slicers, have the ability to use placeholders (basically variables or maybe better: constants). These placeholders are substituted with the correct value upon slicing.</p>
<p>To sequentially heat the bed and hotend you would need to add the following into your start G-code:</p>
<pre>
M117 Heating bed 1st...
M190 S{material_bed_temperature_layer_0}
M117 Heating core 2nd...
M109 S{material_print_temperature_layer_0}
</pre>
<p>For simultaneous heating you need to add:</p>
<pre>
M140 S{material_bed_temperature_layer_0}     ; set bed temperature to e.g. 55 °C and continue
M104 S{material_print_temperature_layer_0}   ; set hot end temperature to e.g. 210 °C and continue
M190 S{material_bed_temperature_layer_0}     ; wait for bed temperature to reach e.g. 55 °C
M109 S{material_print_temperature_layer_0}   ; wait for hot end temperature to reach e.g. 210 °C
</pre>
<p>Note that Cura is very limited in using placeholders. E.g. Slic3r allows for arithmetic using the placeholders. The following example shows heating the bed first to the bed first layer temperature minus 10 degrees Celsius; then the hotend starts heating and heatbed starts further heating up to the final temperature. For my machine this results in the bed and hotend being at final temperature at the same time; so no time is wasted and printing can start.</p>
<pre>
M117 Heating bed...
M190 S{[first_layer_bed_temperature]-10}
M140 S[first_layer_bed_temperature]
M117 Heating core...
M109 S[first_layer_temperature_0]
M190 S[first_layer_bed_temperature]
</pre>

CC BY-SA 4.0
2020-03-16T09:09:18.557Z
2022-06-25T21:32:03.290Z
2022-06-25T21:32:03.290Z
0scar
<p>I notice that if I print from Cura without preheating the printer, it will first raise the bed temperature and then raise the extruder temperature. The G-code it generates is:</p>

<pre><code>M140 S55     ; set bed temperature to 55 C
M105         ; report temperatures
M190 S55     ; wait for bed temperature to reach 55 C
M104 S210    ; set hot end temperature to 210 C
M105         ; report temperatures
M109 S210    ; wait for hot end temperature to reach 210 C
</code></pre>

<p>The "Preheat" feature of Cura presumably send the "set temperature" commands without the corresponding "wait" command.</p>

<p>Wouldn't it be more efficient to do something like this:</p>

<pre><code>M104 S210    ; set hot end temperature to 210 C
M140 S55     ; set bed temperature to 55 C
M105         ; report temperatures
M109 S210    ; wait for hot end temperature to reach 210 C
M105         ; report temperatures
M190 S55     ; wait for bed temperature to reach 55 C
</code></pre>

<p>Then the bed and extruder heat up simultaneously, and we wait for the higher temperature one <em>first</em> assuming that the other will reach its target temperature in the meanwhile.</p>

<p>If this is sound, is there a way to set this in Cura, or would I need to submit a patch?</p>

CC BY-SA 4.0
2020-03-15T22:27:21.013Z
No patch needed, just add it into your start G-code, works fine. I've been using it for a while using place holders in Cura. I'll post an answer when I'm behind my desktop computer. Note that Slic3r allows arithmetic on place holders, that is even more powerful. I allow my bed to heat up to 75 % and then start heating the hotend while the bed continues to 100 %; this results in bed and hotend to reach their final temperature at the same time.
0scar
CC BY-SA 4.0
2020-03-16T15:07:55.897Z
The bed is usually much slower, its temperature sensing less accurate and has no adverse effects if it stays at the target temperature for a while, while the hot end warms up quickly and will start leaking plastic as soon as it is warm. Sequencing the warmup phase allows the bed temperature to stabilize, and allows printing to start immediately.
Simon Richter
CC BY-SA 4.0
2020-03-16T22:57:27.143Z
FWIW in my experience (Ender 3 with PLA, TPU, and PETG) both take roughly the same amount of time. With PETG the extreme bed temp can make bed take slightly longer. This might indicate I should tune PID for hotend better, as the last 10 degrees of hotend heating take inordinately long.
R.. GitHub STOP HELPING ICE
CC BY-SA 4.0
2020-03-17T14:41:26.333Z
I agree with  Simon Richter. The time adds only a few minutes to the total that is usually hours. It prevents the hotend from oozing and also heating up the material for too long, which can start clogging. The bed temperature and enclosure temperature stabilize and also the printer power supply is less stressed.
Hacky
CC BY-SA 4.0
2021-11-27T15:46:43.103Z
This works well in my Cura 4.8 but not Creality Slicer 1.2.3. For some reason the Creality Slicer 1.2.3 ignores the M140 and M104 commands completely. I have tried different variations (e.g. "M140 S60" "M140 S{material_bed_temperature}" "M140 S{material_bed_temperature_layer_0}" and none work with Creality Slicer 1.2.3. Does anyone have a similar experience or fix for the M104 and M140 commands in Creality Slicer 1.2.3?
Thomas Wideman
<ultimaker-cura><g-code>
Simultaneous heating of extruder and bed at start of print
rgov
# Simultaneous heating of extruder and bed at start of print

(Asked by: username_0 on 2020-03-15)

I notice that if I print from Cura without preheating the printer, it will first raise the bed temperature and then raise the extruder temperature. The G-code it generates is:
M140 S55     ; set bed temperature to 55 C
M105         ; report temperatures
M190 S55     ; wait for bed temperature to reach 55 C
M104 S210    ; set hot end temperature to 210 C
M105         ; report temperatures
M109 S210    ; wait for hot end temperature to reach 210 C

The "Preheat" feature of Cura presumably send the "set temperature" commands without the corresponding "wait" command.
Wouldn't it be more efficient to do something like this:
M104 S210    ; set hot end temperature to 210 C
M140 S55     ; set bed temperature to 55 C
M105         ; report temperatures
M109 S210    ; wait for hot end temperature to reach 210 C
M105         ; report temperatures
M190 S55     ; wait for bed temperature to reach 55 C

Then the bed and extruder heat up simultaneously, and we wait for the higher temperature one first assuming that the other will reach its target temperature in the meanwhile.
If this is sound, is there a way to set this in Cura, or would I need to submit a patch?

**Tags:** ultimaker-cura, g-code
> **Comments:**
> **username_1**: No patch needed, just add it into your start G-code, works fine. I've been using it for a while using place holders in Cura. I'll post an answer when I'm behind my desktop computer. Note that Slic3r allows arithmetic on place holders, that is even more powerful. I allow my bed to heat up to 75 % and then start heating the hotend while the bed continues to 100 %; this results in bed and hotend to reach their final temperature at the same time.  
> **username_2**: The bed is usually much slower, its temperature sensing less accurate and has no adverse effects if it stays at the target temperature for a while, while the hot end warms up quickly and will start leaking plastic as soon as it is warm. Sequencing the warmup phase allows the bed temperature to stabilize, and allows printing to start immediately.  
> **username_3**: FWIW in my experience (Ender 3 with PLA, TPU, and PETG) both take roughly the same amount of time. With PETG the extreme bed temp can make bed take slightly longer. This might indicate I should tune PID for hotend better, as the last 10 degrees of hotend heating take inordinately long.  
> **username_4**: I agree with  Simon Richter. The time adds only a few minutes to the total that is usually hours. It prevents the hotend from oozing and also heating up the material for too long, which can start clogging. The bed temperature and enclosure temperature stabilize and also the printer power supply is less stressed.  
> **username_5**: This works well in my Cura 4.8 but not Creality Slicer 1.2.3. For some reason the Creality Slicer 1.2.3 ignores the M140 and M104 commands completely. I have tried different variations (e.g. "M140 S60" "M140 S{material_bed_temperature}" "M140 S{material_bed_temperature_layer_0}" and none work with Creality Slicer 1.2.3. Does anyone have a similar experience or fix for the M104 and M140 commands in Creality Slicer 1.2.3?  

---

## 4 answers

### Answer by username_1 on 2020-03-16. Score: 10 | Accepted answer

This can be achieved with start G-code adaptations, this requires no software changes. Cura, and most slicers, have the ability to use placeholders (basically variables or maybe better: constants). These placeholders are substituted with the correct value upon slicing.
To sequentially heat the bed and hotend you would need to add the following into your start G-code:

M117 Heating bed 1st...
M190 S{material_bed_temperature_layer_0}
M117 Heating core 2nd...
M109 S{material_print_temperature_layer_0}

For simultaneous heating you need to add:

M140 S{material_bed_temperature_layer_0}     ; set bed temperature to e.g. 55 °C and continue
M104 S{material_print_temperature_layer_0}   ; set hot end temperature to e.g. 210 °C and continue
M190 S{material_bed_temperature_layer_0}     ; wait for bed temperature to reach e.g. 55 °C
M109 S{material_print_temperature_layer_0}   ; wait for hot end temperature to reach e.g. 210 °C

Note that Cura is very limited in using placeholders. E.g. Slic3r allows for arithmetic using the placeholders. The following example shows heating the bed first to the bed first layer temperature minus 10 degrees Celsius; then the hotend starts heating and heatbed starts further heating up to the final temperature. For my machine this results in the bed and hotend being at final temperature at the same time; so no time is wasted and printing can start.

M117 Heating bed...
M190 S{[first_layer_bed_temperature]-10}
M140 S[first_layer_bed_temperature]
M117 Heating core...
M109 S[first_layer_temperature_0]
M190 S[first_layer_bed_temperature]


---

### Answer by username_3 on 2020-03-15. Score: 3

I have an open bug report/feature request for this. Apparently Cura doesn't do it because some of Ultimaker's printers have underpowered power supplies that will shut off if you try to do both at the same time. I've been carrying a patch (note this is against CuraEngine not the Cura GUI) that fixes this:
diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp
index de3c771c..ced22017 100644
--- a/src/FffGcodeWriter.cpp
+++ b/src/FffGcodeWriter.cpp
@@ -500,7 +500,7 @@ void FffGcodeWriter::processInitialLayerTemperature(const SliceDataStorage& stor
                 const Temperature bed_temp = scene.current_mesh_group->settings.get("material_bed_temperature_layer_0");
                 if (bed_temp != 0)
                 {
-                    gcode.writeBedTemperatureCommand(bed_temp, scene.current_mesh_group->settings.get("material_bed_temp_wait"));
+                    gcode.writeBedTemperatureCommand(bed_temp, false);
                 }
             }
         }
@@ -547,6 +547,18 @@ void FffGcodeWriter::processInitialLayerTemperature(const SliceDataStorage& stor
                 }
             }
         }
+
+        if (scene.current_mesh_group->settings.get("material_bed_temp_prepend"))
+        {
+            if (scene.current_mesh_group->settings.get("machine_heated_bed"))
+            {
+                const Temperature bed_temp = scene.current_mesh_group->settings.get("material_bed_temperature_layer_0");
+                if (bed_temp != 0)
+                {
+                    gcode.writeBedTemperatureCommand(bed_temp, scene.current_mesh_group->settings.get("material_bed_temp_wait"));
+                }
+            }
+        }
     }
 }


---

### Answer by username_6 on 2023-04-29. Score: 1

import os
    
    for filename in os.listdir():
        if filename.endswith(".gcode"):
            with open(filename, "r") as file:
                lines = file.readlines()
            for i in range(len(lines)):
                if "M140 S" in lines[i]:
                    lines[i] = "M140 S50\n"
                elif "M104 S" in lines[i]:
                    lines[i] = "M190 S50\n"
                elif "M190 S" in lines[i]:
                    lines[i] = "M104 S185\n"
                elif "M109 S" in lines[i]:
                    lines[i] = "M109 S185\n"
            lines = [line for line in lines if "M105" not in line] # remove first two M105 lines
            with open(filename, "w") as file:
                file.writelines(lines)

I wrote the above Python script to edit my G-codes in bulk for a plane I'm creating. This makes both extruder and bed heat up at the same time. It changes the places the code comes up in the order that @0scar listed above. And removes the grab temp M105 lines. This makes my prints start at least a few minutes faster which is nice when you have many to do.

Install python3 in Windows or Linux,
Create a file called something.py
Paste the code above and save
Move the script to the same folder of G-code
Open cmd or PowerShell or Linux terminal and type python3 something.py
or python3 ./something.py

It will update all G-codes to heat simultaneously. For modifying yourself edit the temps I have S50 for the bed and S185 for the extruder.


---

### Answer by username_7 on 2021-05-01. Score: 0

It is a little annoying, what Cura is doing for me is forcing to wait. On start G-code I have:
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
;*** Start Dual Nozzle/Bed Preheating ***
M140 S60 ; start preheating the bed
M104 S200 T0 ; start preheating hotend
G28 ; home
M190 S60 ; heat to Cura Bed setting 
M109 S200
;*** End Preheating ***M420 S1; Load Mesh Bed Level

But on the generated G-code I have:
;Generated with Cura_SteamEngine 4.9.0
M140 S60
M105
M190 S60
M104 S200
M105
M109 S200
M82 ;absolute extrusion mode
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
;*** Start Dual Nozzle/Bed Preheating ***
M140 S60 ; start preheating the bed
M104 S200 T0 ; start preheating hotend
G28 ; home
M190 S60 ; heat to Cura Bed setting 
M109 S200

In the end I'm changing it directly on G-code what is a pain


---

