danchianucci / eagle2kicad Goto Github PK
View Code? Open in Web Editor NEWConverts an Eagle 6.0+ .brd into a kicad .brd
License: MIT License
Converts an Eagle 6.0+ .brd into a kicad .brd
License: MIT License
Running on Python 3.3 in none command line mode I enter the incoming and out going file names and then get and Error Converting Board message Not well formed token :line1 Column 0. The test file is as below. The incoming file is from http://arduino.cc/en/Main/arduinoBoardMega and I am wanting to convert the mainly the board layout file but having the schematic file would be a plus.
Converting: C:/Users/Paul/Downloads/arduino-mega-reference-design/Arduino_MEGA Reference Design/MEGA.brd
Outputing: C:/Users/Paul/Documents/GitHub/ArduinoLightingController/Eagle2Kicad-master/Eagle2Kicad-master/meganew.brd
Conversion Failed
Traceback (most recent call last):
File "C:\Users\Paul\Documents\GitHub\ArduinoLightingController\Eagle2Kicad-master\Eagle2Kicad-master\Start.py", line 74, in convertBoard
node = getRootNode(fileName)
File "C:\Users\Paul\Documents\GitHub\ArduinoLightingController\Eagle2Kicad-master\Eagle2Kicad-master\Start.py", line 48, in getRootNode
node = ElementTree(file=fileName)
File "C:\Python33\lib\xml\etree\ElementTree.py", line 618, in init
self.parse(file)
File "C:\Python33\lib\xml\etree\ElementTree.py", line 1730, in parse
self._root = parser._parse(source)
File "", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0
Many thanks
Paul
I don't see the license for this code anywhere. Is this code just under normal copyright?
since commit f06f4c3
I have another issue converted Symbols are missing pin numbers it is X name name instead of X name number. I am not sure if I can fix this one with my limited knowledge of python and XML.
Using Python 3 on windows, error appears as soon as I run 'start.py'.
I had couple of issues converting libraries.
-Outline of components was all strange
-Converter converted only half or so of library
I have fixed these issues and made really simple crude GUI but have not worked out how to upload it (if I can?) well can't have everything I guess.
First fix is None in symRep from NONE to None
Second fix sort of fixed itself after adding the GUI part, so I guess that was magic :-)
Aaaannnd I forgot to mention the Name and Value is slightly too small.
Hi!
I'm trying to use this, what seems to be a very powerful tool but is not working:
~/Eagle2Kicad$ python Start.py
Traceback (most recent call last):
File "Start.py", line 16, in
from tkinter import Tk,Frame,Label,Button,RIDGE,BOTH,X
ImportError: No module named tkinter
besides that, any attempt to run it in a different way does not work either:
Board$ python Board.py
Input Filename: input
Output Filename: output.brd
Traceback (most recent call last):
File "Board.py", line 180, in
outFileName=input("Output Filename: ")
File "", line 1, in
NameError: name 'output' is not defined
The readme.md mentions 'Eagle2KiCad' but this script doesn't exist. Start.py can be used as a command line program but it would be nice if 1) Start.py didn't need the dependence on Tcl to function if it was being used via the command line and 2) a 'standalone' eagle2kicad program were present that was for the express purpose of being used on the command line.
See: https://github.com/abetusk/Eagle2Kicad/blob/release/eagle2kicad
Using Python3.3
I see below error while converting texas.lbr to KiCAD format
Conversion Failed
Traceback (most recent call last):
File "Start.py", line 141, in convertLib
lib.writeLibrary(modFile,symFile)
File "C:\Python33\Eagle2Kicad/Library\Library.py", line 67, in writeLibrary
self.writeSymFile(symFile)
File "C:\Python33\Eagle2Kicad/Library\Library.py", line 88, in writeSymFile
devicepart.write(symFile)
File "C:\Python33\Eagle2Kicad/Common\Symbol.py", line 51, in write
symbol.write(symFile)
File "C:\Python33\Eagle2Kicad/Common\Symbol.py", line 114, in write
symFile.write(pin.symRep())
File "C:\Python33\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x96' in position 4: character maps to
I was trying to convert Sparkfun-Connectors.lbr (https://github.com/sparkfun/SparkFun-Eagle-Libraries) and seeing below error
Converting Lib: SparkFun-Connectors.lbr
Module Output: SparkFun-Connectors.mod
Symbol Output: SparkFun-Connectors.lib
Lib Name: SparkFun-Connectors
Conversion Failed
Traceback (most recent call last):
File "Start.py", line 133, in convertLib
lib=Library(node,name)
File "C:...\Eagle2Kicad/Library\Library.py", line 59, in init
dp = DevicePart(device, symbolsHash, deviceset.getGates(), symConverter)
File "C:...\Eagle2Kicad/Common\Symbol.py", line 14, in init
for gate in gates]
File "C:...\Eagle2Kicad/Common\Symbol.py", line 14, in
for gate in gates]
File "C:...\Eagle2Kicad/Common\Symbol.py", line 85, in init
pin.pad = device.getPadByPinName(pin.name)
File "C:...\r\Eagle2Kicad/Common\Device.py", line 46, in getPadByPinName
return self.connects[name].pad
KeyError: 'SHIELD'
I am using Python 3.3, have successfully converter other Eagle libraries before.
The TEXTPCB De documentation for KiCAD and in the PDF documentation (page 23), there is no 'hjustify' field.
The documentation is sometimes incomplete or just wrong. I haven't tried it but I assume KiCAD reads these boards just fine with this extra field? Does KiCAD expect this other field or optionally read it if it's available? If not, should this field be taken out?
The relevant line is in Common/Shapes.py:
def boardRep(self):
X, Y = self.getBoardOffset()
hjustify = self.hJust[0].capitalize()
try:
myString = '$TEXTPCB\n'
myString += 'Te "' + self.val + '"\n'
myString += 'Po ' + X + ' ' + Y + ' ' + self.size + ' ' + self.size + ' ' + self.width + ' ' + self.rot + \
'\n'
myString += 'De ' + self.layer + ' ' + self.mirror + ' 0000 ' + self.style + ' ' + hjustify + '\n'
myString += '$EndTEXTPCB\n'
except TypeError:
return '\n'
return myString
Converting Lib: C:\Users\xxx\Dropbox\tech\workspace\hardware\eagle\lbr\Freescale_By_element14_Batch_1.lbr
Module Output: C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\lbr\Freescale_By_element14_Batch_1.mod
Symbol Output: C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\lbr\Freescale_By_element14_Batch_1.lib
Lib Name: Freescale_By_element14_Batch_1
Conversion Failed
Traceback (most recent call last):
File "start.py", line 139, in convertLib
lib.writeLibrary(modFile,symFile)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Library\Library.py", line 67, in writeLibrary
self.writeSymFile(symFile)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Library\Library.py", line 88, in writeSymFile
devicepart.write(symFile)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Common\Symbol.py", line 51, in write
symbol.write(symFile)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Common\Symbol.py", line 114, in write
symFile.write(pin.symRep())
File "C:\Python33\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x96' in position 16: character maps to
Rotation is able to handle mirrored, and Spin, but not both at the same time.
Converting Lib: /home/cii/SparkFun-Eagle-Libraries/SparkFun-Connectors.lbr
Module Output: /home/cii/Eagle2Kicad/Sparkfun-Connectors.mod
Symbol Output: /home/cii/Eagle2Kicad/Sparkfun-Connectors.lib
Lib Name: SparkFun-Connectors
Conversion Failed
Traceback (most recent call last):
File "Start.py", line 129, in convertLib
node = getRootNode(fileName)
File "Start.py", line 51, in getRootNode
node.parse(fileNameparser)
NameError: global name 'fileNameparser' is not defined
Found this issue while converting Vishay's library from element14:
Converting Lib: C:\Users\xxx\Dropbox\tech\workspace\hardware\eagle\lbr\Vishay_By_element14_Batch_1.lbr
Module Output: C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\lbr\Vishay_By_element14_Batch_1.mod
Symbol Output: C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\lbr\Vishay_By_element14_Batch_1.lib
Lib Name: Vishay_By_element14_Batch_1
Conversion Failed
Traceback (most recent call last):
File "start.py", line 131, in convertLib
lib=Library(node,name)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Library\Library.py", line 59, in init
dp = DevicePart(device, symbolsHash, deviceset.getGates(), symConverter)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Common\Symbol.py", line 14, in init
for gate in gates]
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Common\Symbol.py", line 14, in
for gate in gates]
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Common\Symbol.py", line 85, in init
pin.pad = device.getPadByPinName(pin.name)
File "C:\Users\xxx\Dropbox\tech\workspace\hardware\kicad\utils\Eagle2Kicad-master/Common\Device.py", line 46, in getPadByPinName
return self.connects[name].pad
KeyError: '2'
The KiCAD documentation has quotes around EQUIPOT Na "net name" fields, whereas the output does not put quotes around the net name fields. Page 18 of the PDF documentation implies there is are quotes around the "net name" field.
I feel this is a place where the documentation is a bit ambiguous. Should there be quotes around these net names? Is it optional?
The relevant line are in Board/Board.py:
def writeEQUIPOT(self, outFile):
"""
Writes the EQUIPOT Sections to the outFile
Params:
Outfile: the file to output to
Postconditions:
The section has been written to the outfile
"""
for signal in self.signals:
signame = signal
num = self.signals.get(signame)
outFile.write('$EQUIPOT\n')
outFile.write('Na ' + num + ' ' + signame + '\n')
outFile.write('St~\n')
outFile.write('$EndEQUIPOT\n')
Hello, trying to convert this LBR http://www.embeddedartists.com/sites/default/files/support/xpr/LPCXpresso_Boards_EAGLE_lib.zip I receive back an error about XML parser error:
Converting Lib: lpcxpresso.lbr
Module Output: lpcxpresso.mod
Symbol Output: lpcxpresso.lib
Lib Name: lpcxpresso
Error Converting Library: 'lpcxpresso'
Traceback (most recent call last):
File "/home/bmeneg/Downloads/Eagle2Kicad-master/Start.py", line 153, in convertLib
node = getRootNode(fileName)
File "/home/bmeneg/Downloads/Eagle2Kicad-master/Start.py", line 69, in getRootNode
node.parse(fileName, parser)
File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 604, in parse
parser.feed(data)
File "", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0
Would you know what kind of issue is that? I mean, do you know the solution? :)
Thanks.
Where a pin connects to multiple pads, which is quite common with power pins on large devices, the list of pin numbers is truncated to 4 characters and output as a single pin number. This can easily cause syntax errors in the output file if the first 4 characters contain a space (especially if the pin numbers are non-numeric as is common for BGA parts), as well as more subtle errors in the generated library.
For an example with plenty of these, try converting:
The first time I tried to run Start.py the only output I got was:
Traceback (most recent call last):
File "Start.py", line 245, in <module>
main()
File "Start.py", line 237, in main
startGui()
File "Start.py", line 27, in startGui
root = Tk()
NameError: name 'Tk' is not defined
After removing the try-catch block around import_tk
I got the much more helpful error message:
Traceback (most recent call last):
File "/usr/lib/python3.4/tkinter/__init__.py", line 39, in <module>
import _tkinter
ImportError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Start.py", line 242, in <module>
main()
File "Start.py", line 234, in main
startGui()
File "Start.py", line 22, in startGui
import_tk()
File "Start.py", line 15, in import_tk
from tkinter import Tk, Frame, Label, Button, RIDGE, BOTH, X
File "/usr/lib/python3.4/tkinter/__init__.py", line 41, in <module>
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
It seems like swallowing the errors that are thrown makes it much more difficult to figure out what's going on.
Converting Lib: /home/cii/SparkFun-Eagle-Libraries/SparkFun-Resistors.lbr
Module Output:
Symbol Output:
Lib Name: SparkFun-Resistors
Conversion Failed
Traceback (most recent call last):
File "Start.py", line 131, in convertLib
lib=Library(node,name)
File "/home/cii/Eagle2Kicad/Library/Library.py", line 59, in init
dp = DevicePart(device, symbolsHash, deviceset.getGates(), symConverter)
File "/home/cii/Eagle2Kicad/Common/Symbol.py", line 14, in init
for gate in gates]
File "/home/cii/Eagle2Kicad/Common/Symbol.py", line 14, in
for gate in gates]
File "/home/cii/Eagle2Kicad/Common/Symbol.py", line 85, in init
pin.pad = device.getPadByPinName(pin.name)
File "/home/cii/Eagle2Kicad/Common/Device.py", line 46, in getPadByPinName
return self.connects[name].pad
KeyError: '2'
Hi. I have all the .py files in the same directory and am trying to run the "Library.py" file in order to convert an Eagle library of footprints (.lbr). The error I get is:
Traceback (most recent call last):
File "Library.py", line 85, in
node = ElementTree(file=fileName)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 611, in init
self.parse(file)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
source = open(source, "rb")
IOError: [Errno 2] No such file or directory: 'untitled.lbr'
I'm not a programmer, but when I look at the code it appears that the "input" function is commented out and the "fileName" variable is assigned "untitled.lbr". Is this test code that you forgot to finalize or do I not understand how this works?
Hello I did try to convert the OPL, here is some more information about the library and the download:
http://www.seeedstudio.com/wiki/Open_parts_library
I did the download from here:
http://www.seeedstudio.com/depot/OPLopen-parts-library-catalog-c-136_138/?ref=side
I'm using Kicad V4.0.0 RC1 and your Start.py from master from today with python3.4.
With the UI I was able to convert all files without errors. However when I try to use the files I get errors like this in Kicad:
11:26:52 AM: Library 'Seeed-OPL-Transistor' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 339 .
11:26:52 AM: Library 'Seeed-OPL-Transistor' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1088 .
11:26:52 AM: Library 'Seeed-OPL-Transistor' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1216 .
11:26:52 AM: Library 'Seeed-OPL-Transistor' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1568 .
11:26:52 AM: Library 'Seeed-OPL-sensor' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1444 .
11:26:52 AM: Library 'Seeed-OPL-Resistor' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 288 .
11:26:52 AM: Library 'Seeed-OPL-Moudle' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1190 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 613 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 703 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 728 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 753 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 2923 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 3732 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 3757 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 6098 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 6394 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 7293 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 8209 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 8715 .
11:26:52 AM: Library 'Seeed-OPL-ic' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 12075 .
11:26:53 AM: Library 'Seeed-OPL-Connector' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1503 .
11:26:53 AM: Library 'Seeed-OPL-Connector' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 1579 .
11:26:53 AM: Library 'Seeed-OPL-Connector' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 2390 .
11:26:53 AM: Library 'Seeed-OPL-Connector' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 3145 .
11:26:53 AM: Library 'Seeed-OPL-Connector' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 3248 .
11:26:53 AM: Library 'Seeed-OPL-Connector' component load error error <error 'pin parameters read issue' in DRAW command X> occurred at line 3292 .
Zones show up in kicad, however they cannot be filled and they dissappear
Hello, I am not a python expert but i could not run your sript. The error was:
Traceback (most recent call last):
File "Board/Board.py", line 9, in
from Converter import Converter
ImportError: No module named Converter
Executed from Board/
For the files that I've worked on in my fork, I've converted the file from 'dos' to 'unix' by stripping out the trailing '\r'. I would like to issue a pull request with some updates but now I'm in the position where I either have to re-introduce the spurious 'dos' newlines or I have to go through manually and find which changes you made that were appropriate and add them to my repo.
Can you just convert your files to 'unix' by stripping the trailing ^M?
See abetusk@ffd269d for a fix. I think an older version of Kicad didn't use the 'startX startY endX endY' trailing portion for the Eeschema "A" (arc) command and used the start and end angle only. These angles are almost redundant when considering the start and end points. Instead of settling on a convention of always one direction (ccw or cw), Kicad uses the angles to determine if it should render the arc ccw or cw depending on whether the start angle is bigger or smaller than the end angle (after some renormalization).
The comments in the above link have more detail. I use a crude solution of just stuffing in numbers into the start and end angle, but considering how their actual values should be ignored anyway, I feel that's a better solution than stuffing in semi-sensical numbers for the angles and potentially confusing a future developer trying to reverse engineer the byzintine eeschema syntax.
The relevant KiCad source logic can be found in the "TRANSFORM::MapAngles" method in "eeschema/transform.cpp".
To see an example of mis-rendering, check any of the "OSHW-LOGOL_OSH2-LOGO-S", "OSHW-LOGOL_OSH2-LOGO-M" or "OSHW-LOGOL_OSH2-LOGO-L" in https://github.com/sparkfun/SparkFun-Eagle-Libraries/blob/master/SparkFun-Aesthetics.lbr .
I'm happy to issue a pull request but I want #26 resolved before I do.
there's no Eagle2Kicad
executable/script/whatever in the repo, but documented in the readme (but looking at the code it seems that's the correct documentation for the CLI part of Start.py
).
also the Start.py
just script complains about requiring TKinter for the GUI, instead of for example just printing the CLI usage instead (something like "Error Starting GUI. install TKinter or use the following command line options: ...").
I'm getting this:
robomotic@optimus:~/Eagle2Kicad/Board$ python Board.py
Traceback (most recent call last):
File "Board.py", line 187, in
brd.write(open(outFileName,"a"))
File "Board.py", line 136, in write
self.writeMODULES(outFile)
File "Board.py", line 162, in writeMODULES
element.write(outFile)
File "/home/robomotic/Eagle2Kicad/Board/Module.py", line 126, in write
outFile.write(self.value)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb5' in position 35: ordinal not in range(128)
Converting Lib: /home/cii/SparkFun-Eagle-Libraries/SparkFun-Aesthetics.lbr
Module Output: /home/cii/SparkFun-Eagle-Libraries/SparkFun-Aesthetics.mod
Symbol Output: /home/cii/SparkFun-Eagle-Libraries/SparkFun-Aesthetics.lib
Lib Name: SparkFun-Aesthetics
Conversion Failed
Traceback (most recent call last):
File "Start.py", line 131, in convertLib
lib=Library(node,name)
File "/home/cii/Eagle2Kicad/Library/Library.py", line 59, in init
dp = DevicePart(device, symbolsHash, deviceset.getGates(), symConverter)
File "/home/cii/Eagle2Kicad/Common/Symbol.py", line 12, in init
self.name = device.fullName+"_" + self.device.package #we have to create a number of symbols to match diffrent pin configurations
TypeError: Can't convert 'NoneType' object to str implicitly
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.