MarkSlat / OctoPrint-Hologram

A simple OctoPrint plugin to display a render based on the preloaded G-code.
GNU Affero General Public License v3.0
7 stars 1 forks source link

Failed to save points! #3

Open HaGueRe opened 3 months ago

HaGueRe commented 3 months ago

Hello, I installed the Plugin successfully from repo, did the Pi-Settings and wrote the physical Dimensions of my Plate into the fields. First Problem: Length = Y OK Width = X OK Depth = ??? And what is the standard? Is it in mm? My Plate is 240X210 mm :)

I took a snapshot, dragged the Box over the plate and after i pushed the Lock-Bottom, i got the message "Failed to save points!" What went wrong?

FindusD commented 3 months ago

Have the same question. What do you mean with Length, Width and Depth? My build plate has only 2 dimensions.

MarkSlat commented 3 months ago

Sorry, yes for the length and width it is the physical length of the build plate. For the depth you can you use the z print volume. If you leave the depth blank that may be causing the issue. Did the error pop up straight away after locking in the points?

HaGueRe commented 3 months ago

Yes, the message pops up straight after clicking the bottom. No, I did not leave the depth blank.

I reinstalled the Plugin seveal times, but always the same issue.

There is a warning in the octoprint.log, that belongs to matplotlib toolkit (see the message of bleuthoot-sven):

5:28,470 - py.warnings - WARNING - /home/pi/oprint/lib/python3.7/site-packages/octoprint_hologram/utils.py:27: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam figure.max_open_warning).

May the complete Logfile be helpfull?

MarkSlat commented 3 months ago

Yes if you don't mind and are you using version V1.1.0?

HaGueRe commented 3 months ago

Sorry...yes, octoprint v1.1.0 on a Raspberry 3B. Here is the complete octoprint.log: octoprint.log Thanks for your work :)

MarkSlat commented 3 months ago

Sorry for only getting back now I was away for a few days. I had a look there "center_of_quadrilateral raise ValueError("A quadrilateral must have exactly 4 points.")" would suggest that the front end is not sending back all the points it seems. Would you be able inspect the payload and insure you have four point like this:

{ "command": "save_points", "points": [ { "x": 295.25, "y": 130 }, { "x": 624.25, "y": 221 }, { "x": 361.25, "y": 399 }, { "x": 5.25, "y": 254 } ] }

HaGueRe commented 3 months ago

Can you please give me a hint how to do this?

MarkSlat commented 3 months ago

In your browser before you click lock in plate area

https://developer.chrome.com/docs/devtools/network

If you get stuck let me know

HaGueRe commented 3 months ago

OK...Itried the "Inspect" section several times before, but I didn't found this :) Here is the response of the action, which looks like your example: {command: "save_points",…} command : "save_points" points : [{x: 7.25, y: 63}, {x: 354.25, y: 0}, {x: 617.25, y: 180}, {x: 110.25, y: 478}]

MarkSlat commented 3 months ago

Ok, that seems to be working. I am not to sure it may be a CSRF protection issue or more likely a version issue. Would you be able to check what version of 'matplotlib' you have installed? I will try and push an update early next week to fix the CSRF.

HaGueRe commented 3 months ago

It seems to be 3.5.3 in /python3.7/site-packages/ There is no file in / .config/matplotlib, if this is for interest.

MarkSlat commented 3 months ago

Would you be able to upgrade, I am unable to get 3.5.3 installed on my machine but 3.6.0 and above seems to work

HaGueRe commented 3 months ago

I fear I posted the wrong version-number of matplotlb. If I use

python import matplotlib print('matplotlib: {}'.format(matplotlib.version))

in SSH terminal, output is:

python Python 2.7.16 (default, Sep 20 2023, 07:59:17) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. import matplotlib print('matplotlib: {}'.format(matplotlib.version)) matplotlib: 2.2.3

Using

python 3 import matplotlib print('matplotlib: {}'.format(matplotlib.version))

python3 Python 3.7.3 (default, Mar 23 2024, 16:12:05) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. import matplotlib print('matplotlib: {}'.format(matplotlib.version)) matplotlib: 3.0.2

This is a little bit confusing for me. Any idea?

MarkSlat commented 3 months ago

I did some more testing there, since you are on python 7 you may not be able to get matplotlib>=3.6.0 but if you remote in with SSH and try 'pip install matplotlib>=3.6.0', It might be able to upgrade it.

HaGueRe commented 3 months ago

Last weekend I made a fresh install of Octoprint on another SD-Card, so I changed from Buster to Bullseye with Python 3.9.2. There is no matplotlib at all. The Installation of the plugin fails either. I am just printing, so I will be able to try pip install with the old SD-Card in a few hours.

MarkSlat commented 3 months ago

The new version should work I would have thought. If you are installing on a raspberry pi you may need to install these extra libraries: https://github.com/MarkSlat/OctoPrint-Hologram/issues/1#issuecomment-2119077986

HaGueRe commented 3 months ago

First success! :-) After trying several sequenzes of the suggestions here, everytime starting at zero, I now get the message "Points saved succsessfully!". Scrolling down to the Updated Image, there is the next Problem: No image is present. What is the purpose of this? The software packages used are as follows: octoprint v1.1.0 on bullseye Python 3.9.2 matplotlib 3,9,0 numpy 1.26.4 libopenblas-base/oldstable,now 0.3.13

Edit: I made a mistake. When I entered a value in the Image Adjustments fields, the image and the rectangle appeared. Now my old Raspberry Pi needs to cool down, as the thermal throttling has kicked in.

Next Edit: After a restart, all saved settings of the plugin have disappeared. I think I'll stop here and wait for your next release.

Previously, I had one more request: I own a printer with a black Ultrabase print plate. However, the photos from snapshots appear very low-contrast. It would be great if a modified image could be uploaded into the plugin.

MarkSlat commented 3 months ago

The adjustments are just for updating and adjusting the rectangle to make sure it overlaps correctly (I haven't made it clear in the settings page that an input has to be made for the process to start). The settings should be saved; its just that they are not displayed in the box after a refresh. I would like it so that it would show it but that would have to come in a future update. For the image modification part I not to sure what you mean, there maybe a plugin that allows you to modify the snapshots and this plugin would pull from that. Sorry about the slow replies and issues with the plugin.

HaGueRe commented 3 months ago

No need to apologize. It took me nearly 15 minutes to compute the coordinates. The rectangle in the lower image is partially outside the frame and cannot be placed on the build plate. I suspected it might be due to insufficient contrast. So, I attempted to revise the snapshot in the /data/hologram directory and tried to reload it into the program, but that didn't work. I've given up and will try my luck with your next release.

BTW: Installing the matplotlib upgrade to version 3.6.0 was not possible on buster, but it was allowed on bullseye. However, the correct command is not 'pip install matplotlib>=3.6.0' as you mentioned (this isn't working for me), but rather 'pip install matplotlib==3.6.0' ;-)