Changed the mechanism to avoid merging components with empty fields

This commit is contained in:
Salvador E. Tropea 2021-10-18 16:42:58 -03:00
parent bcd1e624e9
commit 3eebc04e4b
3 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- PDF PCB Print: option `hide_excluded` to hide components marked by the - PDF PCB Print: option `hide_excluded` to hide components marked by the
`exclude_filter`. `exclude_filter`.
https://forum.kicad.info/t/fab-drawing-for-only-through-hole-parts/ https://forum.kicad.info/t/fab-drawing-for-only-through-hole-parts/
- Internal BoM: option to avoid merging components with empty fields.
Is named `merge_both_blank` and defaults to true.
### Changed ### Changed
- Internal BoM: now components with different Tolerance, Voltage, Current - Internal BoM: now components with different Tolerance, Voltage, Current
@ -26,8 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Can be disabled to use absolute coordinates. (#87) Can be disabled to use absolute coordinates. (#87)
- Board View: flipped output. (#89) - Board View: flipped output. (#89)
- Board View: problems with netnames using spaces. (#90) - 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 ## [0.11.0] - 2021-04-25

View File

@ -70,7 +70,7 @@ def compare_field(c1, c2, field, cfg):
# If blank comparisons are allowed # If blank comparisons are allowed
if (c1_value == "" or c2_value == "") and cfg.merge_blank_fields: if (c1_value == "" or c2_value == "") and cfg.merge_blank_fields:
return True 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 # Avoid merging two components with empty field
return False return False
return c1_value == c2_value return c1_value == c2_value

View File

@ -270,6 +270,8 @@ class BoMOptions(BaseOptions):
""" Connectors with the same footprints will be grouped together, independent of the name of the connector """ """ Connectors with the same footprints will be grouped together, independent of the name of the connector """
self.merge_blank_fields = True self.merge_blank_fields = True
""" Component groups with blank fields will be merged into the most compatible group, where possible """ """ 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 self.group_fields = GroupFields
""" [list(string)] List of fields used for sorting individual components into groups. """ [list(string)] List of fields used for sorting individual components into groups.
Components which match (comparing *all* fields) will be grouped together. Components which match (comparing *all* fields) will be grouped together.