mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Make getValue return an int if it's an integer number
This is a more generic solution to what's done in 7058ddbb66
.
Contributes to issue CURA-5491.
This commit is contained in:
parent
183cd0182d
commit
6977b8de6e
2 changed files with 9 additions and 6 deletions
|
@ -105,9 +105,12 @@ class Script:
|
|||
if m is None:
|
||||
return default
|
||||
try:
|
||||
return float(m.group(0))
|
||||
except:
|
||||
return default
|
||||
return int(m.group(0))
|
||||
except ValueError: #Not an integer.
|
||||
try:
|
||||
return float(m.group(0))
|
||||
except ValueError: #Not a number at all.
|
||||
return default
|
||||
|
||||
## Convenience function to produce a line of g-code.
|
||||
#
|
||||
|
|
|
@ -162,12 +162,12 @@ class PauseAtHeight(Script):
|
|||
|
||||
#Track the latest printing temperature in order to resume at the correct temperature.
|
||||
if line.startswith("T"):
|
||||
current_t = int(self.getValue(line, "T"))
|
||||
current_t = self.getValue(line, "T")
|
||||
m = self.getValue(line, "M")
|
||||
if m is not None and (int(m) == 104 or int(m) == 109) and self.getValue(line, "S") is not None:
|
||||
if m is not None and (m == 104 or m == 109) and self.getValue(line, "S") is not None:
|
||||
extruder = current_t
|
||||
if self.getValue(line, "T") is not None:
|
||||
extruder = int(self.getValue(line, "T"))
|
||||
extruder = self.getValue(line, "T")
|
||||
target_temperature[extruder] = self.getValue(line, "S")
|
||||
|
||||
if not layers_started:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue