mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 11:49:01 +08:00
Merge pull request #7153 from Ultimaker/CURA-7066_gcode_reader_line_width_fix
Cura 7066 gcode reader line width fix
This commit is contained in:
commit
510d9822dd
@ -169,6 +169,9 @@ class FlavorParser:
|
|||||||
# A threshold is set to avoid weird paths in the GCode
|
# A threshold is set to avoid weird paths in the GCode
|
||||||
if line_width > 1.2:
|
if line_width > 1.2:
|
||||||
return 0.35
|
return 0.35
|
||||||
|
# Prevent showing infinitely wide lines
|
||||||
|
if line_width < 0.0:
|
||||||
|
return 0.0
|
||||||
return line_width
|
return line_width
|
||||||
|
|
||||||
def _gCode0(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position:
|
def _gCode0(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position:
|
||||||
@ -235,7 +238,7 @@ class FlavorParser:
|
|||||||
def _gCode92(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position:
|
def _gCode92(self, position: Position, params: PositionOptional, path: List[List[Union[float, int]]]) -> Position:
|
||||||
if params.e is not None:
|
if params.e is not None:
|
||||||
# Sometimes a G92 E0 is introduced in the middle of the GCode so we need to keep those offsets for calculate the line_width
|
# Sometimes a G92 E0 is introduced in the middle of the GCode so we need to keep those offsets for calculate the line_width
|
||||||
self._extrusion_length_offset[self._extruder_number] += position.e[self._extruder_number] - params.e
|
self._extrusion_length_offset[self._extruder_number] = position.e[self._extruder_number] - params.e
|
||||||
position.e[self._extruder_number] = params.e
|
position.e[self._extruder_number] = params.e
|
||||||
self._previous_extrusion_value = params.e
|
self._previous_extrusion_value = params.e
|
||||||
else:
|
else:
|
||||||
@ -261,13 +264,13 @@ class FlavorParser:
|
|||||||
try:
|
try:
|
||||||
if item[0] == "X":
|
if item[0] == "X":
|
||||||
x = float(item[1:])
|
x = float(item[1:])
|
||||||
if item[0] == "Y":
|
elif item[0] == "Y":
|
||||||
y = float(item[1:])
|
y = float(item[1:])
|
||||||
if item[0] == "Z":
|
elif item[0] == "Z":
|
||||||
z = float(item[1:])
|
z = float(item[1:])
|
||||||
if item[0] == "F":
|
elif item[0] == "F":
|
||||||
f = float(item[1:]) / 60
|
f = float(item[1:]) / 60
|
||||||
if item[0] == "E":
|
elif item[0] == "E":
|
||||||
e = float(item[1:])
|
e = float(item[1:])
|
||||||
except ValueError: # Improperly formatted g-code: Coordinates are not floats.
|
except ValueError: # Improperly formatted g-code: Coordinates are not floats.
|
||||||
continue # Skip the command then.
|
continue # Skip the command then.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user