From 702e7e6ee9f5b16d10caa52b40695f1cd9afeb0a Mon Sep 17 00:00:00 2001 From: Benny Megidish Date: Sat, 20 Apr 2024 21:26:14 +0300 Subject: [PATCH] feat: amended exclude DNP from BOM only option #159 #148 --- plugins/plugin.py | 2 +- plugins/process.py | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/plugins/plugin.py b/plugins/plugin.py index ec85c09..3389d70 100644 --- a/plugins/plugin.py +++ b/plugins/plugin.py @@ -40,7 +40,7 @@ class KiCadToJLCForm(wx.Frame): self.mAutomaticTranslation.SetValue(userOptions[AUTO_TRANSLATE_OPT]) self.mAutomaticFill = wx.CheckBox(self, label='Apply automatic fill for all zones') self.mAutomaticFill.SetValue(userOptions[AUTO_FILL_OPT]) - self.mExcludeDnpCheckbox = wx.CheckBox(self, label='Exclude DNP components') + self.mExcludeDnpCheckbox = wx.CheckBox(self, label='Exclude DNP components from BOM') self.mExcludeDnpCheckbox.SetValue(userOptions[EXCLUDE_DNP_OPT]) layers = get_layer_names(pcbnew.GetBoard()) diff --git a/plugins/process.py b/plugins/process.py index ba47098..e222a4d 100644 --- a/plugins/process.py +++ b/plugins/process.py @@ -159,15 +159,13 @@ class ProcessManager: # 2: 'unspecified' # }.get(footprint.GetAttributes()) - skip_footprint = ((footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES) - or footprint.GetPadCount() == 0 - or exclude_dnp - and (footprint_has_field(footprint, 'dnp') - or (footprint.GetValue().upper() == 'DNP') - or getattr(footprint, 'IsDNP', bool)) - ) + is_dnp = (footprint_has_field(footprint, 'dnp') + or (footprint.GetValue().upper() == 'DNP') + or getattr(footprint, 'IsDNP', bool)) + skip_dnp = exclude_dnp and is_dnp + skip_footprint = footprint.GetPadCount() == 0 - if not skip_footprint: + if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES) and not skip_footprint and not is_dnp: # append unique ID if duplicate footprint designator unique_id = "" if footprint_designators[footprint.GetReference()] > 1: @@ -209,7 +207,7 @@ class ProcessManager: 'Layer': layer, }) - if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_BOM) and not skip_footprint: + if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_BOM) and not skip_footprint and not skip_dnp: # append unique ID if we are dealing with duplicate bom designator unique_id = "" if bom_designators[footprint.GetReference()] > 1: