feat: add common abbreviations for part number (pn, p/n, part no.) (#201)

This commit is contained in:
Randall Scharpf
2025-03-20 02:53:00 -07:00
committed by GitHub
parent 89d587b1cd
commit b98c02c743
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -52,8 +52,8 @@ Add an 'LCSC Part #'* field with the LCSC component part number to the symbol's
<img src="https://github.com/bennymeg/JLC-Plugin-for-KiCad/blob/master/assets/mpn.png?raw=true" height=420>
#### Primary Fields*:
| 'LCSC Part #' | 'LCSC Part' | 'JLCPCB Part #' | 'JLCPCB Part' |
| --- | --- | --- | --- |
| 'LCSC Part #' | 'LCSC Part' | 'LCSC PN' | 'LCSC P/N' | 'LCSC Part No.' | 'JLCPCB Part #' | 'JLCPCB Part' | 'JLCPCB PN' | 'JLCPCB P/N' | 'JLCPCB Part No.' |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
_The fields will be query in the order denoted above._
+3 -1
View File
@@ -406,7 +406,9 @@ class ProcessManager:
def _get_mpn_from_footprint(self, footprint) -> str:
''''Get the MPN/LCSC stock code from standard symbol fields.'''
keys = ['LCSC Part #', 'LCSC Part', 'JLCPCB Part #', 'JLCPCB Part']
supplier_names = ['LCSC', 'JLCPCB']
pn_abbrevs = ['Part #', 'Part', 'PN', 'P/N', 'Part No.']
keys = [(sn + " " + abr) for sn in supplier_names for abr in pn_abbrevs]
fallback_keys = ['LCSC', 'JLC', 'MPN', 'Mpn', 'mpn']
if footprint_has_field(footprint, 'dnp'):