kliment / Printrun

Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software
GNU General Public License v3.0
2.35k stars 995 forks source link

Projector: TypeError on loading SVG #1360

Closed rockstorm101 closed 8 months ago

rockstorm101 commented 1 year ago
  1. Launch Pronterface
  2. Tools > Projector
  3. Load
  4. Choose a random SVG file (one I produced with Inkscape not related to 3D printing)
Traceback (most recent call last):
  File "/home/rock/Projects/printrun/rockintrun/printrun/projectlayer.py", line 595, in load_file
    layers = self.parse_svg(name)
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/rock/Projects/printrun/rockintrun/printrun/projectlayer.py", line 507, in parse_svg
    z = float(i.get('{http://slic3r.org/namespaces/slic3r}z'))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

I guess we should check here for existence of that particular element before doing the type conversion? I'm not overly familiar with the Projector feature to be honest.

neofelis2X commented 1 year ago

The thing is that parse_svg() only checks if there is a 'metadata' tag and treats those like skeinforge-files. Everything else is declared as a slic3r file. So we would need another check that identifies actual slic3r files and sorts out anything else.

DivingDuck commented 1 year ago

These are sliced svg files of an model. I used slic3er for generating this kind of file. Here is an example: Drehmeiselbrett v3-exp.zip