Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MKS plugin not working in Cura 4.0 #10

Open
furymountain opened this issue Mar 28, 2019 · 10 comments
Open

MKS plugin not working in Cura 4.0 #10

furymountain opened this issue Mar 28, 2019 · 10 comments

Comments

@furymountain
Copy link

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?

@jesusperiago
Copy link

yes please!!! Update as soon as posible

@W11N4R7
Copy link

W11N4R7 commented Apr 20, 2019

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.

@IrishMoss
Copy link

IrishMoss commented Apr 20, 2019

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. :(

@jesusperiago
Copy link

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

@IrishMoss
Copy link

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.

@jesusperiago
Copy link

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

@IrishMoss
Copy link

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

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

@W11N4R7
Copy link

W11N4R7 commented Apr 21, 2019

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

@IrishMoss
Copy link

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
Copy link

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! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants