diff options
author | Andrew Belt <andrewpbelt@gmail.com> | 2021-10-19 21:23:08 -0400 |
---|---|---|
committer | Andrew Belt <andrewpbelt@gmail.com> | 2021-10-19 21:23:08 -0400 |
commit | ba7283fca7583f1eb33c2a9c0cd4bb930fcc0fb9 (patch) | |
tree | 5c43406f1b6e7631ddeaf5ef3a3f17e68b934845 /helper.py | |
parent | ce11ceab53f15a44c49566a5b7cbe1800548283d (diff) |
helper.py: Assume unitless SVG dimensions are in px instead of mm.
Diffstat (limited to 'helper.py')
-rwxr-xr-x | helper.py | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -267,12 +267,14 @@ def panel_to_components(tree): } root = tree.getroot() - # Get SVG scale + # Get SVG scale relative to mm root_width = root.get('width') - svg_dpi = 75 - scale = 1 - if re.match('\d+px', root_width): - scale = 25.4 / svg_dpi + if re.match('\d+mm', root_width): + scale = 1 + else: + svg_dpi = 75 + mm_per_in = 25.4 + scale = mm_per_in / svg_dpi # Get components layer group = root.find(".//svg:g[@inkscape:label='components']", ns) |