diff --git a/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py b/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py new file mode 100644 index 0000000000..bfe04b2bea --- /dev/null +++ b/plugins/PostProcessingPlugin/scripts/DisplayFilenameAndLayerOnLCD.py @@ -0,0 +1,37 @@ +# Cura PostProcessingPlugin +# Author: Amanda de Castilho +# Date: August 28, 2018 +# Modified: November 16, 2018 by Joshua Pope-Lewis + +# Description: This plugin is now an option in 'Display Info on LCD' + +from ..Script import Script +from UM.Application import Application +from UM.Message import Message + +class DisplayFilenameAndLayerOnLCD(Script): + def initialize(self) -> None: + Message(title = "[Display Filename and Layer on LCD]", text = "This script is now an option in 'Display Info on LCD'. This post processor no longer works.").show() + + def getSettingDataString(self): + return """{ + "name": "Display Filename And Layer On LCD", + "key": "DisplayFilenameAndLayerOnLCD", + "metadata": {}, + "version": 2, + "settings": + { + "enable_script": + { + "label": "Deprecated/Obsolete", + "description": "This script is now included in 'Display Info on LCD'.", + "type": "bool", + "default_value": true + } + } + }""" + + def execute(self, data): + Message(title = "[Display Filename and Layer on LCD]", text = "This post is now included in 'Display Info on LCD'. This script will exit.").show() + data[0] += "; [Display Filename and Layer on LCD] Did not run. It is now included in 'Display Info on LCD'.\n" + return data diff --git a/plugins/PostProcessingPlugin/scripts/DisplayInfoOnLCD.py b/plugins/PostProcessingPlugin/scripts/DisplayInfoOnLCD.py index 6d2e83d545..bfd88534f8 100644 --- a/plugins/PostProcessingPlugin/scripts/DisplayInfoOnLCD.py +++ b/plugins/PostProcessingPlugin/scripts/DisplayInfoOnLCD.py @@ -134,7 +134,7 @@ class DisplayInfoOnLCD(Script): "countdown_to_pause": { "label": "Countdown to Pauses", - "description": "Instead of layer number and remaining print time the LCD will show 'layers remaining before pause' and 'Est Time to Pause' (ETP).", + "description": "When enabled - DisplayInfoOnLCD must run AFTER all PauseAtHeight and Filament Change scripts. Instead of layer number and remaining print time the LCD will show 'layers remaining before pause/filament change and the time to pause/filament change' (TP).", "type": "bool", "default_value": false, "enabled": "display_option == 'display_progress'" @@ -163,7 +163,7 @@ class DisplayInfoOnLCD(Script): def execute(self, data): display_option = self.getSettingValueByKey("display_option") add_m118_line = self.getSettingValueByKey("add_m118_line") - + # This is Display Filename and Layer on LCD--------------------------------------------------------- if display_option == "filename_layer": max_layer = 0 @@ -229,17 +229,33 @@ class DisplayInfoOnLCD(Script): if line.startswith(";TIME:"): tindex = lines.index(line) cura_time = int(line.split(":")[1]) - print_time = cura_time*speed_factor + print_time = cura_time * speed_factor hhh = print_time/3600 hr = round(hhh // 1) mmm = round((hhh % 1) * 60) orig_hhh = cura_time/3600 orig_hr = round(orig_hhh // 1) - orig_mmm = round((orig_hhh % 1) * 60) - if add_m118_line: lines.insert(tindex+1,"M118 Adjusted Print Time " + str(hr) + "hr " + str(mmm) + "min") - lines.insert(tindex+1,"M117 ET " + str(hr) + "hr " + str(mmm) + "min") + orig_min = int((cura_time - (orig_hr * 3600))/60) # Not rounded up + orig_mmm = round((orig_hhh % 1) * 60) # Rounded up + orig_sec = round(cura_time - orig_hr * 3600 - orig_min * 60) + if add_m118_line: lines.insert(tindex + 3,"M118 Adjusted Print Time " + str(hr) + "hr " + str(mmm) + "min") + lines.insert(tindex + 3,"M117 ET " + str(hr) + "hr " + str(mmm) + "min") + # If Countdown to pause is enabled then count the pauses and/or filament changes + pause_str = "" + if bool(self.getSettingValueByKey("countdown_to_pause")): + pause_count = 0 + filament_change_count = 0 + for num in range(2,len(data) - 1, 1): + if "PauseAtHeight.py" in data[num]: + pause_count += 1 + if "M600" in data[num]: + filament_change_count += 1 + if pause_count > 0: + pause_str = f" with {pause_count} pause(s)" + if filament_change_count > 0: + pause_str += f" and {filament_change_count} filament change(s)" # This line goes in to convert seconds to hours and minutes - lines.insert(tindex+1, f";Cura Time: {orig_hr}hr {orig_mmm}min") + lines.insert(tindex + 3, f";Cura Time Estimate: {cura_time}sec = {orig_hr}hr {orig_min}min {orig_sec}sec {pause_str}") data[0] = "\n".join(lines) data[len(data)-1] += "M117 Orig Cura Est " + str(orig_hr) + "hr " + str(orig_mmm) + "min\n" if add_m118_line: data[len(data)-1] += "M118 Est w/FudgeFactor " + str(speed_factor * 100) + "% was " + str(hr) + "hr " + str(mmm) + "min\n" @@ -328,7 +344,7 @@ class DisplayInfoOnLCD(Script): if line.startswith(";TIME_ELAPSED:"): this_time = (float(line.split(":")[1]))*speed_factor time_list.append(str(this_time)) - if "PauseAtHeight.py" in layer: + if "PauseAtHeight.py" in layer or "M600" in layer: for qnum in range(num - 1, pause_index, -1): time_list[qnum] = str(float(this_time) - float(time_list[qnum])) + "P" pause_index = num-1 diff --git a/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py b/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py new file mode 100644 index 0000000000..4d24aedac0 --- /dev/null +++ b/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py @@ -0,0 +1,40 @@ +# Cura PostProcessingPlugin +# Author: Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen, Inigo Martinez +# Date: July 31, 2019 +# Modified: Nov 30, 2021 + +# Description: This plugin displays progress on the LCD. It can output the estimated time remaining and the completion percentage. + +from ..Script import Script + +import re +import datetime +from UM.Message import Message + +class DisplayProgressOnLCD(Script): + + def initialize(self) -> None: + Message(title = "[Display Progress on LCD]", text = "This script is now an option in 'Display Info on LCD'. This post processor no longer works.").show() + + def getSettingDataString(self): + return """{ + "name": "Display Progress On LCD", + "key": "DisplayProgressOnLCD", + "metadata": {}, + "version": 2, + "settings": + { + "enable_script": + { + "label": "Deprecated/Obsolete", + "description": "This script is now included in 'Display Info on LCD'.", + "type": "bool", + "default_value": true + } + } + }""" + + def execute(self, data): + Message(title = "[Display Progress on LCD]", text = "This post is now included in 'Display Info on LCD'. This script will exit.").show() + data[0] += "; [Display Progress on LCD] Did not run. It is now included in 'Display Info on LCD'.\n" + return data