Merge pull request #6400 from Ultimaker/CURA-6799_pause_at_height_resume_speed

Cura 6799 pause at height resume speed
This commit is contained in:
Lipu Fei 2019-09-25 08:01:13 +02:00 committed by GitHub
commit af1a03d02f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View file

@ -4,6 +4,8 @@
from ..Script import Script
from UM.Application import Application #To get the current printer's settings.
from UM.Logger import Logger
from typing import List, Tuple
class PauseAtHeight(Script):
@ -160,6 +162,7 @@ class PauseAtHeight(Script):
# use offset to calculate the current height: <current_height> = <current_z> - <layer_0_z>
layer_0_z = 0
current_z = 0
current_extrusion_f = 0
got_first_g_cmd_on_layer_0 = False
current_t = 0 #Tracks the current extruder for tracking the target temperature.
target_temperature = {} #Tracks the current target temperature for each extruder.
@ -193,6 +196,10 @@ class PauseAtHeight(Script):
if not layers_started:
continue
# Look for the feed rate of an extrusion instruction
if self.getValue(line, "F") is not None and self.getValue(line, "E") is not None:
current_extrusion_f = self.getValue(line, "F")
# If a Z instruction is in the line, read the current Z
if self.getValue(line, "Z") is not None:
current_z = self.getValue(line, "Z")
@ -331,7 +338,12 @@ class PauseAtHeight(Script):
prepend_gcode += self.putValue(G = 11) + "\n"
else:
prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n"
prepend_gcode += self.putValue(G = 1, F = 9000) + "\n"
if current_extrusion_f != 0:
prepend_gcode += self.putValue(G = 1, F = current_extrusion_f) + " ; restore extrusion feedrate\n"
else:
Logger.log("w", "No previous feedrate found in gcode, feedrate for next layer(s) might be incorrect")
prepend_gcode += self.putValue(M = 82) + " ; switch back to absolute E values\n"
# reset extrude value to pre pause value