From be6bfdd4af56c2ed9f561f21b4bce19b86ab873b Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 8 Sep 2016 13:58:13 +0200 Subject: [PATCH 1/7] Add a "linked" icon to settings that have "global_inherits_stack" set --- resources/qml/Settings/SettingItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index ed16b722dd..cdc557a089 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -138,7 +138,7 @@ Item { { id: linkedSettingIcon; - visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && !definition.settable_per_extruder && base.showLinkedSettingIcon + visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && (!definition.settable_per_extruder || definition.global_inherits_stack != "-1") && base.showLinkedSettingIcon height: parent.height; width: height; From 46942d7cf23e32dcdf5dbf00440aa781061f4f65 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 8 Sep 2016 14:02:44 +0200 Subject: [PATCH 2/7] Remove "infill mesh" as a standard visible setting --- cura/CuraApplication.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 32c5191c7c..14e4cd9bf1 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -253,7 +253,6 @@ class CuraApplication(QtApplication): meshfix blackmagic print_sequence - infill_mesh experimental """.replace("\n", ";").replace(" ", "")) From 4de78db87a6d6396590079486b396ae66b522538 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 8 Sep 2016 14:04:58 +0200 Subject: [PATCH 3/7] Revert "Remove "infill mesh" as a standard visible setting" This reverts commit 46942d7cf23e32dcdf5dbf00440aa781061f4f65. It was not my decision to make --- cura/CuraApplication.py | 1 + plugins/3MFReader/ThreeMFReader.py | 2 +- plugins/PerObjectSettingsTool/PerObjectSettingsTool.py | 5 ++++- plugins/SolidView/SolidView.py | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 14e4cd9bf1..32c5191c7c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -253,6 +253,7 @@ class CuraApplication(QtApplication): meshfix blackmagic print_sequence + infill_mesh experimental """.replace("\n", ";").replace(" ", "")) diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index ea3ca30118..89fa5e3e88 100644 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -71,7 +71,7 @@ class ThreeMFReader(MeshReader): rotation.setByRotationAxis(-0.5 * math.pi, Vector(1, 0, 0)) # TODO: We currently do not check for normals and simply recalculate them. - mesh_builder.calculateNormals() + mesh_builder.calculateNormals(flip = True) mesh_builder.setFileName(file_name) node.setMeshData(mesh_builder.build().getTransformed(rotation)) node.setSelectable(True) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py index 5c52c89416..953f60a33d 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsTool.py @@ -77,7 +77,10 @@ class PerObjectSettingsTool(Tool): if not self._multi_extrusion: default_stack_id = global_container_stack.getId() else: - default_stack_id = ExtruderManager.getInstance().getExtruderStack(0).getId() + default_stack = ExtruderManager.getInstance().getExtruderStack(0) + if default_stack: + default_stack_id = default_stack.getId() + else: default_stack_id = global_container_stack.getId() root_node = Application.getInstance().getController().getScene().getRoot() for node in DepthFirstIterator(root_node): diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 2d017f829f..fd9f106334 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -51,6 +51,8 @@ class SolidView(View): if multi_extrusion: support_extruder_nr = global_container_stack.getProperty("support_extruder_nr", "value") support_angle_stack = ExtruderManager.getInstance().getExtruderStack(support_extruder_nr) + if not support_angle_stack: + support_angle_stack = global_container_stack else: support_angle_stack = global_container_stack From 8a8b55800b905dd479848bf8a4f61a0a6d7ebd1b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Sep 2016 14:15:00 +0200 Subject: [PATCH 4/7] Duplicating materialContainers should now duplicate all related material containers CURA-2242 --- cura/CuraApplication.py | 2 ++ cura/Settings/ContainerManager.py | 35 +++++++++++++++++++++ resources/qml/Preferences/MaterialsPage.qml | 16 +++------- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 32c5191c7c..7651cad930 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -322,6 +322,7 @@ class CuraApplication(QtApplication): path = Resources.getStoragePath(self.ResourceTypes.VariantInstanceContainer, file_name) if path: + instance.setPath(path) with SaveFile(path, "wt", -1, "utf-8") as f: f.write(data) @@ -346,6 +347,7 @@ class CuraApplication(QtApplication): elif stack_type == "extruder_train": path = Resources.getStoragePath(self.ResourceTypes.ExtruderStack, file_name) if path: + stack.setPath(path) with SaveFile(path, "wt", -1, "utf-8") as f: f.write(data) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index c082c64da1..27a9bd90dd 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -167,6 +167,19 @@ class ContainerManager(QObject): return True + @pyqtSlot(str, str, result=str) + def getContainerMetaDataEntry(self, container_id, entry_name): + containers = self._container_registry.findContainers(None, id=container_id) + if not containers: + UM.Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id) + return False + + result = containers[0].getMetaDataEntry(entry_name) + if result: + return result + else: + return "" + ## Set a metadata entry of the specified container. # # This will set the specified entry of the container's metadata to the specified @@ -577,6 +590,28 @@ class ContainerManager(QObject): return new_name + @pyqtSlot(str, result = str) + def duplicateMaterial(self, material_id): + containers = self._container_registry.findInstanceContainers(id=material_id) + if not containers: + UM.Logger.log("d", "Unable to duplicate the material with id %s, because it doesn't exist.", material_id) + return "" + + # Ensure all settings are saved. + UM.Application.getInstance().saveSettings() + + # Create a new ID & container to hold the data. + new_id = self._container_registry.uniqueName(material_id) + container_type = type(containers[0]) # Could be either a XMLMaterialProfile or a InstanceContainer + duplicated_container = container_type(new_id) + + # Instead of duplicating we load the data from the basefile again. + # This ensures that the inheritance goes well and all "cut up" subclasses of the xmlMaterial profile + # are also correctly created. + with open(containers[0].getPath(), encoding="utf-8") as f: + duplicated_container.deserialize(f.read()) + self._container_registry.addContainer(duplicated_container) + # Factory function, used by QML @staticmethod def createContainerManager(engine, js_engine): diff --git a/resources/qml/Preferences/MaterialsPage.qml b/resources/qml/Preferences/MaterialsPage.qml index d2d7c1b0a2..b1f0afe52f 100644 --- a/resources/qml/Preferences/MaterialsPage.qml +++ b/resources/qml/Preferences/MaterialsPage.qml @@ -129,30 +129,24 @@ UM.ManagementPage enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id) }, - /* // apparently visible does not work on OS X - Button + // apparently visible does not work on OS X + /*Button { text: catalog.i18nc("@action:button", "Duplicate"); iconName: "list-add"; enabled: base.currentItem != null onClicked: { - var material_id = Cura.ContainerManager.duplicateContainer(base.currentItem.id) + var base_file = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "base_file") + // We need to copy the base container instead of the specific variant. + var material_id = base_file == "" ? Cura.ContainerManager.duplicateMaterial(base.currentItem.id): Cura.ContainerManager.duplicateMaterial(base_file) if(material_id == "") { return } - if(Cura.MachineManager.filterQualityByMachine) - { - var quality_id = Cura.ContainerManager.duplicateContainer(Cura.MachineManager.activeQualityId) - Cura.ContainerManager.setContainerMetaDataEntry(quality_id, "material", material_id) - Cura.MachineManager.setActiveQuality(quality_id) - } - Cura.MachineManager.setActiveMaterial(material_id) } - visible: false; }, */ Button From 96a1aafb80e7cb463b22d9185281df096837730d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Sep 2016 14:23:35 +0200 Subject: [PATCH 5/7] Zipfile is now closed when it's done loading CURA-2252 --- plugins/CuraProfileReader/CuraProfileReader.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/CuraProfileReader/CuraProfileReader.py b/plugins/CuraProfileReader/CuraProfileReader.py index c8d39b7a78..2bccb8e3cb 100644 --- a/plugins/CuraProfileReader/CuraProfileReader.py +++ b/plugins/CuraProfileReader/CuraProfileReader.py @@ -27,15 +27,15 @@ class CuraProfileReader(ProfileReader): # returned. def read(self, file_name): try: - archive = zipfile.ZipFile(file_name, "r") - results = [] - for profile_id in archive.namelist(): - with archive.open(profile_id) as f: - serialized = f.read() - profile = self._loadProfile(serialized.decode("utf-8"), profile_id) - if profile is not None: - results.append(profile) - return results + with zipfile.ZipFile(file_name, "r") as archive: + results = [] + for profile_id in archive.namelist(): + with archive.open(profile_id) as f: + serialized = f.read() + profile = self._loadProfile(serialized.decode("utf-8"), profile_id) + if profile is not None: + results.append(profile) + return results except zipfile.BadZipFile: # It must be an older profile from Cura 2.1. From 750018003d6d43e346c4aba14767179a3a66890d Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 8 Sep 2016 15:39:33 +0200 Subject: [PATCH 6/7] removal: made support_area_smoothing hardcoded (CURA-2296) --- resources/definitions/fdmprinter.def.json | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index dc5a07ac46..a586f45b21 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2477,19 +2477,6 @@ "enabled": "support_enable", "settable_per_mesh": true }, - "support_area_smoothing": - { - "label": "Support Area Smoothing", - "description": "Maximum distance in the X/Y directions of a line segment which is to be smoothed out. Ragged lines are introduced by the join distance and support bridge, which cause the machine to resonate. Smoothing the support areas won't cause them to break with the constraints, except it might change the overhang.", - "unit": "mm", - "type": "float", - "default_value": 0.6, - "global_inherits_stack": "support_extruder_nr", - "minimum_value": "0", - "maximum_value_warning": "1.0", - "enabled": "support_enable", - "settable_per_mesh": true - }, "support_interface_enable": { "label": "Enable Support Interface", From 6197a5b77a9c7d6a8b75f745d462305422433a4b Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 8 Sep 2016 16:21:34 +0200 Subject: [PATCH 7/7] feat: support_interface_skip_height (CURA-2052) --- resources/definitions/fdmprinter.def.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 3568f9bc14..b1cad3eb68 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2533,6 +2533,19 @@ } } }, + "support_interface_skip_height": + { + "label": "Support Interface Resolution", + "description": "When checking where there's model above the support, take steps of the given height. Lower values will slice slower, while higher values may cause normal support to be printed in some places where there should have been support interface.", + "unit": "mm", + "type": "float", + "default_value": 0.3, + "minimum_value": "0", + "global_inherits_stack": "support_extruder_nr", + "maximum_value_warning": "support_interface_height", + "enabled": "extruderValue(support_extruder_nr, 'support_interface_enable') and support_enable", + "settable_per_mesh": true + }, "support_interface_density": { "label": "Support Interface Density",