From 969b3843de7bbd48689f4025add04b3afeee81ba Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 18 Oct 2021 16:42:58 -0300 Subject: [PATCH] Changed the mechanism to avoid merging components with empty fields --- CHANGELOG.md | 4 ++-- kibot/bom/bom.py | 2 +- kibot/out_bom.py | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e84d035..1c4da111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - skip_bottom: bottom components aren't rotated. - XLSX BoM: option to control the logo scale (#84) - Import mechanism for filters and variants (#88) +- Internal BoM: option to avoid merging components with empty fields. + Is named `merge_both_blank` and defaults to true. ### Changed - Internal BoM: now components with different Tolerance, Voltage, Current @@ -23,8 +25,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Can be disabled to use absolute coordinates. (#87) - Board View: flipped output. (#89) - Board View: problems with netnames using spaces. (#90) -- Internal BoM: When `merge_blank_fields` is disabled and we compare two empty - fields now we avoid a match. So we don't group undefined components. ## [0.11.0] - 2021-04-25 diff --git a/kibot/bom/bom.py b/kibot/bom/bom.py index 7f8792ec..b058f76b 100644 --- a/kibot/bom/bom.py +++ b/kibot/bom/bom.py @@ -70,7 +70,7 @@ def compare_field(c1, c2, field, cfg): # If blank comparisons are allowed if (c1_value == "" or c2_value == "") and cfg.merge_blank_fields: return True - if not cfg.merge_blank_fields and c1_value == "" and c2_value == "": + if not cfg.merge_both_blank and c1_value == "" and c2_value == "": # Avoid merging two components with empty field return False return c1_value == c2_value diff --git a/kibot/out_bom.py b/kibot/out_bom.py index 32203eb3..119b95c2 100644 --- a/kibot/out_bom.py +++ b/kibot/out_bom.py @@ -270,6 +270,8 @@ class BoMOptions(BaseOptions): """ Connectors with the same footprints will be grouped together, independent of the name of the connector """ self.merge_blank_fields = True """ Component groups with blank fields will be merged into the most compatible group, where possible """ + self.merge_both_blank = True + """ When creating groups two components with empty/missing field will be interpreted as with the same value """ self.group_fields = GroupFields """ [list(string)] List of fields used for sorting individual components into groups. Components which match (comparing *all* fields) will be grouped together.