From 037ca041223ce482f05eed1f01a7827fb30375eb Mon Sep 17 00:00:00 2001 From: Kestin Goforth Date: Mon, 1 Aug 2022 05:36:16 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20G2/G3=20arc=20length=20for?= =?UTF-8?q?=20move=20time=20estimates=20(#4581)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AUTHORS.md | 1 + src/octoprint/util/gcodeInterpreter.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index 4fe6c4cec..80e556ce3 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -167,6 +167,7 @@ date of first contribution): * [Zack Lewis](https://github.com/lima3w) * [Billy Richardson](https://github.com/richardsondev) * [Christian Bianchini](https://github.com/max246) + * [Kestin Goforth](https://github.com/kforth) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py index 5574d246f..fa217e73f 100644 --- a/src/octoprint/util/gcodeInterpreter.py +++ b/src/octoprint/util/gcodeInterpreter.py @@ -587,8 +587,13 @@ class gcode: else: e = 0 + # calculate 3d arc length + arcLengthXYZ = math.sqrt( + (oldPos.z - pos.z) ** 2 + ((endAngle - startAngle) * r) ** 2 + ) + # move time in x, y, z, will be 0 if no movement happened - moveTimeXYZ = abs((oldPos - pos).length / feedrate) + moveTimeXYZ = abs(arcLengthXYZ / feedrate) # time needed for extruding, will be 0 if no extrusion happened extrudeTime = abs(e / feedrate)