I think a better method would be to analyze all pad numbers of a part. Example: sort alphanumerically and use the lowest entry. (Or at least this can be done if none of the predefined options is found)
wow, thank you so much for this! I saw it on twitter and hackaday and bookmarked it. It is so awesome!
I’m just working with a Chinese assembly house and have asked them if they want to use this instead of screenshots - I think it’s going to be so much easier.
Thank you for providing this utility. I downloaded and used it immediately this morning with most satisfactory results. The interaction with the layout to highlight components is a great idea. I was also able to simply save the BOM as a text file, import it into a spreadsheet and remove columns that are irrelevant to stores/purchasing (i.e. footprints); just what I needed to find originally. As a side note to any users: simply having generic values in your Bill of Materials (like 22uF) is not very helpful to purchasing or manufacturing, they need unique company or manufacturer codes (sorry if this doesn’t really belong here).
In upcoming version 2 of the plugin there will be an option to backfill BOM with extra fields pulled from netlist or xml file generated from eeschema. You can then put manufacturer part # or whatever else you want to help you identify parts in additional fields on components in schematic and that will appear in bom.
@qu1ck, interesting, just some points to help your road map. This option to fill with BOM / netlist option is nice, but:
The python script should try and pass or warning if don’t found any netlist / xml BOM;
May be better use the BOM instead the the netlist, because now there is an option to synchronize Eeschema->PcbNew without netlist file creation. Even, in the developer “forum” (launchpad) there is some discussion to add new information at the netlist / Eeschema / PcbNew files, what should create some problems at KiCad 6, but the xml will be keep with changes;
The interactive HTML plugin will have to check if the XML file is up-to-date with the Pcb (maybe checking with all the references and values are equal to the Pcb);
It won’t look for the file, you have to choose it in file dialog or pass on command line.
You will have option to use either netlist or xml. In the future maybe reading schematic files directly will be implemented too.
Yes, I already have some checks. It will show a warning if components don’t match.
Wow, that code has more comments than code. I don’t think I will need much of that logic, you will just choose field name(s) in GUI or pass as command line arguments in my case.
(2) Better wait for the eeschema python package (to ready directly the .sch file), already in discussion but not implemented, this will leave your code not dependent of file formats.
(4) Yes, a lot of comments due some refacture and bug fix to read since KiCad v4 and interpretation of the fields by different users
behaviour (e.g. manf#, mpn, p# are translated to manf#; digikey#, digikey-p#, digikey_p# as digikey# … being better to group in this specif made tool).
To people following development and who are somewhat power users: I could use help with testing latest revision.
I just pushed a big update to github. You can call it a v2 release candidate but I haven’t done sufficient testing to officially tag it yet.
Please try it out if you have time to tinker with potentially unstable version and report any bugs to me.
But there are a bunch of goodies:
Things that are not implemented yet: saving settings in dialog and loading netlist file (only xml file works for now).
Update: netlist parser implemented.
So pretty much everything should work now, except that you’ll have to enter all parameters every time you invoke the plugin. That’s what save settings button is for, which I’ll get to in a bit.
It’s a known issue with latest debian and ubuntu based distributions that don’t provide wxpython built with wxwidgets linked with gtk2. Sorry, for now you have to use plugin from command line. KiCad 5.1 is supposed to solve this problem.
I could assign a different XML (for other project) to my iBOM. Could be smart and user responsive to check with the XML/Netlist file have the same designators (R*, C*, …) that the PCB and warning the user;
The ‘dark them’ appear to be always checked in the output file, not mattering checked or not in the GUI. (could it be because the cookie of a file that I already have generated?);
I think it could be done. Search for .xml and .net files in same directory as pcb file and pick the most recent one.
Yes, I provisioned “save settings” button for that. I took a look at your code, looks like wx.Config writes to registry on win, I will probably use wx.FileConfig since registry is evil™.
Also planned
and 5. You are right, settings are cached in browser (but in LocalStorage, not in cookies). Settings in config dialog are defaults which will be relevant for new browser session.
About 2, YES, on Windows HK_USER\Software\your_name_def\. In Linux it saves a file in $HOME\your_name_def’. On Mac, I didn’t read about / had experienced.
One idea could be just generate a ibom_config.inf file in the project folder to be (try) read at the second time that iBOM is started.
About the feedback, as I friend mine, also developer, told me once: ‘the easier it is or less clicks for the user, more work for the programmer’
I hope, in some way my code / feedback can help you.
Now just need to save settings. Not sure if they should be global or per project. On one hand I don’t like adding junk to project directory, on the other hand having settings be global can be tricky.
Thank you for great work. Can you add support of UTF8 filepath?
Traceback (most recent call last):
File "InteractiveHtmlBom/InteractiveHtmlBom/generate_interactive_bom.py", line 655, in <module>
board = pcbnew.LoadBoard(os.path.abspath(args.file))
File "/usr/local/lib/python2.7/dist-packages/pcbnew.py", line 7409, in LoadBoard
return _pcbnew.LoadBoard(*args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 60: ordinal not in range(128)
I fixed one minor issue related to utf8 files but on Linux there seems to be some bug that prevents pcbnew to read files with non ascii names. Here is simple repro:
quick@debian:~$ cat t.py
# encoding: utf8
import pcbnew
print pcbnew.LoadBoard(u'1ა.kicad_pcb')
quick@debian:~$ python t.py
Traceback (most recent call last):
File "t.py", line 4, in <module>
print pcbnew.LoadBoard(u'1ა.kicad_pcb')
File "/usr/local/lib/python2.7/dist-packages/pcbnew.py", line 8542, in LoadBoard
return _pcbnew.LoadBoard(*args)
IOError: Unable to open filename "1ა.kicad_pcb" for reading
Maybe @pointhi can help? I can’t get pcbnew.LoadBoard() to accept unicode filename on linux.
Update: nevermind, I figured out the issue. wxGTK does some shenanigans with file name encodings on wxApp::Init(). Workaround is to create a wx.App() even if you don’t need any windows. Unicode file names issue should be fixed in latest from repo.
This is a big update with much requested functionality finally added.
Most important change is the new configuration dialog and ability to pull extra data from netlist or xml file.
With config dialog you can
Add extra columns to BOM with arbitrary data like manufacturer part number
Configure HTML defaults
Change bom destination directory
Mark parts as DNP (do not populate) to skip them in BOM
Add explicit part blacklist
Configure BOM table default sort order
I’ve already shared a picture of the dialog above, it hasn’t changed much.
Other fixes include:
Correctly parse boards with components that have duplicate references. Now panelized boards work properly.
Fix for boards with utf8 file names
Fix dark theme bug with background of bom table in ‘bom only’ mode
Fix plugin clashing with some other action plugins
Also there is a new copy to clipboard button to help you easily copy data into excel or other spreadsheet software.
I’ve moved the instructions from readme to project wiki which is easier to update.
You’ve done amazing work with this. I think I need to upgrade my microwave to play Doom 3D so we can work on getting this plugin ported over. (@others if you don’t get the joke, read the FAQ.)
I am new user of KiCad and am still getting to grips with using it and it’s quirks. When I searched for a plugin to make a BOM, this is the first thing that came up. I followed the instructions and it just works! Perfectly!
Thank you very, very much! This generates the nicest BOM ever and potential completely replaces assembly drawings!