Okay, I can live without it. Maybe I can find another script that will do the same thing and is easier to use.
I just saw it and thought I’d like to try it out.
Yeah, I googled around and found an installer that installed a bunch of python add-ons, including numpy and some other things. But as you say it didn’t work apparently.
So last question on this - shouldn’t this have shown up in the tools > External Plugins?
It’s not that easy with numpy on windows. See https://stackoverflow.com/a/34587391
No, like I said it’s not a plugin, just a standalone script.
@dnmeeks: If you need to extract BOM, manipulate many BOM version, and push back to schematic. Try my script. May is .exe file, so you can run in under cmd console as normal way.
How can i tell the difference between a script and a plugin?
http://docs.kicad.org/doxygen/md_Documentation_development_pcbnew-plugins.html#ppi_pi_struct
and…
http://docs.kicad.org/stable/en/pcbnew.html#_kicad_scripting_reference#action_menu
You have to read the python code.
In the doc I linked earlier there is this info:
The Python plugin must contain a class derived from
pcbnew.ActionPlugin
and it’sregister()
method must be called within the plugin.
So a plugin will contain a declaration of a class that extends ActionPlugin and there will be a register() method call somewhere.
So if you see some thing like this in the code:
class text_by_date(pcbnew.ActionPlugin):
It should be ActionPlugin
I know why now, 4.0.7 is not detected fully from PyCharm, but 5.0.2 is ok for import pcbnew.
But import sys, or import math are not detected correctly.
For me, I not only point python interpreter to KiCad, but also, I need to include a source tree from <KiCad_Install_Dir>\lib\python2.7. That seem to work.
The bad news is that I am an analog/power design engineer for whom all of this Python script stuff is quite foreign. To me, Python is a snake, and script is my unreadable handwriting. I gave up on that and I print.
The good news is that without really knowing what I was doing, I was able to run a reasonably structured BOM on the first try using bom_csv_grouped_by_value_with_fp.py which came with the KiCad install.
My question is that the “description” field (the 6th column) which is output by that BOM is a lot of wrong information for my parts; I cannot find where it resides so that I can edit it? editititititititi I do not see it in my symbol library or in component properties in Eeschema. (???)
@BobZ. You can try download my python script, and run BOM generator with bom2csv.py. When you edit it in excel for correcting the problem. Then you can run c:\program files\kicad\bin\python.exe bom2sch.py … so update your schematic with the corrected values from the csv bom. You can find and download my thing here: Back import custom fields
Thank you, nhatkhai. I have downloaded and run your script. I am not sure that the BOM produced by your script is any closer to what I want than the BOM produced the script which came with KiCad. I have no desire to learn programming right now. I am trying to correct the source information for that BOM but I do not know where that source information resides? I doubt that the source information is contained in the script. If that were the case then a new script would be required with each BOM change.
You problem get to abstract to me now. I’m not sure what is your exact issue. My be if you can share a BOM or schematic file or image to help me understand what is it about.
Thank you.
Here is a view (in Eeschema) of properties of transistor Q10:
I tried to copy-paste the .py file but cannot. It is _bom_csv_grouped_by_value_with_fp.py
which came with KiCad
Now here is a screenshot of a portion of the BOM which was generated:
The text:
"20V Vds, 1.5A Id, N-channel MOSFET, SOT-323" is a mystery to me. Where did it come from?
I am saying this is a Dpak but some description field somewhere says that it is a SOT-323. How do I edit the source of that information? ( I want to edit the source, not just the BOM.)
I believe that come from the default value of symbol library. This is why some time I decided that my script try to not extracting that information. This information is irrelevance, and can be overwrite when you define the description field for that particular part on your schematic. Or you can correct that, and run my bom2sch script. This should push the new value in description column (if you corrected in csv file), and push them into each part in your schematic. Then next time you re-generated bom from what every scripts (even with mine bom2csv), you should see it been corrected. Also, you should see the description filed defined for each part from eeschema program too.
(ADDITION EDITED) If you still not like run the python script from the cmd line for bom2sch, then you will need to do manually like I mentioned. Depend on how many part you needed to correct. Another way is using the Kicad 5.x version BOM manager tool from one of the drop down menu. That would avoid you to run the script. It is up to you.
Thanks again nhatkhai
I used Tools>Generate bill of materials from Eeschema. That asks me for a plugin which had me stumped for a while. I think you are posing one possible solution. But it feels like it avoids the bad data which is residing somewhere instead of correcting the bad data. I am no programmer and I could be mistaken, but I would like to get another opinion to see if I can fix the bad data somehow…
If you just want to edit your symbol description go in symbol editor, edit->Properties
(there is corresponding toolbar button too, looks like op-amp with a gear in 5.1)
It will be in .lib file then.
My solution (under Protel) was to take from BOM only:
- number of elements: 5
- their symbols: R1, R3, R7, R8, R9
- their value: 1k
I copy such BOM to second page of my LibreOffice spreadsheet and all neded values are filled from the first page which is my database of used elements.
That way I have all such informations in one place, see and edit easily.
With KiCad I will also get footprint from BOM. Thanks to that I will have 1k in different footprints (til now I had 1k and 1k_4 elements). I have checked that spredsheet can serch for text being a concatenation of texts from two columns.
People here helped me to modify bom_csv_grouped_by_value_with_fp.py to get what I wonted:
Another way is use KiField script to extract, correct, and push back into .lib, .dcm, .sch file individually.
Thank you qu1ck.
This information was certainly not in the .lib file, and it was no longer in the .dcm file because I had removed it.
The puzzling issues:
- I am using version (5.0.2)-1 and cannot find this gear icon; I would appreciate a screen shot.
- Yesterday I was still getting this wrong information in my BOM in spite of having removed it from the .dcm file. I am pretty sure that I closed and reopened KiCad and this was still the case
- After turning my computer off last night and on this morning the information is now coming up correctly.
- When I point to a copy of the .py file in my own folder I now do not get the csv output. For some reason I have to use the .py file which is located in the program files folder. (In neither case do I get a .csv dot extension of the filename. I had to add that.