Browse Source

helper.py: Assume unitless SVG dimensions are in px instead of mm.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
ba7283fca7
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      helper.py

+ 7
- 5
helper.py View File

@@ -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)


Loading…
Cancel
Save