evil-mad / axidraw

Software for the AxiDraw drawing machine
GNU General Public License v2.0
430 stars 130 forks source link

Hatch Fill: ValueError: could not convert string to float: '8mm' #172

Closed gorenje closed 6 months ago

gorenje commented 6 months ago

Hi There,

I've got an svg that contains a 'x' coordinate the contains the string '8mm' which can't be parsed.

The SVG works fine in Inkscape (Mac + Linux) and is attached:

qr2.

The stacktrace:

Traceback (most recent call last):
  File "eggbot_hatch.py", line 1784, in <module>
    e.affect()
  File "/Volumes/CaseSensitive/Users/user/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/axidraw_deps/ink_extensions/inkex.py", line 291, in affect
    self.effect()
  File "eggbot_hatch.py", line 1240, in effect
    self.recursivelyTraverseSvg([self.selected[id_]], transform)
  File "eggbot_hatch.py", line 896, in recursivelyTraverseSvg
    x = float(node.get('x'))
ValueError: could not convert string to float: '8mm'

The trace is from mac but the same thing happens on Linux.

Cheers!

gorenje commented 6 months ago

A workaround is to convert the qr code to a path using Inkscape Object-to-path feature.

oskay commented 6 months ago

The Hatch Fill utility does not have support for units in elements; yes, using Object to Path is a fine workaround.

The approach that we recommend, if you have the option, is to use the QR code generator in Inkscape. This tool lets you specify an object to use as your "pixel", which can be an object designed with a path fill. This can make things that tile and print much more effectively, without the overlapping pen lines that you get with a hatch fill inside rectangles.

gorenje commented 6 months ago

Ok, good to know.

I have nothing against closing this issue, those approaches you mention are fine for me 👍