From 755b2e61e404ebee5181524d0777f15735913a91 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 16 Sep 2016 15:16:34 +0200 Subject: [PATCH 1/5] CURA-1852: Sending material volumina per extruder --- plugins/SliceInfoPlugin/SliceInfo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 047a03575d..b691cce387 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -87,7 +87,8 @@ class SliceInfo(Extension): material_radius = 0.5 * global_container_stack.getProperty("material_diameter", "value") # TODO: Send material per extruder instead of mashing it on a pile - material_used = math.pi * material_radius * material_radius * sum(print_information.materialLengths) #Volume of all materials used + material_used = [str(math.pi * material_radius * material_radius * material_length) for material_length in print_information.materialLengths] + material_used = ",".join(material_used) # Get model information (bounding boxes, hashes and transformation matrix) models_info = [] @@ -145,4 +146,4 @@ class SliceInfo(Extension): except Exception as e: # We really can't afford to have a mistake here, as this would break the sending of g-code to a device # (Either saving or directly to a printer). The functionality of the slice data is not *that* important. - Logger.log("e", "Exception raised while sending slice info: %s" %(repr(e))) # But we should be notified about these problems of course. \ No newline at end of file + Logger.log("e", "Exception raised while sending slice info: %s" %(repr(e))) # But we should be notified about these problems of course. From 8366cb8c9bdbe6290f6319e74ef7e9473556e11f Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Mon, 19 Sep 2016 09:50:09 +0200 Subject: [PATCH 2/5] CURA-1852: Removing TODO Removed the TODO tag, but left a little comment about what is happening in the following section. --- plugins/SliceInfoPlugin/SliceInfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index b691cce387..80172ad9d7 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -86,7 +86,7 @@ class SliceInfo(Extension): print_information = Application.getInstance().getPrintInformation() material_radius = 0.5 * global_container_stack.getProperty("material_diameter", "value") - # TODO: Send material per extruder instead of mashing it on a pile + # Send material per extruder material_used = [str(math.pi * material_radius * material_radius * material_length) for material_length in print_information.materialLengths] material_used = ",".join(material_used) From 642b6b1ca31e896140c66024bab751c5b2d7b607 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Sep 2016 12:37:13 +0200 Subject: [PATCH 3/5] Updated documentation CURA-2361 --- cura/Settings/SettingInheritanceManager.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 7989d5bebc..763db46e57 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -1,10 +1,17 @@ +# Copyright (c) 2016 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal import UM.Settings from UM.Application import Application import cura.Settings - +## The settingInheritance manager is responsible for checking each setting in order to see if one of the "deeper" +# containers has a setting function and the topmost one with a value has a value. We need to have this check +# because some profiles tend to have 'hardcoded' values that break our inheritance. A good example of that are the +# speed settings. If all the children of print_speed have a single value override, changing the speed won't +# actually do anything, as only the 'leaf' settings are used by the engine. class SettingInheritanceManager(QObject): def __init__(self, parent = None): super().__init__(parent) @@ -18,10 +25,6 @@ class SettingInheritanceManager(QObject): settingsWithIntheritanceChanged = pyqtSignal() - @pyqtSlot() - def test(self): - pass - ## Get the keys of all children settings with an override. @pyqtSlot(str, result = "QStringList") def getChildrenKeysWithOverride(self, key): @@ -106,7 +109,6 @@ class SettingInheritanceManager(QObject): return True return False - @pyqtProperty("QVariantList", notify = settingsWithIntheritanceChanged) def settingsWithInheritanceWarning(self): return self._settings_with_inheritance_warning From 75c788c31a40272904cae2d6b093e53c42f5a94b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Sep 2016 12:40:05 +0200 Subject: [PATCH 4/5] Moved check for top container setting function up in the code Should improve performance a bit. CURA-2361 --- cura/Settings/SettingInheritanceManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 763db46e57..6bc16c1628 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -128,6 +128,10 @@ class SettingInheritanceManager(QObject): if not self._active_container_stack.getProperty(key, "enabled"): return False + ## Also check if the top container is not a setting function (this happens if the inheritance is restored). + if isinstance(self._active_container_stack.getTop().getProperty(key, "value"), UM.Settings.SettingFunction): + return False + ## Mash all containers for all the stacks together. while stack: containers.extend(stack.getContainers()) @@ -146,8 +150,7 @@ class SettingInheritanceManager(QObject): if has_setting_function: break # There is a setting function somewhere, stop looking deeper. - ## Also check if the top container is not a setting function (this happens if the inheritance is restored). - return has_setting_function and not isinstance(self._active_container_stack.getTop().getProperty(key, "value"), UM.Settings.SettingFunction) and has_non_function_value + return has_setting_function and has_non_function_value def _update(self): self._settings_with_inheritance_warning = [] # Reset previous data. From aac395cb79e592f683dc552b6250e0ae17680671 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Sep 2016 13:01:31 +0200 Subject: [PATCH 5/5] Settings that are not settable per extruder but used by settings who are are now also copied CURA-2409 --- cura/Settings/MachineManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 0758d76608..7cfb3c23d4 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -243,11 +243,11 @@ class MachineManager(QObject): def _onPropertyChanged(self, key, property_name): if property_name == "value": - # If a setting is not settable per extruder, but "has enabled relations" that are settable per extruder + # If a setting is not settable per extruder, but "has enabled" or "value" relations that are settable per extruder # we need to copy the value to global, so that the front-end displays the right settings. if not self._active_container_stack.getProperty(key, "settable_per_extruder"): relations = self._global_container_stack.getBottom()._getDefinition(key).relations - for relation in filter(lambda r: r.role == "enabled" and r.type == RelationType.RequiredByTarget, relations): + for relation in filter(lambda r: (r.role == "enabled" or r.role == "value") and r.type == RelationType.RequiredByTarget, relations): # Target setting is settable per extruder if self._active_container_stack.getProperty(relation.target.key, "settable_per_extruder"): new_value = self._global_container_stack.getProperty(key, "value")