diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-04-10 20:11:47 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-04-10 20:11:47 -0400 |
| commit | ea6f4e500a126fa30c8679db05116f7356eb06d0 (patch) | |
| tree | eb0dc3b87c1b6b8b47ec8d27eaee8bc52cb4b734 | |
| parent | b6866a6a339b57ba98e4d99dd568ff09a6de6a0c (diff) | |
rename layer on import and remove id
| -rw-r--r-- | embroider_input.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/embroider_input.py b/embroider_input.py index 39a0e424..e3a7b0c2 100644 --- a/embroider_input.py +++ b/embroider_input.py @@ -1,8 +1,9 @@ import sys +import os from libembroidery import * from inkex import etree import inkex -from inkstitch import PIXELS_PER_MM, _ +from inkstitch import PIXELS_PER_MM, INKSCAPE_LABEL, _ from inkstitch.stitch_plan import StitchPlan from inkstitch.svg import render_stitch_plan @@ -45,6 +46,11 @@ def main(embroidery_file): }) render_stitch_plan(svg, stitch_plan) + # rename the Stitch Plan layer so that it doesn't get overwritten by Embroider + layer = svg.find(".//*[@id='__inkstitch_stitch_plan__']") + layer.set(INKSCAPE_LABEL, os.path.basename(embroidery_file)) + layer.attrib.pop('id') + print etree.tostring(svg) if __name__ == '__main__': |
