From d379c67790b54eaf982659b8b98b494b1280f057 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sat, 29 Oct 2022 15:51:33 -0300 Subject: [PATCH] [Filters][generic] added options to filter by PCB side --- CHANGELOG.md | 1 + kibot/fil_generic.py | 14 +++++++++++--- setup.cfg | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 003cdd1b..16063d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - New output: - `populate` to create step-by-step assembly instructions +- generic filters: options to filter by PCB side - Diff: - Option to compare only the first schematic page. (See #319) - PcbDraw: diff --git a/kibot/fil_generic.py b/kibot/fil_generic.py index 053aa13b..c7f15071 100644 --- a/kibot/fil_generic.py +++ b/kibot/fil_generic.py @@ -67,11 +67,15 @@ class Generic(BaseFilter): # noqa: F821 self.exclude_all_hash_ref = False """ Exclude all components with a reference starting with # """ self.exclude_virtual = False - """ KiCad 5: exclude components marked as virtual in the PCB """ + """ Exclude components marked as virtual in the PCB """ self.exclude_smd = False - """ KiCad 5: exclude components marked as smd in the PCB """ + """ Exclude components marked as smd in the PCB """ self.exclude_tht = False - """ KiCad 5: exclude components marked as through-hole in the PCB """ + """ Exclude components marked as through-hole in the PCB """ + self.exclude_top = False + """ Exclude components on the top side of the PCB """ + self.exclude_bottom = False + """ Exclude components on the bottom side of the PCB """ self.add_to_doc('keys', 'Use `dnf_list` for '+str(sorted(DNF))) self.add_to_doc('keys', 'Use `dnc_list` for '+str(sorted(DNC))) @@ -180,6 +184,10 @@ class Generic(BaseFilter): # noqa: F821 return exclude if self.exclude_tht and comp.tht: return exclude + if self.exclude_top and not comp.bottom: + return exclude + if self.exclude_bottom and comp.bottom: + return exclude # List of references to be excluded if self.exclude_refs and (comp.ref in self.exclude_refs or comp.ref_prefix+'*' in self.exclude_refs): return exclude diff --git a/setup.cfg b/setup.cfg index 57d89fb5..3c811501 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,7 @@ ignore = E402, E226, E126, W504 # docstrings - text style (imperative, dot) D4 max-line-length = 127 -max-complexity = 21 +max-complexity = 22 exclude = experiments/kicad/v6/ experiments/JLC/ kibot/mcpyrate/