From 2ab7fa4d3a4f2c31a59f3d40237d1cd920fbbecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 Jan 2017 12:11:16 +0100 Subject: [PATCH] Support volume calculate for S3D files --- src/octoprint/util/gcodeInterpreter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/octoprint/util/gcodeInterpreter.py b/src/octoprint/util/gcodeInterpreter.py index 0cc0aab2..432eb0db 100644 --- a/src/octoprint/util/gcodeInterpreter.py +++ b/src/octoprint/util/gcodeInterpreter.py @@ -260,6 +260,7 @@ class gcode(object): if ';' in line: comment = line[line.find(';')+1:].strip() if comment.startswith("filament_diameter"): + # Slic3r filamentValue = comment.split("=", 1)[1].strip() try: self._filamentDiameter = float(filamentValue) @@ -269,6 +270,7 @@ class gcode(object): except ValueError: self._filamentDiameter = 0.0 elif comment.startswith("CURA_PROFILE_STRING") or comment.startswith("CURA_OCTO_PROFILE_STRING"): + # Cura 15.04.* & OctoPrint Cura plugin if comment.startswith("CURA_PROFILE_STRING"): prefix = "CURA_PROFILE_STRING:" else: @@ -280,6 +282,13 @@ class gcode(object): self._filamentDiameter = float(curaOptions["filament_diameter"]) except: self._filamentDiameter = 0.0 + elif comment.startswith("filamentDiameter,"): + # Simplify3D + filamentValue = comment.split(",", 1)[1].strip() + try: + self._filamentDiameter = float(filamentValue) + except ValueError: + self._filamentDiameter = 0.0 line = line[0:line.find(';')] G = getCodeInt(line, 'G')