Fix issue in getting file metadata after slicing
This fixes the issue that there were no informations about filament
usage in metadata after slicing with cura plugin. Trying to call
profile.get_float("filament_diameter") ended in en exception with
message " 'module' object has no attribute 'get_float' ". So i defined
profile before using profile and now it works.
See issue #1685
Also inserted a check to determine if filament usage is > 0 to exclude
tools with no filament usage in metadata.
(cherry picked from commit c9b38bd)
This commit is contained in:
parent
06eae381e4
commit
58f934e2c1
1 changed files with 4 additions and 2 deletions
|
|
@ -372,10 +372,12 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
|
|||
analysis = dict()
|
||||
if not "filament" in analysis:
|
||||
analysis["filament"] = dict()
|
||||
if not tool_key in analysis["filament"]:
|
||||
if not tool_key in analysis["filament"] and filament > 0:
|
||||
analysis["filament"][tool_key] = dict()
|
||||
|
||||
if profile.get_float("filament_diameter") != None:
|
||||
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"))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue