This commit is contained in:
Andrei 2021-03-21 19:56:56 +02:00
parent 8dc935c2d4
commit 9f17be1d71
2 changed files with 22 additions and 0 deletions

View File

@ -30,6 +30,8 @@ else: # modules
fixRotationsPath = "bin/jlc_kicad_tools/cpl_rotations_db.csv"
fixFootprintsPath = "kicad/footprints.csv"
pat_module = re.compile(r'^[Mm]odule-([\w]+)-([\w\.]+)')
#################################################
@ -77,6 +79,14 @@ shutil.copyfile(src_name + ".pdf", dst_name + "-schematic.pdf")
# copy the VRML 3D components
shutil.copyfile(src_name + ".wrl", dst_name + "-vrml.wrl")
footprint_LUT = dict()
print ("Reading footprint replacement table...")
with open(fixFootprintsPath, 'rb') as f_f:
reader = csv.reader(f_f, delimiter=',')
for row in reader:
footprint_LUT[row[0]] = row[1]
bom = dict()
print ("Copying BOM...")
@ -90,6 +100,8 @@ with open(src_name + ".csv", 'rb') as src_f, open(dst_name + "-BOM.csv", 'w') as
des = row[1]
footprint = row[2]
lcsc = row[3]
if footprint in footprint_LUT:
footprint = footprint_LUT[footprint]
bom[des] = footprint
print ("* " + des)
mod = pat_module.match(comment)

10
kicad/footprints.csv Normal file
View File

@ -0,0 +1,10 @@
"Resistor_SMD:R_0402_1005Metric","R0402"
"Resistor_SMD:R_0603_1608Metric","R0603"
"Capacitor_SMD:C_0402_1005Metric","C0402"
"Capacitor_SMD:C_0603_1608Metric","C0603"
"LED_SMD:LED_0603_1608Metric","LED-0603"
"Package_TO_SOT_SMD:TO-252-2","DPAK"
"Package_SO:TSSOP-14_4.4x5mm_P0.65mm","TSSOP14"
"Package_TO_SOT_SMD:TSOT-23-5","TSOT23-5"
"Package_QFP:LQFP-32_7x7mm_P0.8mm","LQFP32"
"Package_TO_SOT_SMD:SOT-23","SOT-23"
1 Resistor_SMD:R_0402_1005Metric R0402
2 Resistor_SMD:R_0603_1608Metric R0603
3 Capacitor_SMD:C_0402_1005Metric C0402
4 Capacitor_SMD:C_0603_1608Metric C0603
5 LED_SMD:LED_0603_1608Metric LED-0603
6 Package_TO_SOT_SMD:TO-252-2 DPAK
7 Package_SO:TSSOP-14_4.4x5mm_P0.65mm TSSOP14
8 Package_TO_SOT_SMD:TSOT-23-5 TSOT23-5
9 Package_QFP:LQFP-32_7x7mm_P0.8mm LQFP32
10 Package_TO_SOT_SMD:SOT-23 SOT-23