diff --git a/cura/PrinterOutput/PrinterOutputModel.py b/cura/PrinterOutput/PrinterOutputModel.py index d4b9d9c99a..1571be453c 100644 --- a/cura/PrinterOutput/PrinterOutputModel.py +++ b/cura/PrinterOutput/PrinterOutputModel.py @@ -68,21 +68,25 @@ class PrinterOutputModel(QObject): @pyqtProperty("long", "long", "long") @pyqtProperty("long", "long", "long", "long") def setHeadPosition(self, x, y, z, speed = 3000): + self.updateHeadPosition(x, y, z) self._controller.setHeadPosition(self, x, y, z, speed) @pyqtProperty("long") @pyqtProperty("long", "long") def setHeadX(self, x, speed = 3000): + self.updateHeadPosition(x, self._head_position.y, self._head_position.z) self._controller.setHeadPosition(self, x, self._head_position.y, self._head_position.z, speed) @pyqtProperty("long") @pyqtProperty("long", "long") def setHeadY(self, y, speed = 3000): + self.updateHeadPosition(self._head_position.x, y, self._head_position.z) self._controller.setHeadPosition(self, self._head_position.x, y, self._head_position.z, speed) @pyqtProperty("long") @pyqtProperty("long", "long") - def setHeadY(self, z, speed = 3000): + def setHeadZ(self, z, speed = 3000): + self.updateHeadPosition(self._head_position.x, self._head_position.y, z) self._controller.setHeadPosition(self, self._head_position.x, self._head_position.y, z, speed) @pyqtSlot("long", "long", "long") diff --git a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py index de0a8d6eff..f830e28764 100644 --- a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py @@ -411,7 +411,7 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): self._authentication_counter / self._max_authentication_counter * 100) if self._authentication_counter > self._max_authentication_counter: self._authentication_timer.stop() - Logger.log("i", "Authentication timer ended. Setting authentication to denied for printer: %s" % self._key) + Logger.log("i", "Authentication timer ended. Setting authentication to denied for printer: %s" % self._id) self.setAuthenticationState(AuthState.AuthenticationDenied) self._resetAuthenticationRequestedMessage() self._authentication_failed_message.show() @@ -530,7 +530,7 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): authenticator.setUser(self._authentication_id) authenticator.setPassword(self._authentication_key) else: - Logger.log("d", "No authentication is available to use for %s, but we did got a request for it.", self._key) + Logger.log("d", "No authentication is available to use for %s, but we did got a request for it.", self._id) def _onGetPrintJobFinished(self, reply): status_code = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) @@ -580,6 +580,9 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): printer.updateTargetBedTemperature(result["bed"]["temperature"]["target"]) printer.updatePrinterState(result["status"]) + head_position = result["heads"][0]["position"] + printer.updateHeadPosition(head_position["x"], head_position["y"], head_position["z"]) + for index in range(0, self._number_of_extruders): temperatures = result["heads"][0]["extruders"][index]["hotend"]["temperature"] extruder = printer.extruders[index] diff --git a/plugins/UM3NetworkPrinting/LegacyUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/LegacyUM3PrinterOutputController.py index ae8c989643..54c126e5cc 100644 --- a/plugins/UM3NetworkPrinting/LegacyUM3PrinterOutputController.py +++ b/plugins/UM3NetworkPrinting/LegacyUM3PrinterOutputController.py @@ -6,6 +6,7 @@ from cura.PrinterOutput.PrinterOutputController import PrinterOutputController MYPY = False if MYPY: from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel + from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel class LegacyUM3PrinterOutputController(PrinterOutputController): @@ -15,3 +16,14 @@ class LegacyUM3PrinterOutputController(PrinterOutputController): def setJobState(self, job: "PrintJobOutputModel", state: str): data = "{\"target\": \"%s\"}" % state self._output_device.put("print_job/state", data, onFinished=None) + + def moveHead(self, printer: "PrinterOutputModel", x, y, z, speed): + head_pos = printer._head_position + new_x = head_pos.x + x + new_y = head_pos.y + y + new_z = head_pos.z + z + data = "{\n\"x\":%s,\n\"y\":%s,\n\"z\":%s\n}" %(new_x, new_y, new_z) + self._output_device.put("printer/heads/0/position", data, onFinished=None) + + def homeBed(self, printer): + self._output_device.put("printer/heads/0/position/z", "0", onFinished=None)