Clarify, extend, and rename ky*.py to kicad_netlist_reader.py.

Significantly enhance the bom_csv_grouped_by_value.py BOM generator.
IMO it at this moment, the best BOM production tool for KiCad.
This commit is contained in:
Dick Hollenbeck
2013-09-01 12:49:01 -05:00
parent 4d1dc14b45
commit 3fcf44ae32
10 changed files with 897 additions and 514 deletions
+9 -5
View File
@@ -4,21 +4,23 @@
# Example: Tab delimited list (The same as std output) Ungrouped
#
from __future__ import print_function
# Import the KiCad python helper module and the csv formatter
import ky_generic_netlist_reader
import kicad_netlist_reader
import csv
import sys
# Generate an instance of a generic netlist, and load the netlist tree from
# the command line option. If the file doesn't exist, execution will stop
net = ky_generic_netlist_reader.netlist(sys.argv[1])
net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write to, if the file cannot be opened output to stdout
# instead
try:
f = open(sys.argv[2], 'w')
except IOError:
print >> sys.stderr, __file__, ":", e
print(__file__, ":", e, file=sys.stderr)
f = stdout
# Create a new csv writer object to use as the output formatter, although we
@@ -32,7 +34,9 @@ out.writerow(['Tool:', net.getTool()])
out.writerow(['Component Count:', len(net.components)])
out.writerow(['Ref', 'Value', 'Part', 'Documentation', 'Description', 'Vendor'])
components = net.getInterestingComponents()
# Output all of the component information
for c in net.components:
out.writerow([c.getRef(), c.getValue(), c.getLib() + "/" + c.getPart(),
for c in components:
out.writerow([c.getRef(), c.getValue(), c.getLibName() + ":" + c.getPartName(),
c.getDatasheet(), c.getDescription(), c.getField("Vendor")])