Skip to content
This repository has been archived by the owner on Jan 17, 2018. It is now read-only.

Commit

Permalink
Fix getting print speed setting
Browse files Browse the repository at this point in the history
The variable 'printspeed' didn't exist. Looking at the original code in LegacyCura, we should load that value from the setting.
  • Loading branch information
Ghostkeeper committed May 22, 2017
1 parent 3ba8b8e commit a4f1687
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/TweakAtZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Modified by Ricardo Gomez, [email protected], to add Bed Temperature and make it work with Cura_13.06.04+
# Modified by Stefan Heule, [email protected] since V3.0 (see changelog below)
# Modified by Jaime van Kessel (Ultimaker), [email protected] to make it work for 15.10 / 2.x
# Modified by Ruben Dulek (Ultimaker), [email protected], to debug.

##history / changelog:
##V3.0.1: TweakAtZ-state default 1 (i.e. the plugin works without any TweakAtZ comment)
Expand Down Expand Up @@ -46,7 +47,7 @@
import re

class TweakAtZ(Script):
version = "5.1"
version = "5.1.1"
def __init__(self):
super().__init__()

Expand Down Expand Up @@ -321,13 +322,14 @@ def execute(self, data):
"extruderTwo": "M104 S%f T1\n",
"fanSpeed": "M106 S%d\n"}
target_values = {"speed": self.getSettingValueByKey("e2_speed"),
"flowrate": self.getSettingValueByKey("g2_flowrate"),
"flowrateOne": self.getSettingValueByKey("g4_flowrateOne"),
"flowrateTwo": self.getSettingValueByKey("g6_flowrateTwo"),
"bedTemp": self.getSettingValueByKey("h2_bedTemp"),
"extruderOne": self.getSettingValueByKey("i2_extruderOne"),
"extruderTwo": self.getSettingValueByKey("i4_extruderTwo"),
"fanSpeed": self.getSettingValueByKey("j2_fanSpeed")}
"printspeed": self.getSettingValueByKey("f2_printspeed"),
"flowrate": self.getSettingValueByKey("g2_flowrate"),
"flowrateOne": self.getSettingValueByKey("g4_flowrateOne"),
"flowrateTwo": self.getSettingValueByKey("g6_flowrateTwo"),
"bedTemp": self.getSettingValueByKey("h2_bedTemp"),
"extruderOne": self.getSettingValueByKey("i2_extruderOne"),
"extruderTwo": self.getSettingValueByKey("i4_extruderTwo"),
"fanSpeed": self.getSettingValueByKey("j2_fanSpeed")}
old = {"speed": -1, "flowrate": -1, "flowrateOne": -1, "flowrateTwo": -1, "platformTemp": -1, "extruderOne": -1,
"extruderTwo": -1, "bedTemp": -1, "fanSpeed": -1, "state": -1}
twLayers = self.getSettingValueByKey("d_twLayers")
Expand Down Expand Up @@ -426,8 +428,8 @@ def execute(self, data):
if 'G1' in line and TweakPrintSpeed and (state==3 or state==4):
# check for pure print movement in target range:
if x != None and y != None and f != None and e != None and newZ==z:
modified_gcode += "G1 F%d X%1.3f Y%1.3f E%1.5f\n" % (int(f/100.0*float(printspeed)),self.getValue(line,"X"),
self.getValue(line,"Y"),self.getValue(line,"E"))
modified_gcode += "G1 F%d X%1.3f Y%1.3f E%1.5f\n" % (int(f / 100.0 * float(target_values["printspeed"])), self.getValue(line, "X"),
self.getValue(line, "Y"), self.getValue(line, "E"))
else: #G1 command but not a print movement
modified_gcode += line + "\n"
# no tweaking on retraction hops which have no x and y coordinate:
Expand Down

0 comments on commit a4f1687

Please sign in to comment.