From a7e22e82b6c8f05ac7b539ec82fc25b4376ec94c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 11:20:08 +0200 Subject: [PATCH 01/13] Duplication now works regardles how deeply group nested a node is CURA-1578 --- cura/CuraApplication.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 800f2a3b95..08d46af4df 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -585,18 +585,16 @@ class CuraApplication(QtApplication): node = Selection.getSelectedObject(0) if node: + current_node = node + # Find the topmost group + while current_node.getParent() and current_node.getParent().callDecoration("isGroup"): + current_node = current_node.getParent() + + new_node = copy.deepcopy(current_node) + op = GroupedOperation() for _ in range(count): - if node.getParent() and node.getParent().callDecoration("isGroup"): - new_node = copy.deepcopy(node.getParent()) #Copy the group node. - new_node.callDecoration("recomputeConvexHull") - - op.addOperation(AddSceneNodeOperation(new_node,node.getParent().getParent())) - else: - new_node = copy.deepcopy(node) - new_node.callDecoration("recomputeConvexHull") - op.addOperation(AddSceneNodeOperation(new_node, node.getParent())) - + op.addOperation(AddSceneNodeOperation(new_node, current_node.getParent())) op.push() ## Center object on platform. From 951e7bf629887118ee9a0837974a573106ec4bba Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 11:40:43 +0200 Subject: [PATCH 02/13] Refusing to change material actually prevents material from being changed CURA-1909 --- cura/Settings/MachineManager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 23335e3e63..fe451e74f6 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -126,6 +126,9 @@ class MachineManager(QObject): self._auto_change_material_hotend_flood_time = time.time() self._auto_change_material_hotend_flood_last_choice = button + if button == QMessageBox.No: + return + Logger.log("d", "Setting hotend variant of hotend %d to %s" % (index, hotend_id)) extruder_manager = ExtruderManager.getInstance() @@ -174,6 +177,9 @@ class MachineManager(QObject): self._auto_change_material_hotend_flood_time = time.time() self._auto_change_material_hotend_flood_last_choice = button + if button == QMessageBox.No: + return + Logger.log("d", "Setting material of hotend %d to %s" % (index, material_id)) extruder_manager = ExtruderManager.getInstance() From 806197f56bbde3dc9587ceaad4d489d680324e3a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 12:10:09 +0200 Subject: [PATCH 03/13] Only basename is used for the name CURA-1680 --- cura/PrintInformation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 5432da5dcc..52c53a34a7 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -81,6 +81,9 @@ class PrintInformation(QObject): @pyqtSlot(str) def setJobName(self, name): + # Ensure that we don't use entire path but only filename + name = os.path.basename(name) + # when a file is opened using the terminal; the filename comes from _onFileLoaded and still contains its # extension. This cuts the extension off if necessary. name = os.path.splitext(name)[0] From 29457ab11f723bb28d08016971bf3d5c6d3c3f16 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Fri, 1 Jul 2016 00:39:04 +0200 Subject: [PATCH 04/13] JSON fix: support roof extruder could be chosen even when roofs weren't enabled (CURA-1723) just putting this commit under that issue so that it will be reviewed... --- 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 6c39aaa330..8cb7f9cb5d 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2998,7 +2998,7 @@ "type": "extruder", "default_value": "0", "value": "support_extruder_nr", - "enabled": "support_enable", + "enabled": "support_enable and support_roof_enable", "settable_per_mesh": false, "settable_per_extruder": false } From 42d400d4369ffb68859f42b16f4d196fdf8c98ba Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Fri, 1 Jul 2016 00:56:48 +0200 Subject: [PATCH 05/13] JSON feat: cubic isometric infill (CURA-1723) --- resources/definitions/fdmprinter.def.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 8cb7f9cb5d..0fc65b2734 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -904,7 +904,7 @@ "type": "float", "default_value": 2, "minimum_value": "0", - "value": "0 if infill_sparse_density == 0 else (infill_line_width * 100) / infill_sparse_density * (2 if infill_pattern == \"grid\" else (3 if infill_pattern == \"triangles\" else 1))", + "value": "0 if infill_sparse_density == 0 else (infill_line_width * 100) / infill_sparse_density * (2 if infill_pattern == \"grid\" else (3 if infill_pattern == \"triangles\" else (3 if infill_pattern == \"cubic\" else 1)))", "settable_per_mesh": true } } @@ -912,12 +912,13 @@ "infill_pattern": { "label": "Infill Pattern", - "description": "The pattern of the infill material of the print. The line and zig zag infill swap direction on alternate layers, reducing material cost. The grid, triangle and concentric patterns are fully printed every layer.", + "description": "The pattern of the infill material of the print. The line and zig zag infill swap direction on alternate layers, reducing material cost. The grid, cubic, triangle and concentric patterns are fully printed every layer.", "type": "enum", "options": { "grid": "Grid", "lines": "Lines", + "cubic": "Cubic", "triangles": "Triangles", "concentric": "Concentric", "zigzag": "Zig Zag" From 026fd3e2ddf375ae74b42be0332669dc3a9f32b1 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Fri, 15 Jul 2016 12:57:37 +0200 Subject: [PATCH 06/13] feat: tetrahedral infill (CURA-1925) --- resources/definitions/fdmprinter.def.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 0fc65b2734..059e2a25e2 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -904,7 +904,7 @@ "type": "float", "default_value": 2, "minimum_value": "0", - "value": "0 if infill_sparse_density == 0 else (infill_line_width * 100) / infill_sparse_density * (2 if infill_pattern == \"grid\" else (3 if infill_pattern == \"triangles\" else (3 if infill_pattern == \"cubic\" else 1)))", + "value": "0 if infill_sparse_density == 0 else (infill_line_width * 100) / infill_sparse_density * (2 if infill_pattern == \"grid\" else (3 if infill_pattern == \"triangles\" or infill_pattern == \"cubic\" else (4 if infill_pattern == \"tetrahedral\" else 1)))", "settable_per_mesh": true } } @@ -912,14 +912,15 @@ "infill_pattern": { "label": "Infill Pattern", - "description": "The pattern of the infill material of the print. The line and zig zag infill swap direction on alternate layers, reducing material cost. The grid, cubic, triangle and concentric patterns are fully printed every layer.", + "description": "The pattern of the infill material of the print. The line and zig zag infill swap direction on alternate layers, reducing material cost. The grid, triangle, cubic, tetrahedral and concentric patterns are fully printed every layer. Cubic and tetrahedral infill change with every layer to provide a more equal distribution of strength over each direction.", "type": "enum", "options": { "grid": "Grid", "lines": "Lines", - "cubic": "Cubic", "triangles": "Triangles", + "cubic": "Cubic", + "tetrahedral": "Tetrahedral", "concentric": "Concentric", "zigzag": "Zig Zag" }, From bd183266c671e18d050ede9567fc9980ac1a3f28 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 13:11:36 +0200 Subject: [PATCH 07/13] Forced size of heatup buttons in checkup CURA-422 --- plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml index 86429ed119..34544dca75 100644 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml +++ b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml @@ -196,8 +196,8 @@ Cura.MachineAction visible: checkupMachineAction.usbConnected Button { + height: 20 text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") - // onClicked: { if (checkupMachineAction.heatupHotendStarted) @@ -259,6 +259,7 @@ Cura.MachineAction Button { text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") + height: 20 onClicked: { if (checkupMachineAction.heatupBedStarted) From d48b4bf7901b197854b7833df6c265efe207f494 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 13:23:25 +0200 Subject: [PATCH 08/13] Material GUID is now sent to engine for each extruder CURA-1836 --- plugins/CuraEngineBackend/StartSliceJob.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 6aa9c4660b..5b715230e2 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -180,6 +180,12 @@ class StartSliceJob(Job): setting.value = str(stack.getProperty(key, "value")).encode("utf-8") Job.yieldThread() + # ALso send the material GUID as a setting. + material_instance_container = stack.findContainer({"type": "material"}) + if material_instance_container: + setting = message.getMessage("settings").addRepeatedMessage("settings") + setting.name = "material_GUID" + setting.value = str(material_instance_container.getMetaDataEntry("GUID", "")).encode("utf-8") ## Sends all global settings to the engine. # # The settings are taken from the global stack. This does not include any From 942539981b8d9b9464916d1546b2bebc45cbc2c6 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Fri, 15 Jul 2016 13:27:50 +0200 Subject: [PATCH 09/13] JSON fix: moved prime location to category platform_adhesion (CURA-1816) --- resources/definitions/fdmextruder.def.json | 34 +++++++++------ resources/definitions/fdmprinter.def.json | 48 +++++++++++----------- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/resources/definitions/fdmextruder.def.json b/resources/definitions/fdmextruder.def.json index 4e3ee0a84f..f602441ff3 100644 --- a/resources/definitions/fdmextruder.def.json +++ b/resources/definitions/fdmextruder.def.json @@ -145,6 +145,28 @@ "settable_per_meshgroup": false, "settable_globally": false }, + "extruder_prime_pos_z": + { + "label": "Extruder Prime Z Position", + "description": "The Z coordinate of the position where the nozzle primes at the start of printing.", + "type": "float", + "unit": "mm", + "default_value": 0, + "minimum_value_warning": "0", + "maximum_value_warning": "machine_height", + "settable_per_mesh": false, + "settable_per_extruder": true + } + } + }, + "platform_adhesion": + { + "label": "Platform Adhesion", + "type": "category", + "icon": "category_adhesion", + "description": "Adhesion", + "children": + { "extruder_prime_pos_x": { "label": "Extruder Prime X Position", @@ -168,18 +190,6 @@ "maximum_value_warning": "machine_depth", "settable_per_mesh": false, "settable_per_extruder": true - }, - "extruder_prime_pos_z": - { - "label": "Extruder Prime Z Position", - "description": "The Z coordinate of the position where the nozzle primes at the start of printing.", - "type": "float", - "unit": "mm", - "default_value": 0, - "minimum_value_warning": "0", - "maximum_value_warning": "machine_height", - "settable_per_mesh": false, - "settable_per_extruder": true } } } diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 059e2a25e2..7894507645 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -326,30 +326,6 @@ "settable_per_extruder": false, "settable_per_meshgroup": false }, - "extruder_prime_pos_x": - { - "label": "Extruder Prime X Position", - "description": "The X coordinate of the position where the nozzle primes at the start of printing.", - "type": "float", - "unit": "mm", - "default_value": 0, - "minimum_value_warning": "0", - "maximum_value_warning": "machine_width", - "settable_per_mesh": false, - "settable_per_extruder": true - }, - "extruder_prime_pos_y": - { - "label": "Extruder Prime Y Position", - "description": "The Y coordinate of the position where the nozzle primes at the start of printing.", - "type": "float", - "unit": "mm", - "default_value": 0, - "minimum_value_warning": "0", - "maximum_value_warning": "machine_depth", - "settable_per_mesh": false, - "settable_per_extruder": true - }, "extruder_prime_pos_z": { "label": "Extruder Prime Z Position", @@ -2448,6 +2424,30 @@ "description": "Adhesion", "children": { + "extruder_prime_pos_x": + { + "label": "Extruder Prime X Position", + "description": "The X coordinate of the position where the nozzle primes at the start of printing.", + "type": "float", + "unit": "mm", + "default_value": 0, + "minimum_value_warning": "0", + "maximum_value_warning": "machine_width", + "settable_per_mesh": false, + "settable_per_extruder": true + }, + "extruder_prime_pos_y": + { + "label": "Extruder Prime Y Position", + "description": "The Y coordinate of the position where the nozzle primes at the start of printing.", + "type": "float", + "unit": "mm", + "default_value": 0, + "minimum_value_warning": "0", + "maximum_value_warning": "machine_depth", + "settable_per_mesh": false, + "settable_per_extruder": true + }, "adhesion_type": { "label": "Platform Adhesion Type", From a52095df0e5840c3fc5073b6eb95c1a0d791e490 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Fri, 15 Jul 2016 13:32:43 +0200 Subject: [PATCH 10/13] JSON fix: disabled prime location by default (CURA-1816) --- resources/definitions/fdmextruder.def.json | 6 ++++-- resources/definitions/fdmprinter.def.json | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/definitions/fdmextruder.def.json b/resources/definitions/fdmextruder.def.json index f602441ff3..7ce44b77b0 100644 --- a/resources/definitions/fdmextruder.def.json +++ b/resources/definitions/fdmextruder.def.json @@ -177,7 +177,8 @@ "minimum_value_warning": "machine_nozzle_offset_x", "maximum_value_warning": "machine_width", "settable_per_mesh": false, - "settable_per_extruder": true + "settable_per_extruder": true, + "enabled": false }, "extruder_prime_pos_y": { @@ -189,7 +190,8 @@ "minimum_value_warning": "machine_nozzle_offset_y", "maximum_value_warning": "machine_depth", "settable_per_mesh": false, - "settable_per_extruder": true + "settable_per_extruder": true, + "enabled": false } } } diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 7894507645..8833c175f3 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2434,7 +2434,8 @@ "minimum_value_warning": "0", "maximum_value_warning": "machine_width", "settable_per_mesh": false, - "settable_per_extruder": true + "settable_per_extruder": true, + "enabled": false }, "extruder_prime_pos_y": { @@ -2446,7 +2447,8 @@ "minimum_value_warning": "0", "maximum_value_warning": "machine_depth", "settable_per_mesh": false, - "settable_per_extruder": true + "settable_per_extruder": true, + "enabled": false }, "adhesion_type": { From 7a431646540f67fea81473c6d20e4b19c46e568d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 15:49:25 +0200 Subject: [PATCH 11/13] Both material weights & lengths are now exposed CURA-1038 --- cura/PrintInformation.py | 35 +++++++++++++++++++++------- plugins/SliceInfoPlugin/SliceInfo.py | 2 +- resources/qml/JobSpecs.qml | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 52c53a34a7..6ba1274a49 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -7,6 +7,8 @@ from UM.Application import Application from UM.Qt.Duration import Duration from UM.Preferences import Preferences +import cura.Settings.ExtruderManager + import math import os.path import unicodedata @@ -44,7 +46,8 @@ class PrintInformation(QObject): self._current_print_time = Duration(None, self) - self._material_amounts = [] + self._material_lengths = [] + self._material_weights = [] self._backend = Application.getInstance().getBackend() if self._backend: @@ -62,11 +65,17 @@ class PrintInformation(QObject): def currentPrintTime(self): return self._current_print_time - materialAmountsChanged = pyqtSignal() + materialLengthsChanged = pyqtSignal() - @pyqtProperty("QVariantList", notify = materialAmountsChanged) - def materialAmounts(self): - return self._material_amounts + @pyqtProperty("QVariantList", notify = materialLengthsChanged) + def materialLengths(self): + return self._material_lengths + + materialWeightsChanged = pyqtSignal() + + @pyqtProperty("QVariantList", notify = materialWeightsChanged) + def materialWeights(self): + return self._material_weights def _onPrintDurationMessage(self, total_time, material_amounts): self._current_print_time.setDuration(total_time) @@ -74,10 +83,18 @@ class PrintInformation(QObject): # Material amount is sent as an amount of mm^3, so calculate length from that r = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2 - self._material_amounts = [] - for amount in material_amounts: - self._material_amounts.append(round((amount / (math.pi * r ** 2)) / 1000, 2)) - self.materialAmountsChanged.emit() + self._material_lengths = [] + self._material_weights = [] + extruder_stacks = list(cura.Settings.ExtruderManager.getInstance().getMachineExtruders(Application.getInstance().getGlobalContainerStack().getId())) + for index, amount in enumerate(material_amounts): + ## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some + # list comprehension filtering to solve this for us. + extruder_stack = [extruder for extruder in extruder_stacks if extruder.getMetaDataEntry("position") == str(index)][0] + density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) + self._material_weights.append(float(amount) * float(density)) + self._material_lengths.append(round((amount / (math.pi * r ** 2)) / 1000, 2)) + self.materialLengthsChanged.emit() + self.materialWeightsChanged.emit() @pyqtSlot(str) def setJobName(self, name): diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 39a55702ab..913ad467c5 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -59,7 +59,7 @@ class SliceInfo(Extension): material_radius = 0.5 * global_container_stack.getProperty("material_diameter", "value") # TODO: Send material per extruder instead of mashing it on a pile - material_used = math.pi * material_radius * material_radius * sum(print_information.materialAmounts) #Volume of all materials used + material_used = math.pi * material_radius * material_radius * sum(print_information.materialLengths) #Volume of all materials used # Get model information (bounding boxes, hashes and transformation matrix) models_info = [] diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index db58b5ee4e..40eb9cd250 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -24,7 +24,7 @@ Rectangle { UM.I18nCatalog { id: catalog; name:"cura"} property variant printDuration: PrintInformation.currentPrintTime - property variant printMaterialAmounts: PrintInformation.materialAmounts + property variant printMaterialAmounts: PrintInformation.materialLengths height: childrenRect.height color: "transparent" From dcc3bc8f80c1ecaabd3786aadc507e8289558627 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 15:56:39 +0200 Subject: [PATCH 12/13] Also refactored name of printlength in jobspecs.qml CURA-1836 --- resources/qml/JobSpecs.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 40eb9cd250..8e14241741 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -24,7 +24,8 @@ Rectangle { UM.I18nCatalog { id: catalog; name:"cura"} property variant printDuration: PrintInformation.currentPrintTime - property variant printMaterialAmounts: PrintInformation.materialLengths + property variant printMaterialLengths: PrintInformation.materialLengths + property variant printMaterialWeights: PrintInformation.materialWeights height: childrenRect.height color: "transparent" @@ -195,9 +196,9 @@ Rectangle { text: { var amounts = []; - if(base.printMaterialAmounts) { - for(var index = 0; index < base.printMaterialAmounts.length; index++) { - amounts.push(base.printMaterialAmounts[index].toFixed(2)); + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) { + amounts.push(base.printMaterialLengths[index].toFixed(2)); } } else { amounts = ["0.00"]; From 56efb92f3e58ca88b984c21291a590733afbb087 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 15 Jul 2016 16:04:02 +0200 Subject: [PATCH 13/13] Added additional decoration to UpdateQualityContainerFromUserContainer This allows the usage from QML withouth parameters. CURA-1890 --- cura/Settings/MachineManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index fe451e74f6..4b3141f900 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -499,6 +499,7 @@ class MachineManager(QObject): self.activeQualityChanged.emit() @pyqtSlot(str) + @pyqtSlot() def updateQualityContainerFromUserContainer(self, quality_id = None): if not self._active_container_stack: return