mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
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:
commit
af1a03d02f
2 changed files with 24 additions and 3 deletions
|
@ -4,6 +4,8 @@
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
|
|
||||||
from UM.Application import Application #To get the current printer's settings.
|
from UM.Application import Application #To get the current printer's settings.
|
||||||
|
from UM.Logger import Logger
|
||||||
|
|
||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
|
|
||||||
class PauseAtHeight(Script):
|
class PauseAtHeight(Script):
|
||||||
|
@ -160,6 +162,7 @@ class PauseAtHeight(Script):
|
||||||
# use offset to calculate the current height: <current_height> = <current_z> - <layer_0_z>
|
# use offset to calculate the current height: <current_height> = <current_z> - <layer_0_z>
|
||||||
layer_0_z = 0
|
layer_0_z = 0
|
||||||
current_z = 0
|
current_z = 0
|
||||||
|
current_extrusion_f = 0
|
||||||
got_first_g_cmd_on_layer_0 = False
|
got_first_g_cmd_on_layer_0 = False
|
||||||
current_t = 0 #Tracks the current extruder for tracking the target temperature.
|
current_t = 0 #Tracks the current extruder for tracking the target temperature.
|
||||||
target_temperature = {} #Tracks the current target temperature for each extruder.
|
target_temperature = {} #Tracks the current target temperature for each extruder.
|
||||||
|
@ -193,6 +196,10 @@ class PauseAtHeight(Script):
|
||||||
if not layers_started:
|
if not layers_started:
|
||||||
continue
|
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 a Z instruction is in the line, read the current Z
|
||||||
if self.getValue(line, "Z") is not None:
|
if self.getValue(line, "Z") is not None:
|
||||||
current_z = self.getValue(line, "Z")
|
current_z = self.getValue(line, "Z")
|
||||||
|
@ -331,7 +338,12 @@ class PauseAtHeight(Script):
|
||||||
prepend_gcode += self.putValue(G = 11) + "\n"
|
prepend_gcode += self.putValue(G = 11) + "\n"
|
||||||
else:
|
else:
|
||||||
prepend_gcode += self.putValue(G = 1, E = retraction_amount, F = retraction_speed * 60) + "\n"
|
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"
|
prepend_gcode += self.putValue(M = 82) + " ; switch back to absolute E values\n"
|
||||||
|
|
||||||
# reset extrude value to pre pause value
|
# reset extrude value to pre pause value
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from UM.Logger import Logger
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
class PauseAtHeightforRepetier(Script):
|
class PauseAtHeightforRepetier(Script):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -73,6 +74,7 @@ class PauseAtHeightforRepetier(Script):
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
x = 0.
|
x = 0.
|
||||||
y = 0.
|
y = 0.
|
||||||
|
current_extrusion_f = 0
|
||||||
current_z = 0.
|
current_z = 0.
|
||||||
pause_z = self.getSettingValueByKey("pause_height")
|
pause_z = self.getSettingValueByKey("pause_height")
|
||||||
retraction_amount = self.getSettingValueByKey("retraction_amount")
|
retraction_amount = self.getSettingValueByKey("retraction_amount")
|
||||||
|
@ -94,9 +96,11 @@ class PauseAtHeightforRepetier(Script):
|
||||||
|
|
||||||
if self.getValue(line, 'G') == 1 or self.getValue(line, 'G') == 0:
|
if self.getValue(line, 'G') == 1 or self.getValue(line, 'G') == 0:
|
||||||
current_z = self.getValue(line, 'Z')
|
current_z = self.getValue(line, 'Z')
|
||||||
|
if self.getValue(line, 'F') is not None and self.getValue(line, 'E') is not None:
|
||||||
|
current_extrusion_f = self.getValue(line, 'F', current_extrusion_f)
|
||||||
x = self.getValue(line, 'X', x)
|
x = self.getValue(line, 'X', x)
|
||||||
y = self.getValue(line, 'Y', y)
|
y = self.getValue(line, 'Y', y)
|
||||||
if current_z != None:
|
if current_z is not None:
|
||||||
if current_z >= pause_z:
|
if current_z >= pause_z:
|
||||||
|
|
||||||
index = data.index(layer)
|
index = data.index(layer)
|
||||||
|
@ -150,7 +154,12 @@ class PauseAtHeightforRepetier(Script):
|
||||||
prepend_gcode +="G1 X%f Y%f F9000\n" % (x, y)
|
prepend_gcode +="G1 X%f Y%f F9000\n" % (x, y)
|
||||||
if retraction_amount != 0:
|
if retraction_amount != 0:
|
||||||
prepend_gcode +="G1 E%f F6000\n" % (retraction_amount)
|
prepend_gcode +="G1 E%f F6000\n" % (retraction_amount)
|
||||||
prepend_gcode +="G1 F9000\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 +="M82\n"
|
prepend_gcode +="M82\n"
|
||||||
|
|
||||||
# reset extrude value to pre pause value
|
# reset extrude value to pre pause value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue