Skip to content

Commit 75d6bd6

Browse files
Added bom generator and moved some readme stuff around
1 parent a751da8 commit 75d6bd6

File tree

4 files changed

+144
-34
lines changed

4 files changed

+144
-34
lines changed

InstallationNotes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Installation Notes
2+
----------------
3+
4+
* [The KiCad site](http://kicad-pcb.org/)
5+
6+
**KiCad installation**
7+
8+
* Uninstall previous versions of KiCad
9+
* Download KiCad stable version 4.0.5 from [http://kicad-pcb.org/download/](http://kicad-pcb.org/download/windows/) and install
10+
* After install, you'll be prompted to install "Wings 3D", check this box to be redirected to [http://www.wings3d.com/](http://www.wings3d.com/)
11+
* Download and install the stable release 2.1.5
12+
13+
**Using the libraries**
14+
15+
* Create a local project (this is necessary because projects hold library path information)
16+
* Open the "Schematic Library Editor"
17+
* Prefrences -> Component Libraries
18+
* Remove all libraries from list
19+
* Add -> navigate to SparkFun-KiCad-Libraries -> select all .lib files -> open, then hit OK
20+
* Test by selecting an active library. All sparkfun libraries should be displayed. Close the library editor
21+
* Open the "PCB Footprint Editor"
22+
* Prefrences -> Footprint Library Manager
23+
* Remove all (if any) libraries, hit OK
24+
* Prefrences -> Footprint Libraries Wizard
25+
* Next (files on my computer)
26+
* Navigate to SparkFun-KiCad-Libraries -> select all .mod files and hit ok
27+
* Next
28+
* Select for this project only
29+
* Next
30+
* Close the editor
31+
* Save the project (Green arrow into extern HDD icon, no menu exists)
32+
33+
Now, This project is linked to the libraries. Open a schematic and place components. See kicad enginursday post for converting from schematic into board (Note: You need to have nets for this to work... not just unconnected components)
34+
License Information

KiCadBomPlugin/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BOM tool
2+
====================================
3+
4+
This folder contains a single file, bom2groupedCsv.xsl. It can be run through tools->Generate Bill of Materials
5+
6+
Use the command line:
7+
xsltproc -o "%O.csv" "C:\github\SparkFun-KiCad-Libraries\Conversion\KiCadBomPlugin\KicadBOM\bom2groupedCsv.xsl" "%I"
8+
9+
The information originally came from a comment by fritsjan, referenced by ContextualElectronics in a video:
10+
https://www.youtube.com/watch?v=9yFZ6PUwKL8
11+
12+
The file came from this zip:
13+
14+
[KicadBom.zip](https://kicad-info.s3.amazonaws.com/3929625ac5cd971344cc17cda0c3877a3981d489907.zip)
15+
16+
You don't need to install the zip contents as described in the video, just execute the .xsl file with the changed command line. I suspect xsltproc wasn't distribued with earlier versions of KiCad.

KiCadBomPlugin/bom2groupedCsv.xsl

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<!--XSL style sheet to convert EESCHEMA XML Partlist Format to grouped CSV BOM Format
2+
Copyright (C) 2014, Wolf Walter.
3+
Copyright (C) 2013, Stefan Helmert.
4+
GPL v2.
5+
6+
Functionality:
7+
Generation of Digi-Key ordering system compatible BOM
8+
9+
How to use this is explained in eeschema.pdf chapter 14. You enter a command line into the
10+
netlist exporter using a new (custom) tab in the netlist export dialog. The command is
11+
on Windows:
12+
xsltproc -o "%O.csv" "pathToFile\bom2groupedCsv.xsl" "%I"
13+
on Linux:
14+
xsltproc -o %O.csv pathToFile/bom2groupedCsv.xsl %I
15+
-->
16+
17+
<!DOCTYPE xsl:stylesheet [
18+
<!ENTITY nl "&#xd;&#xa;"> <!--new line CR, LF, or LF, your choice -->
19+
]>
20+
21+
22+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
23+
<xsl:output method="text"/>
24+
25+
<!-- for Muenchian grouping of footprint and value combination -->
26+
<xsl:key name="partTypeByValueAndFootprint" match="comp" use="concat(footprint, '-', value)" />
27+
28+
<!-- for table head and empty table fields-->
29+
<xsl:key name="headentr" match="field" use="@name"/>
30+
31+
<!-- main part -->
32+
<xsl:template match="/export">
33+
<xsl:text>Reference, Quantity, Value, Footprint, Datasheet</xsl:text>
34+
35+
<!-- find all existing table head entries and list each one once -->
36+
<xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
37+
<xsl:text>, </xsl:text>
38+
<xsl:value-of select="@name"/>
39+
</xsl:for-each>
40+
41+
<!-- all table entries -->
42+
<xsl:apply-templates select="components"/>
43+
</xsl:template>
44+
45+
<xsl:template match="components">
46+
<!-- for Muenchian grouping of footprint and value combination -->
47+
<xsl:for-each select="comp[count(. | key('partTypeByValueAndFootprint', concat(footprint, '-', value))[1]) = 1]">
48+
<xsl:sort select="@ref" />
49+
<xsl:text>&nl;</xsl:text>
50+
<!-- list of all references -->
51+
<xsl:for-each select="key('partTypeByValueAndFootprint', concat(footprint, '-', value))">
52+
<xsl:sort select="@ref" />
53+
<xsl:value-of select="@ref"/><xsl:text> </xsl:text>
54+
</xsl:for-each><xsl:text>,</xsl:text>
55+
<!-- quantity of parts with same footprint and value -->
56+
<xsl:value-of select="count(key('partTypeByValueAndFootprint', concat(footprint, '-', value)))"/><xsl:text>,</xsl:text>
57+
<xsl:value-of select="value"/><xsl:text>,</xsl:text>
58+
<xsl:value-of select="footprint"/><xsl:text>,</xsl:text>
59+
<xsl:value-of select="datasheet"/>
60+
<xsl:apply-templates select="fields"/>
61+
</xsl:for-each>
62+
</xsl:template>
63+
64+
<!-- table entries with dynamic table head -->
65+
<xsl:template match="fields">
66+
67+
<!-- remember current fields section -->
68+
<xsl:variable name="fieldvar" select="field"/>
69+
70+
<!-- for all existing head entries -->
71+
<xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
72+
<xsl:variable name="allnames" select="@name"/>
73+
<xsl:text>,</xsl:text>
74+
75+
<!-- for all field entries in the remembered fields section -->
76+
<xsl:for-each select="$fieldvar">
77+
78+
<!-- only if this field entry exists in this fields section -->
79+
<xsl:if test="@name=$allnames">
80+
<!-- content of the field -->
81+
<xsl:value-of select="."/>
82+
</xsl:if>
83+
<!--
84+
If it does not exist, use an empty cell in output for this row.
85+
Every non-blank entry is assigned to its proper column.
86+
-->
87+
</xsl:for-each>
88+
</xsl:for-each>
89+
</xsl:template>
90+
91+
</xsl:stylesheet>

README.md

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,11 @@ Contents
2121
-------------------
2222

2323
* [/Conversion](https://github.com/sparkfun/SparkFun-KiCad-Libraries/tree/master/Conversion) -- Information and scripts having to do with converting eagle components to KiCad (See contained README.md)
24+
* [/KiCadBomPlugin](https://github.com/sparkfun/SparkFun-KiCad-Libraries/tree/master/KiCadBomPlugin) -- A bom generator that includes extra fields
25+
* [InstallationNotes.md](https://github.com/sparkfun/SparkFun-KiCad-Libraries/tree/master/InstallationNotes.md) -- Notes for installing KiCad.
2426
* README.md -- This file
27+
* *Library Files*
2528

26-
Resource
27-
----------------
28-
29-
* [The KiCad site](http://kicad-pcb.org/)
30-
31-
**KiCad installation**
32-
33-
* Uninstall previous versions of KiCad
34-
* Download KiCad stable version 4.0.5 from [http://kicad-pcb.org/download/](http://kicad-pcb.org/download/windows/) and install
35-
* After install, you'll be prompted to install "Wings 3D", check this box to be redirected to [http://www.wings3d.com/](http://www.wings3d.com/)
36-
* Download and install the stable release 2.1.5
37-
38-
**Using the libraries**
39-
40-
* Create a local project (this is necessary because projects hold library path information)
41-
* Open the "Schematic Library Editor"
42-
* Prefrences -> Component Libraries
43-
* Remove all libraries from list
44-
* Add -> navigate to SparkFun-KiCad-Libraries -> select all .lib files -> open, then hit OK
45-
* Test by selecting an active library. All sparkfun libraries should be displayed. Close the library editor
46-
* Open the "PCB Footprint Editor"
47-
* Prefrences -> Footprint Library Manager
48-
* Remove all (if any) libraries, hit OK
49-
* Prefrences -> Footprint Libraries Wizard
50-
* Next (files on my computer)
51-
* Navigate to SparkFun-KiCad-Libraries -> select all .mod files and hit ok
52-
* Next
53-
* Select for this project only
54-
* Next
55-
* Close the editor
56-
* Save the project (Green arrow into extern HDD icon, no menu exists)
57-
58-
Now, This project is linked to the libraries. Open a schematic and place components. See kicad enginursday post for converting from schematic into board (Note: You need to have nets for this to work... not just unconnected components)
59-
License Information
6029
-------------------
6130

6231
This library is released under the [Creative Commons ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/) license.

0 commit comments

Comments
 (0)