From ba7283fca7583f1eb33c2a9c0cd4bb930fcc0fb9 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Oct 2021 21:23:08 -0400 Subject: [PATCH] helper.py: Assume unitless SVG dimensions are in px instead of mm. --- helper.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/helper.py b/helper.py index bbb7dd92..c5098cfd 100755 --- a/helper.py +++ b/helper.py @@ -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)