Implemented the KiCad version in the Internal BoM.

This commit is contained in:
Salvador E. Tropea 2020-08-05 21:17:20 -03:00
parent 8b3d70dae6
commit 7563d1a9ad
7 changed files with 8 additions and 3 deletions

View File

@ -53,6 +53,7 @@ def write_csv(filename, ext, groups, headings, head_names, cfg):
writer.writerow(["Variant:", ' + '.join(cfg.variant)])
writer.writerow(["Revision:", cfg.revision])
writer.writerow(["Date:", cfg.date])
writer.writerow(["KiCad Version:", cfg.kicad_version])
if not cfg.csv.hide_stats_info:
writer.writerow(["Statistics:"])
writer.writerow(["Component Groups:", cfg.n_groups])
@ -60,6 +61,5 @@ def write_csv(filename, ext, groups, headings, head_names, cfg):
writer.writerow(["Fitted Components:", cfg.n_fitted])
writer.writerow(["Number of PCBs:", cfg.number])
writer.writerow(["Total components:", cfg.n_build])
# writer.writerow(["KiCad Version:", net.getTool()]) TODO?
return True

View File

@ -212,6 +212,7 @@ def write_html(filename, groups, headings, head_names, cfg):
html.write(" <b>Variant</b>: {}<br>\n".format(', '.join(cfg.variant)))
html.write(" <b>Revision</b>: {}<br>\n".format(cfg.revision))
html.write(" <b>Date</b>: {}<br>\n".format(cfg.date))
html.write(" <b>KiCad Version</b>: {}<br>\n".format(cfg.kicad_version))
html.write(' </td>\n')
html.write(' <td class="cell-stats">\n')
if not cfg.html.hide_stats_info:

View File

@ -292,7 +292,7 @@ def write_xlsx(filename, groups, col_fields, head_names, cfg):
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Variant:", ' + '.join(cfg.variant))
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Revision:", cfg.revision)
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Date:", cfg.date)
# row_count = add_info(worksheet, column_widths, row_count, fmt_info, "KiCad Version:", ) TODO?
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "KiCad Version:", cfg.kicad_version)
col1 += 2
rc = r_info_start
if not cfg.xlsx.hide_stats_info:

View File

@ -23,7 +23,7 @@ def write_xml(filename, groups, headings, head_names, cfg):
attrib['Schematic_Date'] = cfg.date
attrib['PCB_Variant'] = ', '.join(cfg.variant)
# attrib['BOM_Date'] = net.getDate() same as schematic
# attrib['KiCad_Version'] = net.getTool() TODO?
attrib['KiCad_Version'] = cfg.kicad_version
attrib['Component_Groups'] = str(cfg.n_groups)
attrib['Component_Count'] = str(cfg.n_total)
attrib['Fitted_Components'] = str(cfg.n_fitted)

View File

@ -33,6 +33,7 @@ class GS(object):
n = datetime.now()
today = n.strftime('%Y-%m-%d')
time = n.strftime('%H-%M-%S')
kicad_version = ''
# Data from the SCH because it doesn't have a Python API
sch_title = None
sch_date = None

View File

@ -119,6 +119,8 @@ def load_board(pcb_file=None):
def load_sch():
GS.kicad_version = pcbnew.GetBuildVersion()
logger.debug('KiCad: '+GS.kicad_version)
GS.check_sch()
GS.sch = Schematic()
try:

View File

@ -388,6 +388,7 @@ class BoMOptions(BaseOptions):
self.date = GS.sch_date
self.revision = GS.sch_rev
self.debug_level = GS.debug_level
self.kicad_version = GS.kicad_version
# Get the components list from the schematic
comps = GS.sch.get_components()
try: