From 75d59f297846c398f3c32d5b0d675c9e08d2bbd2 Mon Sep 17 00:00:00 2001 From: Farsheed Date: Wed, 9 May 2018 12:45:17 -0500 Subject: [PATCH 1/6] Update svg2mod.py to work with python3 methods --- svg2mod/svg2mod.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/svg2mod/svg2mod.py b/svg2mod/svg2mod.py index cc3f060..0428fc8 100755 --- a/svg2mod/svg2mod.py +++ b/svg2mod/svg2mod.py @@ -553,7 +553,7 @@ def _prune( self, items = None ): if items is None: self.layers = {} - for name in self.layer_map.iterkeys(): + for name in self.layer_map.keys(): self.layers[ name ] = None items = self.imported.svg.items @@ -564,7 +564,7 @@ def _prune( self, items = None ): if not isinstance( item, svg.Group ): continue - for name in self.layers.iterkeys(): + for name in self.layers.keys(): #if re.search( name, item.name, re.I ): if name == item.name: print( "Found SVG layer: {}".format( item.name ) ) @@ -653,7 +653,7 @@ def _write_module( self, front ): front, ) - for name, group in self.layers.iteritems(): + for name, group in self.layers.items(): if group is None: continue @@ -1094,7 +1094,7 @@ def _write_library_intro( self ): # Write index: for module_name in sorted( - self.loaded_modules.iterkeys(), + self.loaded_modules.keys(), key = str.lower ): self.output_file.write( module_name + "\n" ) @@ -1111,7 +1111,7 @@ def _write_preserved_modules( self, up_to = None ): up_to = up_to.lower() for module_name in sorted( - self.loaded_modules.iterkeys(), + self.loaded_modules.keys(), key = str.lower ): if up_to is not None and module_name.lower() >= up_to: From a028e419ffa4976b8babcfcf01c5e2248f82cc33 Mon Sep 17 00:00:00 2001 From: Farsheed Date: Wed, 9 May 2018 12:46:27 -0500 Subject: [PATCH 2/6] Updates svg.py to work with python3 --- svg2mod/svg/svg/svg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svg2mod/svg/svg/svg.py b/svg2mod/svg/svg/svg.py index 244fdaa..02949d2 100644 --- a/svg2mod/svg/svg/svg.py +++ b/svg2mod/svg/svg/svg.py @@ -262,7 +262,7 @@ def __init__(self, elt=None): self.name = "" if elt is not None: - for id, value in elt.attrib.iteritems(): + for id, value in elt.attrib.items(): id = self.parse_name( id ) if id[ "name" ] == "label": From 57e62dff045832f4adf012445814f4b04d02882e Mon Sep 17 00:00:00 2001 From: Farsheed Date: Wed, 9 May 2018 12:49:04 -0500 Subject: [PATCH 3/6] Update README.md Add notes about python3 --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index d048ea5..37e7c09 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,19 @@ # svg2mod This is a small program to convert Inkscape SVG drawings to KiCad footprint module files. It uses [cjlano's python SVG parser and drawing module](https://github.com/cjlano/svg) to interpret drawings and approximate curves using straight line segments. Module files can be output in KiCad's legacy or s-expression (i.e., pretty) formats. Horizontally mirrored modules are automatically generated for use on the back of a 2-layer PCB. +## Requirements + +Python 3 + +## Installation + +```python3 setup.py install``` + +- OR - + +```pip3 install git+https://github.com/zirafa/svg2mod``` + + ## Usage ``` usage: svg2mod.py [-h] -i FILENAME [-o FILENAME] [--name NAME] [--value VALUE] From 231ecdd7683034b112d6f83c834cbb01a94506e3 Mon Sep 17 00:00:00 2001 From: Farsheed Date: Wed, 9 May 2018 12:52:54 -0500 Subject: [PATCH 4/6] Update README.md --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 37e7c09..1777191 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,20 @@ Python 3 ```python3 setup.py install``` -- OR - +OR you can install it using the PIP package manager: ```pip3 install git+https://github.com/zirafa/svg2mod``` +## Example + +```python3 svg2mod.py -i input.svg``` + +OR for PIP + +```svg2mod -i input.svg``` + + ## Usage ``` usage: svg2mod.py [-h] -i FILENAME [-o FILENAME] [--name NAME] [--value VALUE] From 32977b8ffdc7a1269bd9656c69c0d738de24d002 Mon Sep 17 00:00:00 2001 From: Farsheed Date: Wed, 9 May 2018 12:56:21 -0500 Subject: [PATCH 5/6] Update README.md --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 1777191..9ba8afc 100644 --- a/README.md +++ b/README.md @@ -7,22 +7,14 @@ Python 3 ## Installation -```python3 setup.py install``` - -OR you can install it using the PIP package manager: - ```pip3 install git+https://github.com/zirafa/svg2mod``` +Note: ```python3 setup.py install``` does not work. ## Example -```python3 svg2mod.py -i input.svg``` - -OR for PIP - ```svg2mod -i input.svg``` - ## Usage ``` usage: svg2mod.py [-h] -i FILENAME [-o FILENAME] [--name NAME] [--value VALUE] From ac6714bf25281bf12317c23045dfc39236839cf0 Mon Sep 17 00:00:00 2001 From: Farsheed Date: Wed, 16 May 2018 16:04:27 -0500 Subject: [PATCH 6/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ba8afc..930d91e 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ Note: ```python3 setup.py install``` does not work. ## Example -```svg2mod -i input.svg``` +```svg2mod -i input.svg -p 1.0``` ## Usage ``` -usage: svg2mod.py [-h] -i FILENAME [-o FILENAME] [--name NAME] [--value VALUE] +usage: svg2mod [-h] -i FILENAME [-o FILENAME] [--name NAME] [--value VALUE] [-f FACTOR] [-p PRECISION] [-d DPI] [--front-only] [--format FORMAT] [--units UNITS]