From fe585e7115adc2688359e92e17294aa94a85891f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 12 Apr 2017 09:38:53 +0200 Subject: [PATCH] Do not repeatedly apply any set offsets in the gcode interpreter They would accumulate and cause wrong calculations Solves #1863 --- src/octoprint/util/gcodeInterpreter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py index ac10954d..41e30201 100644 --- a/src/octoprint/util/gcodeInterpreter.py +++ b/src/octoprint/util/gcodeInterpreter.py @@ -316,11 +316,11 @@ class gcode(object): oldPos = pos - # Use new coordinates if provided. If not provided, use prior coordinates in absolute + # Use new coordinates if provided. If not provided, use prior coordinates (minus offset) in absolute # and 0.0 in relative mode. - newPos = Vector3D(x if x is not None else (pos.x if posAbs else 0.0), - y if y is not None else (pos.y if posAbs else 0.0), - z if z is not None else (pos.z if posAbs else 0.0)) + newPos = Vector3D(x if x is not None else (pos.x - posOffset.x if posAbs else 0.0), + y if y is not None else (pos.y - posOffset.y if posAbs else 0.0), + z if z is not None else (pos.z - posOffset.z if posAbs else 0.0)) if posAbs: # Absolute mode: scale coordinates and apply offsets