I’ve been working on a script for a while now to export a BOM in the format that I like, adn then to roughly cost it. I’ve seen the various threads on using third party products to translate the BOM into a format that is usable, but I wanted to try a little more.
Disclaimer - It’s still very ropey, and Python is not my “home language”.
However, I have got it working as an add-in from within EESchema, so that it:
Exports the standard BOM fields as well as any Template Field Names for parts
Groups the sames parts into a single row (optionally)
Connects to the SupplyFrame FindChips API to gather pricing
If this is something that interests you, jump over to my GitHub repo and give it a try. If you have the energy, please also contribute to make it better.
The Readme file covers most of the things I could think of, but post more if things aren’t making sense.
Hi, Andrew. I had the same need as you for pricing my KiCad projects. I built a tool called KiCost that does the following:
Processes the BOM XML file from your KiCad schematic to create a part-cost spreadsheet by scraping the web sites of several popular distributors for price and inventory data (Digi-Key, Mouser and Newark/Element14 are currently supported).
The spreadsheet contains quantity-adjusted pricing from each distributor for individual parts and the total board.
Enter the number of boards to be built in a spreadsheet cell and all the pricing for the total board and individual parts is updated.
The spreadsheet also shows the current inventory on-hand for each part at each distributor.
Enter the quantity of each part that you want to purchase from each distributor and lists of part numbers and quantities will appear in formats that you can cut-and-paste directly into the website ordering page of each distributor.
I made a video showing how it’s used. I mentioned your program at the end as an alternative tool for pricing boards. I also plan to look over your code to see what ideas I can steal from it.
You can download my tool here or install it using pip.
Just back from vacation and had a look at your video - that’s really great. Apart from actually having a name for the tool (which is pretty cool), I like the way that you go beyond the initial costing to generate a complete workflow through to ordering.
I haven’t dug into your code yet, but thumbs-up for getting that screen-scraping working so well. I’m too terrified to try anything like that!
Thanks, Andrew. The screen scraping isn’t too hard, but it is SLOW: it takes 1.5 minutes to scrape seven part numbers on all three websites. Using the FindChips API is a lot faster. Is there a limit on how many queries you can make to their API? (I know that the Octopart API limits you to 500 queries per month.)
Yes, there is a limit - 1,000 calls to the API a month. Next step up is 5,000 calls a month for $35. If I get to a point where I’m costing out 5,000 BOM parts a month, I’ll be a very happy (and very busy)!
But you may also cost-out 100 parts ten times per month, especially if you’re iterating a design.
Perhaps I can use the FindChips API and then, once I reach my query limit, fail-over to Octopart. Then when I exceed my Octopart limit, I could fail-over to web-scraping.
One of my big problems with KICAD is the lack of extensions of the software to do things like this. I think I have written “parts”. One of the parts that I have written is a web scraper that kind of works for grabbing Digikey and Mouser prices, quantity, $ vs. qty, and lead times. This way I do not have to rely on Findchips or Octoparts for providing this data.
Very cool. Seems there is quite a demand (and number of solutions) for these kind of tools - I’m finding it really interesting seeing how others have tackled and implemented a solution.
All you need is Python. On Windows 7, I would recommend using WinPython 2.7, 32-bit version. Once that’s installed, then the command ‘pip install kicost’ should be all you need to do.
thanks for the fast reply.
OK, I am a complete noob considering python:
I downloaded Python and installed it. I started “WinPythonControlPanel”, clicked on “Advanced” ->“Open Console here”.
Then I entered “pip install kicost” and pressed return.
I got the message of “successfully installed future-0.15.2 kicost-0.1.10”.
I created a field called manf# and set the field value
to the manufacturer’s part number for each part in my schematic.
I created a BOM file and found the corresponding .xml file in my project folder.
I got stuck at the step entering “python kicost -i schem.xml” into the command line.
I installed KiCost here: …\KiCad\kicost-0.1.10\kicost and tried to perform from this directory.
I got the message: “SystemError: Parent module ‘’ not loaded, cannot perform relative import”.
Maybe I missed something?
As I type this, I ran easy_install again, as well as clicked on the link using the browser, both times out
Reading https://pypi.python.org/simple/kicost/
Download error on https://pypi.python.org/simple/kicost/: [Errno 101] Network is unreachable -- Some packages may not be found!
Couldn't find index page for 'kicost' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for kicost