From 31976e591f03d4b4012a6269b6cecbd501c72102 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 24 Nov 2023 15:35:31 +0100 Subject: [PATCH 1/3] All method printers are cloud connected CURA-11377 --- .../src/Cloud/CloudOutputDevice.py | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index edbc509d84..987125f128 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -58,7 +58,6 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): # The minimum version of firmware that support print job actions over cloud. PRINT_JOB_ACTIONS_MIN_VERSION = Version("5.2.12") - PRINT_JOB_ACTIONS_MIN_VERSION_METHOD = Version("2.700") # Notify can only use signals that are defined by the class that they are in, not inherited ones. # Therefore, we create a private signal used to trigger the printersChanged signal. @@ -319,19 +318,29 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): PrintJobUploadErrorMessage(message).show() self.writeError.emit() + @pyqtProperty(bool, notify=_cloudClusterPrintersChanged) + def isMethod(self) -> bool: + """Whether the printer that this output device represents is a Method series printer.""" + + if not self._printers: + return False + + [printer, *_] = self._printers + return printer.pinterType in ("ultimaker_methodx", "ultimaker_methodxl") + @pyqtProperty(bool, notify=_cloudClusterPrintersChanged) def supportsPrintJobActions(self) -> bool: """Whether the printer that this output device represents supports print job actions via the cloud.""" if not self._printers: return False + + if self.isMethod: + return True + version_number = self.printers[0].firmwareVersion.split(".") - if len(version_number)> 2: - firmware_version = Version([version_number[0], version_number[1], version_number[2]]) - return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION - else: - firmware_version = Version([version_number[0], version_number[1]]) - return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION_METHOD + firmware_version = Version([version_number[0], version_number[1], version_number[2]]) + return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION @pyqtProperty(bool, constant = True) From e66a3cda67fb24978831e51a16e193a8d277dc45 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 24 Nov 2023 15:40:11 +0100 Subject: [PATCH 2/3] Only extend file formats for um3 This was a mistake in the previous implementation. The relevant piece of code was adding ufp support for um3 printers. This is legacy support for this printer since the printer didn't know it supported ufp, but through the digital factory it could support ufp files. However, with the addition of method printers we should have added an additional check where we also check if the printer is an um3. Instead an additional check was added that did the same for makerbot printers. Because of this check didn't have a "is method" check support for makerbot format is also added to s-line printers and legacy um printers. (fyi @saumyaj3) CURA-11377 --- .../src/Cloud/CloudOutputDevice.py | 7 ++++++- plugins/UM3NetworkPrinting/src/ExportFileJob.py | 6 +++--- .../UM3NetworkPrinting/src/MeshFormatHandler.py | 15 ++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 987125f128..aed38a3949 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -213,7 +213,12 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): return # Export the scene to the correct file type. - job = ExportFileJob(file_handler=file_handler, nodes=nodes, firmware_version=self.firmwareVersion) + job = ExportFileJob( + file_handler=file_handler, + nodes=nodes, + firmware_version=self.firmwareVersion, + print_type=self.printerType, + ) job.finished.connect(self._onPrintJobCreated) job.start() diff --git a/plugins/UM3NetworkPrinting/src/ExportFileJob.py b/plugins/UM3NetworkPrinting/src/ExportFileJob.py index 953b167a6e..ac3da65719 100644 --- a/plugins/UM3NetworkPrinting/src/ExportFileJob.py +++ b/plugins/UM3NetworkPrinting/src/ExportFileJob.py @@ -16,9 +16,9 @@ from .MeshFormatHandler import MeshFormatHandler class ExportFileJob(WriteFileJob): """Job that exports the build plate to the correct file format for the target cluster.""" - def __init__(self, file_handler: Optional[FileHandler], nodes: List[SceneNode], firmware_version: str) -> None: - - self._mesh_format_handler = MeshFormatHandler(file_handler, firmware_version) + def __init__(self, file_handler: Optional[FileHandler], nodes: List[SceneNode], firmware_version: str, + print_type: str) -> None: + self._mesh_format_handler = MeshFormatHandler(file_handler, firmware_version, print_type) if not self._mesh_format_handler.is_valid: Logger.log("e", "Missing file or mesh writer!") return diff --git a/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py b/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py index e6054773d8..2ca8f9f3ce 100644 --- a/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py +++ b/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py @@ -19,10 +19,9 @@ I18N_CATALOG = i18nCatalog("cura") class MeshFormatHandler: """This class is responsible for choosing the formats used by the connected clusters.""" - - def __init__(self, file_handler: Optional[FileHandler], firmware_version: str) -> None: + def __init__(self, file_handler: Optional[FileHandler], firmware_version: str, printer_type: str) -> None: self._file_handler = file_handler or CuraApplication.getInstance().getMeshFileHandler() - self._preferred_format = self._getPreferredFormat(firmware_version) + self._preferred_format = self._getPreferredFormat(firmware_version, printer_type) self._writer = self._getWriter(self.mime_type) if self._preferred_format else None @property @@ -82,7 +81,7 @@ class MeshFormatHandler: value = value.encode() return value - def _getPreferredFormat(self, firmware_version: str) -> Dict[str, Union[str, int, bool]]: + def _getPreferredFormat(self, firmware_version: str, printer_type: str) -> Dict[str, Union[str, int, bool]]: """Chooses the preferred file format for the given file handler. :param firmware_version: The version of the firmware. @@ -103,13 +102,11 @@ class MeshFormatHandler: machine_file_formats = [file_type.strip() for file_type in machine_file_formats] # Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format. - if "application/x-ufp" not in machine_file_formats and Version(firmware_version) >= Version("4.4"): + if printer_type in ( + "ultimaker3", "ultimaker3_extended") and "application/x-ufp" not in machine_file_formats and Version( + firmware_version) >= Version("4.4"): machine_file_formats = ["application/x-ufp"] + machine_file_formats - # Exception for makerbot firmware version >=2.700: makerbot is supported - elif "application/x-makerbot" not in machine_file_formats and Version(firmware_version >= Version("2.700")): - machine_file_formats = ["application/x-makerbot"] + machine_file_formats - # Take the intersection between file_formats and machine_file_formats. format_by_mimetype = {f["mime_type"]: f for f in file_formats} From 0225f92ae0bc1c7e4e71c6e05c2b5924e6432ddd Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 27 Nov 2023 13:47:08 +0100 Subject: [PATCH 3/3] Fix local cloud printing for um printers CURA-11390 --- .../src/Network/LocalClusterOutputDevice.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDevice.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDevice.py index 2ef18e76e4..2a57bd0321 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDevice.py @@ -146,7 +146,12 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice): self.writeStarted.emit(self) # Export the scene to the correct file type. - job = ExportFileJob(file_handler=file_handler, nodes=nodes, firmware_version=self.firmwareVersion) + job = ExportFileJob( + file_handler=file_handler, + nodes=nodes, + firmware_version=self.firmwareVersion, + print_type=self.printerType, + ) job.finished.connect(self._onPrintJobCreated) job.start()