Don't make retract distances negative

People are reporting that the retraction is reversed. We can't test it since we have no firmware that supports the command at all. So we'll just not make the retract distance negative. That seems more logical anyway if you read the documentation of M600 to the letter.

Fixes #4249.
This commit is contained in:
Ghostkeeper 2018-10-25 13:53:01 +02:00
parent 0e1e8d269a
commit c7b146c9fc
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -1,5 +1,6 @@
# This PostProcessing Plugin script is released
# under the terms of the AGPLv3 or higher
# Copyright (c) 2018 Ultimaker B.V.
# The PostProcessingPlugin is released under the terms of the AGPLv3 or higher.
from typing import Optional, Tuple
from UM.Logger import Logger
@ -54,17 +55,17 @@ class FilamentChange(Script):
layer_nums = self.getSettingValueByKey("layer_number")
initial_retract = self.getSettingValueByKey("initial_retract")
later_retract = self.getSettingValueByKey("later_retract")
color_change = "M600"
if initial_retract is not None and initial_retract > 0.:
color_change = color_change + (" E-%.2f" % initial_retract)
color_change = color_change + (" E%.2f" % initial_retract)
if later_retract is not None and later_retract > 0.:
color_change = color_change + (" L-%.2f" % later_retract)
color_change = color_change + (" L%.2f" % later_retract)
color_change = color_change + " ; Generated by FilamentChange plugin"
layer_targets = layer_nums.split(",")
if len(layer_targets) > 0:
for layer_num in layer_targets: