mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Ignore g-code lines with syntax errors
Discovered while working on CURA-7145.
This commit is contained in:
parent
53d69f3f26
commit
341e149d0e
1 changed files with 14 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
@ -258,6 +258,7 @@ class FlavorParser:
|
||||||
continue
|
continue
|
||||||
if item.startswith(";"):
|
if item.startswith(";"):
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
if item[0] == "X":
|
if item[0] == "X":
|
||||||
x = float(item[1:])
|
x = float(item[1:])
|
||||||
if item[0] == "Y":
|
if item[0] == "Y":
|
||||||
|
@ -268,6 +269,8 @@ class FlavorParser:
|
||||||
f = float(item[1:]) / 60
|
f = float(item[1:]) / 60
|
||||||
if item[0] == "E":
|
if item[0] == "E":
|
||||||
e = float(item[1:])
|
e = float(item[1:])
|
||||||
|
except ValueError: # Improperly formatted g-code: Coordinates are not floats.
|
||||||
|
continue # Skip the command then.
|
||||||
params = PositionOptional(x, y, z, f, e)
|
params = PositionOptional(x, y, z, f, e)
|
||||||
return func(position, params, path)
|
return func(position, params, path)
|
||||||
return position
|
return position
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue