From eb253827be2e331502ec7892286549f66e037eb9 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 13 Sep 2018 13:48:08 +0200 Subject: [PATCH 1/5] JSON setting: option to let support be replaced by brim or not --- resources/definitions/fdmprinter.def.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 4c87a3bcf0..e5726afdca 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -4538,6 +4538,17 @@ } } }, + "brim_replaces_support": + { + "label": "Brim Replaces Support", + "description": "Enforce brim to be printed around the model even if that space would otherwise be occupied by support. This replaces some regions fo the first layer of supprot by brim regions.", + "type": "bool", + "default_value": true, + "enabled": "resolveOrValue('adhesion_type') == 'brim' and support_enable", + "settable_per_mesh": false, + "settable_per_extruder": true, + "limit_to_extruder": "adhesion_extruder_nr" + }, "brim_outside_only": { "label": "Brim Only on Outside", From 945cc7c3e63d70fa3f66be601dda6be14302b608 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 13 Sep 2018 14:25:57 +0200 Subject: [PATCH 2/5] JSon feat: support brim settings --- resources/definitions/fdmprinter.def.json | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index e5726afdca..74e9bab14d 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3888,6 +3888,48 @@ "settable_per_mesh": false, "settable_per_extruder": true }, + "support_brim_enable": + { + "label": "Enable Support Brim", + "description": "Generate a brim within the support infill regions of the first layer. This brim is printed underneath the support, not around it. Enabling this setting increases the adhesion of support to the build plate.", + "type": "bool", + "default_value": false, + "enabled": "support_enable or support_tree_enable", + "limit_to_extruder": "support_infill_extruder_nr", + "settable_per_mesh": false, + "settable_per_extruder": true + }, + "support_brim_width": + { + "label": "Support Brim Width", + "description": "The width of the brim to print underneath the support. A larger brim enhances adhesion to the build plate, at the cost of some extra material.", + "type": "float", + "unit": "mm", + "default_value": 8.0, + "minimum_value": "0.0", + "maximum_value_warning": "50.0", + "enabled": "support_enable", + "settable_per_mesh": false, + "settable_per_extruder": true, + "limit_to_extruder": "support_infill_extruder_nr", + "children": + { + "support_brim_line_count": + { + "label": "Support Brim Line Count", + "description": "The number of lines used for the support brim. More brim lines enhance adhesion to the build plate, at the cost of some extra material.", + "type": "int", + "default_value": 20, + "minimum_value": "0", + "maximum_value_warning": "50 / skirt_brim_line_width", + "value": "math.ceil(support_brim_width / (skirt_brim_line_width * initial_layer_line_width_factor / 100.0))", + "enabled": "support_enable", + "settable_per_mesh": false, + "settable_per_extruder": true, + "limit_to_extruder": "support_infill_extruder_nr" + } + } + }, "support_z_distance": { "label": "Support Z Distance", From 6eb8b754903f3fe1db5baa55ad90305fda94de38 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 Oct 2018 11:31:33 +0200 Subject: [PATCH 3/5] Update typing and fixed the bug it exposes. --- cura/Settings/SettingInheritanceManager.py | 61 ++++++++++++++-------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 9cd24558b7..12b541c3d8 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -1,6 +1,6 @@ # Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import List +from typing import List, Optional, TYPE_CHECKING from PyQt5.QtCore import QObject, QTimer, pyqtProperty, pyqtSignal from UM.FlameProfiler import pyqtSlot @@ -20,13 +20,18 @@ from UM.Settings.SettingInstance import InstanceState from cura.Settings.ExtruderManager import ExtruderManager +if TYPE_CHECKING: + from cura.Settings.ExtruderStack import ExtruderStack + from UM.Settings.SettingDefinition import SettingDefinition + + class SettingInheritanceManager(QObject): - def __init__(self, parent = None): + def __init__(self, parent = None) -> None: super().__init__(parent) Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged) - self._global_container_stack = None - self._settings_with_inheritance_warning = [] - self._active_container_stack = None + self._global_container_stack = None # type: Optional[ContainerStack] + self._settings_with_inheritance_warning = [] # type: List[str] + self._active_container_stack = None # type: Optional[ExtruderStack] self._onGlobalContainerChanged() ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) @@ -41,7 +46,9 @@ class SettingInheritanceManager(QObject): ## Get the keys of all children settings with an override. @pyqtSlot(str, result = "QStringList") - def getChildrenKeysWithOverride(self, key): + def getChildrenKeysWithOverride(self, key: str) -> List[str]: + if self._global_container_stack is None: + return [] definitions = self._global_container_stack.definition.findDefinitions(key=key) if not definitions: Logger.log("w", "Could not find definition for key [%s]", key) @@ -53,9 +60,11 @@ class SettingInheritanceManager(QObject): return result @pyqtSlot(str, str, result = "QStringList") - def getOverridesForExtruder(self, key, extruder_index): - result = [] + def getOverridesForExtruder(self, key: str, extruder_index: str) -> List[str]: + if self._global_container_stack is None: + return [] + result = [] # type: List[str] extruder_stack = ExtruderManager.getInstance().getExtruderStack(extruder_index) if not extruder_stack: Logger.log("w", "Unable to find extruder for current machine with index %s", extruder_index) @@ -73,16 +82,16 @@ class SettingInheritanceManager(QObject): return result @pyqtSlot(str) - def manualRemoveOverride(self, key): + def manualRemoveOverride(self, key: str) -> None: if key in self._settings_with_inheritance_warning: self._settings_with_inheritance_warning.remove(key) self.settingsWithIntheritanceChanged.emit() @pyqtSlot() - def forceUpdate(self): + def forceUpdate(self) -> None: self._update() - def _onActiveExtruderChanged(self): + def _onActiveExtruderChanged(self) -> None: new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack() if not new_active_stack: self._active_container_stack = None @@ -94,13 +103,14 @@ class SettingInheritanceManager(QObject): self._active_container_stack.containersChanged.disconnect(self._onContainersChanged) self._active_container_stack = new_active_stack - self._active_container_stack.propertyChanged.connect(self._onPropertyChanged) - self._active_container_stack.containersChanged.connect(self._onContainersChanged) + if self._active_container_stack is not None: + self._active_container_stack.propertyChanged.connect(self._onPropertyChanged) + self._active_container_stack.containersChanged.connect(self._onContainersChanged) self._update() # Ensure that the settings_with_inheritance_warning list is populated. - def _onPropertyChanged(self, key, property_name): + def _onPropertyChanged(self, key: str, property_name: str) -> None: if (property_name == "value" or property_name == "enabled") and self._global_container_stack: - definitions = self._global_container_stack.definition.findDefinitions(key = key) + definitions = self._global_container_stack.definition.findDefinitions(key = key) # type: List["SettingDefinition"] if not definitions: return @@ -139,7 +149,7 @@ class SettingInheritanceManager(QObject): if settings_with_inheritance_warning_changed: self.settingsWithIntheritanceChanged.emit() - def _recursiveCheck(self, definition): + def _recursiveCheck(self, definition: "SettingDefinition") -> bool: for child in definition.children: if child.key in self._settings_with_inheritance_warning: return True @@ -149,7 +159,7 @@ class SettingInheritanceManager(QObject): return False @pyqtProperty("QVariantList", notify = settingsWithIntheritanceChanged) - def settingsWithInheritanceWarning(self): + def settingsWithInheritanceWarning(self) -> List[str]: return self._settings_with_inheritance_warning ## Check if a setting has an inheritance function that is overwritten @@ -157,9 +167,14 @@ class SettingInheritanceManager(QObject): has_setting_function = False if not stack: stack = self._active_container_stack - if not stack: #No active container stack yet! + if not stack: # No active container stack yet! return False - containers = [] # type: List[ContainerInterface] + + if self._active_container_stack is None: + return False + all_keys = self._active_container_stack.getAllKeys() + + containers = [] # type: List[ContainerInterface] ## Check if the setting has a user state. If not, it is never overwritten. has_user_state = stack.getProperty(key, "state") == InstanceState.User @@ -190,8 +205,8 @@ class SettingInheritanceManager(QObject): has_setting_function = isinstance(value, SettingFunction) if has_setting_function: for setting_key in value.getUsedSettingKeys(): - if setting_key in self._active_container_stack.getAllKeys(): - break # We found an actual setting. So has_setting_function can remain true + if setting_key in all_keys: + break # We found an actual setting. So has_setting_function can remain true else: # All of the setting_keys turned out to not be setting keys at all! # This can happen due enum keys also being marked as settings. @@ -205,7 +220,7 @@ class SettingInheritanceManager(QObject): break # There is a setting function somewhere, stop looking deeper. return has_setting_function and has_non_function_value - def _update(self): + def _update(self) -> None: self._settings_with_inheritance_warning = [] # Reset previous data. # Make sure that the GlobalStack is not None. sometimes the globalContainerChanged signal gets here late. @@ -226,7 +241,7 @@ class SettingInheritanceManager(QObject): # Notify others that things have changed. self.settingsWithIntheritanceChanged.emit() - def _onGlobalContainerChanged(self): + def _onGlobalContainerChanged(self) -> None: if self._global_container_stack: self._global_container_stack.propertyChanged.disconnect(self._onPropertyChanged) self._global_container_stack.containersChanged.disconnect(self._onContainersChanged) From 4a0808378b9a224cde179b95c8326343b33a5202 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 16 Oct 2018 13:23:35 +0200 Subject: [PATCH 4/5] Allow whitespaces in the job name. Fixes #4530. --- resources/qml/JobSpecs.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 31ca84d66e..1a5b604886 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -86,7 +86,7 @@ Item { printJobTextfield.focus = false; } validator: RegExpValidator { - regExp: /^[^\\ \/ \*\?\|\[\]]*$/ + regExp: /^[^\\\/\*\?\|\[\]]*$/ } style: TextFieldStyle{ textColor: UM.Theme.getColor("text_scene"); From 25000e8a6b9232bebdb4565463dcd41e347aeb4c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 16 Oct 2018 13:05:15 +0200 Subject: [PATCH 5/5] Fix typo's. [CURA-5760] Feature support brim. --- resources/definitions/fdmprinter.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 22491417ab..138e1adcc5 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -4613,7 +4613,7 @@ "brim_replaces_support": { "label": "Brim Replaces Support", - "description": "Enforce brim to be printed around the model even if that space would otherwise be occupied by support. This replaces some regions fo the first layer of supprot by brim regions.", + "description": "Enforce brim to be printed around the model even if that space would otherwise be occupied by support. This replaces some regions of the first layer of support by brim regions.", "type": "bool", "default_value": true, "enabled": "resolveOrValue('adhesion_type') == 'brim' and support_enable",