From d4824a8ff19d5cadbd9ad7e5765e0b5c65bb372f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 20 Jul 2017 09:43:31 +0200 Subject: [PATCH 01/16] Make time estimates tooltip also appear on clock icon Perhaps that reduces the complaints we have about that thing not appearing. --- resources/qml/JobSpecs.qml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 13d855d993..fa0ca087b7 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -157,19 +157,6 @@ Item { width: parent.width height: parent.height - UM.RecolorImage - { - id: timeIcon - anchors.right: timeSpecPerFeatureTooltipArea.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 - anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("print_time") - } UM.TooltipArea { id: timeSpecPerFeatureTooltipArea @@ -205,10 +192,25 @@ Item { anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter + UM.RecolorImage + { + id: timeIcon + anchors.left: parent.left + anchors.top: parent.top + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text_subtext") + source: UM.Theme.getIcon("print_time") + } + Text { id: timeSpec - anchors.left: parent.left + anchors.left: timeIcon.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2 anchors.top: parent.top font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_subtext") From 216b1a7a14c1cfd093b9af28a4bf4473ead1232b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Jul 2017 11:39:12 +0200 Subject: [PATCH 02/16] Added control item to printOutputDevice CURA-4057 --- cura/PrinterOutputDevice.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index e23efc0f5a..60df3c3f6e 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -65,6 +65,11 @@ class PrinterOutputDevice(QObject, OutputDevice): self._monitor_view_qml_path = "" self._monitor_component = None self._monitor_item = None + + self._control_view_qml_path = "" + self._control_component = None + self._control_item = None + self._qml_context = None def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None): @@ -131,6 +136,29 @@ class PrinterOutputDevice(QObject, OutputDevice): return self._monitor_item + @pyqtProperty(QObject, constant=True) + def controlItem(self): + if not self._control_component: + self._createControlViewFromQML() + + return self._control_item + + def _createControlViewFromQML(self): + path = QUrl.fromLocalFile(self._monitor_view_qml_path) + + # Because of garbage collection we need to keep this referenced by python. + self._control_component = QQmlComponent(Application.getInstance()._engine, path) + + # Check if the context was already requested before (Printer output device might have multiple items in the future) + if self._qml_context is None: + self._qml_context = QQmlContext(Application.getInstance()._engine.rootContext()) + self._qml_context.setContextProperty("OutputDevice", self) + + self._control_item = self._control_component.create(self._qml_context) + if self._control_item is None: + Logger.log("e", "QQmlComponent status %s", self._control_component.status()) + Logger.log("e", "QQmlComponent error string %s", self._control_component.errorString()) + def _createMonitorViewFromQML(self): path = QUrl.fromLocalFile(self._monitor_view_qml_path) From 6e55bf2d8fb6117a86ef0037b0ddb505f161b04a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Jul 2017 13:30:57 +0200 Subject: [PATCH 03/16] If output device has a contorl item, that one is used. If a printerOutput device does not define anything, the fallback is used. CURA-4057 --- cura/PrinterOutputDevice.py | 2 +- .../NetworkPrinterOutputDevice.py | 1 - resources/qml/Sidebar.qml | 41 ++++++++++++++++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 60df3c3f6e..bf013e4b9f 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -144,7 +144,7 @@ class PrinterOutputDevice(QObject, OutputDevice): return self._control_item def _createControlViewFromQML(self): - path = QUrl.fromLocalFile(self._monitor_view_qml_path) + path = QUrl.fromLocalFile(self._control_view_qml_path) # Because of garbage collection we need to keep this referenced by python. self._control_component = QQmlComponent(Application.getInstance()._engine, path) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index b309691e81..03636fd0b0 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -179,7 +179,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._compressing_print = False self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml") - printer_type = self._properties.get(b"machine", b"").decode("utf-8") if printer_type.startswith("9511"): self._updatePrinterType("ultimaker3_extended") diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index b57b56c292..db5f60862d 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -20,6 +20,7 @@ Rectangle // Is there an output device for this printer? property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null property int backendState: UM.Backend.state; property bool monitoringPrint: false @@ -344,12 +345,48 @@ Rectangle Loader { + id: controlItem anchors.bottom: footerSeparator.top anchors.top: headerSeparator.bottom anchors.left: base.left anchors.right: base.right - source: monitoringPrint ? "PrintMonitor.qml": "SidebarContents.qml" - } + sourceComponent: + { + if(monitoringPrint && connectedPrinter != null) + { + if(connectedPrinter.controlItem != null) + { + return connectedPrinter.controlItem + } + } + return null + } + } + + Loader + { + anchors.bottom: footerSeparator.top + anchors.top: headerSeparator.bottom + anchors.left: base.left + anchors.right: base.right + source: + { + if(controlItem.sourceComponent == null) + { + if(monitoringPrint) + { + return "PrintMonitor.qml" + } else + { + return "SidebarContents.qml" + } + } + else + { + return "" + } + } + } Rectangle { From 121fc170647ae2fe01dae42bfe41a3c30ebee034 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Jul 2017 15:15:03 +0200 Subject: [PATCH 04/16] Multiply objects dialog is now application modal CURA-3768 --- resources/qml/Menus/ContextMenu.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index 915d320f41..86e146cb17 100755 --- a/resources/qml/Menus/ContextMenu.qml +++ b/resources/qml/Menus/ContextMenu.qml @@ -78,6 +78,7 @@ Menu Dialog { id: multiplyDialog + modality: Qt.ApplicationModal title: catalog.i18ncp("@title:window", "Multiply Selected Model", "Multiply Selected Models", UM.Selection.selectionCount) From 4d0c46508aa0e2ec76459c597ea5c059b10a6c56 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Jul 2017 15:17:46 +0200 Subject: [PATCH 05/16] Fixed incorrect naming of printcores in error messages CURA-3734 --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index b309691e81..5a7fb3a409 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -645,7 +645,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # Only check for mistakes if there is material length information. if print_information.materialLengths: - # Check if print cores / materials are loaded at all. Any failure in these results in an Error. + # Check if PrintCores / materials are loaded at all. Any failure in these results in an Error. for index in range(0, self._num_extruders): if index < len(print_information.materialLengths) and print_information.materialLengths[index] != 0: if self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["id"] == "": @@ -677,7 +677,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if variant: if variant.getName() != core_name: Logger.log("w", "Extruder %s has a different Cartridge (%s) as Cura (%s)", index + 1, core_name, variant.getName()) - warnings.append(i18n_catalog.i18nc("@label", "Different print core (Cura: {0}, Printer: {1}) selected for extruder {2}".format(variant.getName(), core_name, index + 1))) + warnings.append(i18n_catalog.i18nc("@label", "Different PrintCore (Cura: {0}, Printer: {1}) selected for extruder {2}".format(variant.getName(), core_name, index + 1))) material = extruder_manager.getExtruderStack(index).findContainer({"type": "material"}) if material: @@ -699,7 +699,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): is_offset_calibrated = True if not is_offset_calibrated: - warnings.append(i18n_catalog.i18nc("@label", "Print core {0} is not properly calibrated. XY calibration needs to be performed on the printer.").format(index + 1)) + warnings.append(i18n_catalog.i18nc("@label", "PrintCore {0} is not properly calibrated. XY calibration needs to be performed on the printer.").format(index + 1)) else: Logger.log("w", "There was no material usage found. No check to match used material with machine is done.") @@ -1176,7 +1176,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): i18n_catalog.i18nc("@label", "Would you like to use your current printer configuration in Cura?"), i18n_catalog.i18nc("@label", - "The print cores and/or materials on your printer differ from those within your current project. For the best result, always slice for the print cores and materials that are inserted in your printer."), + "The PrintCores and/or materials on your printer differ from those within your current project. For the best result, always slice for the PrintCores and materials that are inserted in your printer."), buttons=QMessageBox.Yes + QMessageBox.No, icon=QMessageBox.Question, callback=callback From 326c4cc4a420883fdf971193bb5acd94f01f4f7f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 21 Jul 2017 10:15:20 +0200 Subject: [PATCH 06/16] Removed code duplication CURA-4053 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index aca3948813..56b8c62d28 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -254,12 +254,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader): for index, container_id in enumerate(id_list): # take into account the old empty container IDs container_id = self._old_empty_profile_id_dict.get(container_id, container_id) - # HACK: there used to be 5, now we have one more 5 - definition changes - if len(id_list) == 6 and index == 5: - if global_stack.getContainer(5).getId() != "empty": - machine_conflict = True - break - index = 6 if global_stack.getContainer(index).getId() != container_id: machine_conflict = True break @@ -295,12 +289,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader): for index, container_id in enumerate(id_list): # take into account the old empty container IDs container_id = self._old_empty_profile_id_dict.get(container_id, container_id) - # HACK: there used to be 5, now we have one more 5 - definition changes - if len(id_list) == 6 and index == 5: - if existing_extruder_stack.getContainer(5).getId() != "empty": - machine_conflict = True - break - index = 6 if existing_extruder_stack.getContainer(index).getId() != container_id: machine_conflict = True break @@ -875,6 +863,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader): container_list = container_string.split(",") container_ids = [container_id for container_id in container_list if container_id != ""] + if len(container_ids) == 5: + # Hack; We used to not save the definition changes. Fix this. + container_ids.insert(4, "empty") + return container_ids def _getMachineNameFromSerializedStack(self, serialized): From 141cfe776e60057959a53b7424ad8aceeae782e3 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 11:28:44 +0200 Subject: [PATCH 07/16] Fix handling old stack without definition_changes and add doc CURA-4053 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 56b8c62d28..1a7a06d8b6 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -863,9 +863,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader): container_list = container_string.split(",") container_ids = [container_id for container_id in container_list if container_id != ""] - if len(container_ids) == 5: + # HACK: there used to be 6 containers numbering from 0 to 5 in a stack, + # now we have 7: index 5 becomes "definition_changes" + if len(container_ids) == 6: # Hack; We used to not save the definition changes. Fix this. - container_ids.insert(4, "empty") + container_ids.insert(5, "empty") return container_ids From 15a6b5626dc3a8771aab39d5fa56ff9271a19896 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 11:32:09 +0200 Subject: [PATCH 08/16] Remove useless code CURA-4053 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 1a7a06d8b6..e40a7c5479 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -881,5 +881,3 @@ class ThreeMFWorkspaceReader(WorkspaceReader): metadata = data.iterfind("./um:metadata/um:name/um:label", {"um": "http://www.ultimaker.com/material"}) for entry in metadata: return entry.text - pass - From ed91bf816f34f3b146d7788ca90a7d6e89704a61 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 11:36:45 +0200 Subject: [PATCH 09/16] Correct definition_changes location in 2.6 to 2.7 upgrade script CURA-4053 --- plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py b/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py index b0c0d70ae2..c309142c8f 100644 --- a/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py @@ -53,7 +53,7 @@ def getMetaData(): }, "definition_changes": { "get_version": upgrade.getCfgVersion, - "location": {"./machine_instances"} + "location": {"./definition_changes"} } } } From 66c97259c258813a11d7bb3483d1b76590fbead2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Jul 2017 11:14:17 +0200 Subject: [PATCH 10/16] Make prime tower automatic formula the default for all FDM printers The Custom FDM Printer had wrong positions by default as well. --- resources/definitions/cartesio.def.json | 4 ++-- resources/definitions/fdmprinter.def.json | 2 ++ resources/definitions/makeit_pro_l.def.json | 4 ++-- resources/definitions/makeit_pro_m.def.json | 4 ++-- resources/definitions/ultimaker3.def.json | 3 +-- resources/definitions/ultimaker_original_dual.def.json | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index bbc62bdf75..e5253f3b75 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -48,8 +48,8 @@ "material_bed_temp_wait": { "default_value": false }, "prime_tower_enable": { "default_value": true }, "prime_tower_wall_thickness": { "resolve": 0.7 }, - "prime_tower_position_x": { "default_value": 50 }, - "prime_tower_position_y": { "default_value": 150 }, + "prime_tower_position_x": { "value": "50" }, + "prime_tower_position_y": { "value": "150" }, "prime_blob_enable": { "default_value": false }, "machine_max_feedrate_z": { "default_value": 20 }, "machine_disallowed_areas": { "default_value": [ diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 4186a74a74..225ae76080 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -4462,6 +4462,7 @@ "unit": "mm", "enabled": "resolveOrValue('prime_tower_enable')", "default_value": 200, + "value": "machine_width - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) - 1", "maximum_value": "machine_width / 2 if machine_center_is_zero else machine_width", "minimum_value": "resolveOrValue('prime_tower_size') - machine_width / 2 if machine_center_is_zero else resolveOrValue('prime_tower_size')", "settable_per_mesh": false, @@ -4475,6 +4476,7 @@ "unit": "mm", "enabled": "resolveOrValue('prime_tower_enable')", "default_value": 200, + "value": "machine_depth - prime_tower_size - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) - 1", "maximum_value": "machine_depth / 2 - resolveOrValue('prime_tower_size') if machine_center_is_zero else machine_depth - resolveOrValue('prime_tower_size')", "minimum_value": "machine_depth / -2 if machine_center_is_zero else 0", "settable_per_mesh": false, diff --git a/resources/definitions/makeit_pro_l.def.json b/resources/definitions/makeit_pro_l.def.json index 79dab33fc1..32f65d2b99 100644 --- a/resources/definitions/makeit_pro_l.def.json +++ b/resources/definitions/makeit_pro_l.def.json @@ -72,10 +72,10 @@ "enabled": true }, "prime_tower_position_x": { - "default_value": 185 + "value": "185" }, "prime_tower_position_y": { - "default_value": 160 + "value": "160" }, "material_diameter": { "default_value": 1.75 diff --git a/resources/definitions/makeit_pro_m.def.json b/resources/definitions/makeit_pro_m.def.json index 0d9dab7073..7cae1d12ae 100644 --- a/resources/definitions/makeit_pro_m.def.json +++ b/resources/definitions/makeit_pro_m.def.json @@ -72,10 +72,10 @@ "enabled": false }, "prime_tower_position_x": { - "default_value": 185 + "value": "185" }, "prime_tower_position_y": { - "default_value": 160 + "value": "160" }, "material_diameter": { "default_value": 1.75 diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index 1cbd1fa363..06f0fe3a89 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -69,8 +69,7 @@ "extruder_prime_pos_abs": { "default_value": true }, "machine_start_gcode": { "default_value": "" }, "machine_end_gcode": { "default_value": "" }, - "prime_tower_position_x": { "default_value": 170 }, - "prime_tower_position_y": { "value": "machine_depth - prime_tower_size - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) - 1" }, + "prime_tower_position_x": { "value": "machine_depth - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) - 30" }, "prime_tower_wipe_enabled": { "default_value": false }, "prime_blob_enable": { "enabled": true }, diff --git a/resources/definitions/ultimaker_original_dual.def.json b/resources/definitions/ultimaker_original_dual.def.json index d133a3853f..e219a5ecb5 100644 --- a/resources/definitions/ultimaker_original_dual.def.json +++ b/resources/definitions/ultimaker_original_dual.def.json @@ -73,10 +73,10 @@ "default_value": 2 }, "prime_tower_position_x": { - "default_value": 195 + "value": "195" }, "prime_tower_position_y": { - "default_value": 149 + "value": "149" } } } From 4bb95eee36ccfd83c28ec9bb474d6d0b556cfbcc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Jul 2017 11:15:43 +0200 Subject: [PATCH 11/16] Apply initial layer line width to skirt lines in prime tower position calculation --- resources/definitions/fdmprinter.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 225ae76080..47cb24b1f8 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -4462,7 +4462,7 @@ "unit": "mm", "enabled": "resolveOrValue('prime_tower_enable')", "default_value": 200, - "value": "machine_width - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) - 1", + "value": "machine_width - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 - 1", "maximum_value": "machine_width / 2 if machine_center_is_zero else machine_width", "minimum_value": "resolveOrValue('prime_tower_size') - machine_width / 2 if machine_center_is_zero else resolveOrValue('prime_tower_size')", "settable_per_mesh": false, @@ -4476,7 +4476,7 @@ "unit": "mm", "enabled": "resolveOrValue('prime_tower_enable')", "default_value": 200, - "value": "machine_depth - prime_tower_size - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) - 1", + "value": "machine_depth - prime_tower_size - max(extruderValue(adhesion_extruder_nr, 'brim_width') * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 if adhesion_type == 'brim' else (extruderValue(adhesion_extruder_nr, 'raft_margin') if adhesion_type == 'raft' else (extruderValue(adhesion_extruder_nr, 'skirt_gap') if adhesion_type == 'skirt' else 0)), max(extruderValues('travel_avoid_distance'))) - max(extruderValues('support_offset')) - sum(extruderValues('skirt_brim_line_width')) * extruderValue(adhesion_extruder_nr, 'initial_layer_line_width_factor') / 100 - 1", "maximum_value": "machine_depth / 2 - resolveOrValue('prime_tower_size') if machine_center_is_zero else machine_depth - resolveOrValue('prime_tower_size')", "minimum_value": "machine_depth / -2 if machine_center_is_zero else 0", "settable_per_mesh": false, From 75af56b1a1ba18d408886a8830d48fe63c804541 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 Jul 2017 12:56:15 +0200 Subject: [PATCH 12/16] Only use line widths of used extruders for brim/skirt size No lines are drawn for the rest of the extruders. Contributes to issue CURA-4072. --- cura/BuildVolume.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index e65756f181..cf75d75d5e 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -904,6 +904,7 @@ class BuildVolume(SceneNode): if not self._global_container_stack: return 0 container_stack = self._global_container_stack + used_extruders = ExtruderManager.getInstance().getUsedExtruderStacks() # If we are printing one at a time, we need to add the bed adhesion size to the disallowed areas of the objects if container_stack.getProperty("print_sequence", "value") == "one_at_a_time": @@ -914,24 +915,18 @@ class BuildVolume(SceneNode): skirt_distance = self._getSettingFromAdhesionExtruder("skirt_gap") skirt_line_count = self._getSettingFromAdhesionExtruder("skirt_line_count") bed_adhesion_size = skirt_distance + (skirt_line_count * self._getSettingFromAdhesionExtruder("skirt_brim_line_width")) * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor") / 100.0 - if len(ExtruderManager.getInstance().getUsedExtruderStacks()) > 1: - adhesion_extruder_nr = int(self._global_container_stack.getProperty("adhesion_extruder_nr", "value")) - extruder_values = ExtruderManager.getInstance().getAllExtruderValues("skirt_brim_line_width") - line_width_factors = ExtruderManager.getInstance().getAllExtruderValues("initial_layer_line_width_factor") - del extruder_values[adhesion_extruder_nr] # Remove the value of the adhesion extruder nr. - del line_width_factors[adhesion_extruder_nr] - for i in range(min(len(extruder_values), len(line_width_factors))): - bed_adhesion_size += extruder_values[i] * line_width_factors[i] / 100.0 + if len(used_extruders) > 1: + for extruder_stack in used_extruders: + bed_adhesion_size += extruder_stack.getProperty("skirt_brim_line_width", "value") * extruder_stack.getProperty("initial_layer_line_width_factor", "value") / 100.0 + #We don't create an additional line for the extruder we're printing the skirt with. + bed_adhesion_size -= self._getSettingFromAdhesionExtruder("skirt_brim_line_width", "value") * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor", "value") / 100.0 elif adhesion_type == "brim": bed_adhesion_size = self._getSettingFromAdhesionExtruder("brim_line_count") * self._getSettingFromAdhesionExtruder("skirt_brim_line_width") * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor") / 100.0 if self._global_container_stack.getProperty("machine_extruder_count", "value") > 1: - adhesion_extruder_nr = int(self._global_container_stack.getProperty("adhesion_extruder_nr", "value")) - extruder_values = ExtruderManager.getInstance().getAllExtruderValues("skirt_brim_line_width") - line_width_factors = ExtruderManager.getInstance().getAllExtruderValues("initial_layer_line_width_factor") - del extruder_values[adhesion_extruder_nr] # Remove the value of the adhesion extruder nr. - del line_width_factors[adhesion_extruder_nr] - for i in range(min(len(extruder_values), len(line_width_factors))): - bed_adhesion_size += extruder_values[i] * line_width_factors[i] / 100.0 + for extruder_stack in used_extruders: + bed_adhesion_size += extruder_stack.getProperty("skirt_brim_line_width", "value") * extruder_stack.getProperty("initial_layer_line_width_factor", "value") / 100.0 + #We don't create an additional line for the extruder we're printing the brim with. + bed_adhesion_size -= self._getSettingFromAdhesionExtruder("skirt_brim_line_width", "value") * self._getSettingFromAdhesionExtruder("initial_layer_line_width_factor", "value") / 100.0 elif adhesion_type == "raft": bed_adhesion_size = self._getSettingFromAdhesionExtruder("raft_margin") elif adhesion_type == "none": @@ -951,7 +946,6 @@ class BuildVolume(SceneNode): move_from_wall_radius = 0 # Moves that start from outer wall. move_from_wall_radius = max(move_from_wall_radius, max(self._getSettingFromAllExtruders("infill_wipe_dist"))) - used_extruders = ExtruderManager.getInstance().getUsedExtruderStacks() avoid_enabled_per_extruder = [stack.getProperty("travel_avoid_other_parts","value") for stack in used_extruders] travel_avoid_distance_per_extruder = [stack.getProperty("travel_avoid_distance", "value") for stack in used_extruders] for avoid_other_parts_enabled, avoid_distance in zip(avoid_enabled_per_extruder, travel_avoid_distance_per_extruder): #For each extruder (or just global). From 9a92b58ac3ba481bd45e1d71aa57df5d4d48541a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 13:26:46 +0200 Subject: [PATCH 13/16] Check all limit_to_extruder features in getUsedExtruderStacks() CURA-4069 getUsedExtruderStacks() doesn't take into account some new limit to extruder features, The BuildVolume uses it to determine disallowed areas, and this makes it give incorrect results. --- cura/Settings/ExtruderManager.py | 48 ++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 70f95caae5..322d61fa3b 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -426,6 +426,7 @@ class ExtruderManager(QObject): support_enabled = False support_bottom_enabled = False support_roof_enabled = False + support_interface_enable = False scene_root = Application.getInstance().getController().getScene().getRoot() meshes = [node for node in DepthFirstIterator(scene_root) if type(node) is SceneNode and node.isSelectable()] #Only use the nodes that will be printed. for mesh in meshes: @@ -434,19 +435,40 @@ class ExtruderManager(QObject): extruder_stack_id = self.extruderIds["0"] used_extruder_stack_ids.add(extruder_stack_id) - #Get whether any of them use support. - per_mesh_stack = mesh.callDecoration("getStack") - if per_mesh_stack: - support_enabled |= per_mesh_stack.getProperty("support_enable", "value") - support_bottom_enabled |= per_mesh_stack.getProperty("support_bottom_enable", "value") - support_roof_enabled |= per_mesh_stack.getProperty("support_roof_enable", "value") - else: #Take the setting from the build extruder stack. - extruder_stack = container_registry.findContainerStacks(id = extruder_stack_id)[0] - support_enabled |= extruder_stack.getProperty("support_enable", "value") - support_bottom_enabled |= extruder_stack.getProperty("support_bottom_enable", "value") - support_roof_enabled |= extruder_stack.getProperty("support_roof_enable", "value") + # Get whether any of them use support. + stack_to_use = mesh.callDecoration("getStack") # if there is a per-mesh stack, we use it + if not stack_to_use: + # if there is no per-mesh stack, we use the build extruder for this mesh + stack_to_use = container_registry.findContainerStacks(id = extruder_stack_id)[0] - #The support extruders. + support_enabled |= stack_to_use.getProperty("support_enable", "value") + support_bottom_enabled |= stack_to_use.getProperty("support_bottom_enable", "value") + support_roof_enabled |= stack_to_use.getProperty("support_roof_enable", "value") + support_interface_enable |= stack_to_use.getProperty("support_interface_enable", "value") + + # Check limit to extruders + limit_to_extruder_feature_list = ["wall_extruder_nr", + "wall_0_extruder_nr", + "wall_x_extruder_nr", + "top_bottom_extruder_nr", + "infill_extruder_nr", + ] + wall_extruder_nr = None + for extruder_nr_feature_name in limit_to_extruder_feature_list: + extruder_nr = global_stack.getProperty(extruder_nr_feature_name, "value") + if extruder_nr == -1: + # outer and inner wall extruder numbers should first inherit from the wall extruder number + if extruder_nr_feature_name in ["wall_0_extruder_nr", "wall_x_extruder_nr"]: + extruder_nr = wall_extruder_nr + else: + extruder_nr = 0 + + used_extruder_stack_ids.add(self.extruderIds[str(extruder_nr)]) + + if extruder_nr_feature_name == "wall_extruder_nr": + wall_extruder_nr = extruder_nr + + # Check support extruders if support_enabled: used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_infill_extruder_nr", "value"))]) used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_extruder_nr_layer_0", "value"))]) @@ -454,6 +476,8 @@ class ExtruderManager(QObject): used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_bottom_extruder_nr", "value"))]) if support_roof_enabled: used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_roof_extruder_nr", "value"))]) + if support_interface_enable: + used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_interface_enable", "value"))]) #The platform adhesion extruder. Not used if using none. if global_stack.getProperty("adhesion_type", "value") != "none": From 1b0268f09c9648d01dca59ed650e55ac4e45a833 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 13:32:44 +0200 Subject: [PATCH 14/16] Use extruder_nr as integers for comparison CURA-4069 --- 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 322d61fa3b..487c7f8f7a 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -455,7 +455,7 @@ class ExtruderManager(QObject): ] wall_extruder_nr = None for extruder_nr_feature_name in limit_to_extruder_feature_list: - extruder_nr = global_stack.getProperty(extruder_nr_feature_name, "value") + extruder_nr = int(global_stack.getProperty(extruder_nr_feature_name, "value")) if extruder_nr == -1: # outer and inner wall extruder numbers should first inherit from the wall extruder number if extruder_nr_feature_name in ["wall_0_extruder_nr", "wall_x_extruder_nr"]: From b0be9010793298f77aec1b86e5b81003bbd03b7a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 13:40:13 +0200 Subject: [PATCH 15/16] Do not check support_interface_extruder_nr if it is used CURA-4069 support_bottom_extruder_nr and support_roof_extruder_nr are the support interface extruder numbers, so checking those two is enough and there is no need to check the interface extruder number. --- cura/Settings/ExtruderManager.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 487c7f8f7a..e490d94c16 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -426,7 +426,6 @@ class ExtruderManager(QObject): support_enabled = False support_bottom_enabled = False support_roof_enabled = False - support_interface_enable = False scene_root = Application.getInstance().getController().getScene().getRoot() meshes = [node for node in DepthFirstIterator(scene_root) if type(node) is SceneNode and node.isSelectable()] #Only use the nodes that will be printed. for mesh in meshes: @@ -444,7 +443,6 @@ class ExtruderManager(QObject): support_enabled |= stack_to_use.getProperty("support_enable", "value") support_bottom_enabled |= stack_to_use.getProperty("support_bottom_enable", "value") support_roof_enabled |= stack_to_use.getProperty("support_roof_enable", "value") - support_interface_enable |= stack_to_use.getProperty("support_interface_enable", "value") # Check limit to extruders limit_to_extruder_feature_list = ["wall_extruder_nr", @@ -476,8 +474,6 @@ class ExtruderManager(QObject): used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_bottom_extruder_nr", "value"))]) if support_roof_enabled: used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_roof_extruder_nr", "value"))]) - if support_interface_enable: - used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("support_interface_enable", "value"))]) #The platform adhesion extruder. Not used if using none. if global_stack.getProperty("adhesion_type", "value") != "none": From d7f3553c90e2e16587d51390821f611d39628968 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 21 Jul 2017 14:39:43 +0200 Subject: [PATCH 16/16] Brim Line Count should take into account the initial layer line width factor CURA-4027 --- 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 47cb24b1f8..9f014616c5 100755 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3911,7 +3911,7 @@ "default_value": 20, "minimum_value": "0", "maximum_value_warning": "50 / skirt_brim_line_width", - "value": "math.ceil(brim_width / skirt_brim_line_width)", + "value": "math.ceil(brim_width / (skirt_brim_line_width * initial_layer_line_width_factor / 100.0))", "enabled": "resolveOrValue('adhesion_type') == 'brim'", "settable_per_mesh": false, "settable_per_extruder": true,