Added suppport for multiprojects to the internal KiCost.

- Also changes the KitSpace queries format to be more readable.
This commit is contained in:
Salvador E. Tropea 2021-05-25 18:02:22 -03:00
parent fb99ef375b
commit 3bdae8507a
16 changed files with 194 additions and 60 deletions

View File

@ -222,9 +222,9 @@ class ComponentGroup(object):
if self.cfg.source_by_id:
prj = self.cfg.source_to_id[prj]
if prj in sources:
sources[prj] += 1
sources[prj] += c.qty
else:
sources[prj] = 1
sources[prj] = c.qty
field = ''
for prj in sorted(sources.keys()):
n = sources[prj]

View File

@ -247,10 +247,12 @@ def create_color_ref(workbook, col_colors, hl_empty, fmt_cols, do_kicost, kicost
def adjust_widths(worksheet, column_widths, max_width, levels):
c_levels = len(levels)
for i, width in enumerate(column_widths):
if width > max_width:
width = max_width
worksheet.set_column(i, i, width, None, {'level': levels[i]})
if i < c_levels:
worksheet.set_column(i, i, width, None, {'level': levels[i]})
def adjust_heights(worksheet, rows, max_width, head_size):
@ -264,7 +266,7 @@ def adjust_heights(worksheet, rows, max_width, head_size):
worksheet.set_row(head_size+rn, 15.0*max_h)
def write_info(cfg, r_info_start, worksheet, column_widths, col1, fmt_info, fmt_subtitle):
def write_info(cfg, r_info_start, worksheet, column_widths, col1, fmt_info, fmt_subtitle, compact=False):
if len(cfg.aggregate) == 1:
# Only one project
rc = r_info_start
@ -300,8 +302,9 @@ def write_info(cfg, r_info_start, worksheet, column_widths, col1, fmt_info, fmt_
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Number of PCBs:", cfg.number)
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Total Components:", cfg.n_build)
# Individual stats
# No need to waste space for a column with no data
r_info_start += 3 if cfg.xlsx.hide_stats_info and compact else 5
for prj in cfg.aggregate:
r_info_start += 5
col1 = old_col1
worksheet.set_row(r_info_start, 24)
worksheet.merge_range(r_info_start, col1, r_info_start, len(column_widths)-1, prj.sch.title, fmt_subtitle)
@ -323,6 +326,7 @@ def write_info(cfg, r_info_start, worksheet, column_widths, col1, fmt_info, fmt_
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Fitted Components:", prj.comp_fitted)
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Number of PCBs:", prj.number)
rc = add_info(worksheet, column_widths, rc, col1, fmt_info, "Total Components:", prj.comp_build)
r_info_start += 5
def adapt_extra_cost_columns(cfg):
@ -402,6 +406,12 @@ def solve_distributors(cfg, silent=True):
return dist_list
def compute_qtys(cfg, g):
if len(cfg.aggregate) == 1:
return str(g.get_count())
return [str(g.get_count(sch.name)) for sch in cfg.aggregate]
def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_subtitle, cfg):
if not KICOST_SUPPORT:
logger.warning(W_NOKICOST, 'KiCost sheet requested but failed to load KiCost support')
@ -419,11 +429,11 @@ def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_s
# Start with a clean list of available distributors
init_distributor_dict()
# Create the projects information structure
prj_info = [{'title': p.name, 'company': p.sch.company, 'date': p.sch.date} for p in cfg.aggregate]
prj_info = [{'title': p.name, 'company': p.sch.company, 'date': p.sch.date, 'qty': p.number} for p in cfg.aggregate]
# Create the worksheets
ws_names = ['Costs', 'Costs (DNF)']
Spreadsheet.PRJ_INFO_ROWS = 5
Spreadsheet.PRJ_INFO_START = 1
Spreadsheet.PRJ_INFO_ROWS = 5 if len(cfg.aggregate) == 1 else 6
Spreadsheet.PRJ_INFO_START = 1 if len(cfg.aggregate) == 1 else 4
Spreadsheet.ADJUST_ROW_AND_COL_SIZE = True
Spreadsheet.MAX_COL_WIDTH = cfg.xlsx.max_col_width
Spreadsheet.PART_NSEQ_SEPRTR = cfg.ref_separator
@ -447,7 +457,7 @@ def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_s
Spreadsheet.WRK_FORMATS['header']['font_size'] = 11
# Avoid the use of the same color twice
Spreadsheet.WRK_FORMATS['order_too_much']['bg_color'] = '#FF4040'
Spreadsheet.WRK_FORMATS['order_min_qty']['bg_color'] = '#FFFF40'
Spreadsheet.WRK_FORMATS['order_min_qty']['bg_color'] = '#FF6060'
# Project quantity as the default quantity
Spreadsheet.DEFAULT_BUILD_QTY = cfg.number
# Add version information
@ -479,6 +489,7 @@ def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_s
part = PartGroup()
part.refs = [c.ref for c in g.components]
part.fields = g.fields
part.fields['manf#_qty'] = compute_qtys(cfg, g)
parts.append(part)
# Process any "join" request
apply_join_requests(cfg.join_ce, part.fields, g.fields)
@ -495,14 +506,14 @@ def create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_s
# Logo
col1 = insert_logo(wks, image_data)
if col1:
col1 += 2
col1 += 1
# PCB & Stats Info
if not (cfg.xlsx.hide_pcb_info and cfg.xlsx.hide_stats_info):
r_info_start = 1 if cfg.xlsx.title else 0
column_widths = [col1+2]*10
column_widths = [0]*5 # Column 1 to 5
old_stats = cfg.xlsx.hide_stats_info
cfg.xlsx.hide_stats_info = True
write_info(cfg, r_info_start, wks, column_widths, col1, fmt_info, fmt_subtitle)
write_info(cfg, r_info_start, wks, column_widths, col1, fmt_info, fmt_subtitle, compact=True)
cfg.xlsx.hide_stats_info = old_stats
ss.col_widths[col1] = column_widths[col1]
ss.col_widths[col1+1] = column_widths[col1+1]
@ -588,7 +599,7 @@ def write_xlsx(filename, groups, col_fields, head_names, cfg):
# Headings
# Create the head titles
column_widths = [0]*len(col_fields)
column_widths = [0]*max(len(col_fields), 6)
rows = [row_headings]
for i in range(len(row_headings)):
# Title for this column

View File

@ -344,10 +344,12 @@ class BoMOptions(BaseOptions):
self.exclude_filter = self.dnf_filter = self.dnc_filter = None
self.variant.config(self) # Fill or adjust any detail
def process_columns_config(self, cols, valid_columns):
def process_columns_config(self, cols, valid_columns, add_all=True):
column_rename = {}
join = []
if isinstance(cols, type):
if not add_all:
return ([], [], [], column_rename, join)
# If none specified make a list with all the possible columns.
# Here are some exceptions:
# Ignore the part and footprint library, also sheetpath and the Reference in singular
@ -467,7 +469,7 @@ class BoMOptions(BaseOptions):
(self.columns, self.column_levels, self.column_comments, self.column_rename,
self.join) = self.process_columns_config(self.columns, valid_columns)
(self.columns_ce, self.column_levels_ce, self.column_comments_ce, self.column_rename_ce,
self.join_ce) = self.process_columns_config(self.cost_extra_columns, valid_columns)
self.join_ce) = self.process_columns_config(self.cost_extra_columns, valid_columns, add_all=False)
def aggregate_comps(self, comps):
self.qtys = {GS.sch_basename: self.number}

@ -1 +1 @@
Subproject commit f78aebbd3370c1169c51d712998baba0ea73fbb2
Subproject commit 1671c43995571312c9bab13cac4cbea2210c0729

View File

@ -21,6 +21,7 @@ F 0 "R1" H 2570 1946 50 0000 L CNN
F 1 "1k" H 2570 1855 50 0000 L CNN
F 2 "" V 2430 1900 50 0001 C CNN
F 3 "~" H 2500 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 2500 1900
1 0 0 -1
$EndComp
@ -32,6 +33,7 @@ F 0 "R2" H 3070 1946 50 0000 L CNN
F 1 "1k" H 3070 1855 50 0000 L CNN
F 2 "" V 2930 1900 50 0001 C CNN
F 3 "~" H 3000 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 3000 1900
1 0 0 -1
$EndComp
@ -43,6 +45,7 @@ F 0 "R3" H 3570 1946 50 0000 L CNN
F 1 "1k" H 3570 1855 50 0000 L CNN
F 2 "" V 3430 1900 50 0001 C CNN
F 3 "~" H 3500 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 3500 1900
1 0 0 -1
$EndComp
@ -54,6 +57,7 @@ F 0 "C1" H 2615 2446 50 0000 L CNN
F 1 "1nF" H 2615 2355 50 0000 L CNN
F 2 "" H 2538 2250 50 0001 C CNN
F 3 "~" H 2500 2400 50 0001 C CNN
F 4 "GRM1555C1H102JA01D" H 2100 1700 50 0001 C CNN "manf#"
1 2500 2400
1 0 0 -1
$EndComp
@ -65,6 +69,7 @@ F 0 "C2" H 3115 2446 50 0000 L CNN
F 1 "10nF" H 3115 2355 50 0000 L CNN
F 2 "" H 3038 2250 50 0001 C CNN
F 3 "~" H 3000 2400 50 0001 C CNN
F 4 "GRM155R71E103KA01D" H 2100 1700 50 0001 C CNN "manf#"
1 3000 2400
1 0 0 -1
$EndComp

View File

@ -21,6 +21,7 @@ F 0 "R1" H 2570 1946 50 0000 L CNN
F 1 "10k" H 2570 1855 50 0000 L CNN
F 2 "" V 2430 1900 50 0001 C CNN
F 3 "~" H 2500 1900 50 0001 C CNN
F 4 "RC0805JR-0710KL" H 2100 1700 50 0001 C CNN "manf#"
1 2500 1900
1 0 0 -1
$EndComp
@ -32,6 +33,7 @@ F 0 "R2" H 3070 1946 50 0000 L CNN
F 1 "1000" H 3070 1855 50 0000 L CNN
F 2 "" V 2930 1900 50 0001 C CNN
F 3 "~" H 3000 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 3000 1900
1 0 0 -1
$EndComp
@ -43,6 +45,7 @@ F 0 "R3" H 3570 1946 50 0000 L CNN
F 1 "1000" H 3570 1855 50 0000 L CNN
F 2 "" V 3430 1900 50 0001 C CNN
F 3 "~" H 3500 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 3500 1900
1 0 0 -1
$EndComp
@ -54,6 +57,7 @@ F 0 "C1" H 2615 2446 50 0000 L CNN
F 1 "10nF" H 2615 2355 50 0000 L CNN
F 2 "" H 2538 2250 50 0001 C CNN
F 3 "~" H 2500 2400 50 0001 C CNN
F 4 "GRM155R71E103KA01D" H 2100 1700 50 0001 C CNN "manf#"
1 2500 2400
1 0 0 -1
$EndComp
@ -65,6 +69,7 @@ F 0 "C2" H 3115 2446 50 0000 L CNN
F 1 "1nF" H 3115 2355 50 0000 L CNN
F 2 "" H 3038 2250 50 0001 C CNN
F 3 "~" H 3000 2400 50 0001 C CNN
F 4 "GRM1555C1H102JA01D" H 2100 1700 50 0001 C CNN "manf#"
1 3000 2400
1 0 0 -1
$EndComp
@ -76,6 +81,7 @@ F 0 "R4" H 4070 1946 50 0000 L CNN
F 1 "1000" H 4070 1855 50 0000 L CNN
F 2 "" V 3930 1900 50 0001 C CNN
F 3 "~" H 4000 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 4000 1900
1 0 0 -1
$EndComp

View File

@ -21,6 +21,7 @@ F 0 "R1" H 2570 1946 50 0000 L CNN
F 1 "10k" H 2570 1855 50 0000 L CNN
F 2 "" V 2430 1900 50 0001 C CNN
F 3 "~" H 2500 1900 50 0001 C CNN
F 4 "RC0805JR-0710KL" H 2100 1700 50 0001 C CNN "manf#"
1 2500 1900
1 0 0 -1
$EndComp
@ -32,6 +33,7 @@ F 0 "R2" H 3070 1946 50 0000 L CNN
F 1 "10k" H 3070 1855 50 0000 L CNN
F 2 "" V 2930 1900 50 0001 C CNN
F 3 "~" H 3000 1900 50 0001 C CNN
F 4 "RC0805JR-0710KL" H 2100 1700 50 0001 C CNN "manf#"
1 3000 1900
1 0 0 -1
$EndComp
@ -43,6 +45,7 @@ F 0 "R3" H 3570 1946 50 0000 L CNN
F 1 "10k" H 3570 1855 50 0000 L CNN
F 2 "" V 3430 1900 50 0001 C CNN
F 3 "~" H 3500 1900 50 0001 C CNN
F 4 "RC0805JR-0710KL" H 2100 1700 50 0001 C CNN "manf#"
1 3500 1900
1 0 0 -1
$EndComp
@ -54,6 +57,7 @@ F 0 "R4" H 4070 1946 50 0000 L CNN
F 1 "10k" H 4070 1855 50 0000 L CNN
F 2 "" V 3930 1900 50 0001 C CNN
F 3 "~" H 4000 1900 50 0001 C CNN
F 4 "RC0805JR-0710KL" H 2100 1700 50 0001 C CNN "manf#"
1 4000 1900
1 0 0 -1
$EndComp
@ -65,6 +69,7 @@ F 0 "R5" H 4570 1946 50 0000 L CNN
F 1 "1k" H 4570 1855 50 0000 L CNN
F 2 "" V 4430 1900 50 0001 C CNN
F 3 "~" H 4500 1900 50 0001 C CNN
F 4 "RC0805JR-071KL" H 2100 1700 50 0001 C CNN "manf#"
1 4500 1900
1 0 0 -1
$EndComp

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,20 @@
,,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Schematic:,kibom-variant_2c,,,,Board Qty:,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Variant:,default,,,,Unit Cost:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Revision:,A,,,,Total Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,,Date:,2021-04-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Schematic:,kibom-variant_2c,,,,,Board Qty:,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Variant:,default,,,,,Unit Cost:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Revision:,A,,,,,Total Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,Date:,2021-04-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Global Part Info,,,,,,,,,,,Arrow,,,,,Digi-Key,,,,,Farnell,,,,,LCSC,,,,,Mouser,,,,,Newark,,,,,RS Components,,,,,TME,,,,,test,,,,
References,Value,Real value,Tolerancia,Voltage,Footprint,Manufacturer,Manufacturer P/N,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
R1 R2,1k,1000,1%,,,Bourns,CR0603-JW-102ELF,100,0,0,,,,,,51387,,0,0,CR0603-JW-102ELFCT-ND,55000,,0,0,2333561,,,,,,52251,,0,0,652CR0603JW102ELF,110000,,0,0,02J2284,,,,,,,,,,,,,,,
,Used currency rates:,,,,,,,,Total Purchase:,0,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,,0,,0,
,USD($)/GBP(£):,1.375941592305018,,,,,,,Purchase description:,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Used currency rates:,,,,,,,,Total Purchase:,0,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,,,,0,
,USD($)/GBP(£):,1.375941592305018,,,,,,,Purchase description:,,,,,,,,,,,,,,,,,,"Copy this header and order to a CSV
file and use it for JLCPCB
manufacturer PCB house.
The multipart components that use
""#"" symbol are not allowed by JLCPCB.",,,,,,,,,,,,,,,,,,,,,,,,,,,,
Created:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

1 KiBot Bill of Materials
2 Schematic: kibom-variant_2c kibom-variant_2c Board Qty: 50
3 Variant: default default Unit Cost: 0
4 Revision: A A Total Cost: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 Date: 2021-04-06 2021-04-06
6 KiCad Version:
7 Global Part Info Arrow Digi-Key Farnell LCSC Mouser Newark RS Components TME test
8 References Value Real value Voltage Tolerancia Tolerancia Voltage Footprint Manufacturer Manufacturer P/N Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
9 R1 R2 1k 1000 1% 1% Bourns CR0603-JW-102ELF 100 0 0 51387 0 0 CR0603-JW-102ELFCT-ND 55000 0 0 2333561 52251 0 0 652CR0603JW102ELF 110000 0 0 02J2284
10 Used currency rates: Total Purchase: 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 0 0
11 USD($)/GBP(£): 1.375941592305018 Purchase description: 0 0 0 0 Copy this header and order to a CSV file and use it for JLCPCB manufacturer PCB house. The multipart components that use "#" symbol are not allowed by JLCPCB. 0 0 0 0 0
12 Created: 0
13 Created: KiCost
14
15
16
17
18
19
20

View File

@ -1,14 +1,15 @@
,,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,
,,,,Schematic:,kibom-variant_2c,,,,Board Qty:,50,,,,,,,,,,
,,,,Variant:,default,,,,Unit Cost:,0,,,,,,,,,,
,,,,Revision:,A,,,,Total Cost:,0,,,,0,0,,,,0,0
,,,,Date:,2021-04-06,,,,,,,,,,,,,,,
,,,,KiCad Version:,,,,,,,,,,,,,,,,
,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,
,,,Schematic:,kibom-variant_2c,,,,,Board Qty:,50,,,,,,,,,,
,,,Variant:,default,,,,,Unit Cost:,0,,,,,,,,,,
,,,Revision:,A,,,,,Total Cost:,0,,,,0,0,,,,0,0
,,,Date:,2021-04-06,,,,,,,,,,,,,,,,
,,,KiCad Version:,,,,,,,,,,,,,,,,,
Global Part Info,,,,,,,,,,,Mouser,,,,,Digi-Key,,,,
References,Value,Real value,Tolerancia,Voltage,Footprint,Manufacturer,Manufacturer P/N,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
R1 R2,1k,1000,1%,,,Bourns,CR0603-JW-102ELF,100,0,0,110042,,0,0,652CR0603JW102ELF,38625,,0,0,CR0603-JW-102ELFCT-ND
,,,,,,,,,Total Purchase:,0,Buy here,0,,0,,Buy here,0,,0,
Created:,,,,,,,,,Purchase description:,,,0,,,,,0,,,
,,,,,,,,,Total Purchase:,0,Buy here,,,0,,Buy here,,,0,
Created:,,,,,,,,,Purchase description:,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,

1 KiBot Bill of Materials
2 Schematic: kibom-variant_2c kibom-variant_2c Board Qty: 50
3 Variant: default default Unit Cost: 0
4 Revision: A A Total Cost: 0 0 0 0 0
5 Date: 2021-04-06 2021-04-06
6 KiCad Version:
7 Global Part Info Mouser Digi-Key
8 References Value Real value Voltage Tolerancia Tolerancia Voltage Footprint Manufacturer Manufacturer P/N Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
9 R1 R2 1k 1000 1% 1% Bourns CR0603-JW-102ELF 100 0 0 110042 0 0 652CR0603JW102ELF 38625 0 0 CR0603-JW-102ELFCT-ND
10 Total Purchase: 0 Buy here 0 0 Buy here 0 0
11 Created: Purchase description: 0 0
12 KiCost
13
14
15

View File

@ -1,14 +1,15 @@
,,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,
,,,,Schematic:,kibom-variant_2c,,,,Board Qty:,50,,,,,,,,,,
,,,,Variant:,default,,,,Unit Cost:,0,,,,,,,,,,
,,,,Revision:,A,,,,Total Cost:,0,,,,0,0,,,,0,0
,,,,Date:,2021-04-06,,,,,,,,,,,,,,,
,,,,KiCad Version:,,,,,,,,,,,,,,,,
,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,
,,,Schematic:,kibom-variant_2c,,,,,Board Qty:,50,,,,,,,,,,
,,,Variant:,default,,,,,Unit Cost:,0,,,,,,,,,,
,,,Revision:,A,,,,,Total Cost:,0,,,,0,0,,,,0,0
,,,Date:,2021-04-06,,,,,,,,,,,,,,,,
,,,KiCad Version:,,,,,,,,,,,,,,,,,
Global Part Info,,,,,,,,,,,Mouser,,,,,Digi-Key,,,,
References,Value,Real value,Tolerancia,Voltage,Footprint,Manufacturer,Manufacturer P/N,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
C1 C2,1nF, 1000pF,20%,50 V 100 V,,Samsung,CL10B102KC8NNNC,100,0,0,NonStk,,0,0,187CL10B102KC8NNNC,NonStk,,0,0,1276-1131-1-ND
,,,,,,,,,Total Purchase:,0,Buy here,0,,0,,Buy here,0,,0,
Created:,,,,,,,,,Purchase description:,,,0,,,,,0,,,
,,,,,,,,,Total Purchase:,0,Buy here,,,0,,Buy here,,,0,
Created:,,,,,,,,,Purchase description:,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,

1 KiBot Bill of Materials
2 Schematic: kibom-variant_2c kibom-variant_2c Board Qty: 50
3 Variant: default default Unit Cost: 0
4 Revision: A A Total Cost: 0 0 0 0 0
5 Date: 2021-04-06 2021-04-06
6 KiCad Version:
7 Global Part Info Mouser Digi-Key
8 References Value Real value Voltage Tolerancia Tolerancia Voltage Footprint Manufacturer Manufacturer P/N Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
9 C1 C2 1nF 1000pF 50 V 100 V 20% 20% 50 V 100 V Samsung CL10B102KC8NNNC 100 0 0 NonStk 0 0 187CL10B102KC8NNNC NonStk 0 0 1276-1131-1-ND
10 Total Purchase: 0 Buy here 0 0 Buy here 0 0
11 Created: Purchase description: 0 0
12 KiCost
13
14
15

View File

@ -1,17 +1,21 @@
,,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Schematic:,kibom-variant_2c,,,,Board Qty:,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Variant:,default,,,,Unit Cost:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Revision:,A,,,,Total Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,,Date:,2021-04-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Schematic:,kibom-variant_2c,,,,,Board Qty:,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Variant:,default,,,,,Unit Cost:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Revision:,A,,,,,Total Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,Date:,2021-04-06,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Global Part Info,,,,,,,,,,,Arrow,,,,,Digi-Key,,,,,Farnell,,,,,LCSC,,,,,Mouser,,,,,Newark,,,,,RS Components,,,,,TME,,,,,test,,,,
References,Value,Real value,Tolerancia,Voltage,Footprint,Manufacturer,Manufacturer P/N,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
C1 C2,1nF, 1000pF,20%,50 V 100 V,,Samsung,CL10B102KC8NNNC,100,0,0,,,,,,NonStk,,0,0,1276-1131-1-ND,3860,,0,0,3013404,542250,,0,0,C153291,NonStk,,0,0,187CL10B102KC8NNNC,19600,,0,0,82AC9311,NonStk,,0,0,7665480,5789,,0,0,CL10B102KC8NNNC,,,,,
,Used currency rates:,,,,,,,,Total Purchase:,0,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,Buy here,0,,0,,,0,,0,
,USD($)/EUR(€):,1.1873,,,,,,,Purchase description:,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,USD($)/GBP(£):,1.375941592305018,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,Used currency rates:,,,,,,,,Total Purchase:,0,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,,,,0,
,USD($)/EUR(€):,1.1873,,,,,,,Purchase description:,,,,,,,,,,,,,,,,,,"Copy this header and order to a CSV
file and use it for JLCPCB
manufacturer PCB house.
The multipart components that use
""#"" symbol are not allowed by JLCPCB.",,,,,,,,,,,,,,,,,,,,,,,,,,,,
,USD($)/GBP(£):,1.375941592305018,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Created:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

1 KiBot Bill of Materials
2 Schematic: kibom-variant_2c kibom-variant_2c Board Qty: 50
3 Variant: default default Unit Cost: 0
4 Revision: A A Total Cost: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 Date: 2021-04-06 2021-04-06
6 KiCad Version:
7 Global Part Info Arrow Digi-Key Farnell LCSC Mouser Newark RS Components TME test
8 References Value Real value Voltage Tolerancia Tolerancia Voltage Footprint Manufacturer Manufacturer P/N Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
9 C1 C2 1nF 1000pF 50 V 100 V 20% 20% 50 V 100 V Samsung CL10B102KC8NNNC 100 0 0 NonStk 0 0 1276-1131-1-ND 3860 0 0 3013404 542250 0 0 C153291 NonStk 0 0 187CL10B102KC8NNNC 19600 0 0 82AC9311 NonStk 0 0 7665480 5789 0 0 CL10B102KC8NNNC
10 Used currency rates: Total Purchase: 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 Buy here 0 0 0 0
11 USD($)/EUR(€): 1.1873 Purchase description: 0 0 0 0 Copy this header and order to a CSV file and use it for JLCPCB manufacturer PCB house. The multipart components that use "#" symbol are not allowed by JLCPCB. 0 0 0 0 0
12 USD($)/GBP(£): 1.375941592305018 0
13 Created:
14 KiCost Created:
15 KiCost
16
17
18
19
20
21

View File

@ -0,0 +1,50 @@
,,,KiBot Bill of Materials,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Variant:,default,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,KiCad Version:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,merge_1,,,,,Board Qty0:,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Schematic:,merge_1,,,,Unit Cost0:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Revision:,,,,,Total Cost0:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,Date:,2021-05-11_13-08-20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Company:,Test company,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,ID:,prj0:,,,,,,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,merge_2,,,,,Board Qty1:,20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Schematic:,2nd project,,,,Unit Cost1:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Revision:,,,,,Total Cost1:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
,,,Date:,2021-05-11_13-10-07,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,ID:,prj1:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,merge_3,,,,,Board Qty2:,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Schematic:,merge_3,,,,Unit Cost2:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Revision:,,,,,Total Cost2:,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,Date:,2021-05-11_13-10-48,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,ID:,prj2:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,Total Prjs Cost:,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0,,,,0,0
Global Part Info,,,,,,,,,,Arrow,,,,,Digi-Key,,,,,Farnell,,,,,LCSC,,,,,Mouser,,,,,Newark,,,,,RS Components,,,,,TME,,,,
References,Value,Footprint,Manufacturer P/N,Qty.Prj0,Qty.Prj1,Qty.Prj2,Build Quantity,Unit$,Ext$,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#,Avail,Purch,Unit$,Ext$,Cat#
"prj0:C1
prj1:C2",1nF,,GRM1555C1H102JA01D,50,20,0,70,0,0,,,,,,3602377,,0,0,490-3244-1-ND,NonStk,,0,0,1118130,13600,,0,0,C76947,NonStk,,0,0,81GRM1555C1H102JA1D,NonStk,,0,0,38K1651,2000,,0,0,6242913,100700,,0,0,GRM1555C1H102JA01D
"prj1:C1
prj0:C2",10nF,,GRM155R71E103KA01D,50,20,0,70,0,0,,,,,,2329523,,0,0,490-1312-1-ND,10000,,0,0,1118150,133200,,0,0,C77013,42743,,0,0,81GRM36X103K25,10000,,0,0,37K6460,,,,,,124600,,0,0,GRM155R71E103KA01D
"prj0:R1-R3
prj1:R2-R4
prj2:R5",1k,,RC0805JR-071KL,150,60,30,240,0,0,,,,,,512,,0,0,311-1.0KARCT-ND,47623,,0,0,1799479,,,,,,192935,,0,0,603RC0805JR071KL,1498,,0,0,68R0253,2100,,0,0,1995761,17400,,0,0,RC0805JR071K
"prj1:R1
prj2:R1-R4",10k,,RC0805JR-0710KL,0,20,120,140,0,0,,,,,,5497493,,0,0,311-10KARCT-ND,22848,,0,0,2131807,,,,,,2294842,,0,0,603RC0805JR0710KL,10000,,0,0,80K7383,3800,,0,0,1995759,240800,,0,0,RC0805JR0710K
,Used currency rates:,,,,,,,Total Purchase:,0,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,,Buy here,,,0,
,USD($)/GBP(£):,1.375941592305018,,,,,,Purchase description:,,,,,,,,,,,,,,,,,,"Copy this header and order to a CSV
file and use it for JLCPCB
manufacturer PCB house.
The multipart components that use
""#"" symbol are not allowed by JLCPCB.",,,,,,,,,,,,,,,,,,,,,,,
Created:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
KiCost,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,,,,,,,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,,,,,,,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,,,0,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1 KiBot Bill of Materials
2 Variant: default
3 KiCad Version:
4 merge_1 Board Qty0: 50
5 Schematic: merge_1 Unit Cost0: 0
6 Revision: Total Cost0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 Date: 2021-05-11_13-08-20
8 Company: Test company
9 ID: prj0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10 merge_2 Board Qty1: 20
11 Schematic: 2nd project Unit Cost1: 0
12 Revision: Total Cost1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
13 Date: 2021-05-11_13-10-07
14 ID: prj1:
15 merge_3 Board Qty2: 30
16 Schematic: merge_3 Unit Cost2: 0
17 Revision: Total Cost2: 0
18 Date: 2021-05-11_13-10-48
19 ID: prj2:
20 Total Prjs Cost: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
21 Global Part Info Arrow Digi-Key Farnell LCSC Mouser Newark RS Components TME
22 References Value Footprint Manufacturer P/N Qty.Prj0 Qty.Prj1 Qty.Prj2 Build Quantity Unit$ Ext$ Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat# Avail Purch Unit$ Ext$ Cat#
23 prj0:C1 prj1:C2 1nF GRM1555C1H102JA01D 50 20 0 70 0 0 3602377 0 0 490-3244-1-ND NonStk 0 0 1118130 13600 0 0 C76947 NonStk 0 0 81GRM1555C1H102JA1D NonStk 0 0 38K1651 2000 0 0 6242913 100700 0 0 GRM1555C1H102JA01D
24 prj1:C1 prj0:C2 10nF GRM155R71E103KA01D 50 20 0 70 0 0 2329523 0 0 490-1312-1-ND 10000 0 0 1118150 133200 0 0 C77013 42743 0 0 81GRM36X103K25 10000 0 0 37K6460 124600 0 0 GRM155R71E103KA01D
25 prj0:R1-R3 prj1:R2-R4 prj2:R5 1k RC0805JR-071KL 150 60 30 240 0 0 512 0 0 311-1.0KARCT-ND 47623 0 0 1799479 192935 0 0 603RC0805JR071KL 1498 0 0 68R0253 2100 0 0 1995761 17400 0 0 RC0805JR071K
26 prj1:R1 prj2:R1-R4 10k RC0805JR-0710KL 0 20 120 140 0 0 5497493 0 0 311-10KARCT-ND 22848 0 0 2131807 2294842 0 0 603RC0805JR0710KL 10000 0 0 80K7383 3800 0 0 1995759 240800 0 0 RC0805JR0710K
27 Used currency rates: Total Purchase: 0 Buy here 0 Buy here 0 Buy here 0 Buy here 0 Buy here 0 Buy here 0 Buy here 0 Buy here 0
28 USD($)/GBP(£): 1.375941592305018 Purchase description: Copy this header and order to a CSV file and use it for JLCPCB manufacturer PCB house. The multipart components that use "#" symbol are not allowed by JLCPCB.
29 Created:
30 KiCost
31
32 0 0 0 0 0 0 0 0
33 0 0 0 0 0 0 0 0
34 0 0 0 0 0 0 0 0
35

View File

@ -92,3 +92,15 @@ def test_kicost_bom_sel_dist_1(test_dir):
convert2csv(ctx.get_out_path(output), sheet='Costs (DNF)')
ctx.compare_txt(csv, output[:-5]+'_dk_mou_dnf.csv')
ctx.clean_up()
def test_kicost_bom_merge_1(test_dir):
''' Internal BoM + KiCost, merging 3 projects. '''
prj = 'merge_1'
ctx = context.TestContextSCH(test_dir, 'test_kicost_bom_merge_1', prj, 'int_bom_kicost_merge_xlsx', OUT_DIR)
ctx.run(kicost=True) # , extra_debug=True
output = op.join(OUT_DIR, prj+'-bom.xlsx')
ctx.expect_out_file(output)
convert2csv(ctx.get_out_path(output), sheet='Costs')
csv = output[:-4]+'csv'
ctx.compare_txt(csv)

View File

@ -75,11 +75,11 @@ class S(BaseHTTPRequestHandler):
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length).decode('utf8')
self._set_headers()
if post_data in queries:
self.wfile.write(queries[post_data].encode("utf8"))
print("Known query "+comments[post_data])
data = unquote(post_data.replace('+', ' '))
if data in queries:
self.wfile.write(queries[data].encode("utf8"))
print("Known query "+comments[data])
else:
data = unquote(post_data.replace('+', ' '))
print('Unknown query, len={}\n{}\n{}'.format(content_length, post_data, data))
content = "<html><body><h1>POST!</h1><pre>{}</pre></body></html>".format(post_data)
self.wfile.write(content.encode("utf8"))
@ -101,7 +101,6 @@ def load_queries(file):
query = line
is_query = False
else:
# print(query)
# print(len(query))
queries[query] = line
comments[query] = '{} ({})'.format(last_comment, id)

View File

@ -0,0 +1,31 @@
# Example KiBot config file
kibot:
version: 1
outputs:
- name: 'bom_internal'
comment: "Bill of Materials in XLSX format"
type: bom
dir: KiCost
options:
use_alt: true
ref_id: 'prj0:'
number: 50
source_by_id: true
aggregate:
- file: tests/board_samples/kicad_5/merge_2.sch
name: 2nd project
ref_id: 'prj1:'
number: 20
- file: tests/board_samples/kicad_5/merge_3.sch
ref_id: 'prj2:'
number: 30
columns:
- References
- Part
- Value
- Quantity Per PCB
- field: manf#
name: Manufacturer P/N
xlsx:
kicost: true