Update DisplayInfoOnLCD.py

Add the 'Quality Name' to the gcode with the other settings.

Update DisplayInfoOnLCD.py

Touchups.

Update DisplayInfoOnLCD.py

Minor change
This commit is contained in:
GregValiant 2025-04-14 09:04:34 -04:00
parent 1b518b8c92
commit bf8d31aa51

View file

@ -1,6 +1,5 @@
"""
Display Filename and Layer on the LCD by Amanda de Castilho on August 28, 2018
<<<<<<< Updated upstream
Modified: Joshua Pope-Lewis on November 16, 2018
Display Progress on LCD by Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen, Inigo Martinez on July 31, 2019
Show Progress was adapted from Display Progress by Louis Wooters on January 6, 2020. His changes are included here.
@ -30,35 +29,6 @@ Display Filename and Layer on the LCD by Amanda de Castilho on August 28, 2018
- 'Add M118 Line' is available with either option. M118 will bounce the message back to a remote print server through the USB connection.
- 'Add M73 Line' is used by 'Display Progress' only. There are options to incluse M73 P(percent) and M73 R(time remaining)
- Enable 'Finish-Time' Message - when enabled, takes the Print Time and calculates when the print will end. It uses the Time Fudge Factor. The user may enter a print start time.
=======
Modified: Joshua Pope-Lewis on November 16, 2018
Display Progress on LCD by Mathias Lyngklip Kjeldgaard, Alexander Gee, Kimmo Toivanen, Inigo Martinez on July 31, 2019
Show Progress was adapted from Display Progress by Louis Wooters on January 6, 2020. His changes are included here.
---------------------------------------------------------------
DisplayNameOrProgressOnLCD.py
Cura Post-Process plugin
Combines 'Display Filename and Layer on the LCD' with 'Display Progress'
Combined and with additions by: GregValiant (Greg Foresi)
Date: September 8, 2023
NOTE: This combined post processor will make 'Display Filename and Layer on the LCD' and 'Display Progress' obsolete
Description: Display Filename and Layer options:
Status messages sent to the printer...
- Scrolling (SCROLL_LONG_FILENAMES) if enabled in Marlin and you aren't printing a small item select this option.
- Name: By default it will use the name generated by Cura (EG: TT_Test_Cube) - You may enter a custom name here
- Start Num: Choose which number you prefer for the initial layer, 0 or 1
- Max Layer: Enabling this will show how many layers are in the entire print (EG: Layer 1 of 265!)
- Add prefix 'Printing': Enabling this will add the prefix 'Printing'
- Example Line on LCD: Printing Layer 0 of 395 3DBenchy
Display Progress options:
- Display Total Layer Count
- Disply Time Remaining for the print
- Time Fudge Factor % - Divide the Actual Print Time by the Cura Estimate. Enter as a percentage and the displayed time will be adjusted. This allows you to bring the displayed time closer to reality (Ex: Entering 87.5 would indicate an adjustment to 87.5% of the Cura estimate).
- Example line on LCD: 1/479 | ET 2h13m
- Time to Pauses changes the M117/M118 lines to countdown to the next pause as 1/479 | TP 2h36m
- 'Add M118 Line' is available with either option. M118 will bounce the message back to a remote print server through the USB connection.
- 'Add M73 Line' is used by 'Display Progress' only. There are options to incluse M73 P(percent) and M73 R(time remaining)
- Enable 'Finish-Time' Message - when enabled, takes the Print Time and calculates when the print will end. It takes into account the Time Fudge Factor. The user may enter a print start time. This is also available for Display Filename.
>>>>>>> Stashed changes
"""
from ..Script import Script
@ -270,7 +240,6 @@ class DisplayInfoOnLCD(Script):
def execute(self, data):
display_option = self.getSettingValueByKey("display_option")
<<<<<<< Updated upstream
self.add_m117_line = self.getSettingValueByKey("add_m117_line")
self.add_m118_line = self.getSettingValueByKey("add_m118_line")
self.add_m118_a1 = self.getSettingValueByKey("add_m118_a1")
@ -280,21 +249,12 @@ class DisplayInfoOnLCD(Script):
self.add_m73_time = self.getSettingValueByKey("add_m73_time")
self.add_m73_percent = self.getSettingValueByKey("add_m73_percent")
self.m73_str = ""
=======
add_m118_line = self.getSettingValueByKey("add_m118_line")
add_m73_line = self.getSettingValueByKey("add_m73_line")
add_m73_time = self.getSettingValueByKey("add_m73_time")
add_m73_percent = self.getSettingValueByKey("add_m73_percent")
# This is Display Filename and Layer on LCD
>>>>>>> Stashed changes
if display_option == "filename_layer":
data = self._display_filename_layer(data)
else:
data = self._display_progress(data)
return data
<<<<<<< Updated upstream
# This is from the original 'Display Filename and Layer on LCD'
def _display_filename_layer(self, data: str) -> str:
data[0] = self._add_stats(data)
@ -320,28 +280,6 @@ class DisplayInfoOnLCD(Script):
self.m118_text = octo_text + str(i)
layer_index = data.index(layer)
lines = layer.split("\n")
=======
# Display Progress (from 'Show Progress' and 'Display Progress on LCD')
elif display_option == "display_progress":
# get settings
display_total_layers = self.getSettingValueByKey("display_total_layers")
display_remaining_time = self.getSettingValueByKey("display_remaining_time")
speed_factor = self.getSettingValueByKey("speed_factor") / 100
m73_time = False
m73_percent = False
if add_m73_line and add_m73_time:
m73_time = True
if add_m73_line and add_m73_percent:
m73_percent = True
# initialize global variables
first_layer_index = 0
time_total = 0
number_of_layers = 0
time_elapsed = 0
# if at least one of the settings is disabled, there is enough room on the display to display "layer"
first_section = data[0]
lines = first_section.split("\n")
>>>>>>> Stashed changes
for line in lines:
if line.startswith(";LAYER_COUNT:"):
max_layer = line
@ -710,7 +648,7 @@ class DisplayInfoOnLCD(Script):
filament_line_t0 += f"; Filament Dia.: {global_stack.extruderList[0].getProperty("material_diameter", "value")}mm\n"
filament_line_t0 += f"; Nozzle Size : {global_stack.extruderList[0].getProperty("machine_nozzle_size", "value")}mm\n"
filament_line_t0 += f"; Print Temp. : {global_stack.extruderList[0].getProperty("material_print_temperature", "value")}°"
# if there is more than one extruder then get the stats for the second one.
filament_line_t1 = ""
if extruder_count > 1:
@ -720,15 +658,17 @@ class DisplayInfoOnLCD(Script):
filament_line_t1 += f"; Filament Dia.: {global_stack.extruderList[1].getProperty("material_diameter", "value")}mm\n"
filament_line_t1 += f"; Nozzle Size : {global_stack.extruderList[1].getProperty("machine_nozzle_size", "value")}mm\n"
filament_line_t1 += f"; Print Temp. : {global_stack.extruderList[1].getProperty("material_print_temperature", "value")}°"
# Add the stats to the gcode file
lines = data[0].split("\n")
for index, line in enumerate(lines):
if line.startswith(";Layer height:"):
lines[index] += "\n" + init_layer_hgt_line
lines[index] += f"\n{init_layer_hgt_line}"
lines[index] += f"\n;Base Quality Name : '{global_stack.quality.getMetaDataEntry("name", "")}'"
lines[index] += f"\n;Custom Quality Name: '{global_stack.qualityChanges.getMetaDataEntry("name")}'"
if line.startswith(";Filament used"):
lines[index] = filament_line_t0 + filament_line_t1
if "MINX" in line or "MIN.X" in line:
# Add the model list
# Add the Object List
lines[index - 1] += f"\n;Model List: {str(model_list)}"
return "\n".join(lines)