diff --git a/README.md b/README.md index d048ea5..930d91e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,23 @@ # 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 + +```pip3 install git+https://github.com/zirafa/svg2mod``` + +Note: ```python3 setup.py install``` does not work. + +## Example + +```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] 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": 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: