From b98c02c7434202607a65531fe84e97dc3f73e477 Mon Sep 17 00:00:00 2001 From: Randall Scharpf <43557842+Randall-Scharpf@users.noreply.github.com> Date: Thu, 20 Mar 2025 02:53:00 -0700 Subject: [PATCH] feat: add common abbreviations for part number (pn, p/n, part no.) (#201) --- README.md | 4 ++-- plugins/process.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3763425..033f608 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ Add an 'LCSC Part #'* field with the LCSC component part number to the symbol's #### 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._ diff --git a/plugins/process.py b/plugins/process.py index 91dfb7d..ff97dc6 100644 --- a/plugins/process.py +++ b/plugins/process.py @@ -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'):