mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
Update DisplayFilenameAndLayerOnLCD.py
updated to display layer count before filename (layer number was getting cut off in event of long filename). updated to include option to start layer count at either 0 or 1. removed ':' in the display string as it is a gcode command that was splitting the line into two different commands.
This commit is contained in:
parent
78ee666919
commit
de95d4f021
1 changed files with 17 additions and 7 deletions
|
@ -3,8 +3,9 @@
|
||||||
# Date: August 28, 2018
|
# Date: August 28, 2018
|
||||||
|
|
||||||
# Description: This plugin inserts a line at the start of each layer,
|
# Description: This plugin inserts a line at the start of each layer,
|
||||||
# M117 - displays the filename and layer height to the LCD
|
# M117 displays the filename and layer height to the LCD
|
||||||
# Alternatively, user can override the filename to display alt text + layer height
|
# ** user must enter 'filename'
|
||||||
|
# ** future update: include actual filename
|
||||||
|
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
@ -23,10 +24,19 @@ class DisplayFilenameAndLayerOnLCD(Script):
|
||||||
{
|
{
|
||||||
"name":
|
"name":
|
||||||
{
|
{
|
||||||
"label": "text to display:",
|
"label": "Text to display:",
|
||||||
"description": "By default the current filename will be displayed on the LCD. Enter text here to override the filename and display something else.",
|
"description": "By default the current filename will be displayed on the LCD. Enter text here to override the filename and display something else.",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": ""
|
"default_value": ""
|
||||||
|
},
|
||||||
|
"startNum":
|
||||||
|
{
|
||||||
|
"label": "Initial layer number:",
|
||||||
|
"description": "Choose which number you prefer for the initial layer, 0 or 1",
|
||||||
|
"type": "int",
|
||||||
|
"default_value": 0,
|
||||||
|
"minimum_value": 0,
|
||||||
|
"maximum_value": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
@ -36,10 +46,10 @@ class DisplayFilenameAndLayerOnLCD(Script):
|
||||||
name = self.getSettingValueByKey("name")
|
name = self.getSettingValueByKey("name")
|
||||||
else:
|
else:
|
||||||
name = Application.getInstance().getPrintInformation().jobName
|
name = Application.getInstance().getPrintInformation().jobName
|
||||||
lcd_text = "M117 " + name + " layer: "
|
lcd_text = "M117 Layer "
|
||||||
i = 0
|
i = self.getSettingValueByKey("startNum")
|
||||||
for layer in data:
|
for layer in data:
|
||||||
display_text = lcd_text + str(i)
|
display_text = lcd_text + str(i) + " " + name
|
||||||
layer_index = data.index(layer)
|
layer_index = data.index(layer)
|
||||||
lines = layer.split("\n")
|
lines = layer.split("\n")
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue