From f20e985d0da3d197dabe350cda67ead4cff0117d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 11 Jan 2017 11:55:39 +0100 Subject: [PATCH] profile => slicing_profile & removed filament 0 check If the slicer returns values for a tool we want it in our analysis result, even if it's zero. That way the result will be the same as if we have our own built in gcode analyser take a look at the file. (cherry picked from commit 818ae92) --- src/octoprint/plugins/cura/__init__.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/octoprint/plugins/cura/__init__.py b/src/octoprint/plugins/cura/__init__.py index e4a2f3d1..3633cf5e 100644 --- a/src/octoprint/plugins/cura/__init__.py +++ b/src/octoprint/plugins/cura/__init__.py @@ -266,6 +266,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, working_dir = os.path.dirname(executable) + slicing_profile = Profile(self._load_profile(profile_path), printer_profile, posX, posY) engine_settings = self._convert_to_engine(profile_path, printer_profile, posX, posY) # Start building the argument list for the CuraEngine command execution @@ -372,16 +373,14 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin, analysis = dict() if not "filament" in analysis: analysis["filament"] = dict() - if not tool_key in analysis["filament"] and filament > 0: + if not tool_key in analysis["filament"]: analysis["filament"][tool_key] = dict() - profile = Profile(self._load_profile(profile_path), printer_profile, posX, posY) - - if profile.get_float("filament_diameter") != None and filament > 0: - if profile.get("gcode_flavor") == GcodeFlavors.ULTIGCODE or profile.get("gcode_flavor") == GcodeFlavors.REPRAP_VOLUME: - analysis["filament"][tool_key] = _get_usage_from_volume(filament, profile.get_float("filament_diameter")) + if slicing_profile.get_float("filament_diameter") is not None: + if slicing_profile.get("gcode_flavor") == GcodeFlavors.ULTIGCODE or slicing_profile.get("gcode_flavor") == GcodeFlavors.REPRAP_VOLUME: + analysis["filament"][tool_key] = _get_usage_from_volume(filament, slicing_profile.get_float("filament_diameter")) else: - analysis["filament"][tool_key] = _get_usage_from_length(filament, profile.get_float("filament_diameter")) + analysis["filament"][tool_key] = _get_usage_from_length(filament, slicing_profile.get_float("filament_diameter")) except: pass