From bd1f2922effd7f852bea90dadc3298054733ae97 Mon Sep 17 00:00:00 2001 From: Christophe Baribaud Date: Sat, 17 Feb 2018 13:30:08 +0100 Subject: [PATCH 1/5] Post stretch algorithm fixes Extract line width from current extruder nozzle size Change default values of stretch parameters from 0.08 to 0.1 --- .../PostProcessingPlugin/scripts/Stretch.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/Stretch.py b/plugins/PostProcessingPlugin/scripts/Stretch.py index bcb923d3ff..c7a36ab7d6 100644 --- a/plugins/PostProcessingPlugin/scripts/Stretch.py +++ b/plugins/PostProcessingPlugin/scripts/Stretch.py @@ -12,6 +12,7 @@ import numpy as np from UM.Logger import Logger from UM.Application import Application import re +from cura.Settings.ExtruderManager import ExtruderManager def _getValue(line, key, default=None): """ @@ -90,9 +91,9 @@ class Stretcher(): """ Computes the new X and Y coordinates of all g-code steps """ - Logger.log("d", "Post stretch with line width = " + str(self.line_width) - + "mm wide circle stretch = " + str(self.wc_stretch)+ "mm" - + "and push wall stretch = " + str(self.pw_stretch) + "mm") + Logger.log("d", "Post stretch with line width " + str(self.line_width) + + "mm wide circle stretch " + str(self.wc_stretch)+ "mm" + + " and push wall stretch " + str(self.pw_stretch) + "mm") retdata = [] layer_steps = [] current = GCodeStep(0) @@ -282,7 +283,7 @@ class Stretcher(): dmin_tri is the minimum distance between two consecutive points of an acceptable triangle """ - dmin_tri = self.line_width / 2.0 + dmin_tri = 0.5 iextra_base = np.floor_divide(len(orig_seq), 3) # Nb of extra points ibeg = 0 # Index of first point of the triangle iend = 0 # Index of the third point of the triangle @@ -325,9 +326,10 @@ class Stretcher(): relpos = 0.5 # To avoid division by zero or precision loss projection = (pos_before[ibeg] + relpos * (pos_after[iend] - pos_before[ibeg])) dist_from_proj = np.sqrt(((projection - step) ** 2).sum(0)) - if dist_from_proj > 0.001: # Move central point only if points are not aligned + if dist_from_proj > 0.0003: # Move central point only if points are not aligned modif_seq[i] = (step - (self.wc_stretch / dist_from_proj) * (projection - step)) + return def wideTurn(self, orig_seq, modif_seq): @@ -411,8 +413,6 @@ class Stretcher(): modif_seq[ibeg] = modif_seq[ibeg] + xperp * self.pw_stretch elif not materialleft and materialright: modif_seq[ibeg] = modif_seq[ibeg] - xperp * self.pw_stretch - if materialleft and materialright: - modif_seq[ibeg] = orig_seq[ibeg] # Surrounded by walls, don't move # Setup part of the stretch plugin class Stretch(Script): @@ -437,7 +437,7 @@ class Stretch(Script): "description": "Distance by which the points are moved by the correction effect in corners. The higher this value, the higher the effect", "unit": "mm", "type": "float", - "default_value": 0.08, + "default_value": 0.1, "minimum_value": 0, "minimum_value_warning": 0, "maximum_value_warning": 0.2 @@ -448,7 +448,7 @@ class Stretch(Script): "description": "Distance by which the points are moved by the correction effect when two lines are nearby. The higher this value, the higher the effect", "unit": "mm", "type": "float", - "default_value": 0.08, + "default_value": 0.1, "minimum_value": 0, "minimum_value_warning": 0, "maximum_value_warning": 0.2 @@ -463,7 +463,7 @@ class Stretch(Script): the returned string is the list of modified g-code instructions """ stretcher = Stretcher( - Application.getInstance().getGlobalContainerStack().getProperty("line_width", "value") + ExtruderManager.getInstance().getActiveExtruderStack().getProperty("machine_nozzle_size", "value") , self.getSettingValueByKey("wc_stretch"), self.getSettingValueByKey("pw_stretch")) return stretcher.execute(data) From 6d21a6bddbf6fa33ebce023cecefafbe1a4c8311 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 20 Mar 2018 16:19:40 +0100 Subject: [PATCH 2/5] Show printer group and which machine to update in project loading CURA-5125 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 10 ++++++++++ plugins/3MFReader/WorkspaceDialog.py | 11 +++++++++++ plugins/3MFReader/WorkspaceDialog.qml | 19 +++++++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 5c312e7c5a..633142187c 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -358,8 +358,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader): machine_name = self._getMachineNameFromSerializedStack(serialized) stacks = self._container_registry.findContainerStacks(name = machine_name, type = "machine") self._is_same_machine_type = True + existing_global_stack = None if stacks: global_stack = stacks[0] + existing_global_stack = global_stack containers_found_dict["machine"] = True # Check if there are any changes at all in any of the container stacks. id_list = self._getContainerIdListFromSerialized(serialized) @@ -495,8 +497,16 @@ class ThreeMFWorkspaceReader(WorkspaceReader): if machine_conflict and not self._is_same_machine_type: machine_conflict = False + is_printer_group = False + if machine_conflict: + group_name = existing_global_stack.getMetaDataEntry("connect_group_name") + if group_name is not None: + is_printer_group = True + machine_name = group_name + # Show the dialog, informing the user what is about to happen. self._dialog.setMachineConflict(machine_conflict) + self._dialog.setIsPrinterGroup(is_printer_group) self._dialog.setQualityChangesConflict(quality_changes_conflict) self._dialog.setMaterialConflict(material_conflict) self._dialog.setHasVisibleSettingsField(has_visible_settings_string) diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index bb31afd40b..da682a6fc0 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -49,6 +49,7 @@ class WorkspaceDialog(QObject): self._material_labels = [] self._extruders = [] self._objects_on_plate = False + self._is_printer_group = False machineConflictChanged = pyqtSignal() qualityChangesConflictChanged = pyqtSignal() @@ -66,6 +67,16 @@ class WorkspaceDialog(QObject): machineTypeChanged = pyqtSignal() variantTypeChanged = pyqtSignal() extrudersChanged = pyqtSignal() + isPrinterGroupChanged = pyqtSignal() + + @pyqtProperty(bool, notify = isPrinterGroupChanged) + def isPrinterGroup(self) -> bool: + return self._is_printer_group + + def setIsPrinterGroup(self, value: bool): + if value != self._is_printer_group: + self._is_printer_group = value + self.isPrinterGroupChanged.emit() @pyqtProperty(str, notify=variantTypeChanged) def variantType(self): diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index 5418dcef6d..58d881c915 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -108,7 +108,22 @@ UM.Dialog text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?") ComboBox { - model: resolveStrategiesModel + model: ListModel + { + Component.onCompleted: + { + append({"key": "override", "label": catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName}); + append({"key": "new", "label": catalog.i18nc("@action:ComboBox option", "Create new")}); + } + } + Connections + { + target: manager + onMachineNameChanged: + { + machineResolveComboBox.model.get(0).label = catalog.i18nc("@action:ComboBox option", "Update") + " " + manager.machineName; + } + } textRole: "label" id: machineResolveComboBox width: parent.width @@ -141,7 +156,7 @@ UM.Dialog height: childrenRect.height Label { - text: catalog.i18nc("@action:label", "Name") + text: catalog.i18nc("@action:label", manager.isPrinterGroup ? "Printer Group" : "Printer Name") width: (parent.width / 3) | 0 } Label From 5993847c4aada98e07edaba2bd2a813ff977da3f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 20 Mar 2018 16:22:55 +0100 Subject: [PATCH 3/5] Show printer group or machine name in workspace summary CURA-5125 --- resources/qml/WorkspaceSummaryDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/WorkspaceSummaryDialog.qml b/resources/qml/WorkspaceSummaryDialog.qml index cf19e45fdd..4d15860257 100644 --- a/resources/qml/WorkspaceSummaryDialog.qml +++ b/resources/qml/WorkspaceSummaryDialog.qml @@ -111,12 +111,12 @@ UM.Dialog height: childrenRect.height Label { - text: catalog.i18nc("@action:label", "Name") + text: catalog.i18nc("@action:label", Cura.MachineManager.activeMachineNetworkGroupName != "" ? "Printer Group" : "Name") width: (parent.width / 3) | 0 } Label { - text: Cura.MachineManager.activeMachineName + text: Cura.MachineManager.activeMachineNetworkGroupName != "" ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName width: (parent.width / 3) | 0 } } From 9dc50ec73f12270a7629fcf0b548e93891bdf717 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 20 Mar 2018 16:54:34 +0100 Subject: [PATCH 4/5] CURA-4400 Apply correct shader to grouped nodes --- cura/BuildVolume.py | 11 ++++++++++- plugins/CuraEngineBackend/StartSliceJob.py | 4 ---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index d93ce1107d..6da8f33fff 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -238,7 +238,16 @@ class BuildVolume(SceneNode): # Group nodes should override the _outside_buildarea property of their children. for group_node in group_nodes: - for child_node in group_node.getAllChildren(): + children = group_node.getAllChildren() + + # Check if one or more children are non-printable and if so, set the parent as non-printable: + for child_node in children: + if child_node.isOutsideBuildArea(): + group_node.setOutsideBuildArea(True) + break + + # Apply results of the check to all children of the group: + for child_node in children: child_node.setOutsideBuildArea(group_node.isOutsideBuildArea()) ## Update the outsideBuildArea of a single node, given bounds or current build volume diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 63e8034859..89f9a144b0 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -197,10 +197,6 @@ class StartSliceJob(Job): if getattr(node, "_outside_buildarea", False) and not is_non_printing_mesh: continue - #node_position = node.callDecoration("getActiveExtruderPosition") - #if not stack.extruders[str(node_position)].isEnabled: - # continue - temp_list.append(node) if not is_non_printing_mesh: has_printing_mesh = True From 7f6a89e6aa97d5d7c61d470298b16ef00d59e179 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 21 Mar 2018 09:52:03 +0100 Subject: [PATCH 5/5] Fixed bug that didn't do anything Sometimes `None` was in the grouped objects which threw an error when trying to use `.callDecoration("isGroup")` on it. Nothing seems to break before, apart from the error message, and nothing breaks now either. But no error message. So that's good. --- plugins/CuraEngineBackend/StartSliceJob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 89f9a144b0..0297a34385 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -239,7 +239,7 @@ class StartSliceJob(Job): for group in filtered_object_groups: group_message = self._slice_message.addRepeatedMessage("object_lists") - if group[0].getParent().callDecoration("isGroup"): + if group[0].getParent() is not None and group[0].getParent().callDecoration("isGroup"): self._handlePerObjectSettings(group[0].getParent(), group_message) for object in group: mesh_data = object.getMeshData()