Software icon indicating copy to clipboard operation
Software copied to clipboard

MKS plugin not working in Cura 4.0

Open furymountain opened this issue 5 years ago • 10 comments

Cura 4.0 is launched and the MKS plugin doesn't work with it. It just disables itself and can't be used at all. Any update on this?

furymountain avatar Mar 28 '19 12:03 furymountain

yes please!!! Update as soon as posible

jesusperiago avatar Apr 19 '19 17:04 jesusperiago

In plugin.json file, replace the line "api": 5 to "api": "6.0". After that, the plugin will show up in Cura. Next in the utils.py file you need to replace

scale = 200 / 50 * total_x
offset = 80 / 282 * total_x
camera_tool.setOrigin(Vector(0, offset, 0))
m_camera.setPosition(Vector(0, 0, scale))
m_camera.setPerspective(True)
m_camera.lookAt(Vector(0, 120, 0))
camera_tool.rotateCam(0, 30)
camera_tool.rotateCam(30, 0)

window_image = app.grabWindow()
sidebar_width = app.minimumWidth() / 2
now_height = app.height()
now_width = app.width()
pw = now_width - sidebar_width - 40
if now_height < pw:
  nw = (now_width - sidebar_width - now_height) / 2
  cut_image = window_image.copy(nw, 60, now_height, now_height)
else:
  nw = (now_width - sidebar_width - pw) / 2
  cut_image = window_image.copy(nw, now_height - pw, pw, pw)
return cut_image

on this

scale = 6 * total_x
offset = 130 / 282 * total_x
camera_tool.setOrigin(Vector(0, offset, 0))
m_camera.setPosition(Vector(0, 0, scale))
m_camera.setPerspective(True)
camera_tool.rotateCam(0, 45)

window_image = app.grabWindow()
now_height = app.height()
now_width = app.width()
altura = now_height / 2
anchura = (now_width - 250 + now_height) / 2
cut_image = window_image.copy(anchura, altura, now_height, now_height)
return cut_image

And ready. Now the plugin works for you.

W11N4R7 avatar Apr 20 '19 13:04 W11N4R7

Changing the api value to "6.0" in the json file does get the plugin to properly showup as installed now, but after making those proposed changes in the utils.py file, the plugin no longer appears in the installed list after restarting cura.

I've tried using the plugin as is after only the api version change, and it allows me to add the printer ip, but it bombs on connect: Traceback (most recent call last): File "C:\Program Files\Ultimaker Cura 4.0\plugins\MKS Plugin\MachineConfig.py", line 115, in setKey self._network_plugin.reCheckConnections() File "C:\Program Files\Ultimaker Cura 4.0\plugins\MKS Plugin\MKSOutputDevicePlugin.py", line 119, in reCheckConnections self._printers[key].connect() File "C:\Program Files\Ultimaker Cura 4.0\plugins\MKS Plugin\MKSOutputDevice.py", line 111, in connect self.setConnectionState(ConnectionState.connecting) File "enum.py", line 274, in __getattr__ AttributeError: connecting

I'm not a developer, though I don't see why the changes to that take_screenshot subroutine in utils.py would impact anything. But it's breaking the plugin for me.

Seems to me there's some more tweaking that needs to happen in the other py files. Tried a few trial&error changes, but not being a python dev, I'm not getting far. :(

IrishMoss avatar Apr 20 '19 19:04 IrishMoss

MKS Plugin.zip Try this one. For me is working

jesusperiago avatar Apr 20 '19 19:04 jesusperiago

Thanks. That one works for me... well, sort of. When I select 'print over TFT', it simply uploads the gcode file to the sd card plugged into the TFT, and then reboots the TFT. Don't know if that's intended functionality or not, but I was expecting it to work a little more like printing over USB works.

Oh well. this functionality wasn't super critical, just more of a nice-to-have.

and thanks for sharing the working plugin.

IrishMoss avatar Apr 20 '19 20:04 IrishMoss

I use the TFT35, and for me it is working. Maybe the script is getting an error with your display

jesusperiago avatar Apr 20 '19 21:04 jesusperiago

I have the TFT28, so that could be the issue.

Maybe a future version of the MKS firmware or plugin will address this.

IrishMoss avatar Apr 20 '19 23:04 IrishMoss

This plugin is intended for 3.5” screens and more. Since they have a larger screen, and there is support for displaying thumbnails image.

W11N4R7 avatar Apr 21 '19 05:04 W11N4R7

Ok. I wasn't completely sure, as the mks page also lists a 2.x version, so didn't know if that was version related or screen-size related.

Would still like to see one tweaked to work with the smaller screens on cura 4.0, maybe without the thumbnail images. As the main reason for this plugin is to be able to connect and print over wifi.

IrishMoss avatar Apr 21 '19 12:04 IrishMoss

I've figured out a workaround for the TFT28. The file was getting transferred across fine, but would bomb the TFT when it tried to print. Looking at the gcode, I could see a bunch of M10086 commands at the beginning of the file. Seems this is all the binary data for the images for the larger displays. Removing that, and the files print fine.

In SaveOutputDevice.py comment out the following lines: save_file.write(utils.add_screenshot(image, 100, 100, ";simage:")) save_file.write(utils.add_screenshot(image, 200, 200, ";;gimage:"))

In MKSOutputDevice.py comment out the following: single_string_file_data += utils.add_screenshot(self._screenShot, 100, 100, ";simage:") single_string_file_data += utils.add_screenshot(self._screenShot, 200, 200, ";;gimage:")

Wifi printing... woohoo! :)

IrishMoss avatar Apr 22 '19 22:04 IrishMoss