Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems converting.. #10

Open
islainstruments opened this issue Sep 27, 2016 · 7 comments
Open

Problems converting.. #10

islainstruments opened this issue Sep 27, 2016 · 7 comments

Comments

@islainstruments
Copy link

Hey Guys,
not sure if this is the right place to ask for suggestions or not.

I have several svgs that I have drawn and am trying to convert into kicad modules.
Each time I try, i end up getting an empty footprint with just the svg2mod text and nothing else in the result.

I've tried my best to follow instructions to the letter, and even tried experimenting with diferent sizes to see if i was just trying to convert something that was too small.

This is the output I get (i'm on mac)

Mac-Pro:svg2mod-master brad$ ./svg2mod.py -i circle_pad_all.svg -o circle.mod -p 0.1
Parsing SVG...
No handler for element {http://www.w3.org/2000/svg}metadata
No handler for element {http://www.w3.org/2000/svg}defs
No handler for element {http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}namedview
transform: matrix [5.7434625, 0.0, 0.0, 5.7434625, -358.57396, -616.14193]
transform: matrix [5.7434625, 0.0, 0.0, 5.7434625, -358.57396, -616.14193]
Writing module file: circle.mod
Mac-Pro:svg2mod-master brad$ 

I have converted objects to paths, saved as inkscape svg, done the layer names and so at this point I am a bit lost...

in any case, thanks for making this tool!, Hopefully, I can get some results from it.

screen shot 2016-09-22 at 12 28 02 pm

@kasbah
Copy link
Contributor

kasbah commented Sep 27, 2016

Hi bradholland, if you are willing to share the SVG I could have a go at it.

@sammdu
Copy link

sammdu commented Nov 17, 2016

same here...
./svg2mod.py -i '/home/samm/Downloads/certification-mark-master/templates/oshwa-2.4.svg' -o '.../OSHW_BACK_2CM.kicad_mod' --name 'OSHW_BACK_2CM' --format pretty
was the command i executed (full path was given in the actual program)
the result was a ".kicad_mod" file in the folder, but theres only the footprint name but not the actual file
and about the reversed file being generated as mentioned in the README...i didn't see that either since there's only 1 file generated at all.
also the -p PRECISION argument, i don't really get the meaning...like what is the range etc.
plz help thx a lot!
here's the source svg if somehow helpful
oshwa-2.4.svg.zip

@kasbah
Copy link
Contributor

kasbah commented Nov 17, 2016

You didn't use a layer in the SVG. I put everything on a SilkS layer and converted with:

 svg2mod -i oshwa-2.4.svg --format pretty -p 1.0 

https://kaspar.h1x.com/oshwa-2.4.svg
https://kaspar.h1x.com/oshwa-2.4.kicad_mod

The precison default seems to be 10.0 and will give jagged edges on some of the letters on your example. I am not sure what the units are either.

@sammdu
Copy link

sammdu commented Nov 17, 2016

Okay thanks a lot @kasbah problem solved! So the conversion would only work if you put stuff into a layer.
@bradholland u might wanna try this out and close the ticket if it works ;-)

@chaosAD
Copy link

chaosAD commented Nov 24, 2017

I got the following error. I am using Inkscape version 0.92. I put my my drawing on SilkS layer. It is kinda strange... I got the same error when converting the example given in examples/ folder. I am using Python 3.6.2. Am I missing something?

$ svg2mod -i FireMeUp.svg --format pretty -p 1.0
Parsing SVG...
No handler for element {http://www.w3.org/2000/svg}defs
No handler for element {http://www.w3.org/2000/svg}metadata
transform: translate [-69.644863, -53.060926]
Traceback (most recent call last):
  File "C:\Dummy\Python\Python36-32\Scripts\svg2mod-script.py", line 11, in <module>
    load_entry_point('svg2mod', 'console_scripts', 'svg2mod')()
  File "C:\Dummy\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Dummy\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "C:\Dummy\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
    return self.resolve()
  File "C:\Dummy\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg2mod.py", line 1433, in <module>
    main()
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg2mod.py", line 39, in main
    args.module_value
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg2mod.py", line 444, in __init__
    self.svg = svg.parse( file_name )
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg\svg\__init__.py", line 6, in parse
    f = svg.Svg(filename)
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg\svg\svg.py", line 210, in __init__
    self.parse(filename)
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg\svg\svg.py", line 239, in parse
    top_group.append(self.root)
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg\svg\svg.py", line 286, in append
    item = elt_class(elt)
  File "C:\Dummy\projects\python\svg2mod\svg2mod\svg\svg\svg.py", line 265, in __init__
    for id, value in elt.attrib.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

@kasbah
Copy link
Contributor

kasbah commented Nov 30, 2017

Hi @chaosAD, have you tried with Python 2, do you get the same error?

@dmrlsn
Copy link

dmrlsn commented Feb 1, 2020

@kasbah had the same problem. rebuilding and reinstalling with python 2 solved it. many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants