From 20ab6265c8d4cbc83230b6f57f4595a423355bcf Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 22 Jan 2018 13:58:35 +0100 Subject: [PATCH 1/4] CURA-4821 Delete also the GCode SceneNode when clearing the buildplate --- cura/CuraApplication.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7b6e970a68..26f9516a89 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1055,7 +1055,7 @@ class CuraApplication(QtApplication): continue # Node that doesnt have a mesh and is not a group. if only_selectable and not node.isSelectable(): continue - if not node.callDecoration("isSliceable"): + if not node.callDecoration("isSliceable") and not node.callDecoration("getLayerData"): continue # Only remove nodes that are selectable. if node.getParent() and node.getParent().callDecoration("isGroup"): continue # Grouped nodes don't need resetting as their parent (the group) is resetted) @@ -1071,10 +1071,6 @@ class CuraApplication(QtApplication): # Reset the print information: self.getController().getScene().sceneChanged.emit(node) - # self._print_information.setToZeroPrintInformation(self.getBuildPlateModel().activeBuildPlate) - - # stay on the same build plate - #self.getCuraSceneController().setActiveBuildPlate(0) # Select first build plate ## Reset all translation on nodes with mesh data. @pyqtSlot() From 619a8ccce5db5d72e0e87c95aa2c3613bebb8f78 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 22 Jan 2018 15:02:55 +0100 Subject: [PATCH 2/4] CURA-4839 Fix single extrusing for overrite the extruder stack. --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 31 ++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 638971d109..2c92b4cb6d 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -754,25 +754,18 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # If not extruder stacks were saved in the project file (pre 3.1) create one manually # We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this if not extruder_stacks: - if self._resolve_strategies["machine"] == "new": - stack = self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder") + stack = self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder") + if global_stack.quality.getId() in ("empty", "empty_quality"): + stack.quality = empty_quality_container + if self._resolve_strategies["machine"] == "override": + # in case the extruder is newly created (for a single-extrusion machine), we need to override + # the existing extruder stack. + existing_extruder_stack = global_stack.extruders[stack.getMetaDataEntry("position")] + for idx in range(len(_ContainerIndexes.IndexTypeMap)): + existing_extruder_stack.replaceContainer(idx, stack._containers[idx], postpone_emit = True) + extruder_stacks.append(existing_extruder_stack) else: - stack = global_stack.extruders.get("0") - if not stack: - # this should not happen - Logger.log("e", "Cannot find any extruder in an existing global stack [%s].", global_stack.getId()) - if stack: - if global_stack.quality.getId() in ("empty", "empty_quality"): - stack.quality = empty_quality_container - if self._resolve_strategies["machine"] == "override": - # in case the extruder is newly created (for a single-extrusion machine), we need to override - # the existing extruder stack. - existing_extruder_stack = global_stack.extruders[stack.getMetaDataEntry("position")] - for idx in range(len(_ContainerIndexes.IndexTypeMap)): - existing_extruder_stack.replaceContainer(idx, stack._containers[idx], postpone_emit = True) - extruder_stacks.append(existing_extruder_stack) - else: - extruder_stacks.append(stack) + extruder_stacks.append(stack) except: Logger.logException("w", "We failed to serialize the stack. Trying to clean up.") @@ -870,7 +863,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # We will first find the correct quality profile for the extruder, then apply the same # quality profile for the global stack. # - if len(extruder_stacks) == 1: + if has_extruder_stack_files and len(extruder_stacks) == 1: extruder_stack = extruder_stacks[0] search_criteria = {"type": "quality", "quality_type": global_stack.quality.getMetaDataEntry("quality_type")} From 50ccf101d83fab1a3530c0393fcbf6bd0980d3c8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 22 Jan 2018 15:37:51 +0100 Subject: [PATCH 3/4] Don't write Octoprint keys to workspace projects They should not be shared since they are private keys, so let's protect the user from accidentally sharing it via a project file. --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index f07a37a25f..825259ad58 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -97,7 +97,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): file_in_archive.compress_type = zipfile.ZIP_DEFLATED # Do not include the network authentication keys - ignore_keys = {"network_authentication_id", "network_authentication_key"} + ignore_keys = {"network_authentication_id", "network_authentication_key", "octoprint_api_key"} serialized_data = container.serialize(ignored_metadata_keys = ignore_keys) archive.writestr(file_in_archive, serialized_data) From d8ae78d80c6cb389a3b2dd3b51c34a77dbe2539f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 22 Jan 2018 16:12:11 +0100 Subject: [PATCH 4/4] CURA-4821 Select the groups to be deleted also when clearing the scene --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 26f9516a89..bfcbe529f7 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1055,7 +1055,7 @@ class CuraApplication(QtApplication): continue # Node that doesnt have a mesh and is not a group. if only_selectable and not node.isSelectable(): continue - if not node.callDecoration("isSliceable") and not node.callDecoration("getLayerData"): + if not node.callDecoration("isSliceable") and not node.callDecoration("getLayerData") and not node.callDecoration("isGroup"): continue # Only remove nodes that are selectable. if node.getParent() and node.getParent().callDecoration("isGroup"): continue # Grouped nodes don't need resetting as their parent (the group) is resetted)