From 704c6e5d8fefcd50815d339843f9c9f9521fee23 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 May 2017 13:19:28 +0200 Subject: [PATCH 01/20] Removed no longer used profiles CURA-3816 --- .../um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg | 14 -------------- ...8_TPU_Not_Supported_Superdraft_Quality.inst.cfg | 14 -------------- 2 files changed, 28 deletions(-) delete mode 100755 resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg delete mode 100755 resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg deleted file mode 100755 index 84e5c6d3d3..0000000000 --- a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[general] -version = 2 -name = Not Supported -definition = ultimaker3 - -[metadata] -type = quality -quality_type = normal -material = generic_tpu_ultimaker3_BB_0.8 -weight = 0 -supported = False -setting_version = 1 - -[values] diff --git a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg deleted file mode 100755 index 222a4935d5..0000000000 --- a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[general] -version = 2 -name = Not Supported -definition = ultimaker3 - -[metadata] -type = quality -quality_type = superdraft -material = generic_tpu_ultimaker3_BB_0.8 -weight = 0 -supported = False -setting_version = 1 - -[values] From b95712ef95f4cdd61bf5751c11525309027dff92 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Tue, 16 May 2017 13:23:15 +0200 Subject: [PATCH 02/20] Revert "Resolve bed adhesion type via limit-to-extruder" This reverts commit 396f4381dd13e34a144aa3c5d0a5a0569f6c9341. The comit introduced an infinite recursion. You cannot have both a limit_to_extruder and settable_per_extruder=false --- 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 a87cebdc28..ce964b0265 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3624,7 +3624,7 @@ "none": "None" }, "default_value": "brim", - "limit_to_extruder": "adhesion_extruder_nr", + "resolve": "'raft' if 'raft' in extruderValues('adhesion_type') else ('brim' if 'brim' in extruderValues('adhesion_type') else 'skirt')", "settable_per_mesh": false, "settable_per_extruder": false }, From 286c4665fcd273388d0166e66ca047804c5e805d Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Tue, 16 May 2017 13:27:34 +0200 Subject: [PATCH 03/20] Resolve bed adhesion type to adhesion extruder (CURA-3738)" The cause for this change is that TPU says we want to print with brim but CPE wants to print with raft. In those cases the resolve function would choose the raft because that's safer. However if the default extruder happens to be the TPU one you then get a raft made of TPU which is flexible. That defeats the purpose of the raft, and causes the raft to warp, clog on the nozzle, destroy the world, etc. So there, I saved the world once more. --- 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 ce964b0265..cd28064e0f 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3624,7 +3624,7 @@ "none": "None" }, "default_value": "brim", - "resolve": "'raft' if 'raft' in extruderValues('adhesion_type') else ('brim' if 'brim' in extruderValues('adhesion_type') else 'skirt')", + "resolve": "extruderValue(adhesion_extruder_nr, 'adhesion_type')", "settable_per_mesh": false, "settable_per_extruder": false }, From e921808cd6ba1d51ef54432453b03ed2953a43c8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 May 2017 14:13:20 +0200 Subject: [PATCH 04/20] We now try to remove the right container when removing extruder --- cura/Settings/ExtruderManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 0aceabca6c..7a8c1be8bc 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -458,7 +458,7 @@ class ExtruderManager(QObject): # \param machine_id The machine to remove the extruders for. def removeMachineExtruders(self, machine_id: str): for extruder in self.getMachineExtruders(machine_id): - ContainerRegistry.getInstance().removeContainer(extruder.user.getId()) + ContainerRegistry.getInstance().removeContainer(extruder.userChanges.getId()) ContainerRegistry.getInstance().removeContainer(extruder.getId()) ## Returns extruders for a specific machine. From 1b4564bdb1c085d0aaff42178af44c7d6ec3991e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 May 2017 14:37:47 +0200 Subject: [PATCH 05/20] Added missing typing import --- cura/Settings/ExtruderManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 7a8c1be8bc..40d8fe7a19 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -20,6 +20,7 @@ from typing import Optional, List, TYPE_CHECKING, Union if TYPE_CHECKING: from cura.Settings.ExtruderStack import ExtruderStack + from cura.Settings.GlobalStack import GlobalStack ## Manages all existing extruder stacks. From 40d70b5f39373df41fd0fd49bc4d0fb6a4e7e52d Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 16 May 2017 14:37:12 +0200 Subject: [PATCH 06/20] Fix version upgrade for project loading CURA-3756 --- cura/CuraApplication.py | 9 ++++- cura/Settings/ContainerManager.py | 3 +- cura/Settings/CuraContainerRegistry.py | 4 +- cura/Settings/CuraStackBuilder.py | 6 +-- cura/Settings/ExtruderManager.py | 4 +- plugins/3MFReader/ThreeMFWorkspaceReader.py | 37 +++++++++++++++---- .../MachineSettingsAction.py | 4 +- .../UMOUpgradeSelection.py | 4 +- .../VersionUpgrade22to24/VersionUpgrade.py | 10 +++++ .../VersionUpgrade22to24/__init__.py | 6 +-- .../VersionUpgrade25to26.py | 15 ++++++-- .../VersionUpgrade25to26/__init__.py | 16 ++++---- 12 files changed, 84 insertions(+), 34 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7e047cae0a..b85c1a2f54 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -99,6 +99,11 @@ if not MYPY: class CuraApplication(QtApplication): + # SettingVersion represents the set of settings available in the machine/extruder definitions. + # You need to make sure that this version number needs to be increased if there is any non-backwards-compatible + # changes of the settings. + SettingVersion = 1 + class ResourceTypes: QmlFiles = Resources.UserType + 1 Firmware = Resources.UserType + 2 @@ -169,11 +174,11 @@ class CuraApplication(QtApplication): UM.VersionUpgradeManager.VersionUpgradeManager.getInstance().setCurrentVersions( { - ("quality", InstanceContainer.Version): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), + ("quality_changes", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), ("machine_stack", ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), ("extruder_train", ContainerStack.Version): (self.ResourceTypes.ExtruderStack, "application/x-uranium-extruderstack"), ("preferences", Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences"), - ("user", InstanceContainer.Version): (self.ResourceTypes.UserInstanceContainer, "application/x-uranium-instancecontainer") + ("user", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.UserInstanceContainer, "application/x-uranium-instancecontainer") } ) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index dee468f069..ff7b2d8020 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -28,6 +28,7 @@ from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog +import cura.CuraApplication from cura.Settings.ExtruderManager import ExtruderManager catalog = i18nCatalog("cura") @@ -918,7 +919,7 @@ class ContainerManager(QObject): quality_changes.setDefinition(self._container_registry.findContainers(id = "fdmprinter")[0]) else: quality_changes.setDefinition(QualityManager.getInstance().getParentMachineDefinition(machine_definition)) - quality_changes.addMetaDataEntry("setting_version", quality_changes.getDefinition().getMetaDataEntry("setting_version", default = 0)) + quality_changes.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) return quality_changes diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 2943ed009d..7961e8db31 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -22,6 +22,8 @@ from . import GlobalStack from .ContainerManager import ContainerManager from .ExtruderManager import ExtruderManager +from cura.CuraApplication import CuraApplication + from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") @@ -43,7 +45,7 @@ class CuraContainerRegistry(ContainerRegistry): if isinstance(container, InstanceContainer) and type(container) != type(self.getEmptyInstanceContainer()): #Check against setting version of the definition. - required_setting_version = int(container.getDefinition().getMetaDataEntry("setting_version", default = 0)) + required_setting_version = CuraApplication.SettingVersion actual_setting_version = int(container.getMetaDataEntry("setting_version", default = 0)) if required_setting_version != actual_setting_version: Logger.log("w", "Instance container {container_id} is outdated. Its setting version is {actual_setting_version} but it should be {required_setting_version}.".format(container_id = container.getId(), actual_setting_version = actual_setting_version, required_setting_version = required_setting_version)) diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index 652425ba6a..17b461e2d2 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -9,9 +9,9 @@ from UM.Settings.ContainerRegistry import ContainerRegistry from .GlobalStack import GlobalStack from .ExtruderStack import ExtruderStack -from .CuraContainerStack import CuraContainerStack from typing import Optional +import cura.CuraApplication ## Contains helper functions to create new machines. class CuraStackBuilder: @@ -76,7 +76,7 @@ class CuraStackBuilder: user_container = InstanceContainer(new_stack_id + "_user") user_container.addMetaDataEntry("type", "user") user_container.addMetaDataEntry("extruder", new_stack_id) - user_container.addMetaDataEntry("setting_version", machine_definition.getMetaDataEntry("setting_version", default = 0)) + user_container.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) user_container.setDefinition(machine_definition) stack.setUserChanges(user_container) @@ -125,7 +125,7 @@ class CuraStackBuilder: user_container = InstanceContainer(new_stack_id + "_user") user_container.addMetaDataEntry("type", "user") user_container.addMetaDataEntry("machine", new_stack_id) - user_container.addMetaDataEntry("setting_version", definition.getMetaDataEntry("setting_version", default = 0)) + user_container.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) user_container.setDefinition(definition) stack.setUserChanges(user_container) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 40d8fe7a19..9e1e65c911 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -18,6 +18,8 @@ from UM.Settings.ContainerStack import ContainerStack from UM.Settings.DefinitionContainer import DefinitionContainer from typing import Optional, List, TYPE_CHECKING, Union +import cura.CuraApplication + if TYPE_CHECKING: from cura.Settings.ExtruderStack import ExtruderStack from cura.Settings.GlobalStack import GlobalStack @@ -363,7 +365,7 @@ class ExtruderManager(QObject): user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile. user_profile.addMetaDataEntry("type", "user") user_profile.addMetaDataEntry("extruder", extruder_stack_id) - user_profile.addMetaDataEntry("setting_version", machine_definition.getMetaDataEntry("setting_version", default = 0)) + user_profile.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) user_profile.setDefinition(machine_definition) container_registry.addContainer(user_profile) container_stack.addContainer(user_profile) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index e1b65805c1..593591b5dc 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -46,6 +46,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader): self._extruder_stack_suffix = "." + ContainerRegistry.getMimeTypeForContainer(ExtruderStack).preferredSuffix self._global_stack_suffix = "." + ContainerRegistry.getMimeTypeForContainer(GlobalStack).preferredSuffix + # Certain instance container types are ignored because we make the assumption that only we make those types + # of containers. They are: + # - quality + # - variant + self._ignored_instance_container_types = {"quality", "variant"} + self._resolve_strategies = {} self._id_mapping = {} @@ -183,6 +189,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): num_user_settings = 0 quality_changes_conflict = False definition_changes_conflict = False + for each_instance_container_file in instance_container_files: container_id = self._stripFileToId(each_instance_container_file) instance_container = InstanceContainer(container_id) @@ -208,14 +215,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader): if definition_changes: if definition_changes[0] != instance_container: definition_changes_conflict = True - elif container_type == "quality": - # If the quality name is not set (either by quality or changes, set it now) - # Quality changes should always override this (as they are "on top") - if quality_name == "": - quality_name = instance_container.getName() - quality_type = instance_container.getName() elif container_type == "user": num_user_settings += len(instance_container._instances) + elif container_type in self._ignored_instance_container_types: + # Ignore certain instance container types + Logger.log("w", "Ignoring instance container [%s] with type [%s]", container_id, container_type) + continue Job.yieldThread() @@ -417,13 +422,29 @@ class ThreeMFWorkspaceReader(WorkspaceReader): quality_and_definition_changes_instance_containers = [] for instance_container_file in instance_container_files: container_id = self._stripFileToId(instance_container_file) + serialized = archive.open(instance_container_file).read().decode("utf-8") + + # HACK! we ignore the "metadata/type = quality" instance containers! + parser = configparser.ConfigParser() + parser.read_string(serialized) + if not parser.has_option("metadata", "type"): + Logger.log("w", "Cannot find metadata/type in %s, ignoring it", instance_container_file) + continue + if parser.get("metadata", "type") == "quality": + continue + instance_container = InstanceContainer(container_id) # Deserialize InstanceContainer by converting read data from bytes to string - instance_container.deserialize(archive.open(instance_container_file).read().decode("utf-8")) + instance_container.deserialize(serialized) container_type = instance_container.getMetaDataEntry("type") Job.yieldThread() - if container_type == "user": + + if container_type in self._ignored_instance_container_types: + # Ignore certain instance container types + Logger.log("w", "Ignoring instance container [%s] with type [%s]", container_id, container_type) + continue + elif container_type == "user": # Check if quality changes already exists. user_containers = self._container_registry.findInstanceContainers(id = container_id) if not user_containers: diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.py b/plugins/MachineSettingsAction/MachineSettingsAction.py index f09d1f2b1d..983b70d174 100755 --- a/plugins/MachineSettingsAction/MachineSettingsAction.py +++ b/plugins/MachineSettingsAction/MachineSettingsAction.py @@ -14,7 +14,7 @@ from UM.Settings.DefinitionContainer import DefinitionContainer from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Logger import Logger -from cura.Settings.CuraContainerRegistry import CuraContainerRegistry +from cura.CuraApplication import CuraApplication from cura.Settings.ExtruderManager import ExtruderManager import UM.i18n @@ -99,7 +99,7 @@ class MachineSettingsAction(MachineAction): definition = container_stack.getBottom() definition_changes_container.setDefinition(definition) definition_changes_container.addMetaDataEntry("type", "definition_changes") - definition_changes_container.addMetaDataEntry("setting_version", definition.getMetaDataEntry("setting_version", default = 0)) + definition_changes_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) self._container_registry.addContainer(definition_changes_container) container_stack.definitionChanges = definition_changes_container diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py index d2c3b31359..02b1482719 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py @@ -11,7 +11,7 @@ from UM.Application import Application catalog = i18nCatalog("cura") import UM.Settings.InstanceContainer - +from cura.CuraApplication import CuraApplication ## The Ultimaker Original can have a few revisions & upgrades. This action helps with selecting them, so they are added # as a variant. @@ -49,7 +49,7 @@ class UMOUpgradeSelection(MachineAction): definition = global_container_stack.getBottom() definition_changes_container.setDefinition(definition) definition_changes_container.addMetaDataEntry("type", "definition_changes") - definition_changes_container.addMetaDataEntry("setting_version", definition.getMetaDataEntry("setting_version", default = 0)) + definition_changes_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().addContainer(definition_changes_container) # Insert definition_changes between the definition and the variant diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index ab934210f6..9d508e553b 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -142,6 +142,16 @@ class VersionUpgrade22to24(VersionUpgrade): config.write(output) return [filename], [output.getvalue()] + def upgradeQuality(self, serialised, filename): + config = configparser.ConfigParser(interpolation = None) + config.read_string(serialised) # Read the input string as config file. + config.set("metadata", "type", "quality_changes") # Update metadata/type to quality_changes + config.set("general", "version", "2") # Just bump the version number. That is all we need for now. + + output = io.StringIO() + config.write(output) + return [filename], [output.getvalue()] + def getCfgVersion(self, serialised): parser = configparser.ConfigParser(interpolation = None) parser.read_string(serialised) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py index 0df2c94b75..0ff121f35e 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py @@ -21,9 +21,9 @@ def getMetaData(): # From To Upgrade function ("machine_instance", 2000000): ("machine_stack", 3000000, upgrade.upgradeMachineInstance), ("extruder_train", 2000000): ("extruder_train", 3000000, upgrade.upgradeExtruderTrain), - ("preferences", 3000000): ("preferences", 4000000, upgrade.upgradePreferences) - - }, + ("preferences", 3000000): ("preferences", 4000000, upgrade.upgradePreferences), + ("quality", 2000000): ("quality_changes", 2000000, upgrade.upgradeQuality), + }, "sources": { "machine_stack": { "get_version": upgrade.getCfgVersion, diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py index c61962d276..85f54dd654 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py @@ -5,6 +5,7 @@ import configparser #To parse the files we need to upgrade and write the new fil import io #To serialise configparser output to a string. from UM.VersionUpgrade import VersionUpgrade +from cura.CuraApplication import CuraApplication _removed_settings = { #Settings that were removed in 2.5. "start_layers_at_same_position", @@ -86,11 +87,17 @@ class VersionUpgrade25to26(VersionUpgrade): parser["values"][replacement] = parser["values"][replaced_setting] #Copy to replacement before removing the original! del replaced_setting - #Change the version number in the file. - if parser.has_section("general"): - parser["general"]["setting_version"] = "1" + for each_section in ("general", "metadata"): + if not parser.has_section(each_section): + parser.add_section(each_section) + + # Change the version number in the file. + parser["metadata"]["setting_version"] = str(CuraApplication.SettingVersion) + + # Update version + parser["general"]["version"] = "2" #Re-serialise the file. output = io.StringIO() parser.write(output) - return [filename], [output.getvalue()] \ No newline at end of file + return [filename], [output.getvalue()] diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py b/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py index 3aee161e3c..a24473f65d 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py @@ -18,14 +18,16 @@ def getMetaData(): "api": 3 }, "version_upgrade": { - # From To Upgrade function - ("preferences", 4000000): ("preferences", 4000001, upgrade.upgradePreferences), - ("quality", 2000000): ("quality", 2000001, upgrade.upgradeInstanceContainer), - ("variant", 2000000): ("variant", 2000001, upgrade.upgradeInstanceContainer), #We can re-use upgradeContainerStack since there is nothing specific to quality, variant or user profiles being changed. - ("user", 2000000): ("user", 2000001, upgrade.upgradeInstanceContainer) + # From To Upgrade function + ("preferences", 4000000): ("preferences", 4000001, upgrade.upgradePreferences), + # NOTE: All the instance containers share the same general/version, so we have to update all of them + # if any is updated. + ("quality_changes", 2000000): ("quality_changes", 2000001, upgrade.upgradeInstanceContainer), + ("user", 2000000): ("user", 2000001, upgrade.upgradeInstanceContainer), + ("quality", 2000000): ("quality", 2000001, upgrade.upgradeInstanceContainer), }, "sources": { - "quality": { + "quality_changes": { "get_version": upgrade.getCfgVersion, "location": {"./quality"} }, @@ -36,7 +38,7 @@ def getMetaData(): "user": { "get_version": upgrade.getCfgVersion, "location": {"./user"} - } + }, } } From 1ad9ba6c95ec5e3be167b5d94a37c18579a7aa4c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 May 2017 13:45:32 +0200 Subject: [PATCH 07/20] Remove lower warnings from Jerk settings It's sometimes required to be extra careful, and the difference between 0 and 5 isn't that big that it would cause a great increase in print time. --- resources/definitions/fdmprinter.def.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index cd28064e0f..621feb2c70 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2555,7 +2555,6 @@ "default_value": 20, "value": "jerk_support_interface", "minimum_value": "0.1", - "minimum_value_warning": "5", "maximum_value_warning": "50", "enabled": "resolveOrValue('jerk_enabled') and extruderValue(support_roof_extruder_nr, 'support_roof_enable') and support_enable", "limit_to_extruder": "support_roof_extruder_nr", @@ -2571,7 +2570,6 @@ "default_value": 20, "value": "jerk_support_interface", "minimum_value": "0.1", - "minimum_value_warning": "5", "maximum_value_warning": "50", "enabled": "resolveOrValue('jerk_enabled') and extruderValue(support_bottom_extruder_nr, 'support_bottom_enable') and support_enable", "limit_to_extruder": "support_bottom_extruder_nr", From a02ff8df5f284b65c8938a66596fd6f3b4bef61b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 May 2017 13:47:44 +0200 Subject: [PATCH 08/20] Sort settings alphabetically Makes it easier to compare profiles. --- .../ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg index b2abfff2e7..af5cbd432f 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg @@ -11,11 +11,11 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] -support_infill_rate = 25 -support_interface_height = 0.8 +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_standby_temperature = 100 prime_tower_enable = False speed_support_interface = =math.ceil(speed_support * 20 / 25) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) +support_infill_rate = 25 +support_interface_height = 0.8 support_xy_distance = =round(line_width * 1.5, 2) From 9b3568acaeae43b4f310c2f929fe0e494554a6ab Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 May 2017 13:51:28 +0200 Subject: [PATCH 09/20] Sort other PVA profiles as well Makes it easier to compare profiles and to find setting values by key. --- .../quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg | 8 ++++---- .../quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg | 8 ++++---- .../ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg index 767e321da0..f0b1b6116b 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg @@ -11,12 +11,12 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_print_temperature = =default_material_print_temperature + 10 material_standby_temperature = 100 -skin_overlap = 20 -support_interface_height = 0.8 prime_tower_enable = False +skin_overlap = 20 speed_support_interface = =math.ceil(speed_support * 20 / 25) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) +support_interface_height = 0.8 support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg index f266a26ef0..70439e6404 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg @@ -11,12 +11,12 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_print_temperature = =default_material_print_temperature + 5 material_standby_temperature = 100 +prime_tower_enable = False skin_overlap = 15 support_interface_height = 0.8 -prime_tower_enable = False speed_support_interface = =math.ceil(speed_support * 20 / 25) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) -support_xy_distance = =round(line_width * 1.5, 2) +support_xy_distance = =round(line_width * 1.5, 2) \ No newline at end of file diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg index f6bb460359..82cbe0a165 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg @@ -11,11 +11,11 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) +material_standby_temperature = 100 support_infill_rate = 25 support_interface_height = 0.8 -material_standby_temperature = 100 prime_tower_enable = False speed_support_interface = =math.ceil(speed_support * 20 / 25) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) support_xy_distance = =round(line_width * 1.5, 2) From 8e3dff76abd3ae773d22372e69d4a9f7d5283dea Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 May 2017 14:00:52 +0200 Subject: [PATCH 10/20] Set support X/Y distance for all PVA profiles This is an update from the materials team for our settings. --- .../quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg | 1 - resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg | 3 +-- .../quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg | 1 - .../quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg | 1 - resources/variants/ultimaker3_bb0.8.inst.cfg | 2 +- resources/variants/ultimaker3_bb04.inst.cfg | 2 +- 6 files changed, 3 insertions(+), 7 deletions(-) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg index f0b1b6116b..80a8173621 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg @@ -19,4 +19,3 @@ prime_tower_enable = False skin_overlap = 20 speed_support_interface = =math.ceil(speed_support * 20 / 25) support_interface_height = 0.8 -support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg index 70439e6404..97c7008b79 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg @@ -18,5 +18,4 @@ material_standby_temperature = 100 prime_tower_enable = False skin_overlap = 15 support_interface_height = 0.8 -speed_support_interface = =math.ceil(speed_support * 20 / 25) -support_xy_distance = =round(line_width * 1.5, 2) \ No newline at end of file +speed_support_interface = =math.ceil(speed_support * 20 / 25) \ No newline at end of file diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg index af5cbd432f..4f32b3d460 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg @@ -18,4 +18,3 @@ prime_tower_enable = False speed_support_interface = =math.ceil(speed_support * 20 / 25) support_infill_rate = 25 support_interface_height = 0.8 -support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg index 82cbe0a165..87ab432269 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg @@ -18,4 +18,3 @@ support_infill_rate = 25 support_interface_height = 0.8 prime_tower_enable = False speed_support_interface = =math.ceil(speed_support * 20 / 25) -support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/variants/ultimaker3_bb0.8.inst.cfg b/resources/variants/ultimaker3_bb0.8.inst.cfg index c0e09e808c..4ba2ca8422 100644 --- a/resources/variants/ultimaker3_bb0.8.inst.cfg +++ b/resources/variants/ultimaker3_bb0.8.inst.cfg @@ -75,7 +75,7 @@ support_line_width = =round(line_width * 0.4 / 0.35, 2) support_offset = 1.5 support_pattern = triangles support_use_towers = False -support_xy_distance = =wall_line_width_0 / 2 +support_xy_distance = =round(wall_line_width_0 * 0.75, 2) support_xy_distance_overhang = =wall_line_width_0 / 4 support_z_distance = 0 switch_extruder_prime_speed = 15 diff --git a/resources/variants/ultimaker3_bb04.inst.cfg b/resources/variants/ultimaker3_bb04.inst.cfg index 654de8a986..f379a8d1e2 100644 --- a/resources/variants/ultimaker3_bb04.inst.cfg +++ b/resources/variants/ultimaker3_bb04.inst.cfg @@ -36,5 +36,5 @@ support_interface_skip_height = =layer_height support_join_distance = 3 support_line_width = =round(line_width * 0.4 / 0.35, 2) support_offset = 3 -support_xy_distance = =wall_line_width_0 * 3 +support_xy_distance = =round(wall_line_width_0 * 0.75, 2) support_xy_distance_overhang = =wall_line_width_0 / 2 From 93c249280e71dc5c0fe8e82e9daee512b3a7aab7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 May 2017 14:03:15 +0200 Subject: [PATCH 11/20] Copy UM3 variants to UM3E They should be kept in sync for now. --- .../ultimaker3_extended_bb0.8.inst.cfg | 16 ++++++++--- .../ultimaker3_extended_bb04.inst.cfg | 28 +++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/resources/variants/ultimaker3_extended_bb0.8.inst.cfg b/resources/variants/ultimaker3_extended_bb0.8.inst.cfg index f88dc818c8..2e6292ed08 100644 --- a/resources/variants/ultimaker3_extended_bb0.8.inst.cfg +++ b/resources/variants/ultimaker3_extended_bb0.8.inst.cfg @@ -11,7 +11,9 @@ setting_version = 1 [values] acceleration_enabled = True acceleration_print = 4000 -acceleration_support_interface = =math.ceil(acceleration_topbottom * 100 / 500) +acceleration_support = =math.ceil(acceleration_print * 2000 / 4000) +acceleration_support_interface = =math.ceil(acceleration_support * 1500 / 2000) +acceleration_support_bottom = =math.ceil(acceleration_support_interface * 100 / 1500) brim_width = 3 cool_fan_speed = 50 cool_min_speed = 5 @@ -21,7 +23,9 @@ infill_pattern = triangles infill_wipe_dist = 0 jerk_enabled = True jerk_print = 25 -jerk_support_interface = =math.ceil(jerk_topbottom * 1 / 5) +jerk_support = =math.ceil(jerk_print * 15 / 25) +jerk_support_interface = =math.ceil(jerk_support * 10 / 15) +jerk_support_bottom = =math.ceil(jerk_support_interface * 1 / 10) layer_height = 0.2 machine_min_cool_heat_time_window = 15 machine_nozzle_heat_up_speed = 1.5 @@ -54,20 +58,24 @@ retraction_prime_speed = 15 skin_overlap = 5 speed_layer_0 = 20 speed_print = 35 -speed_support_interface = =math.ceil(speed_topbottom * 15 / 20) +speed_support = =math.ceil(speed_print * 25 / 35) +speed_support_interface = =math.ceil(speed_support * 20 / 25) +speed_support_bottom = =math.ceil(speed_support_interface * 10 / 20) speed_wall_0 = =math.ceil(speed_wall * 25 / 30) support_angle = 60 support_bottom_height = =layer_height * 2 +support_bottom_pattern = zigzag support_bottom_stair_step_height = =layer_height support_infill_rate = 25 support_interface_enable = True support_interface_height = =layer_height * 5 +support_interface_skip_height = =layer_height support_join_distance = 3 support_line_width = =round(line_width * 0.4 / 0.35, 2) support_offset = 1.5 support_pattern = triangles support_use_towers = False -support_xy_distance = =wall_line_width_0 / 2 +support_xy_distance = =round(wall_line_width_0 * 0.75, 2) support_xy_distance_overhang = =wall_line_width_0 / 4 support_z_distance = 0 switch_extruder_prime_speed = 15 diff --git a/resources/variants/ultimaker3_extended_bb04.inst.cfg b/resources/variants/ultimaker3_extended_bb04.inst.cfg index 229bde1916..abeaf69db2 100644 --- a/resources/variants/ultimaker3_extended_bb04.inst.cfg +++ b/resources/variants/ultimaker3_extended_bb04.inst.cfg @@ -9,20 +9,32 @@ type = variant setting_version = 1 [values] -cool_fan_speed_max = 100 +acceleration_support = =math.ceil(acceleration_print * 2000 / 4000) +acceleration_support_interface = =math.ceil(acceleration_support * 1500 / 2000) +acceleration_support_bottom = =math.ceil(acceleration_support_interface * 100 / 1500) +cool_fan_speed_max = =cool_fan_speed +jerk_support = =math.ceil(jerk_print * 15 / 25) +jerk_support_interface = =math.ceil(jerk_support * 10 / 15) +jerk_support_bottom = =math.ceil(jerk_support_interface * 1 / 10) machine_nozzle_heat_up_speed = 1.5 -machine_nozzle_size = 0.4 -material_bed_temperature = 60 material_print_temperature = 215 -raft_acceleration = =acceleration_layer_0 -raft_jerk = =jerk_layer_0 +raft_base_speed = 20 +raft_interface_speed = 20 +raft_speed = 25 retraction_extrusion_window = =retraction_amount +speed_layer_0 = 20 +speed_support = =math.ceil(speed_print * 25 / 35) +speed_support_interface = =math.ceil(speed_support * 20 / 25) +speed_support_bottom = =math.ceil(speed_support_interface * 10 / 20) speed_wall_0 = =math.ceil(speed_wall * 25 / 30) support_bottom_height = =layer_height * 2 +support_bottom_pattern = zigzag support_bottom_stair_step_height = =layer_height +support_infill_rate = 25 support_interface_enable = True +support_interface_skip_height = =layer_height +support_join_distance = 3 support_line_width = =round(line_width * 0.4 / 0.35, 2) -support_pattern = triangles -support_use_towers = False -support_xy_distance = =wall_line_width_0 * 3 +support_offset = 3 +support_xy_distance = =round(wall_line_width_0 * 0.75, 2) support_xy_distance_overhang = =wall_line_width_0 / 2 From 50bda1c9dd9de04cd75fb59dc7da0f209e200d8d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 May 2017 14:37:41 +0200 Subject: [PATCH 12/20] Remove overrides of support interface speed/accel/jerk This is a settings updates from the Materials team. --- .../quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg | 3 --- .../quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg | 3 --- .../quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg | 3 --- .../quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg | 5 +---- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg index 80a8173621..43bb096ebf 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg @@ -11,11 +11,8 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_print_temperature = =default_material_print_temperature + 10 material_standby_temperature = 100 prime_tower_enable = False skin_overlap = 20 -speed_support_interface = =math.ceil(speed_support * 20 / 25) support_interface_height = 0.8 diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg index 97c7008b79..c78833b867 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg @@ -11,11 +11,8 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_print_temperature = =default_material_print_temperature + 5 material_standby_temperature = 100 prime_tower_enable = False skin_overlap = 15 support_interface_height = 0.8 -speed_support_interface = =math.ceil(speed_support * 20 / 25) \ No newline at end of file diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg index 4f32b3d460..5bc96c8f08 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg @@ -11,10 +11,7 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_standby_temperature = 100 prime_tower_enable = False -speed_support_interface = =math.ceil(speed_support * 20 / 25) support_infill_rate = 25 support_interface_height = 0.8 diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg index 87ab432269..7896b5a57a 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg @@ -11,10 +11,7 @@ material = generic_pva_ultimaker3_BB_0.4 setting_version = 1 [values] -acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500) -jerk_support_interface = =math.ceil(jerk_support * 1 / 5) material_standby_temperature = 100 +prime_tower_enable = False support_infill_rate = 25 support_interface_height = 0.8 -prime_tower_enable = False -speed_support_interface = =math.ceil(speed_support * 20 / 25) From 121ebd79cf5e6a1ec9de7c4589545c386cf7d0da Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 16 May 2017 14:54:57 +0200 Subject: [PATCH 13/20] Fix circular import problem caused by moving SettingVersion into CuraApplication CURA-3756 --- cura/Settings/ContainerManager.py | 4 ++-- cura/Settings/CuraStackBuilder.py | 7 ++++--- cura/Settings/ExtruderManager.py | 5 ++--- tests/Settings/TestCuraContainerRegistry.py | 11 +++++++---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index ff7b2d8020..b5c76f1f17 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -28,7 +28,6 @@ from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog -import cura.CuraApplication from cura.Settings.ExtruderManager import ExtruderManager catalog = i18nCatalog("cura") @@ -919,7 +918,8 @@ class ContainerManager(QObject): quality_changes.setDefinition(self._container_registry.findContainers(id = "fdmprinter")[0]) else: quality_changes.setDefinition(QualityManager.getInstance().getParentMachineDefinition(machine_definition)) - quality_changes.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) + from cura.CuraApplication import CuraApplication + quality_changes.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) return quality_changes diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index 17b461e2d2..b84b1f4634 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -11,7 +11,6 @@ from .GlobalStack import GlobalStack from .ExtruderStack import ExtruderStack from typing import Optional -import cura.CuraApplication ## Contains helper functions to create new machines. class CuraStackBuilder: @@ -76,7 +75,8 @@ class CuraStackBuilder: user_container = InstanceContainer(new_stack_id + "_user") user_container.addMetaDataEntry("type", "user") user_container.addMetaDataEntry("extruder", new_stack_id) - user_container.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) + from cura.CuraApplication import CuraApplication + user_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) user_container.setDefinition(machine_definition) stack.setUserChanges(user_container) @@ -125,7 +125,8 @@ class CuraStackBuilder: user_container = InstanceContainer(new_stack_id + "_user") user_container.addMetaDataEntry("type", "user") user_container.addMetaDataEntry("machine", new_stack_id) - user_container.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) + from cura.CuraApplication import CuraApplication + user_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) user_container.setDefinition(definition) stack.setUserChanges(user_container) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 9e1e65c911..10934c2d31 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -18,8 +18,6 @@ from UM.Settings.ContainerStack import ContainerStack from UM.Settings.DefinitionContainer import DefinitionContainer from typing import Optional, List, TYPE_CHECKING, Union -import cura.CuraApplication - if TYPE_CHECKING: from cura.Settings.ExtruderStack import ExtruderStack from cura.Settings.GlobalStack import GlobalStack @@ -365,7 +363,8 @@ class ExtruderManager(QObject): user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile. user_profile.addMetaDataEntry("type", "user") user_profile.addMetaDataEntry("extruder", extruder_stack_id) - user_profile.addMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.SettingVersion) + from cura.CuraApplication import CuraApplication + user_profile.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) user_profile.setDefinition(machine_definition) container_registry.addContainer(user_profile) container_stack.addContainer(user_profile) diff --git a/tests/Settings/TestCuraContainerRegistry.py b/tests/Settings/TestCuraContainerRegistry.py index ad79f74dd4..11e772c3b7 100644 --- a/tests/Settings/TestCuraContainerRegistry.py +++ b/tests/Settings/TestCuraContainerRegistry.py @@ -68,11 +68,12 @@ def test_addContainerGlobalStack(container_registry, definition_container): assert type(mock_super_add_container.call_args_list[0][0][0]) == GlobalStack def test_addContainerGoodSettingVersion(container_registry, definition_container): - definition_container.getMetaData()["setting_version"] = 3 + from cura.CuraApplication import CuraApplication + definition_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion container_registry.addContainer(definition_container) instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance") - instance.addMetaDataEntry("setting_version", 3) + instance.addMetaDataEntry("setting_version", CuraApplication.SettingVersion) instance.setDefinition(definition_container) mock_super_add_container = unittest.mock.MagicMock() #Take the role of the Uranium-ContainerRegistry where the resulting containers get registered. @@ -82,7 +83,8 @@ def test_addContainerGoodSettingVersion(container_registry, definition_container mock_super_add_container.assert_called_once_with(instance) #The instance must have been registered now. def test_addContainerNoSettingVersion(container_registry, definition_container): - definition_container.getMetaData()["setting_version"] = 3 + from cura.CuraApplication import CuraApplication + definition_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion container_registry.addContainer(definition_container) instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance") @@ -96,7 +98,8 @@ def test_addContainerNoSettingVersion(container_registry, definition_container): mock_super_add_container.assert_not_called() #Should not get passed on to UM.Settings.ContainerRegistry.addContainer, because the setting_version is interpreted as 0! def test_addContainerBadSettingVersion(container_registry, definition_container): - definition_container.getMetaData()["setting_version"] = 3 + from cura.CuraApplication import CuraApplication + definition_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion container_registry.addContainer(definition_container) instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance") From 77843107f6a068cfad95a4525559ccbaba0833ed Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 May 2017 17:18:57 +0200 Subject: [PATCH 14/20] Revert "Removed no longer used profiles" This reverts commit 704c6e5d8fefcd50815d339843f9c9f9521fee23. --- .../um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg | 14 ++++++++++++++ ...8_TPU_Not_Supported_Superdraft_Quality.inst.cfg | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg create mode 100755 resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg new file mode 100755 index 0000000000..84e5c6d3d3 --- /dev/null +++ b/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg @@ -0,0 +1,14 @@ +[general] +version = 2 +name = Not Supported +definition = ultimaker3 + +[metadata] +type = quality +quality_type = normal +material = generic_tpu_ultimaker3_BB_0.8 +weight = 0 +supported = False +setting_version = 1 + +[values] diff --git a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg new file mode 100755 index 0000000000..222a4935d5 --- /dev/null +++ b/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg @@ -0,0 +1,14 @@ +[general] +version = 2 +name = Not Supported +definition = ultimaker3 + +[metadata] +type = quality +quality_type = superdraft +material = generic_tpu_ultimaker3_BB_0.8 +weight = 0 +supported = False +setting_version = 1 + +[values] From f8b29c4d1f29cee03cdb54a967d106175dc3bd95 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 May 2017 17:19:41 +0200 Subject: [PATCH 15/20] Delete the right not supported profiles --- .../um3_aa0.8_TPU_Not_Supported_Quality.inst.cfg | 14 -------------- ...8_TPU_Not_Supported_Superdraft_Quality.inst.cfg | 14 -------------- 2 files changed, 28 deletions(-) delete mode 100755 resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Quality.inst.cfg delete mode 100755 resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Quality.inst.cfg deleted file mode 100755 index b7ddab1a97..0000000000 --- a/resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Quality.inst.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[general] -version = 2 -name = Not Supported -definition = ultimaker3 - -[metadata] -weight = 0 -type = quality -quality_type = normal -material = generic_tpu_ultimaker3_AA_0.8 -supported = False -setting_version = 1 - -[values] diff --git a/resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg deleted file mode 100755 index 0693986d1e..0000000000 --- a/resources/quality/ultimaker3/um3_aa0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[general] -version = 2 -name = Not Supported -definition = ultimaker3 - -[metadata] -weight = 0 -type = quality -quality_type = superdraft -material = generic_tpu_ultimaker3_AA_0.8 -supported = False -setting_version = 1 - -[values] From 616ee34be5e864b57382cf21db08f697ff5df9fa Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 May 2017 17:43:05 +0200 Subject: [PATCH 16/20] Simplify SettingExtruder setting item This way it properly updates when a parent setting changes. Contributes to CURA-3804 --- resources/qml/Settings/SettingExtruder.qml | 114 +++++++-------------- 1 file changed, 36 insertions(+), 78 deletions(-) diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index cbe1d039bd..92d2da31e8 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -15,22 +15,19 @@ SettingItem contents: ComboBox { id: control + anchors.fill: parent - model: Cura.ExtrudersModel - { - id: extruders_model - onModelChanged: control.color = extruders_model.getItem(control.currentIndex).color - } - property string color: - { - var model_color = extruders_model.getItem(control.currentIndex).color; - return (model_color) ? model_color : ""; - } + model: Cura.ExtrudersModel { } textRole: "name" - anchors.fill: parent - onCurrentIndexChanged: updateCurrentColor(); + onActivated: + { + forceActiveFocus(); + propertyProvider.setPropertyValue("value", model.getItem(index).index); + } + + currentIndex: propertyProvider.properties.value MouseArea { @@ -59,7 +56,19 @@ SettingItem } } border.width: UM.Theme.getSize("default_lining").width - border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") + border.color: + { + if(!enabled) + { + return UM.Theme.getColor("setting_control_disabled_border"); + } + if(control.hovered || base.activeFocus) + { + UM.Theme.getColor("setting_control_border_highlight") + } + + return UM.Theme.getColor("setting_control_border") + } } label: Item { @@ -68,35 +77,36 @@ SettingItem id: swatch height: UM.Theme.getSize("setting_control").height / 2 width: height - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width + anchors.verticalCenter: parent.verticalCenter - color: control.color border.width: UM.Theme.getSize("default_lining").width - border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border") + border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border") + + color: control.currentText != "" ? control.model.getItem(control.currentIndex).color : "" } Label { - anchors.left: swatch.right - anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.right: downArrow.left - anchors.rightMargin: UM.Theme.getSize("default_lining").width - anchors.verticalCenter: parent.verticalCenter + anchors + { + left: swatch.right; + right: arrow.left; + verticalCenter: parent.verticalCenter + margins: UM.Theme.getSize("default_lining").width + } + width: parent.width - swatch.width; text: control.currentText font: UM.Theme.getFont("default") - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") + color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") elide: Text.ElideRight verticalAlignment: Text.AlignVCenter } - UM.RecolorImage { - id: downArrow + id: arrow anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 anchors.verticalCenter: parent.verticalCenter source: UM.Theme.getIcon("arrow_bottom") @@ -109,57 +119,5 @@ SettingItem } } } - - onActivated: - { - forceActiveFocus(); - propertyProvider.setPropertyValue("value", extruders_model.getItem(index).index); - control.color = extruders_model.getItem(index).color; - } - - onModelChanged: updateCurrentIndex(); - - Binding - { - target: control - property: "currentIndex" - value: - { - for(var i = 0; i < extruders_model.rowCount(); ++i) - { - if(extruders_model.getItem(i).index == propertyProvider.properties.value) - { - return i; - } - } - return -1; - } - } - - // In some cases we want to update the current color without updating the currentIndex, so it's a seperate function. - function updateCurrentColor() - { - for(var i = 0; i < extruders_model.rowCount(); ++i) - { - if(extruders_model.getItem(i).index == currentIndex) - { - control.color = extruders_model.getItem(i).color; - return; - } - } - } - - function updateCurrentIndex() - { - for(var i = 0; i < extruders_model.rowCount(); ++i) - { - if(extruders_model.getItem(i).index == propertyProvider.properties.value) - { - control.currentIndex = i; - return; - } - } - currentIndex = -1; - } } } From 69e4afffc89ac26bbad0e87367641acf42516b36 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Tue, 16 May 2017 17:42:21 +0200 Subject: [PATCH 17/20] fix: heightening of shadow for raft didn't take layer_0_z_overlap into account (CURA-3819) --- cura/BuildVolume.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 164cd00fde..c87e07a974 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -433,7 +433,8 @@ class BuildVolume(SceneNode): self._global_container_stack.getProperty("raft_interface_thickness", "value") + self._global_container_stack.getProperty("raft_surface_layers", "value") * self._global_container_stack.getProperty("raft_surface_thickness", "value") + - self._global_container_stack.getProperty("raft_airgap", "value")) + self._global_container_stack.getProperty("raft_airgap", "value") - + self._global_container_stack.getProperty("layer_0_z_overlap", "value")) # Rounding errors do not matter, we check if raft_thickness has changed at all if old_raft_thickness != self._raft_thickness: @@ -951,7 +952,7 @@ class BuildVolume(SceneNode): return max(min(value, max_value), min_value) _skirt_settings = ["adhesion_type", "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "brim_width", "brim_line_count", "raft_margin", "draft_shield_enabled", "draft_shield_dist"] - _raft_settings = ["adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "raft_surface_thickness", "raft_airgap"] + _raft_settings = ["adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "raft_surface_thickness", "raft_airgap", "layer_0_z_overlap"] _extra_z_settings = ["retraction_hop_enabled", "retraction_hop"] _prime_settings = ["extruder_prime_pos_x", "extruder_prime_pos_y", "extruder_prime_pos_z", "prime_blob_enable"] _tower_settings = ["prime_tower_enable", "prime_tower_size", "prime_tower_position_x", "prime_tower_position_y"] From 32c2418957ca8257cc8465733f76566202f5b2ff Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Tue, 16 May 2017 17:44:46 +0200 Subject: [PATCH 18/20] cleanup: remove raft height stuff from ConvexHullDecorator (CURA-3819) --- cura/ConvexHullDecorator.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py index 404342fb78..44150cb76f 100644 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -328,8 +328,7 @@ class ConvexHullDecorator(SceneNodeDecorator): return self.__isDescendant(root, node.getParent()) _affected_settings = [ - "adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", - "raft_surface_thickness", "raft_airgap", "raft_margin", "print_sequence", + "adhesion_type", "raft_margin", "print_sequence", "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"] ## Settings that change the convex hull. From 191dfdcb33061d8211eb25e8033bf12b9ddcc120 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 16 May 2017 16:05:44 +0200 Subject: [PATCH 19/20] Save Cura version to project files CURA-3822 --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 0960d89076..326cd87845 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -7,6 +7,7 @@ from cura.Settings.ExtruderManager import ExtruderManager import zipfile from io import StringIO import copy +import configparser class ThreeMFWorkspaceWriter(WorkspaceWriter): @@ -48,6 +49,16 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): Preferences.getInstance().writeToFile(preferences_string) archive.writestr(preferences_file, preferences_string.getvalue()) + # Save Cura version + version_file = zipfile.ZipInfo("Cura/version.ini") + version_config_parser = configparser.ConfigParser() + version_config_parser.add_section("versions") + version_config_parser.set("versions", "cura_version", Application.getStaticVersion()) + + version_file_string = StringIO() + version_config_parser.write(version_file_string) + archive.writestr(version_file, version_file_string.getvalue()) + # Close the archive & reset states. archive.close() mesh_writer.setStoreArchive(False) From ee831928ba813e1ea10a7009e52ded50c2b85cf9 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 17 May 2017 10:20:12 +0200 Subject: [PATCH 20/20] Fix overriding extruder stacks for project loading CURA-3756 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 593591b5dc..7e33c460b6 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -592,8 +592,27 @@ class ThreeMFWorkspaceReader(WorkspaceReader): if container_stacks: # this container stack already exists, try to resolve stack = container_stacks[0] + if self._resolve_strategies["machine"] == "override": - pass # do nothing + # NOTE: This is the same code as those in the lower part + global_stacks = self._container_registry.findContainerStacks(id = global_stack_id_original) + # deserialize new extruder stack over the current ones + if global_stacks: + old_extruder_stack_id = global_stacks[0].extruders[index].getId() + # HACK delete file + self._container_registry._deleteFiles(global_stacks[0].extruders[index]) + global_stacks[0].extruders[index].deserialize(archive.open(extruder_stack_file).read().decode("utf-8")) + # HACK + global_stacks[0]._extruders = global_stacks[0]._extruders[:2] + # HACK update cache + del self._container_registry._id_container_cache[old_extruder_stack_id] + new_extruder_stack_id = global_stacks[0].extruders[index].getId() + self._container_registry._id_container_cache[new_extruder_stack_id] = global_stacks[0].extruders[index] + + stack = global_stacks[0].extruders[index] + else: + Logger.log("w", "Could not find global stack, while I expected it: %s" % global_stack_id_original) + elif self._resolve_strategies["machine"] == "new": # create a new extruder stack from this one new_id = self.getNewId(container_id)