From 4a34f141d146f3daab6300a8b00b436bb0320438 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 7 Aug 2017 13:13:23 +0200 Subject: [PATCH 1/7] Check if a material container is used by GUID CURA-4129 isContainerUsed() is used to enable/disable the "Remove" button on the Material Manager dialog. When a custom material is created, it creates multiple containers, one for each extruder variant. In the dialog, it only checks if the material for the currently active extruder is being used or not. This causes a problem when 2 extruders are of different types and one uses a custom material. Then, the "Remove" button will not be correctly enabled/disable in the Material Manager dialog when the other extruder is activated. --- cura/Settings/ContainerManager.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 0d776aec20..840e8a7602 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -333,11 +333,29 @@ class ContainerManager(QObject): @pyqtSlot(str, result = bool) def isContainerUsed(self, container_id): Logger.log("d", "Checking if container %s is currently used", container_id) - containers = self._container_registry.findContainerStacks() - for stack in containers: - if container_id in [child.getId() for child in stack.getContainers()]: - Logger.log("d", "The container is in use by %s", stack.getId()) - return True + # check if this is a material container. If so, check if any material with the same GUID is being used by any + # stacks. + container_ids_to_check = [container_id] + container_results = self._container_registry.findInstanceContainers(id = container_id) + if container_results: + this_container = container_results[0] + container_guid = this_container.getMetaDataEntry("GUID") + # FIXME: only material containers have GUIDs, but to make it safer, metadata/material is also checked. + # but note that this is not a proper way to check whether a container is a material container. + # there should be a better way to do this + is_material = container_guid and this_container.getMetaDataEntry("material") + if is_material: + # check all material container IDs with the same guid + material_containers = self._container_registry.findInstanceContainers(GUID = container_guid) + if material_containers: + container_ids_to_check = [container.getId() for container in material_containers] + + all_stacks = self._container_registry.findContainerStacks() + for stack in all_stacks: + for container_id in container_ids_to_check: + if container_id in [child.getId() for child in stack.getContainers()]: + Logger.log("d", "The container is in use by %s", stack.getId()) + return True return False @pyqtSlot(str, result = str) From 919bc6767cc8257977a24eafa5112658eded9351 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 7 Aug 2017 11:46:09 +0200 Subject: [PATCH 2/7] Disable top surface line directions if there is no top surface --- 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 a4121ba2cc..cf1cc948e2 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -997,7 +997,7 @@ "type": "[int]", "default_value": "[ ]", "value": "skin_angles", - "enabled": "roofing_pattern != 'concentric'", + "enabled": "roofing_pattern != 'concentric' and roofing_layer_count > 0 and top_layers > 0", "limit_to_extruder": "roofing_extruder_nr", "settable_per_mesh": true }, From a75387ff3e7b9c30467ae05c157e91b804d20d81 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 8 Aug 2017 11:39:53 +0200 Subject: [PATCH 3/7] Only use Z-hop setting for the used extruders Otherwise the unused extruders still influence the build volume. --- cura/BuildVolume.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 7c965c6cdf..70578d0e02 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -442,7 +442,7 @@ class BuildVolume(SceneNode): def _updateExtraZClearance(self) -> None: extra_z = 0.0 - extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()) + extruders = ExtruderManager.getInstance().getUsedExtruderStacks() use_extruders = False for extruder in extruders: if extruder.getProperty("retraction_hop_enabled", "value"): From fe406f530c203e41939e875d9c1f84667c96638a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 8 Aug 2017 13:51:40 +0200 Subject: [PATCH 4/7] Never fill None for quality changes profile We want it to be the empty profile instead. This gets passed on all the way to _replaceQualityOrQualityChangesInStack where the metadata is requested. Contributes to issue CURA-3301. --- cura/Settings/MachineManager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 7fb9c3b0a2..0ea2c9f977 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -929,6 +929,8 @@ class MachineManager(QObject): quality_changes = quality_changes_list[0] else: quality_changes = global_quality_changes + if not quality_changes: + quality_changes = self._empty_quality_changes_container material = stack.material quality = quality_manager.findQualityByQualityType(quality_type, global_machine_definition, [material]) From b9cdeb68d6733206591dd3207d833da2255093cc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 8 Aug 2017 14:40:02 +0200 Subject: [PATCH 5/7] Don't crash when there is no global quality container We fill the stack with an empty container rather than with None in that case. Contributes to issue CURA-3301. --- cura/Settings/MachineManager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 0ea2c9f977..e946c18790 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -916,6 +916,8 @@ class MachineManager(QObject): global_quality = quality_manager.findQualityByQualityType(quality_type, global_machine_definition, [], global_quality = True) else: global_quality = quality_manager.findQualityByQualityType(quality_type, global_machine_definition, [material]) + if not global_quality: + global_quality = self._empty_quality_container # Find the values for each extruder. extruder_stacks = ExtruderManager.getInstance().getActiveExtruderStacks() From bb1475d1fd71b3857f2e3338a5fbe7cf4cf89ef7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 8 Aug 2017 16:32:01 +0200 Subject: [PATCH 6/7] Search for instance containers with type material CURA-4129 --- cura/Settings/ContainerManager.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 840e8a7602..aea04ade34 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -336,19 +336,15 @@ class ContainerManager(QObject): # check if this is a material container. If so, check if any material with the same GUID is being used by any # stacks. container_ids_to_check = [container_id] - container_results = self._container_registry.findInstanceContainers(id = container_id) + container_results = self._container_registry.findInstanceContainers(id = container_id, type = "material") if container_results: this_container = container_results[0] container_guid = this_container.getMetaDataEntry("GUID") - # FIXME: only material containers have GUIDs, but to make it safer, metadata/material is also checked. - # but note that this is not a proper way to check whether a container is a material container. - # there should be a better way to do this - is_material = container_guid and this_container.getMetaDataEntry("material") - if is_material: - # check all material container IDs with the same guid - material_containers = self._container_registry.findInstanceContainers(GUID = container_guid) - if material_containers: - container_ids_to_check = [container.getId() for container in material_containers] + # check all material container IDs with the same GUID + material_containers = self._container_registry.findInstanceContainers(GUID = container_guid, + type = "material") + if material_containers: + container_ids_to_check = [container.getId() for container in material_containers] all_stacks = self._container_registry.findContainerStacks() for stack in all_stacks: From 8c6abc85fcf83c258722eb9bd6167cf450a9c21a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 8 Aug 2017 16:32:38 +0200 Subject: [PATCH 7/7] Rename variable in for loop CURA-4129 --- cura/Settings/ContainerManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index aea04ade34..9707ca4909 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -348,8 +348,8 @@ class ContainerManager(QObject): all_stacks = self._container_registry.findContainerStacks() for stack in all_stacks: - for container_id in container_ids_to_check: - if container_id in [child.getId() for child in stack.getContainers()]: + for used_container_id in container_ids_to_check: + if used_container_id in [child.getId() for child in stack.getContainers()]: Logger.log("d", "The container is in use by %s", stack.getId()) return True return False