summaryrefslogtreecommitdiff
path: root/helper.py
diff options
context:
space:
mode:
authorAndrew Belt <andrewpbelt@gmail.com>2021-10-19 21:23:08 -0400
committerAndrew Belt <andrewpbelt@gmail.com>2021-10-19 21:23:08 -0400
commitba7283fca7583f1eb33c2a9c0cd4bb930fcc0fb9 (patch)
tree5c43406f1b6e7631ddeaf5ef3a3f17e68b934845 /helper.py
parentce11ceab53f15a44c49566a5b7cbe1800548283d (diff)
helper.py: Assume unitless SVG dimensions are in px instead of mm.
Diffstat (limited to 'helper.py')
-rwxr-xr-xhelper.py12
1 files 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)