Merge branch 'main' into CURA-12449_handling-painted-models-map
Some checks are pending
conan-package-resources / conan-package (push) Waiting to run
conan-package-resources / signal-curator (push) Blocked by required conditions
conan-package / conan-package (push) Waiting to run
printer-linter-format / Printer linter auto format (push) Waiting to run
unit-test / Run unit tests (push) Waiting to run

This commit is contained in:
Erwan MATHIEU 2025-09-11 09:00:07 +02:00 committed by GitHub
commit e2b19731ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 1765 additions and 580 deletions

View file

@ -61,6 +61,7 @@ class MachineErrorChecker(QObject):
self._machine_manager.globalContainerChanged.connect(self.startErrorCheck)
self._onMachineChanged()
self.startErrorCheck()
def _setCheckTimer(self) -> None:
"""A QTimer to regulate error check frequency

View file

@ -21,7 +21,6 @@ class Marketplace(Extension, QObject):
def __init__(self, parent: Optional[QObject] = None) -> None:
QObject.__init__(self, parent)
Extension.__init__(self)
self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here.
self._package_manager = CuraApplication.getInstance().getPackageManager()
self._material_package_list: Optional[RemotePackageList] = None
@ -79,20 +78,17 @@ class Marketplace(Extension, QObject):
If the window hadn't been loaded yet into Qt, it will be created lazily.
"""
if self._window is None:
plugin_registry = PluginRegistry.getInstance()
plugin_registry.pluginsEnabledOrDisabledChanged.connect(self.checkIfRestartNeeded)
plugin_path = plugin_registry.getPluginPath(self.getPluginId())
if plugin_path is None:
plugin_path = os.path.dirname(__file__)
path = os.path.join(plugin_path, "resources", "qml", "Marketplace.qml")
self._window = CuraApplication.getInstance().createQmlComponent(path, {"manager": self})
if self._window is None: # Still None? Failed to load the QML then.
return
if not self._window.isVisible():
self.setTabShown(0)
self._window.show()
self._window.requestActivate() # Bring window into focus, if it was already open in the background.
plugin_registry = PluginRegistry.getInstance()
plugin_registry.pluginsEnabledOrDisabledChanged.connect(self.checkIfRestartNeeded)
plugin_path = plugin_registry.getPluginPath(self.getPluginId())
if plugin_path is None:
plugin_path = os.path.dirname(__file__)
path = os.path.join(plugin_path, "resources", "qml", "Marketplace.qml")
window = CuraApplication.getInstance().createQmlSubWindow(path, {"manager": self})
if window is not None: # Still None? Failed to load the QML then.
window.show()
@pyqtSlot()
def setVisibleTabToMaterials(self) -> None:
@ -103,9 +99,6 @@ class Marketplace(Extension, QObject):
self.setTabShown(1)
def checkIfRestartNeeded(self) -> None:
if self._window is None:
return
if self._package_manager.hasPackagesToRemoveOrInstall or \
PluginRegistry.getInstance().getCurrentSessionActivationChangedPlugins():
self._restart_needed = True

View file

@ -9,7 +9,7 @@ import QtQuick.Window 2.2
import UM 1.5 as UM
import Cura 1.6 as Cura
Window
UM.Dialog
{
id: marketplaceDialog
property variant catalog: UM.I18nCatalog { name: "cura" }
@ -25,293 +25,289 @@ Window
width: minimumWidth
height: minimumHeight
onVisibleChanged:
{
while(contextStack.depth > 1)
{
contextStack.pop(); //Do NOT use the StackView.Immediate transition here, since it causes the window to stay empty. Seemingly a Qt bug: https://bugreports.qt.io/browse/QTBUG-60670?
}
}
Connections
{
target: Cura.API.account
function onLoginStateChanged()
{
close();
}
}
title: "Marketplace" //Seen by Ultimaker as a brand name, so this doesn't get translated.
modality: Qt.NonModal
// Background color
Rectangle
{
anchors.fill: parent
color: UM.Theme.getColor("main_background")
}
//The Marketplace can have a page in front of everything with package details. The stack view controls its visibility.
StackView
{
id: contextStack
anchors.fill: parent
initialItem: packageBrowse
ColumnLayout
//The Marketplace can have a page in front of everything with package details. The stack view controls its visibility.
StackView
{
id: packageBrowse
id: contextStack
anchors.fill: parent
spacing: UM.Theme.getSize("narrow_margin").height
initialItem: packageBrowse
// Page title.
Item
ColumnLayout
{
Layout.preferredWidth: parent.width
Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
id: packageBrowse
UM.Label
spacing: UM.Theme.getSize("narrow_margin").height
// Page title.
Item
{
id: pageTitle
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
bottom: parent.bottom
}
Layout.preferredWidth: parent.width
Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
font: UM.Theme.getFont("large")
text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...")
UM.Label
{
id: pageTitle
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
bottom: parent.bottom
}
font: UM.Theme.getFont("large")
text: content.item ? content.item.pageTitle : catalog.i18nc("@title", "Loading...")
}
}
}
OnboardBanner
{
id: onBoardBanner
visible: content.item && content.item.bannerVisible
text: content.item && content.item.bannerText
icon: content.item && content.item.bannerIcon
onRemove: content.item && content.item.onRemoveBanner
readMoreUrl: content.item && content.item.bannerReadMoreUrl
Layout.fillWidth: true
Layout.leftMargin: UM.Theme.getSize("default_margin").width
Layout.rightMargin: UM.Theme.getSize("default_margin").width
}
// Search & Top-Level Tabs
Item
{
id: searchHeader
implicitHeight: childrenRect.height
implicitWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width
Layout.alignment: Qt.AlignHCenter
RowLayout
OnboardBanner
{
width: parent.width
height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height
spacing: UM.Theme.getSize("thin_margin").width
id: onBoardBanner
visible: content.item && content.item.bannerVisible
text: content.item && content.item.bannerText
icon: content.item && content.item.bannerIcon
onRemove: content.item && content.item.onRemoveBanner
readMoreUrl: content.item && content.item.bannerReadMoreUrl
Cura.SearchBar
Layout.fillWidth: true
Layout.leftMargin: UM.Theme.getSize("default_margin").width
Layout.rightMargin: UM.Theme.getSize("default_margin").width
}
// Search & Top-Level Tabs
Item
{
id: searchHeader
implicitHeight: childrenRect.height
implicitWidth: parent.width - 2 * UM.Theme.getSize("default_margin").width
Layout.alignment: Qt.AlignHCenter
RowLayout
{
id: searchBar
implicitHeight: UM.Theme.getSize("button_icon").height
Layout.fillWidth: true
onTextEdited: searchStringChanged(text)
}
width: parent.width
height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height
spacing: UM.Theme.getSize("thin_margin").width
// Page selection.
TabBar
{
id: pageSelectionTabBar
Layout.alignment: Qt.AlignRight
height: UM.Theme.getSize("button_icon").height
spacing: 0
background: Rectangle { color: "transparent" }
currentIndex: manager.tabShown
onCurrentIndexChanged:
Cura.SearchBar
{
manager.tabShown = currentIndex
searchBar.text = "";
searchBar.visible = currentItem.hasSearch;
content.source = currentItem.sourcePage;
id: searchBar
implicitHeight: UM.Theme.getSize("button_icon").height
Layout.fillWidth: true
onTextEdited: searchStringChanged(text)
}
PackageTypeTab
// Page selection.
TabBar
{
id: pluginTabText
width: implicitWidth
text: catalog.i18nc("@button", "Plugins")
property string sourcePage: "Plugins.qml"
property bool hasSearch: true
}
PackageTypeTab
{
id: materialsTabText
width: implicitWidth
text: catalog.i18nc("@button", "Materials")
property string sourcePage: "Materials.qml"
property bool hasSearch: true
}
ManagePackagesButton
{
property string sourcePage: "ManagedPackages.qml"
property bool hasSearch: false
id: pageSelectionTabBar
Layout.alignment: Qt.AlignRight
height: UM.Theme.getSize("button_icon").height
spacing: 0
background: Rectangle {
color: "transparent"
}
currentIndex: manager.tabShown
Cura.NotificationIcon
onCurrentIndexChanged:
{
anchors
{
horizontalCenter: parent.right
verticalCenter: parent.top
}
visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
manager.tabShown = currentIndex
searchBar.text = "";
searchBar.visible = currentItem.hasSearch;
content.source = currentItem.sourcePage;
}
labelText:
PackageTypeTab
{
id: pluginTabText
width: implicitWidth
text: catalog.i18nc("@button", "Plugins")
property string sourcePage: "Plugins.qml"
property bool hasSearch: true
}
PackageTypeTab
{
id: materialsTabText
width: implicitWidth
text: catalog.i18nc("@button", "Materials")
property string sourcePage: "Materials.qml"
property bool hasSearch: true
}
ManagePackagesButton
{
property string sourcePage: "ManagedPackages.qml"
property bool hasSearch: false
Cura.NotificationIcon
{
const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length
return itemCount > 9 ? "9+" : itemCount
anchors
{
horizontalCenter: parent.right
verticalCenter: parent.top
}
visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
labelText:
{
const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length
return itemCount > 9 ? "9+" : itemCount
}
}
}
}
}
}
}
FontMetrics
{
id: fontMetrics
font: UM.Theme.getFont("default")
}
FontMetrics
{
id: fontMetrics
font: UM.Theme.getFont("default")
}
Cura.TertiaryButton
{
text: catalog.i18nc("@info", "Search in the browser")
iconSource: UM.Theme.getIcon("LinkExternal")
visible: pageSelectionTabBar.currentItem.hasSearch && searchHeader.visible
isIconOnRightSide: true
height: fontMetrics.height
textFont: fontMetrics.font
textColor: UM.Theme.getColor("text")
Cura.TertiaryButton
{
text: catalog.i18nc("@info", "Search in the browser")
iconSource: UM.Theme.getIcon("LinkExternal")
visible: pageSelectionTabBar.currentItem.hasSearch && searchHeader.visible
isIconOnRightSide: true
height: fontMetrics.height
textFont: fontMetrics.font
textColor: UM.Theme.getColor("text")
onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl)
}
// Page contents.
Rectangle
{
Layout.preferredWidth: parent.width
Layout.fillHeight: true
color: UM.Theme.getColor("detail_background")
onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl)
}
// Page contents.
Loader
Rectangle
{
id: content
anchors.fill: parent
anchors.margins: UM.Theme.getSize("default_margin").width
source: "Plugins.qml"
Layout.preferredWidth: parent.width
Layout.fillHeight: true
color: UM.Theme.getColor("detail_background")
Connections
// Page contents.
Loader
{
target: content
function onLoaded()
id: content
anchors.fill: parent
anchors.margins: UM.Theme.getSize("default_margin").width
source: "Plugins.qml"
Connections
{
pageTitle.text = content.item.pageTitle
searchStringChanged.connect(handleSearchStringChanged)
}
function handleSearchStringChanged(new_search)
{
content.item.model.searchString = new_search
target: content
function onLoaded()
{
pageTitle.text = content.item.pageTitle
searchStringChanged.connect(handleSearchStringChanged)
}
function handleSearchStringChanged(new_search)
{
content.item.model.searchString = new_search
}
}
}
}
}
}
}
Rectangle
{
height: quitButton.height + 2 * UM.Theme.getSize("default_margin").width
color: UM.Theme.getColor("primary")
visible: manager.showRestartNotification
anchors
{
left: parent.left
right: parent.right
bottom: parent.bottom
}
RowLayout
Rectangle
{
height: quitButton.height + 2 * UM.Theme.getSize("default_margin").width
color: UM.Theme.getColor("primary")
visible: manager.showRestartNotification
anchors
{
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
margins: UM.Theme.getSize("default_margin").width
bottom: parent.bottom
}
spacing: UM.Theme.getSize("default_margin").width
UM.ColorImage
{
id: bannerIcon
source: UM.Theme.getIcon("Plugin")
color: UM.Theme.getColor("primary_button_text")
implicitWidth: UM.Theme.getSize("banner_icon_size").width
implicitHeight: UM.Theme.getSize("banner_icon_size").height
}
Text
RowLayout
{
color: UM.Theme.getColor("primary_button_text")
text: catalog.i18nc("@button", "In order to use the package you will need to restart Cura")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
Layout.fillWidth: true
}
Cura.SecondaryButton
{
id: quitButton
text: catalog.i18nc("@info:button, %1 is the application name", "Quit %1").arg(CuraApplication.applicationDisplayName)
onClicked:
anchors
{
marketplaceDialog.hide();
CuraApplication.checkAndExitApplication();
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
margins: UM.Theme.getSize("default_margin").width
}
spacing: UM.Theme.getSize("default_margin").width
UM.ColorImage
{
id: bannerIcon
source: UM.Theme.getIcon("Plugin")
color: UM.Theme.getColor("primary_button_text")
implicitWidth: UM.Theme.getSize("banner_icon_size").width
implicitHeight: UM.Theme.getSize("banner_icon_size").height
}
Text
{
color: UM.Theme.getColor("primary_button_text")
text: catalog.i18nc("@button", "In order to use the package you will need to restart Cura")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
Layout.fillWidth: true
}
Cura.SecondaryButton
{
id: quitButton
text: catalog.i18nc("@info:button, %1 is the application name", "Quit %1").arg(CuraApplication.applicationDisplayName)
onClicked:
{
marketplaceDialog.hide();
CuraApplication.checkAndExitApplication();
}
}
}
}
}
Rectangle
{
color: UM.Theme.getColor("main_background")
anchors.fill: parent
visible: !Cura.API.account.isLoggedIn && CuraApplication.isEnterprise
UM.Label
Rectangle
{
id: signInLabel
anchors.centerIn: parent
width: Math.round(UM.Theme.getSize("modal_window_minimum").width / 2.5)
text: catalog.i18nc("@description","Please sign in to get verified plugins and materials for UltiMaker Cura Enterprise")
horizontalAlignment: Text.AlignHCenter
color: UM.Theme.getColor("main_background")
anchors.fill: parent
visible: !Cura.API.account.isLoggedIn && CuraApplication.isEnterprise
UM.Label
{
id: signInLabel
anchors.centerIn: parent
width: Math.round(UM.Theme.getSize("modal_window_minimum").width / 2.5)
text: catalog.i18nc("@description", "Please sign in to get verified plugins and materials for UltiMaker Cura Enterprise")
horizontalAlignment: Text.AlignHCenter
}
Cura.PrimaryButton
{
id: loginButton
width: UM.Theme.getSize("account_button").width
height: UM.Theme.getSize("account_button").height
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: signInLabel.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height * 2
text: catalog.i18nc("@button", "Sign in")
fixedWidthMode: true
onClicked: Cura.API.account.login()
}
}
Cura.PrimaryButton
Connections
{
id: loginButton
width: UM.Theme.getSize("account_button").width
height: UM.Theme.getSize("account_button").height
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: signInLabel.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height * 2
text: catalog.i18nc("@button", "Sign in")
fixedWidthMode: true
onClicked: Cura.API.account.login()
target: Cura.API.account
function onLoginStateChanged()
{
reject();
}
}
}
}

View file

@ -40,7 +40,7 @@ class PaintUndoCommand(QUndoCommand):
bit_range_start, bit_range_end = self._bit_range
full_int32 = 0xffffffff
clear_mask = full_int32 ^ (((full_int32 << (32 - 1 - (bit_range_end - bit_range_start))) & full_int32) >> (
clear_texture_bit_mask = full_int32 ^ (((full_int32 << (32 - 1 - (bit_range_end - bit_range_start))) & full_int32) >> (
32 - 1 - bit_range_end))
image_rect = QRect(0, 0, self._stroke_mask.width(), self._stroke_mask.height())
@ -48,7 +48,7 @@ class PaintUndoCommand(QUndoCommand):
clear_bits_image.invertPixels()
painter = QPainter(clear_bits_image)
painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_Lighten)
painter.fillRect(image_rect, clear_mask)
painter.fillRect(image_rect, clear_texture_bit_mask)
painter.end()
set_value_image = self._stroke_mask.copy()

View file

@ -0,0 +1,571 @@
"""
Copyright (c) 2025 GregValiant (Greg Foresi)
When Annealing:
The user may elect to hold the build plate at a temperature for a period of time. When the hold expires, the 'Timed Cooldown' will begin.
If there is no 'Hold Time' then the 'Annealing' cooldown will begin when the print ends. In 'Annealing' the bed temperature drops in 3° increments across the time span.
G4 commands are used for the cooldown steps.
If there is a 'Heated Chamber' then the chamber will start to cool when the bed temperature reaches the chamber temperature.
When drying filament:
The bed must be empty because the printer will auto-home before raising the Z to 'machine_height minus 20mm' and then park the head in the XY.
The bed will heat up to the set point.
G4 commands are used to keep the machine from turning the bed off until the Drying Time has expired.
If you happen to have an enclosure with a fan, the fan can be set up to run during the drying or annealing.
NOTE: This script uses the G4 Dwell command as a timer. It cannot be canceled from the LCD. If you wish to 'escape' from G4 you might have to cancel the print from the LCD or cycle the printer on and off to reset.
"""
from UM.Application import Application
from ..Script import Script
from UM.Message import Message
class AnnealingOrDrying(Script):
def initialize(self) -> None:
super().initialize()
# Get the Bed Temperature from Cura
self.global_stack = Application.getInstance().getGlobalContainerStack()
bed_temp_during_print = str(self.global_stack.getProperty("material_bed_temperature", "value"))
self._instance.setProperty("startout_temp", "value", bed_temp_during_print)
# Get the Build Volume temperature if there is one
heated_build_volume = bool(self.global_stack.getProperty("machine_heated_build_volume", "value"))
chamber_fan_nr = self.global_stack.getProperty("build_volume_fan_nr", "value")
extruder_count = self.global_stack.getProperty("machine_extruder_count", "value")
if heated_build_volume:
chamber_temp = self.global_stack.getProperty("build_volume_temperature", "value")
self._instance.setProperty("has_build_volume_heater", "value", heated_build_volume)
self._instance.setProperty("build_volume_temp", "value", chamber_temp)
try:
if chamber_fan_nr > 0:
self._instance.setProperty("enable_chamber_fan_setting", "value", True)
except:
pass
def getSettingDataString(self):
return """{
"name": "Annealing CoolDown or Filament Drying",
"key": "AnnealingOrDrying",
"metadata": {},
"version": 2,
"settings":
{
"enable_script":
{
"label": "Enable the Script",
"description": "If it isn't enabled it doesn't run.",
"type": "bool",
"default_value": true,
"enabled": true
},
"cycle_type":
{
"label": "Anneal Print or Dry Filament",
"description": "Whether to Anneal the Print (by keeping the bed hot for a period of time), or to use the bed as a Filament Dryer. If drying; you will still need to slice a model, but it will not print. The gcode will consist only of a short script to heat the bed, wait for a while, then turn the bed off. The 'Z' will move to the max height and XY park position so the filament can be covered. The 'Hold Time', 'Bed Start Temp' and (if applicable) the 'Chamber Temp' come from these settings rather than from the Cura settings. When annealing; the Timed Cooldown will commence when the print ends.",
"type": "enum",
"options":
{
"anneal_cycle": "Anneal Print",
"dry_cycle": "Dry Filament"
},
"default_value": "anneal_cycle",
"enabled": true,
"enabled": "enable_script"
},
"heating_zone_selection":
{
"label": "Hold the Temp for the:",
"description": "Select the 'Bed' for just the bed, or 'Bed and Chamber' if you want to include your 'Heated Build Volume'.",
"type": "enum",
"options":
{
"bed_only": "Bed",
"bed_chamber": "Bed and Chamber"
},
"default_value": "bed_only",
"enabled": "enable_script"
},
"wait_time":
{
"label": "Hold Time at Temp(s)",
"description": "Hold the bed temp at the 'Bed Start Out Temperature' for this amount of time (in decimal hours). When this time expires then the Annealing cool down will start. This is also the 'Drying Time' used when 'Drying Filament'.",
"type": "float",
"default_value": 0.0,
"unit": "Decimal Hrs ",
"enabled": "enable_script and cycle_type == 'anneal_cycle'"
},
"dry_time":
{
"label": "Drying Time",
"description": "Hold the bed temp at the 'Bed Start Out Temperature' for this amount of time (in decimal hours). When this time expires the bed will shut off.",
"type": "float",
"default_value": 4.0,
"unit": "Decimal Hrs ",
"enabled": "enable_script and cycle_type == 'dry_cycle'"
},
"pause_cmd":
{
"label": "Pause Cmd for Auto-Home",
"description": "Not required when you are paying attention and the bed is empty; ELSE; Enter the pause command to use prior to the Auto-Home command. The pause insures that the user IS paying attention and clears the build plate for Auto-Home. If you leave the box empty then there won't be a pause.",
"type": "str",
"default_value": "",
"enabled": "enable_script and cycle_type == 'dry_cycle'"
},
"startout_temp":
{
"label": "Bed Start Out Temperature:",
"description": "Enter the temperature to start at. This is typically the bed temperature during the print but can be changed here. This is also the temperature used when drying filament.",
"type": "int",
"value": 30,
"unit": "Degrees ",
"minimum_value": 30,
"maximum_value": 110,
"maximum_value_warning": 100,
"enabled": "enable_script"
},
"lowest_temp":
{
"label": "Shut-Off Temp:",
"description": "Enter the lowest temperature to control the cool down. This is the shut-off temperature for the build plate and (when applicable) the Heated Chamber. The minimum value is 30",
"type": "int",
"default_value": 30,
"unit": "Degrees ",
"minimum_value": 30,
"enabled": "enable_script and cycle_type == 'anneal_cycle'"
},
"build_volume_temp":
{
"label": "Build Volume Temperature:",
"description": "Enter the temperature for the Build Volume (Heated Chamber). This is typically the temperature during the print but can be changed here.",
"type": "int",
"value": 24,
"unit": "Degrees ",
"minimum_value": 0,
"maximum_value": 90,
"maximum_value_warning": 75,
"enabled": "enable_script and has_build_volume_heater and heating_zone_selection == 'bed_chamber'"
},
"enable_chamber_fan_setting":
{
"label": "Hidden Setting",
"description": "Enables chamber fan and speed.",
"type": "bool",
"default_value": false,
"enabled": false
},
"chamber_fan_speed":
{
"label": "Chamber Fan Speed",
"description": "Set to % fan speed. Set to 0 to turn it off.",
"type": "int",
"default_value": 0,
"minimum_value": 0,
"maximum_value": 100,
"unit": "% ",
"enabled": "enable_script and enable_chamber_fan_setting"
},
"time_span":
{
"label": "Cool Down Time Span:",
"description": "The total amount of time (in decimal hours) to control the cool down. The build plate temperature will be dropped in 3° increments across this time span. 'Cool Down Time' starts at the end of the 'Hold Time' if you entered one.",
"type": "float",
"default_value": 1.0,
"unit": "Decimal Hrs ",
"minimum_value_warning": 0.25,
"enabled": "enable_script and cycle_type == 'anneal_cycle'"
},
"park_head":
{
"label": "Park at MaxX and MaxY",
"description": "When unchecked, the park position is X0 Y0. Enable this setting to move the nozzle to the Max X and Max Y to allow access to the print.",
"type": "bool",
"default_value": false,
"enabled": "enable_script and cycle_type == 'anneal_cycle'"
},
"park_max_z":
{
"label": "Move to MaxZ",
"description": "Enable this setting to move the nozzle to 'Machine_Height - 20' to allow the print to be covered.",
"type": "bool",
"default_value": false,
"enabled": "enable_script and cycle_type == 'anneal_cycle'"
},
"beep_when_done":
{
"label": "Beep when done",
"description": "Add an annoying noise when the Cool Down completes.",
"type": "bool",
"default_value": true,
"enabled": "enable_script"
},
"beep_duration":
{
"label": "Beep Duration",
"description": "The length of the buzzer sound. Units are in milliseconds so 1000ms = 1 second.",
"type": "int",
"unit": "milliseconds ",
"default_value": 1000,
"enabled": "beep_when_done and enable_script"
},
"add_messages":
{
"label": "Include M117 and M118 messages",
"description": "Add messages to the LCD and any print server.",
"type": "bool",
"default_value": false,
"enabled": "enable_script"
},
"has_build_volume_heater":
{
"label": "Hidden setting",
"description": "Hidden. This setting enables the build volume settings.",
"type": "bool",
"default_value": false,
"enabled": false
}
}
}"""
def execute(self, data):
# Exit if there is no heated bed.
if not bool(self.global_stack.getProperty("machine_heated_bed", "value")):
Message(title = "[Anneal or Dry Filament]", text = "The script did not run because Heated Bed is disabled in Machine Settings.").show()
return data
# Enter a message in the gcode if the script is not enabled.
if not bool(self.getSettingValueByKey("enable_script")):
data[0] += "; [Anneal or Dry Filament] was not enabled\n"
return data
lowest_temp = int(self.getSettingValueByKey("lowest_temp"))
# If the shutoff temp is under 30° then exit as a safety precaution so the bed doesn't stay on.
if lowest_temp < 30:
data[0] += "; Anneal or Dry Filament did not run. Shutoff Temp < 30\n"
Message(title = "[Anneal or Dry Filament]", text = "The script did not run because the Shutoff Temp is less than 30°.").show()
return data
extruders = self.global_stack.extruderList
bed_temperature = int(self.getSettingValueByKey("startout_temp"))
heated_chamber = bool(self.global_stack.getProperty("machine_heated_build_volume", "value"))
heating_zone = self.getSettingValueByKey("heating_zone_selection")
# Get the heated chamber temperature or set to 0 if no chamber
if heated_chamber:
chamber_temp = str(self.getSettingValueByKey("build_volume_temp"))
else:
heating_zone = "bed_only"
chamber_temp = "0"
# Beep line
if bool(self.getSettingValueByKey("beep_when_done")):
beep_duration = self.getSettingValueByKey("beep_duration")
self.beep_string = f"M300 S440 P{beep_duration} ; Beep\n"
else:
self.beep_string = ""
# For compatibility with earlier Cura versions
if self.global_stack.getProperty("build_volume_fan_nr", "value") is not None:
has_bv_fan = bool(self.global_stack.getProperty("build_volume_fan_nr", "value"))
bv_fan_nr = int(self.global_stack.getProperty("build_volume_fan_nr", "value"))
if bv_fan_nr > 0:
speed_bv_fan = int(self.getSettingValueByKey("chamber_fan_speed"))
else:
speed_bv_fan = 0
if bool(extruders[0].getProperty("machine_scale_fan_speed_zero_to_one", "value")) and has_bv_fan:
speed_bv_fan = round(speed_bv_fan * 0.01)
else:
speed_bv_fan = round(speed_bv_fan * 2.55)
if has_bv_fan and speed_bv_fan > 0:
self.bv_fan_on_str = f"M106 S{speed_bv_fan} P{bv_fan_nr} ; Build Chamber Fan On\n"
self.bv_fan_off_str = f"M106 S0 P{bv_fan_nr} ; Build Chamber Fan Off\n"
else:
self.bv_fan_on_str = ""
self.bv_fan_off_str = ""
else:
has_bv_fan = False
bv_fan_nr = 0
speed_bv_fan = 0
self.bv_fan_on_str = ""
self.bv_fan_off_str = ""
# Park Head
max_y = str(self.global_stack.getProperty("machine_depth", "value"))
max_x = str(self.global_stack.getProperty("machine_width", "value"))
# Max_z is limited to 'machine_height - 20' just so the print head doesn't smack into anything.
max_z = str(int(self.global_stack.getProperty("machine_height", "value")) - 20)
speed_travel = str(round(extruders[0].getProperty("speed_travel", "value")*60))
park_xy = bool(self.getSettingValueByKey("park_head"))
park_z = bool(self.getSettingValueByKey("park_max_z"))
cycle_type = self.getSettingValueByKey("cycle_type")
add_messages = bool(self.getSettingValueByKey("add_messages"))
if cycle_type == "anneal_cycle":
data = self._anneal_print(add_messages, data, bed_temperature, chamber_temp, heated_chamber, heating_zone, lowest_temp, max_x, max_y, max_z, park_xy, park_z, speed_travel)
elif cycle_type == "dry_cycle":
data = self._dry_filament_only(data, bed_temperature, chamber_temp, heated_chamber, heating_zone, max_y, max_z, speed_travel)
return data
def _anneal_print(
self,
add_messages: bool,
anneal_data: str,
bed_temperature: int,
chamber_temp: str,
heated_chamber: bool,
heating_zone: str,
lowest_temp: int,
max_x: str,
max_y: str,
max_z: str,
park_xy: bool,
park_z: bool,
speed_travel: str) -> str:
"""
The procedure disables the M140 (and M141) lines at the end of the print, and adds additional bed (and chamber) temperature commands to the end of the G-Code file.
The bed is allowed to cool down over a period of time.
:param add_messages: Whether to include M117 and M118 messages for LCD and print server
:param anneal_data: The G-code data to be modified with annealing commands
:param bed_temperature: Starting bed temperature in degrees Celsius
:param chamber_temp: Chamber/build volume temperature in degrees Celsius as string
:param heated_chamber: Whether the printer has a heated build volume/chamber
:param heating_zone: Zone selection - "bed_only" or "bed_chamber"
:param lowest_temp: Final shutdown temperature in degrees Celsius
:param max_x: Maximum X axis position for parking as string
:param max_y: Maximum Y axis position for parking as string
:param max_z: Maximum Z axis position (machine height - 20mm) as string
:param park_xy: Whether to park the print head at max X and Y positions
:param park_z: Whether to raise Z to maximum safe height
:param speed_travel: Travel speed for positioning moves in mm/min as string
:return: Modified G-code data with annealing cooldown sequence
"""
# Put the head parking string together
bed_temp_during_print = int(self.global_stack.getProperty("material_bed_temperature", "value"))
time_minutes = 1
time_span = int(float(self.getSettingValueByKey("time_span")) * 3600)
park_string = ""
if park_xy:
park_string += f"G0 F{speed_travel} X{max_x} Y{max_y} ; Park XY\n"
if park_z:
park_string += f"G0 Z{max_z} ; Raise Z to 'ZMax - 20'\n"
if not park_xy and not park_z:
park_string += f"G91 ; Relative movement\nG0 F{speed_travel} Z5 ; Raise Z\nG90 ; Absolute movement\nG0 X0 Y0 ; Park\n"
park_string += "M84 X Y E ; Disable steppers except Z\n"
# Calculate the temperature differential
hysteresis = bed_temperature - lowest_temp
# Exit if the bed temp is below the shutoff temp
if hysteresis <= 0:
anneal_data[0] += "; Anneal or Dry Filament did not run. Bed Temp < Shutoff Temp\n"
Message(title = "Anneal or Dry Filament", text = "Did not run because the Bed Temp < Shutoff Temp.").show()
return anneal_data
# Drop the bed temperature in 3° increments.
num_steps = int(hysteresis / 3)
step_index = 2
deg_per_step = int(hysteresis / num_steps)
time_per_step = int(time_span / num_steps)
step_down = bed_temperature
wait_time = int(float(self.getSettingValueByKey("wait_time")) * 3600)
# Put the first lines of the anneal string together
anneal_string = ";\n;TYPE:CUSTOM ---------------- Anneal Print\n"
if bed_temperature == bed_temp_during_print:
anneal_string += self.beep_string
if add_messages:
anneal_string += "M117 Cool Down for " + str(round((wait_time + time_span)/3600,2)) + "hr\n"
anneal_string += "M118 Cool Down for " + str(round((wait_time + time_span)/3600,2)) + "hr\n"
anneal_string += self.bv_fan_on_str
if wait_time > 0:
# Add the parking string BEFORE the M190
anneal_string += park_string
if heating_zone == "bed_only":
anneal_string += f"M190 S{bed_temperature} ; Set the bed temp\n{self.beep_string}"
if heating_zone == "bed_chamber":
anneal_string += f"M190 S{bed_temperature} ; Set the bed temp\nM141 S{chamber_temp} ; Set the chamber temp\n{self.beep_string}"
anneal_string += f"G4 S{wait_time} ; Hold for {round(wait_time / 3600,2)} hrs\n"
else:
# Add the parking string AFTER the M140
anneal_string += f"M140 S{step_down} ; Set bed temp\n"
anneal_string += park_string
anneal_string += f"G4 S{time_per_step} ; wait time in seconds\n"
step_down -= deg_per_step
time_remaining = round(time_span/3600,2)
# Step the bed/chamber temps down and add each step to the anneal string. The chamber remains at it's temperature until the bed gets down to that temperature.
for num in range(bed_temperature, lowest_temp, -3):
anneal_string += f"M140 S{step_down} ; Step down bed\n"
if heating_zone == "bed_chamber" and int(step_down) < int(chamber_temp):
anneal_string += f"M141 S{step_down} ; Step down chamber\n"
anneal_string += f"G4 S{time_per_step} ; Wait\n"
if time_remaining >= 1.00:
if add_messages:
anneal_string += f"M117 CoolDown - {round(time_remaining,1)}hr\n"
anneal_string += f"M118 CoolDown - {round(time_remaining,1)}hr\n"
elif time_minutes > 0:
time_minutes = round(time_remaining * 60,1)
if add_messages:
anneal_string += f"M117 CoolDown - {time_minutes}min\n"
anneal_string += f"M118 CoolDown - {time_minutes}min\n"
time_remaining = round((time_span-(step_index*time_per_step))/3600,2)
step_down -= deg_per_step
step_index += 1
if step_down <= lowest_temp:
break
# Close out the anneal string
anneal_string += "M140 S0 ; Shut off the bed heater" + "\n"
if heating_zone == "bed_chamber":
anneal_string += "M141 S0 ; Shut off the chamber heater\n"
anneal_string += self.bv_fan_off_str
anneal_string += self.beep_string
if add_messages:
anneal_string += "M117 CoolDown Complete\n"
anneal_string += "M118 CoolDown Complete\n"
anneal_string += ";TYPE:CUSTOM ---------------- End of Anneal\n;"
# Format the inserted lines.
anneal_lines = anneal_string.split("\n")
for index, line in enumerate(anneal_lines):
if not line.startswith(";") and ";" in line:
front_txt = anneal_lines[index].split(";")[0]
back_txt = anneal_lines[index].split(";")[1]
anneal_lines[index] = front_txt + str(" " * (30 - len(front_txt))) +";" + back_txt
anneal_string = "\n".join(anneal_lines) + "\n"
end_gcode = anneal_data[-1]
end_lines = end_gcode.split("\n")
# Comment out the existing M140 S0 lines in the ending gcode.
for num in range(len(end_lines)-1,-1,-1):
if end_lines[num].startswith("M140 S0"):
end_lines[num] = ";M140 S0 ; Shutoff Overide - Anneal or Dry Filament"
anneal_data[-1] = "\n".join(end_lines)
# If there is a Heated Chamber and it's included then comment out the M141 S0 line
if heating_zone == "bed_chamber" and heated_chamber:
for num in range(0,len(end_lines)-1):
if end_lines[num].startswith("M141 S0"):
end_lines[num] = ";M141 S0 ; Shutoff Overide - Anneal or Dry Filament"
anneal_data[-1] = "\n".join(end_lines)
# If park head is enabled then dont let the steppers disable until the head is parked
disable_string = ""
for num in range(0,len(end_lines)-1):
if end_lines[num][:3] in ("M84", "M18"):
disable_string = end_lines[num] + "\n"
stepper_timeout = int(wait_time + time_span)
if stepper_timeout > 14400: stepper_timeout = 14400
end_lines[num] = ";" + end_lines[num] + " ; Overide - Anneal or Dry Filament"
end_lines.insert(num, "M84 S" + str(stepper_timeout) + " ; Increase stepper timeout - Anneal or Dry Filament")
anneal_data[-1] = "\n".join(end_lines)
break
# The Anneal string is the new end of the gcode so move the 'End of Gcode' comment line in case there are other scripts running
anneal_data[-1] = anneal_data[-1].replace(";End of Gcode", anneal_string + disable_string + ";End of Gcode")
return anneal_data
def _dry_filament_only(
self,
bed_temperature: int,
chamber_temp: int,
drydata: str,
heated_chamber: bool,
heating_zone: str,
max_y: str,
max_z: str,
speed_travel: str) -> str:
"""
This procedure turns the bed on, homes the printer, parks the head. After the time period the bed is turned off.
There is no actual print in the generated gcode, just a couple of moves to get the nozzle out of the way, and the bed heat (and possibly chamber heat) control.
It allows a user to use the bed to warm up and hopefully dry a filament roll.
:param bed_temperature: Bed temperature for drying in degrees Celsius
:param chamber_temp: Chamber/build volume temperature for drying in degrees Celsius
:param drydata: The G-code data to be replaced with filament drying commands
:param heated_chamber: Whether the printer has a heated build volume/chamber
:param heating_zone: Zone selection - "bed_only" or "bed_chamber"
:param max_y: Maximum Y axis position for parking as string
:param max_z: Maximum Z axis position (machine height - 20mm) as string
:param speed_travel: Travel speed for positioning moves in mm/min as string
:return: Modified G-code data containing only filament drying sequence
"""
for num in range(2, len(drydata)):
drydata[num] = ""
drydata[0] = drydata[0].split("\n")[0] + "\n"
add_messages = bool(self.getSettingValueByKey("add_messages"))
pause_cmd = self.getSettingValueByKey("pause_cmd")
if pause_cmd != "":
pause_cmd = self.beep_string + pause_cmd
dry_time = self.getSettingValueByKey("dry_time") * 3600
lines = drydata[1].split("\n")
drying_string = lines[0] + f"\n;............TYPE:CUSTOM: Dry Filament\n{self.beep_string}"
if add_messages:
drying_string += f"M117 Cool Down for {round(dry_time/3600,2)} hr ; Message\n"
drying_string += f"M118 Cool Down for {round(dry_time/3600,2)} hr ; Message\n"
# M113 sends messages to a print server as a 'Keep Alive' and can generate a lot of traffic over the USB
drying_string += "M113 S0 ; No echo\n"
drying_string += f"M84 S{round(dry_time)} ; Set stepper timeout\n"
drying_string += f"M140 S{bed_temperature} ; Heat bed\n"
drying_string += self.bv_fan_on_str
if heated_chamber and heating_zone == "bed_chamber":
drying_string += f"M141 S{chamber_temp} ; Chamber temp\n"
if pause_cmd == "M0":
pause_cmd = "M0 Clear bed and click...; Pause"
if pause_cmd != "":
drying_string += pause_cmd + " ; Pause\n"
drying_string += "G28 ; Auto-Home\n"
drying_string += f"G0 F{speed_travel} Z{max_z} ; Raise Z to 'ZMax - 20'\n"
drying_string += f"G0 F{speed_travel} X0 Y{max_y} ; Park print head\n"
if dry_time <= 3600:
if add_messages:
drying_string += f"M117 {dry_time/3600} hr remaining ; Message\n"
drying_string += f"M118 {dry_time/3600} hr remaining ; Message\n"
drying_string += f"G4 S{dry_time} ; Dry time\n"
elif dry_time > 3600:
temp_time = dry_time
while temp_time > 3600:
if add_messages:
drying_string += f"M117 {temp_time/3600} hr remaining ; Message\n"
drying_string += f"M118 {temp_time/3600} hr remaining ; Message\n"
drying_string += f"G4 S3600 ; Dry time split\n"
if temp_time > 3600:
temp_time -= 3600
if temp_time > 0:
if add_messages:
drying_string += f"M117 {temp_time/3600} hr remaining ; Message\n"
drying_string += f"M118 {temp_time/3600} hr remaining ; Message\n"
drying_string += f"G4 S{temp_time} ; Dry time\n"
if heated_chamber and heating_zone == "bed_chamber":
drying_string += f"M141 S0 ; Shut off chamber\n"
drying_string += "M140 S0 ; Shut off bed\n"
drying_string += self.bv_fan_off_str
if self.getSettingValueByKey("beep_when_done"):
beep_duration = self.getSettingValueByKey("beep_duration")
drying_string += self.beep_string
if add_messages:
drying_string += "M117 End of drying cycle ; Message\n"
drying_string += "M118 End of drying cycle ; Message\n"
drying_string += "M84 X Y E ; Disable steppers except Z\n"
drying_string += ";End of Gcode"
# Format the lines
lines = drying_string.split("\n")
for index, line in enumerate(lines):
if not line.startswith(";") and ";" in line:
front_txt = lines[index].split(";")[0]
back_txt = lines[index].split(";")[1]
lines[index] = front_txt + str(" " * (30 - len(front_txt))) +";" + back_txt
drydata[1] = "\n".join(lines) + "\n"
dry_txt = "; Drying time ...................... " + str(self.getSettingValueByKey("dry_time")) + " hrs\n"
dry_txt += "; Drying temperature ........ " + str(bed_temperature) + "°\n"
if heated_chamber and heating_zone == "bed_chamber":
dry_txt += "; Chamber temperature ... " + str(chamber_temp) + "°\n"
Message(title = "[Dry Filament]", text = dry_txt).show()
drydata[0] = "; <<< This is a filament drying file only. There is no actual print. >>>\n;\n" + dry_txt + ";\n"
return drydata

View file

@ -1,31 +1,36 @@
# Display Filename and Layer on the LCD by Amanda de Castilho on August 28, 2018
# 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.
"""
Display Filename and Layer on the LCD by Amanda de Castilho on August 28, 2018
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
Date: March 31, 2024 - Bug fix for problem with adding M118 lines if 'Remaining Time' was not checked.
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 uses the Time Fudge Factor. The user may enter a print start time.
Date: June 30, 2025 Cost of electricity added to the other print statistics in '_add_stats'.
"""
from ..Script import Script
from UM.Application import Application
@ -37,6 +42,19 @@ from UM.Message import Message
class DisplayInfoOnLCD(Script):
def initialize(self) -> None:
super().initialize()
try:
if Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value") == "all_at_once":
enable_countdown = True
self._instance.setProperty("enable_countdown", "value", enable_countdown)
except AttributeError:
# Handle cases where the global container stack or its properties are not accessible
pass
except KeyError:
# Handle cases where the "print_sequence" property is missing
pass
def getSettingDataString(self):
return """{
"name": "Display Info on LCD",
@ -77,7 +95,7 @@ class DisplayInfoOnLCD(Script):
"label": "Initial layer number:",
"description": "Choose which number you prefer for the initial layer, 0 or 1",
"type": "int",
"default_value": 0,
"default_value": 1,
"minimum_value": 0,
"maximum_value": 1,
"enabled": "display_option == 'filename_layer'"
@ -114,17 +132,40 @@ class DisplayInfoOnLCD(Script):
"default_value": true,
"enabled": "display_option == 'display_progress'"
},
"add_m117_line":
{
"label": "Add M117 Line",
"description": "M117 sends a message to the LCD screen. Some screen firmware will not accept or display messages.",
"type": "bool",
"default_value": true
},
"add_m118_line":
{
"label": "Add M118 Line",
"description": "Adds M118 in addition to the M117. It will bounce the message back through the USB port to a computer print server (if a printer server like Octoprint or Pronterface is in use).",
"type": "bool",
"default_value": false
"default_value": true
},
"add_m118_a1":
{
"label": " Add A1 to M118 Line",
"description": "Adds A1 parameter. A1 adds a double foreslash '//' to the response. Octoprint may require this.",
"type": "bool",
"default_value": false,
"enabled": "add_m118_line"
},
"add_m118_p0":
{
"label": " Add P0 to M118 Line",
"description": "Adds P0 parameter. P0 has the printer send the response out through all it's ports. Octoprint may require this.",
"type": "bool",
"default_value": false,
"enabled": "add_m118_line"
},
"add_m73_line":
{
"label": "Add M73 Line(s)",
"description": "Adds M73 in addition to the M117. For some firmware this will set the printers time and or percentage.",
"description": "Adds M73 in addition to the M117. For some firmware this will set the printers time and or percentage. M75 is added to the beginning of the file and M77 is added to the end of the file. M73 will be added if one or both of the following options is chosen.",
"type": "bool",
"default_value": false,
"enabled": "display_option == 'display_progress'"
@ -132,7 +173,7 @@ class DisplayInfoOnLCD(Script):
"add_m73_percent":
{
"label": " Add M73 Percentage",
"description": "Adds M73 with the P parameter. For some firmware this will set the printers 'percentage' of layers completed and it will count upward.",
"description": "Adds M73 with the P parameter to the start of each layer. For some firmware this will set the printers 'percentage' of layers completed and it will count upward.",
"type": "bool",
"default_value": false,
"enabled": "add_m73_line and display_option == 'display_progress'"
@ -140,10 +181,10 @@ class DisplayInfoOnLCD(Script):
"add_m73_time":
{
"label": " Add M73 Time",
"description": "Adds M73 with the R parameter. For some firmware this will set the printers 'print time' and it will count downward.",
"description": "Adds M73 with the R parameter to the start of each layer. For some firmware this will set the printers 'print time' and it will count downward.",
"type": "bool",
"default_value": false,
"enabled": "add_m73_line and display_option == 'display_progress'"
"enabled": "add_m73_line and display_option == 'display_progress' and display_remaining_time"
},
"speed_factor":
{
@ -154,13 +195,29 @@ class DisplayInfoOnLCD(Script):
"default_value": 100,
"enabled": "enable_end_message or display_option == 'display_progress'"
},
"enable_countdown":
{
"label": "Enable Countdown to Pauses",
"description": "If print sequence is 'one_at_a_time' this is false. This setting is always hidden.",
"type": "bool",
"value": false,
"enabled": false
},
"countdown_to_pause":
{
"label": "Countdown to Pauses",
"description": "Instead of the remaining print time the LCD will show the estimated time to pause (TP).",
"description": "This must run AFTER any script that adds a pause. Instead of the remaining print time the LCD will show the estimated time to the next layer that has a pause (TP). Countdown to Pause is not available when in One-at-a-Time' mode.",
"type": "bool",
"default_value": false,
"enabled": "display_option == 'display_progress'"
"enabled": "display_option == 'display_progress' and enable_countdown and display_remaining_time"
},
"pause_cmd":
{
"label": " What pause command(s) are used?",
"description": "This might be M0, or M25 or M600 if Filament Change is used. If you have mixed commands then delimit them with a comma ',' (Ex: M0,M600). Spaces are not allowed.",
"type": "str",
"default_value": "M0",
"enabled": "display_option == 'display_progress' and countdown_to_pause and enable_countdown and display_remaining_time"
},
"enable_end_message":
{
@ -173,11 +230,29 @@ class DisplayInfoOnLCD(Script):
"print_start_time":
{
"label": "Print Start Time (Ex 16:45)",
"description": "Use 'Military' time. 16:45 would be 4:45PM. 09:30 would be 9:30AM. If you leave this blank it will be assumed that the print will start Now. If you enter a guesstimate of your printer start time and that time is before 'Now' the guesstimate will consider that the print will start tomorrow at the entered time. ",
"description": "Use 'Military' time. 16:45 would be 4:45PM. 09:30 would be 9:30AM. If you leave this blank it will be assumed that the print will start Now. If you enter a guesstimate of your printer start time and that time is before 'Now' then the guesstimate will consider that the print will start tomorrow at the entered time. ",
"type": "str",
"default_value": "",
"unit": "hrs ",
"enabled": "enable_end_message"
},
"electricity_cost":
{
"label": "Electricity Cost per kWh",
"description": "Cost of electricity per kilowatt-hour. This should be on your electric utility bill.",
"type": "float",
"default_value": 0.151,
"minimum_value": 0,
"unit": "€/kWh "
},
"printer_power_usage":
{
"label": "Printer Power Usage",
"description": "Average power usage of the 3D printer in Watts. The actual wattage has many variables. 50% of the power supply rating would be a ballpark figure.",
"type": "float",
"default_value": 175,
"minimum_value": 0,
"unit": "Watts "
}
}
@ -185,239 +260,303 @@ class DisplayInfoOnLCD(Script):
def execute(self, data):
display_option = self.getSettingValueByKey("display_option")
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---------------------------------------------------------
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")
self.add_m118_p0 = self.getSettingValueByKey("add_m118_p0")
self.m118_text = "M118 "
self.add_m73_line = self.getSettingValueByKey("add_m73_line")
self.add_m73_time = self.getSettingValueByKey("add_m73_time")
self.add_m73_percent = self.getSettingValueByKey("add_m73_percent")
self.m73_str = ""
para_1 = data[0].split("\n")
for line in para_1:
if line.startswith(";TIME:") or line.startswith(";PRINT.TIME:"):
self.time_total = int(line.split(":")[1])
break
if display_option == "filename_layer":
max_layer = 0
lcd_text = "M117 "
if self.getSettingValueByKey("file_name") != "":
file_name = self.getSettingValueByKey("file_name")
else:
file_name = Application.getInstance().getPrintInformation().jobName
if self.getSettingValueByKey("addPrefixPrinting"):
lcd_text += "Printing "
if not self.getSettingValueByKey("scroll"):
lcd_text += "Layer "
else:
lcd_text += file_name + " - Layer "
i = self.getSettingValueByKey("startNum")
for layer in data:
display_text = lcd_text + str(i)
layer_index = data.index(layer)
lines = layer.split("\n")
for line in lines:
if line.startswith(";LAYER_COUNT:"):
max_layer = line
max_layer = max_layer.split(":")[1]
if self.getSettingValueByKey("startNum") == 0:
max_layer = str(int(max_layer) - 1)
if line.startswith(";LAYER:"):
if self.getSettingValueByKey("maxlayer"):
display_text = display_text + " of " + max_layer
if not self.getSettingValueByKey("scroll"):
display_text = display_text + " " + file_name
else:
if not self.getSettingValueByKey("scroll"):
display_text = display_text + " " + file_name + "!"
else:
display_text = display_text + "!"
line_index = lines.index(line)
lines.insert(line_index + 1, display_text)
if add_m118_line:
lines.insert(line_index + 2, str(display_text.replace("M117", "M118", 1)))
i += 1
final_lines = "\n".join(lines)
data[layer_index] = final_lines
if bool(self.getSettingValueByKey("enable_end_message")):
message_str = self.message_to_user(self.getSettingValueByKey("speed_factor") / 100)
Message(title = "Display Info on LCD - Estimated Finish Time", text = message_str[0] + "\n\n" + message_str[1] + "\n" + message_str[2] + "\n" + message_str[3]).show()
return data
data = self._display_filename_layer(data)
else:
data = self._display_progress(data)
return data
# 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")
# 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)
max_layer = 0
format_option = self.getSettingValueByKey("format_option")
lcd_text = "M117 "
octo_text = "M118 "
if self.getSettingValueByKey("file_name") != "":
file_name = self.getSettingValueByKey("file_name")
else:
file_name = Application.getInstance().getPrintInformation().jobName
if self.getSettingValueByKey("addPrefixPrinting"):
lcd_text += "Printing "
octo_text += "Printing "
if not format_option:
lcd_text += "Lay "
octo_text += "Layer "
else:
lcd_text += file_name + " - Layer "
octo_text += file_name + " - Layer "
i = self.getSettingValueByKey("startNum")
for layer in data:
display_text = lcd_text + str(i)
self.m118_text = octo_text + str(i)
layer_index = data.index(layer)
lines = layer.split("\n")
for line in lines:
if line.startswith(";TIME:"):
tindex = lines.index(line)
cura_time = int(line.split(":")[1])
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 = math.floor((orig_hhh % 1) * 60)
orig_sec = round((((orig_hhh % 1) * 60) % 1) * 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")
# add M73 line at beginning
mins = int(60 * hr + mmm)
if m73_time:
lines.insert(tindex + 3, "M73 R{}".format(mins))
if m73_percent:
lines.insert(tindex + 3, "M73 P0")
# If Countdonw to pause is enabled then count the pauses
pause_str = ""
if bool(self.getSettingValueByKey("countdown_to_pause")):
pause_count = 0
for num in range(2,len(data) - 1, 1):
if "PauseAtHeight.py" in data[num]:
pause_count += 1
pause_str = f" with {pause_count} pause(s)"
# This line goes in to convert seconds to hours and minutes
lines.insert(tindex + 3, f";Cura Time Estimate: {cura_time}sec = {orig_hr}hr {orig_mmm}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"
if not display_total_layers or not display_remaining_time:
base_display_text = "layer "
else:
base_display_text = ""
layer = data[len(data)-1]
data[len(data)-1] = layer.replace(";End of Gcode" + "\n", "")
data[len(data)-1] += ";End of Gcode" + "\n"
# Search for the number of layers and the total time from the start code
for index in range(len(data)):
data_section = data[index]
# We have everything we need, save the index of the first layer and exit the loop
if ";LAYER:" in data_section:
first_layer_index = index
break
else:
for line in data_section.split("\n"):
if line.startswith(";LAYER_COUNT:"):
number_of_layers = int(line.split(":")[1])
elif line.startswith(";TIME:"):
time_total = int(line.split(":")[1])
# for all layers...
current_layer = 0
for layer_counter in range(len(data)-2):
current_layer += 1
layer_index = first_layer_index + layer_counter
display_text = base_display_text
display_text += str(current_layer)
# create a list where each element is a single line of code within the layer
lines = data[layer_index].split("\n")
if not ";LAYER:" in data[layer_index]:
current_layer -= 1
continue
# add the total number of layers if this option is checked
if display_total_layers:
display_text += "/" + str(number_of_layers)
# if display_remaining_time is checked, it is calculated in this loop
if display_remaining_time:
time_remaining_display = " | ET " # initialize the time display
m = (time_total - time_elapsed) // 60 # estimated time in minutes
m *= speed_factor # correct for printing time
m = int(m)
h, m = divmod(m, 60) # convert to hours and minutes
# add the time remaining to the display_text
if h > 0: # if it's more than 1 hour left, display format = xhxxm
time_remaining_display += str(h) + "h"
if m < 10: # add trailing zero if necessary
time_remaining_display += "0"
time_remaining_display += str(m) + "m"
if line.startswith(";LAYER_COUNT:"):
max_layer = line
max_layer = max_layer.split(":")[1]
if self.getSettingValueByKey("startNum") == 0:
max_layer = str(int(max_layer) - 1)
if line.startswith(";LAYER:"):
if self.getSettingValueByKey("maxlayer"):
display_text += "/" + max_layer
self.m118_text += "/" + max_layer
if not format_option:
display_text += "|" + file_name
self.m118_text += " | " + file_name
else:
time_remaining_display += str(m) + "m"
display_text += time_remaining_display
# find time_elapsed at the end of the layer (used to calculate the remaining time of the next layer)
if not current_layer == number_of_layers:
for line_index in range(len(lines) - 1, -1, -1):
line = lines[line_index]
if line.startswith(";TIME_ELAPSED:"):
# update time_elapsed for the NEXT layer and exit the loop
time_elapsed = int(float(line.split(":")[1]))
break
# insert the text AFTER the first line of the layer (in case other scripts use ";LAYER:")
for l_index, line in enumerate(lines):
if line.startswith(";LAYER:"):
if not format_option:
display_text += "|" + file_name + "!"
self.m118_text += " | " + file_name + "!"
else:
display_text += "!"
self.m118_text += "!"
line_index = lines.index(line)
if self.add_m117_line:
lines.insert(line_index + 1, display_text)
if self.add_m118_line:
if self.add_m118_a1:
self.m118_text = self.m118_text.replace("M118 ","M118 A1 ")
if self.add_m118_p0:
self.m118_text = self.m118_text.replace("M118 ","M118 P0 ")
lines.insert(line_index + 2, self.m118_text)
i += 1
final_lines = "\n".join(lines)
data[layer_index] = final_lines
if bool(self.getSettingValueByKey("enable_end_message")):
message_str = self._message_to_user(self.getSettingValueByKey("speed_factor") / 100)
Message(title = "Display Info on LCD - Estimated Finish Time", text = message_str[0] + "\n\n" + message_str[1] + "\n" + message_str[2] + "\n" + message_str[3]).show()
return data
# This is from 'Show Progress on LCD'
def _display_progress(self, data: str) -> str:
# Add some common print settings to the start of the gcode
data[0] = self._add_stats(data)
# Get settings
print_sequence = Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value")
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 self.add_m73_line and self.add_m73_time:
m73_time = True
if self.add_m73_line and self.add_m73_percent:
m73_percent = True
if self.add_m73_line:
data[1] = "M75\n" + data[1]
data[len(data)-1] += "M77\n"
# Initialize some variables
first_layer_index = 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")
pause_cmd = []
for line in lines:
if line.startswith(";TIME:"):
tindex = lines.index(line)
cura_time = int(line.split(":")[1])
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 = math.floor((orig_hhh % 1) * 60)
if self.add_m118_line:
lines.insert(len(lines) - 2, f"M118 Adjusted Print Time is {hr} hr {mmm} min")
if self.add_m117_line:
lines.insert(len(lines) - 2, f"M117 ET {hr} hr {mmm} min")
# Add M73 line at beginning
mins = int(60 * hr + mmm)
if self.add_m73_line and (self.add_m73_time or self.add_m73_percent):
if m73_time:
self.m73_str += " R{}".format(mins)
if m73_percent:
self.m73_str += " P0"
lines.insert(tindex + 4, "M73" + self.m73_str)
# If Countdown to pause is enabled then count the pauses
pause_str = ""
if bool(self.getSettingValueByKey("countdown_to_pause")):
pause_count = 0
pause_setting = self.getSettingValueByKey("pause_cmd").upper()
if pause_setting != "":
pause_cmd = []
if "," in pause_setting:
pause_cmd = pause_setting.split(",")
else:
pause_cmd.append(pause_setting)
for q in range(0, len(pause_cmd)):
pause_cmd[q] = "\n" + pause_cmd[q]
for num in range(2,len(data) - 2, 1):
for q in range(0,len(pause_cmd)):
if pause_cmd[q] in data[num]:
pause_count += data[num].count(pause_cmd[q], 0, len(data[num]))
pause_str = f"with {pause_count} pause" + ("s" if pause_count > 1 else "")
else:
pause_str = ""
# This line goes in to convert seconds to hours and minutes
lines.insert(tindex + 1, f";Cura Time Estimate: {orig_hr}hr {orig_mmm}min {pause_str}")
data[0] = "\n".join(lines)
if self.add_m117_line:
data[len(data)-1] += "M117 Orig Cura Est " + str(orig_hr) + "hr " + str(orig_mmm) + "min\n"
if self.add_m118_line:
data[len(data)-1] += "M118 Est w/FudgeFactor " + str(speed_factor * 100) + "% was " + str(hr) + "hr " + str(mmm) + "min\n"
if not display_total_layers or not display_remaining_time:
base_display_text = "layer "
else:
base_display_text = ""
layer = data[len(data)-1]
data[len(data)-1] = layer.replace(";End of Gcode" + "\n", "")
data[len(data)-1] += ";End of Gcode" + "\n"
# Search for the number of layers and the total time from the start code
for index in range(len(data)):
data_section = data[index]
# We have everything we need, save the index of the first layer and exit the loop
if ";LAYER:" in data_section:
first_layer_index = index
break
else:
for line in data_section.split("\n"):
if line.startswith(";LAYER_COUNT:"):
number_of_layers = int(line.split(":")[1])
if print_sequence == "one_at_a_time":
number_of_layers = 1
for lay in range(2,len(data)-1,1):
if ";LAYER:" in data[lay]:
number_of_layers += 1
# for all layers...
current_layer = 0
for layer_counter in range(len(data)-2):
current_layer += 1
layer_index = first_layer_index + layer_counter
display_text = base_display_text
display_text += str(current_layer)
# create a list where each element is a single line of code within the layer
lines = data[layer_index].split("\n")
if not ";LAYER:" in data[layer_index]:
current_layer -= 1
continue
# add the total number of layers if this option is checked
if display_total_layers:
display_text += "/" + str(number_of_layers)
# if display_remaining_time is checked, it is calculated in this loop
if display_remaining_time:
time_remaining_display = " | ET " # initialize the time display
m = (self.time_total - time_elapsed) // 60 # estimated time in minutes
m *= speed_factor # correct for printing time
m = int(m)
h, m = divmod(m, 60) # convert to hours and minutes
# add the time remaining to the display_text
if h > 0: # if it's more than 1 hour left, display format = xhxxm
time_remaining_display += str(h) + "h"
if m < 10: # add trailing zero if necessary
time_remaining_display += "0"
time_remaining_display += str(m) + "m"
else:
time_remaining_display += str(m) + "m"
display_text += time_remaining_display
# find time_elapsed at the end of the layer (used to calculate the remaining time of the next layer)
if not current_layer == number_of_layers:
for line_index in range(len(lines) - 1, -1, -1):
line = lines[line_index]
if line.startswith(";TIME_ELAPSED:"):
# update time_elapsed for the NEXT layer and exit the loop
time_elapsed = int(float(line.split(":")[1]))
break
# insert the text AFTER the first line of the layer (in case other scripts use ";LAYER:")
for l_index, line in enumerate(lines):
if line.startswith(";LAYER:"):
if self.add_m117_line:
lines[l_index] += "\nM117 " + display_text
# add M73 line
if self.add_m118_line:
m118_text = "\nM118 "
if self.add_m118_a1:
m118_text += "A1 "
if self.add_m118_p0:
m118_text += "P0 "
lines[l_index] += m118_text + display_text
# add M73 line
if display_remaining_time:
mins = int(60 * h + m)
if m73_time:
lines[l_index] += "\nM73 R{}".format(mins)
if self.add_m73_line and (self.add_m73_time or self.add_m73_percent):
self.m73_str = ""
if m73_time and display_remaining_time:
self.m73_str += " R{}".format(mins)
if m73_percent:
lines[l_index] += "\nM73 P" + str(round(int(current_layer) / int(number_of_layers) * 100))
if add_m118_line:
lines[l_index] += "\nM118 " + display_text
break
# overwrite the layer with the modified layer
data[layer_index] = "\n".join(lines)
self.m73_str += " P" + str(round(int(current_layer) / int(number_of_layers) * 100))
lines[l_index] += "\nM73" + self.m73_str
break
# overwrite the layer with the modified layer
data[layer_index] = "\n".join(lines)
# If enabled then change the ET to TP for 'Time To Pause'
if bool(self.getSettingValueByKey("countdown_to_pause")):
time_list = []
time_list.append("0")
time_list.append("0")
this_time = 0
pause_index = 1
time_list = []
if bool(self.getSettingValueByKey("countdown_to_pause")):
time_list.append("0")
time_list.append("0")
this_time = 0
pause_index = 1
# Get the layer times
for num in range(2,len(data) - 1):
layer = data[num]
lines = layer.split("\n")
for line in lines:
if line.startswith(";TIME_ELAPSED:"):
this_time = (float(line.split(":")[1]))*speed_factor
time_list.append(str(this_time))
if "PauseAtHeight.py" in layer:
# Get the layer times
for num in range(2,len(data) - 1):
layer = data[num]
lines = layer.split("\n")
for line in lines:
if line.startswith(";TIME_ELAPSED:"):
this_time = (float(line.split(":")[1]))*speed_factor
time_list.append(str(this_time))
for p_cmd in pause_cmd:
if p_cmd 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
break
# Make the adjustments to the M117 (and M118) lines that are prior to a pause
for num in range (2, len(data) - 1,1):
layer = data[num]
lines = layer.split("\n")
for line in lines:
# Make the adjustments to the M117 (and M118) lines that are prior to a pause
for num in range (2, len(data) - 1,1):
layer = data[num]
lines = layer.split("\n")
for line in lines:
try:
if line.startswith("M117") and "|" in line and "P" in time_list[num]:
M117_line = line.split("|")[0] + "| TP "
alt_time = time_list[num][:-1]
hhh = int(float(alt_time) / 3600)
if hhh > 0:
hhr = str(hhh) + "h"
else:
hhr = ""
mmm = ((float(alt_time) / 3600) - (int(float(alt_time) / 3600))) * 60
sss = int((mmm - int(mmm)) * 60)
mmm = str(round(mmm)) + "m"
time_to_go = str(hhr) + str(mmm)
if hhr == "": time_to_go = time_to_go + str(sss) + "s"
M117_line = M117_line + time_to_go
time_to_go = self._get_time_to_go(time_list[num])
M117_line = line.split("|")[0] + "| TP " + time_to_go
layer = layer.replace(line, M117_line)
if line.startswith("M118") and "|" in line and "P" in time_list[num]:
time_to_go = self._get_time_to_go(time_list[num])
M118_line = line.split("|")[0] + "| TP " + time_to_go
layer = layer.replace(line, M118_line)
data[num] = layer
setting_data = ""
if bool(self.getSettingValueByKey("enable_end_message")):
message_str = self.message_to_user(speed_factor)
Message(title = "[Display Info on LCD] - Estimated Finish Time", text = message_str[0] + "\n\n" + message_str[1] + "\n" + message_str[2] + "\n" + message_str[3]).show()
except:
continue
data[num] = layer
if bool(self.getSettingValueByKey("enable_end_message")):
message_str = self._message_to_user(data, speed_factor, pause_cmd)
Message(title = "[Display Info on LCD] - Estimated Finish Time", text = message_str[0] + "\n\n" + message_str[1] + "\n" + message_str[2] + "\n" + message_str[3]).show()
return data
def message_to_user(self, speed_factor: float):
# Message the user of the projected finish time of the print
def _message_to_user(self, data: str, speed_factor: float, pause_cmd: str) -> str:
"""
Message the user of the projected finish time of the print and when any pauses might occur
"""
print_time = Application.getInstance().getPrintInformation().currentPrintTime.getDisplayString(DurationFormat.Format.ISO8601)
print_start_time = self.getSettingValueByKey("print_start_time")
# If the user entered a print start time make sure it is in the correct format or ignore it.
@ -476,8 +615,97 @@ class DisplayInfoOnLCD(Script):
if print_start_time != "":
print_start_str = "Print Start Time................." + str(print_start_time) + "hrs"
else:
print_start_str = "Print Start Time.................Now."
print_start_str = "Print Start Time.................Now"
estimate_str = "Cura Time Estimate.........." + str(print_time)
adjusted_str = "Adjusted Time Estimate..." + str(time_change)
finish_str = week_day + " " + str(mo_str) + " " + str(new_time.strftime("%d")) + ", " + str(new_time.strftime("%Y")) + " at " + str(show_hr) + str(new_time.strftime("%M")) + str(show_ampm)
return finish_str, estimate_str, adjusted_str, print_start_str
finish_str = f"{week_day} {mo_str} {new_time.strftime('%d')}, {new_time.strftime('%Y')} at {show_hr}{new_time.strftime('%M')}{show_ampm}"
# If there are pauses and if countdown is enabled, then add the time-to-pause to the message.
if bool(self.getSettingValueByKey("countdown_to_pause")):
num = 1
for layer in data:
for p_cmd in pause_cmd:
if p_cmd in layer or "Do the actual pause" in layer:
adjusted_str += "\n" + self._get_time_to_go(layer.split("TIME_ELAPSED:")[1].split("\n")[0]) + " ET from start to pause #" + str(num)
num += 1
return finish_str, estimate_str, adjusted_str, print_start_str
def _get_time_to_go(self, time_str: str):
"""
Converts a time string in seconds to a human-readable format (e.g., "2h30m").
:param time_str: The time string in seconds.
:return: A formatted string representing the time.
"""
alt_time = time_str[:-1]
total_seconds = float(alt_time)
hours = int(total_seconds // 3600)
minutes = int((total_seconds % 3600) // 60)
seconds = int(total_seconds % 60)
time_to_go = f"{hours}h" if hours > 0 else ""
time_to_go += f"{minutes}m"
if hours == 0:
time_to_go += f"{seconds}s"
return time_to_go
def _add_stats(self, data: str) -> str:
global_stack = Application.getInstance().getGlobalContainerStack()
"""
Make a list of the models in the file.
Add some of the filament stats to the first section of the gcode.
"""
model_list = []
for mdex, layer in enumerate(data):
layer = data[mdex].split("\n")
for line in layer:
if line.startswith(";MESH:") and "NONMESH" not in line:
model_name = line.split(":")[1]
if not model_name in model_list:
model_list.append(model_name)
# Filament stats
extruder_count = global_stack.getProperty("machine_extruder_count", "value")
layheight_0 = global_stack.getProperty("layer_height_0", "value")
init_layer_hgt_line = ";Initial Layer Height: " + f"{layheight_0:.2f}".format(layheight_0)
filament_line_t0 = ";Extruder 1 (T0)\n"
filament_amount = Application.getInstance().getPrintInformation().materialLengths
filament_line_t0 += f"; Filament used: {filament_amount[0]}m\n"
filament_line_t0 += f"; Filament Type: {global_stack.extruderList[0].material.getMetaDataEntry("material", "")}\n"
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")}°\n"
filament_line_t0 += f"; Bed Temp. : {global_stack.extruderList[0].getProperty("material_bed_temperature", "value")}°"
# if there is more than one extruder then get the stats for the second one.
filament_line_t1 = ""
if extruder_count > 1:
filament_line_t1 = "\n;Extruder 2 (T1)\n"
filament_line_t1 += f"; Filament used: {filament_amount[1]}m\n"
filament_line_t1 += f"; Filament Type: {global_stack.extruderList[1].material.getMetaDataEntry("material", "")}\n"
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")}°"
# Calculate the cost of electricity for the print
electricity_cost = self.getSettingValueByKey("electricity_cost")
printer_power_usage = self.getSettingValueByKey("printer_power_usage")
currency_unit = Application.getInstance().getPreferences().getValue("cura/currency")
total_cost_electricity = (printer_power_usage / 1000) * (self.time_total / 3600) * electricity_cost
# Add the stats to the gcode file
lines = data[0].split("\n")
for index, line in enumerate(lines):
if line.startswith(";Layer height:") or line.startswith(";TARGET_MACHINE.NAME:"):
lines[index] = ";Layer height: " + f"{global_stack.getProperty("layer_height", "value")}"
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 + f"\n;Electric Cost: {currency_unit}{total_cost_electricity:.2f}".format(total_cost_electricity)
# The target machine "machine_name" is actually the printer model. This adds the user defined printer name to the "TARGET_MACHINE" line.
if line.startswith(";TARGET_MACHINE"):
machine_model = str(global_stack.getProperty("machine_name", "value"))
machine_name = str(global_stack.getName())
lines[index] += f" / {machine_name}"
if "MINX" in line or "MIN.X" in line:
# Add the Object List
lines[index - 1] += f"\n;Model List: {str(model_list)}"
return "\n".join(lines)

View file

@ -1681,7 +1681,7 @@
"maximum_value": "999999",
"type": "int",
"minimum_value_warning": "2",
"value": "0 if infill_sparse_density == 100 else math.ceil(round(top_thickness / resolveOrValue('layer_height'), 4))",
"value": "math.ceil(round(top_thickness / resolveOrValue('layer_height'), 4))",
"limit_to_extruder": "top_bottom_extruder_nr",
"settable_per_mesh": true
}
@ -1711,7 +1711,7 @@
"default_value": 6,
"maximum_value": "999999",
"type": "int",
"value": "999999 if infill_sparse_density == 100 and not magic_spiralize else math.ceil(round(bottom_thickness / resolveOrValue('layer_height'), 4))",
"value": "math.ceil(round(bottom_thickness / resolveOrValue('layer_height'), 4))",
"limit_to_extruder": "top_bottom_extruder_nr",
"settable_per_mesh": true
},
@ -4568,7 +4568,7 @@
"minimum_value_warning": "-0.0001",
"maximum_value_warning": "10.0",
"enabled": "retraction_enable and machine_gcode_flavor != \"UltiGCode\"",
"settable_per_mesh": false,
"settable_per_mesh": true,
"settable_per_extruder": true
},
"retraction_speed":
@ -4658,7 +4658,7 @@
"maximum_value": 999999999,
"type": "int",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_mesh": true,
"settable_per_extruder": true
},
"retraction_extrusion_window":
@ -4672,7 +4672,7 @@
"maximum_value_warning": "retraction_amount * 2",
"value": "retraction_amount",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_mesh": true,
"settable_per_extruder": true
},
"retraction_combing":

View file

@ -16,7 +16,6 @@
{
"acceleration_layer_0": { "value": "acceleration_topbottom" },
"acceleration_travel_enabled": { "value": false },
"bottom_layers": { "value": "math.ceil(round(bottom_thickness / resolveOrValue('layer_height'), 4))" },
"bridge_enable_more_layers": { "value": false },
"bridge_fan_speed": { "value": "cool_fan_speed_max" },
"bridge_fan_speed_2": { "value": "cool_fan_speed_min" },
@ -219,7 +218,6 @@
"support_wall_count": { "value": "1 if support_structure == 'tree' else 0" },
"support_xy_distance_overhang": { "value": "0.2" },
"support_z_distance": { "value": "0" },
"top_layers": { "value": "math.ceil(round(top_thickness / resolveOrValue('layer_height'), 4))" },
"wall_0_material_flow_layer_0": { "value": "1.10 * material_flow_layer_0" },
"wall_thickness": { "value": "wall_line_width_0 + wall_line_width_x" },
"wall_x_material_flow_layer_0": { "value": "0.95 * material_flow_layer_0" },

View file

@ -98,7 +98,7 @@
{
"maximum_value": "machine_max_acceleration_x",
"maximum_value_warning": "machine_max_acceleration_x*0.8",
"value": "acceleration_wall_0"
"value": "acceleration_topbottom / 2"
},
"acceleration_skirt_brim":
{
@ -199,15 +199,19 @@
},
"adhesion_type": { "value": "'brim' if support_enable and support_structure=='tree' else 'skirt'" },
"bottom_thickness": { "value": "3*layer_height if top_layers==4 and not support_enable else top_bottom_thickness" },
"bridge_skin_material_flow": { "value": 200 },
"bridge_enable_more_layers": { "value": true },
"bridge_skin_density": { "value": 70 },
"bridge_skin_material_flow": { "value": 150 },
"bridge_skin_material_flow_2": { "value": 70 },
"bridge_skin_speed":
{
"unit": "mm/s",
"value": "bridge_wall_speed"
"value": 35
},
"bridge_skin_speed_2": { "value": "speed_print*2/3" },
"bridge_sparse_infill_max_density": { "value": 50 },
"bridge_wall_material_flow": { "value": "bridge_skin_material_flow" },
"bridge_wall_min_length": { "value": 10 },
"bridge_wall_material_flow": { "value": 200 },
"bridge_wall_min_length": { "value": 2 },
"bridge_wall_speed":
{
"unit": "mm/s",
@ -221,23 +225,26 @@
]
},
"cool_during_extruder_switch": { "value": "'all_fans'" },
"cool_min_layer_time": { "value": 5 },
"cool_min_layer_time_overhang": { "value": 9 },
"cool_min_layer_time_overhang_min_segment_length": { "value": 2 },
"cool_min_layer_time": { "value": 6 },
"cool_min_layer_time_overhang": { "value": 11 },
"cool_min_layer_time_overhang_min_segment_length": { "value": 1.5 },
"cool_min_speed": { "value": 6 },
"cool_min_temperature":
{
"minimum_value_warning": "material_print_temperature-15",
"minimum_value_warning": "material_print_temperature-20",
"value": "material_print_temperature-15"
},
"default_material_print_temperature": { "maximum_value_warning": 320 },
"extra_infill_lines_to_support_skins": { "value": "'walls_and_lines'" },
"flooring_layer_count": { "value": 1 },
"gradual_flow_enabled": { "value": false },
"flooring_material_flow": { "value": "skin_material_flow * 110/93" },
"flooring_monotonic": { "value": false },
"gradual_flow_discretisation_step_size": { "value": 1 },
"gradual_flow_enabled": { "value": true },
"hole_xy_offset": { "value": 0.075 },
"infill_material_flow": { "value": "material_flow" },
"infill_material_flow": { "value": "material_flow if infill_sparse_density < 95 else 95" },
"infill_overlap": { "value": 10 },
"infill_pattern": { "value": "'zigzag' if infill_sparse_density > 80 else 'grid'" },
"infill_pattern": { "value": "'zigzag' if infill_sparse_density > 50 else 'grid'" },
"infill_sparse_density": { "value": 15 },
"infill_wall_line_count": { "value": "1 if infill_sparse_density > 80 else 0" },
"initial_bottom_layers": { "value": 2 },
@ -281,7 +288,7 @@
{
"maximum_value_warning": "machine_max_jerk_xy / 2",
"unit": "m/s\u00b3",
"value": "jerk_wall_0"
"value": "jerk_print"
},
"jerk_skirt_brim":
{
@ -424,7 +431,7 @@
},
"material_print_temperature": { "maximum_value_warning": 320 },
"material_print_temperature_layer_0": { "maximum_value_warning": 320 },
"max_flow_acceleration": { "value": 8.0 },
"max_flow_acceleration": { "value": 1.5 },
"max_skin_angle_for_expansion": { "value": 45 },
"meshfix_maximum_resolution": { "value": 0.4 },
"min_infill_area": { "default_value": 10 },
@ -438,11 +445,15 @@
"retraction_hop": { "value": 1 },
"retraction_hop_after_extruder_switch_height": { "value": 2 },
"retraction_hop_enabled": { "value": true },
"retraction_min_travel": { "value": "5 if support_enable and support_structure=='tree' else line_width * 2.5" },
"retraction_min_travel": { "value": "2.5 if support_enable and support_structure=='tree' else line_width * 2.5" },
"retraction_prime_speed": { "value": 15 },
"roofing_monotonic": { "value": false },
"roofing_pattern": { "value": "'zigzag'" },
"seam_overhang_angle": { "value": 35 },
"skin_edge_support_thickness": { "value": 0 },
"skin_material_flow": { "value": 95 },
"skin_overlap": { "value": 0 },
"skin_material_flow": { "value": 93 },
"skin_outline_count": { "value": 0 },
"skin_overlap": { "value": 20 },
"skin_preshrink": { "value": 0 },
"skirt_brim_minimal_length": { "value": 1000 },
"skirt_brim_speed":
@ -538,12 +549,12 @@
"speed_wall":
{
"maximum_value_warning": 300,
"value": "speed_print*2/3"
"value": "speed_print*1/2"
},
"speed_wall_0":
{
"maximum_value_warning": 300,
"value": "speed_wall"
"value": "speed_wall*60/75"
},
"speed_wall_0_flooring":
{
@ -571,38 +582,46 @@
"value": "speed_wall"
},
"support_angle": { "value": 60 },
"support_bottom_distance": { "maximum_value_warning": "3*layer_height" },
"support_bottom_distance":
{
"maximum_value_warning": "3*layer_height",
"value": "support_z_distance"
},
"support_bottom_offset": { "value": 0 },
"support_brim_width": { "value": 10 },
"support_interface_enable": { "value": true },
"support_interface_offset": { "value": "support_offset" },
"support_line_width": { "value": "1.25*line_width" },
"support_offset": { "value": "1.2 if support_structure == 'tree' else 0.8" },
"support_offset": { "value": 0.8 },
"support_pattern": { "value": "'gyroid' if support_structure == 'tree' else 'lines'" },
"support_roof_height": { "minimum_value_warning": 0 },
"support_structure": { "value": "'normal'" },
"support_top_distance": { "maximum_value_warning": "3*layer_height" },
"support_tree_angle": { "value": 50 },
"support_tree_angle_slow": { "value": 35 },
"support_tree_bp_diameter": { "value": 15 },
"support_tree_branch_diameter": { "value": 8 },
"support_tree_tip_diameter": { "value": 1.0 },
"support_tree_top_rate": { "value": 20 },
"support_xy_distance_overhang": { "value": "machine_nozzle_size" },
"support_z_distance": { "value": "0.4*material_shrinkage_percentage_z/100.0" },
"top_bottom_thickness": { "value": "round(4*layer_height, 2)" },
"support_tree_bp_diameter": { "value": 20 },
"support_tree_branch_diameter": { "value": 5 },
"support_tree_branch_diameter_angle": { "value": 5 },
"support_tree_max_diameter": { "value": 15 },
"support_tree_tip_diameter": { "value": 2.0 },
"support_tree_top_rate": { "value": 10 },
"support_xy_distance": { "value": 1.2 },
"support_xy_distance_overhang": { "value": "1.5*machine_nozzle_size" },
"support_z_distance": { "value": "2*layer_height" },
"top_bottom_thickness": { "value": "wall_thickness" },
"travel_avoid_other_parts": { "value": true },
"travel_avoid_supports": { "value": true },
"wall_0_acceleration": { "value": 1000 },
"wall_0_deceleration": { "value": 1000 },
"wall_0_end_speed_ratio": { "value": 100 },
"wall_0_inset": { "value": 0.05 },
"wall_0_speed_split_distance": { "value": 0.2 },
"wall_0_start_speed_ratio": { "value": 100 },
"wall_0_wipe_dist": { "value": 0 },
"wall_material_flow": { "value": 95 },
"wall_overhang_angle": { "value": 45 },
"wall_x_material_flow": { "value": 100 },
"xy_offset": { "value": 0.05 },
"xy_offset": { "value": 0.075 },
"z_seam_corner": { "value": "'z_seam_corner_weighted'" },
"z_seam_position": { "value": "'backright'" },
"z_seam_type": { "value": "'sharpest_corner'" }

View file

@ -75,10 +75,6 @@
"Extrudr_GreenTECPro_Silver_175",
"Extrudr_GreenTECPro_White_175",
"verbatim_bvoh_175",
"Vertex_Delta_ABS",
"Vertex_Delta_PET",
"Vertex_Delta_PLA",
"Vertex_Delta_TPU",
"chromatik_pla",
"dsm_arnitel2045_175",
"dsm_novamid1070_175",
@ -186,9 +182,7 @@
"machine_extruder_trains": { "0": "zyyx_plus_extruder_0" },
"machine_x3g_variant": "z",
"preferred_material": "generic_pla",
"preferred_quality_type": "normal",
"quality_definition": "zyyx_plus",
"setting_version": 3
"preferred_quality_type": "normal"
},
"overrides":
{

View file

@ -73,10 +73,6 @@
"Extrudr_GreenTECPro_Silver_175",
"Extrudr_GreenTECPro_White_175",
"verbatim_bvoh_175",
"Vertex_Delta_ABS",
"Vertex_Delta_PET",
"Vertex_Delta_PLA",
"Vertex_Delta_TPU",
"chromatik_pla",
"dsm_arnitel2045_175",
"dsm_novamid1070_175",
@ -185,8 +181,6 @@
"machine_x3g_variant": "z",
"preferred_material": "generic_pla",
"preferred_variant_name": "Carbon0.6",
"quality_definition": "zyyx_pro",
"setting_version": 3,
"variants_name": "SwiftTool"
},
"overrides":

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -0,0 +1,27 @@
[general]
definition = ultimaker_s8
name = Quick
version = 4
[metadata]
intent_category = quick
material = generic_abs
quality_type = draft
setting_version = 25
type = intent
variant = AA+ 0.4
[values]
cool_min_layer_time = 5
cool_min_layer_time_overhang = 9
cool_min_speed = 6
cool_min_temperature = =material_print_temperature - 15
gradual_flow_enable = False
hole_xy_offset = 0.075
inset_direction = outside-in
speed_wall = =speed_print
speed_wall_x = =speed_print
speed_wall_x_roofing = =speed_wall
wall_line_width_x = =wall_line_width
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -0,0 +1,27 @@
[general]
definition = ultimaker_s8
name = Quick
version = 4
[metadata]
intent_category = quick
material = generic_petg
quality_type = draft
setting_version = 25
type = intent
variant = AA+ 0.4
[values]
cool_min_layer_time = 5
cool_min_layer_time_overhang = 9
cool_min_speed = 6
cool_min_temperature = =material_print_temperature - 15
gradual_flow_enable = False
hole_xy_offset = 0.075
inset_direction = outside-in
speed_wall = =speed_print
speed_wall_x = =speed_print
speed_wall_x_roofing = =speed_wall
wall_line_width_x = =wall_line_width
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -0,0 +1,27 @@
[general]
definition = ultimaker_s8
name = Quick
version = 4
[metadata]
intent_category = quick
material = generic_pla
quality_type = draft
setting_version = 25
type = intent
variant = AA+ 0.4
[values]
cool_min_layer_time = 5
cool_min_layer_time_overhang = 9
cool_min_speed = 6
cool_min_temperature = =material_print_temperature - 15
gradual_flow_enable = False
hole_xy_offset = 0.075
inset_direction = outside-in
speed_wall = =speed_print
speed_wall_x = =speed_print
speed_wall_x_roofing = =speed_wall
wall_line_width_x = =wall_line_width
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = AA+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -0,0 +1,27 @@
[general]
definition = ultimaker_s8
name = Quick
version = 4
[metadata]
intent_category = quick
material = generic_tough_pla
quality_type = draft
setting_version = 25
type = intent
variant = AA+ 0.4
[values]
cool_min_layer_time = 5
cool_min_layer_time_overhang = 9
cool_min_speed = 6
cool_min_temperature = =material_print_temperature - 15
gradual_flow_enable = False
hole_xy_offset = 0.075
inset_direction = outside-in
speed_wall = =speed_print
speed_wall_x = =speed_print
speed_wall_x_roofing = =speed_wall
wall_line_width_x = =wall_line_width
xy_offset = 0.075

View file

@ -13,7 +13,10 @@ type = intent
variant = CC+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -13,7 +13,10 @@ type = intent
variant = CC+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -13,7 +13,10 @@ type = intent
variant = CC+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -13,7 +13,10 @@ type = intent
variant = CC+ 0.4
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = CC+ 0.6
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -12,7 +12,10 @@ type = intent
variant = CC+ 0.6
[values]
hole_xy_offset = 0.075
infill_sparse_density = 20
inset_direction = outside-in
top_bottom_thickness = =wall_thickness
wall_thickness = =line_width * 4
xy_offset = 0.075

View file

@ -456,45 +456,32 @@ UM.MainWindow
}
}
UM.PreferencesDialog
Component
{
id: preferences
Component.onCompleted:
id: preferencesDialogComponent
Cura.PreferencesDialog
{
//; Remove & re-add the general page as we want to use our own instead of uranium standard.
removePage(0);
insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml"));
removePage(1);
insertPage(1, catalog.i18nc("@title:tab","Settings"), Qt.resolvedUrl("Preferences/SettingVisibilityPage.qml"));
insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml"));
insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/Materials/MaterialsPage.qml"));
insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml"));
currentPage = 0;
selfDestroy: true
}
}
onVisibleChanged:
{
// When the dialog closes, switch to the General page.
// This prevents us from having a heavy page like Setting Visibility active in the background.
setPage(0);
}
function showPreferencesDialog()
{
var dialog = preferencesDialogComponent.createObject(base)
dialog.show()
return dialog
}
Connections
{
target: Cura.Actions.preferences
function onTriggered() { preferences.visible = true }
function onTriggered() { showPreferencesDialog() }
}
Connections
{
target: CuraApplication
function onShowPreferencesWindow() { preferences.visible = true }
function onShowPreferencesWindow() { showPreferencesDialog() }
}
Connections
@ -511,8 +498,8 @@ UM.MainWindow
target: Cura.Actions.configureMachines
function onTriggered()
{
preferences.visible = true;
preferences.setPage(2);
var dialog = showPreferencesDialog()
dialog.currentPage = 2;
}
}
@ -521,8 +508,8 @@ UM.MainWindow
target: Cura.Actions.manageProfiles
function onTriggered()
{
preferences.visible = true;
preferences.setPage(4);
var dialog = showPreferencesDialog()
dialog.currentPage = 4;
}
}
@ -531,8 +518,8 @@ UM.MainWindow
target: Cura.Actions.manageMaterials
function onTriggered()
{
preferences.visible = true;
preferences.setPage(3)
var dialog = showPreferencesDialog()
dialog.currentPage = 3;
}
}
@ -541,11 +528,11 @@ UM.MainWindow
target: Cura.Actions.configureSettingVisibility
function onTriggered(source)
{
preferences.visible = true;
preferences.setPage(1);
var dialog = showPreferencesDialog()
dialog.currentPage = 1;
if(source && source.key)
{
preferences.getCurrentItem().scrollToSection(source.key);
dialog.currentItem.scrollToSection(source.key);
}
}
}

View file

@ -0,0 +1,130 @@
// Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import ".."
import UM 1.6 as UM
UM.Dialog
{
id: base
title: catalog.i18nc("@title:window", "Preferences")
minimumWidth: UM.Theme.getSize("modal_window_minimum").width
minimumHeight: UM.Theme.getSize("modal_window_minimum").height
width: minimumWidth
height: minimumHeight
backgroundColor: UM.Theme.getColor("background_2")
property alias currentPage: pagesList.currentIndex
property alias currentItem: pagesList.currentItem
Item
{
id: test
anchors.fill: parent
ListView
{
id: pagesList
width: UM.Theme.getSize("preferences_page_list_item").width
anchors.top: parent.top
anchors.bottom: parent.bottom
ScrollBar.vertical: UM.ScrollBar {}
clip: true
model: [
{
name: catalog.i18nc("@title:tab", "General"),
item: Qt.resolvedUrl("GeneralPage.qml")
},
{
name: catalog.i18nc("@title:tab", "Settings"),
item: Qt.resolvedUrl("SettingVisibilityPage.qml")
},
{
name: catalog.i18nc("@title:tab", "Printers"),
item: Qt.resolvedUrl("MachinesPage.qml")
},
{
name: catalog.i18nc("@title:tab", "Materials"),
item: Qt.resolvedUrl("Materials/MaterialsPage.qml")
},
{
name: catalog.i18nc("@title:tab", "Profiles"),
item: Qt.resolvedUrl("ProfilesPage.qml")
}
]
delegate: Rectangle
{
width: parent ? parent.width : 0
height: pageLabel.height
color: ListView.isCurrentItem ? UM.Theme.getColor("background_3") : UM.Theme.getColor("main_background")
UM.Label
{
id: pageLabel
anchors.centerIn: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
width: parent.width
height: UM.Theme.getSize("preferences_page_list_item").height
color: UM.Theme.getColor("text_default")
text: modelData.name
}
MouseArea
{
anchors.fill: parent
onClicked: pagesList.currentIndex = index
}
}
onCurrentIndexChanged: stackView.replace(model[currentIndex].item)
}
StackView
{
id: stackView
anchors
{
left: pagesList.right
leftMargin: UM.Theme.getSize("narrow_margin").width
top: parent.top
bottom: parent.bottom
right: parent.right
}
initialItem: Item { property bool resetEnabled: false }
replaceEnter: Transition
{
NumberAnimation
{
properties: "opacity"
from: 0
to: 1
duration: 100
}
}
replaceExit: Transition
{
NumberAnimation
{
properties: "opacity"
from: 1
to: 0
duration: 100
}
}
}
UM.I18nCatalog { id: catalog; name: "uranium"; }
}
}

View file

@ -52,3 +52,7 @@ NumericTextFieldWithUnit 1.0 NumericTextFieldWithUnit.qml
PrintHeadMinMaxTextField 1.0 PrintHeadMinMaxTextField.qml
SimpleCheckBox 1.0 SimpleCheckBox.qml
RenameDialog 1.0 RenameDialog.qml
# Cura/Preferences
PreferencesDialog 1.0 PreferencesDialog.qml

View file

@ -14,7 +14,14 @@ weight = -2
[values]
cool_min_layer_time = 4
cool_min_layer_time_fan_speed_max = 9
cool_min_temperature = =material_print_temperature - 10
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
retraction_prime_speed = 15
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -13,7 +13,13 @@ weight = -2
[values]
cool_min_layer_time = 4
hole_xy_offset = 0.1
inset_direction = inside-out
material_print_temperature = =default_material_print_temperature + 5
retraction_prime_speed = 15
support_structure = tree
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -12,8 +12,16 @@ variant = AA+ 0.4
weight = -1
[values]
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
material_final_print_temperature = =material_print_temperature - 15
material_initial_print_temperature = =material_print_temperature - 15
retraction_prime_speed = =retraction_speed
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -12,9 +12,17 @@ variant = AA+ 0.4
weight = 0
[values]
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
material_final_print_temperature = =material_print_temperature - 15
material_initial_print_temperature = =material_print_temperature - 15
retraction_prime_speed = =retraction_speed
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
top_bottom_thickness = =round(6*layer_height,3)
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -12,8 +12,16 @@ variant = AA+ 0.4
weight = -2
[values]
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
material_final_print_temperature = =material_print_temperature - 15
material_initial_print_temperature = =material_print_temperature - 15
retraction_prime_speed = =retraction_speed
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -12,7 +12,15 @@ variant = AA+ 0.4
weight = -1
[values]
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
retraction_prime_speed = =retraction_speed
retraction_speed = 25
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -12,7 +12,15 @@ variant = AA+ 0.4
weight = 0
[values]
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
retraction_prime_speed = =retraction_speed
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
top_bottom_thickness = =round(6*layer_height,3)
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -12,6 +12,14 @@ variant = AA+ 0.4
weight = -2
[values]
cool_min_temperature = =material_print_temperature - 20
hole_xy_offset = 0.1
inset_direction = inside-out
retraction_prime_speed = =retraction_speed
speed_roofing = =speed_topbottom * 1/3
speed_wall_x = =speed_wall
speed_wall_x_roofing = =speed_wall * 0.8
support_structure = tree
wall_line_width_x = =wall_line_width * 1.25
xy_offset = 0.025

View file

@ -13,12 +13,41 @@ variant = CC+ 0.4
weight = -2
[values]
acceleration_roofing = =acceleration_topbottom/2
bridge_enable_more_layers = True
bridge_skin_density = 70
bridge_skin_material_flow = 100
bridge_skin_material_flow_2 = 70
bridge_skin_speed = 30
bridge_skin_speed_2 = =speed_print*2/3
bridge_wall_material_flow = 100
bridge_wall_min_length = 2
bridge_wall_speed = 30
cool_min_layer_time = 6
cool_min_layer_time_fan_speed_max = 11
retraction_prime_speed = 15
cool_min_layer_time_overhang = 11
cool_min_temperature = =material_print_temperature-10
flooring_monotonic = False
infill_material_flow = =material_flow if infill_sparse_density < 95 else 95
infill_pattern = ='zigzag' if infill_sparse_density > 50 else 'grid'
jerk_roofing = =jerk_print
material_flow = 95
retraction_hop_enabled = False
retraction_prime_speed = 25
roofing_material_flow = =skin_material_flow
roofing_monotonic = False
skin_material_flow = =0.95*material_flow
skin_outline_count = 0
support_bottom_distance = =support_z_distance
support_structure = tree
support_tree_tip_diameter = 2.0
support_tree_top_rate = 10
support_xy_distance = 1.2
support_xy_distance_overhang = =1.5*machine_nozzle_size
support_z_distance = =min(2*layer_height, 0.4)
top_bottom_thickness = =wall_thickness
wall_0_inset = =0.05
wall_overhang_speed_factors = [100,90,80,70,60,50]
wall_x_material_flow = =material_flow
xy_offset = 0.075

View file

@ -13,12 +13,43 @@ variant = CC+ 0.4
weight = -2
[values]
acceleration_roofing = =acceleration_topbottom/2
adhesion_type = skirt
bridge_enable_more_layers = True
bridge_skin_density = 70
bridge_skin_material_flow = 100
bridge_skin_material_flow_2 = 70
bridge_skin_speed = 30
bridge_skin_speed_2 = =speed_print*2/3
bridge_wall_material_flow = 100
bridge_wall_min_length = 2
bridge_wall_speed = 30
cool_min_layer_time = 6
cool_min_layer_time_overhang = 11
cool_min_temperature = =material_print_temperature-10
flooring_monotonic = False
infill_material_flow = =material_flow if infill_sparse_density < 95 else 95
infill_pattern = ='zigzag' if infill_sparse_density > 50 else 'grid'
jerk_roofing = =jerk_print
material_pressure_advance_factor = 0.25
retraction_hop_enabled = False
retraction_prime_speed = 15
roofing_material_flow = =skin_material_flow
roofing_monotonic = False
skin_material_flow = =0.95*material_flow
skin_outline_count = 0
skirt_height = 5
support_bottom_distance = =support_z_distance
support_structure = tree
support_tree_tip_diameter = 2.0
support_tree_top_rate = 10
support_xy_distance = 1.2
support_xy_distance_overhang = =1.5*machine_nozzle_size
support_z_distance = =min(2*layer_height, 0.4)
switch_extruder_retraction_amount = 16
top_bottom_thickness = =wall_thickness
wall_0_inset = =0.05
wall_overhang_speed_factors = [100,90,80,70,60,50]
wall_x_material_flow = =material_flow
xy_offset = 0.075

View file

@ -463,6 +463,8 @@
"layerview_support_infill": [0, 230, 230, 127],
"layerview_move_combing": [0, 0, 255, 255],
"layerview_move_retraction": [128, 127, 255, 255],
"layerview_move_while_retracting": [127, 255, 255, 255],
"layerview_move_while_unretracting": [255, 127, 255, 255],
"layerview_support_interface": [63, 127, 255, 127],
"layerview_prime_tower": [0, 255, 255, 255],
"layerview_nozzle": [224, 192, 16, 64],