Internal BoM: the field used for variants doesn't produce conflicts.
- Fixes: #100
This commit is contained in:
parent
5620113b49
commit
ca5dfb428b
|
|
@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
These fields are now part of the default `group_fields`. (#79)
|
||||
- JLCPCB example, to match current recommendations
|
||||
(g200kg/kicad-gerberzipper#11)
|
||||
- Internal BoM: the field used for variants doesn't produce conflicts. (#100)
|
||||
|
||||
### Fixed
|
||||
- Position files now defaults to use the auxiliar origin as KiCad.
|
||||
|
|
|
|||
|
|
@ -720,7 +720,7 @@ Next time you need this list just use an alias, like this:
|
|||
- `merge_both_blank`: [boolean=true] When creating groups two components with empty/missing field will be interpreted as with the same value.
|
||||
- `no_conflict`: [list(string)] List of fields where we tolerate conflicts.
|
||||
Use it to avoid undesired warnings.
|
||||
By default the field indicated in `fit_field` and the field `part` are excluded.
|
||||
By default the field indicated in `fit_field`, the field used for variants and the field `part` are excluded.
|
||||
- `no_distributors`: [string|list(string)] Exclude this distributors list. They are removed after computing `distributors`.
|
||||
- `normalize_locale`: [boolean=false] When normalizing values use the locale decimal point.
|
||||
- `normalize_values`: [boolean=false] Try to normalize the R, L and C values, producing uniform units and prefixes.
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ outputs:
|
|||
merge_both_blank: true
|
||||
# [list(string)] List of fields where we tolerate conflicts.
|
||||
# Use it to avoid undesired warnings.
|
||||
# By default the field indicated in `fit_field` and the field `part` are excluded
|
||||
# By default the field indicated in `fit_field`, the field used for variants and the field `part` are excluded
|
||||
no_conflict: ['Config', 'Part']
|
||||
# [string|list(string)] Exclude this distributors list. They are removed after computing `distributors`
|
||||
no_distributors:
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ class BoMOptions(BaseOptions):
|
|||
self.no_conflict = NoConflict
|
||||
""" [list(string)] List of fields where we tolerate conflicts.
|
||||
Use it to avoid undesired warnings.
|
||||
By default the field indicated in `fit_field` and the field `part` are excluded """
|
||||
By default the field indicated in `fit_field`, the field used for variants and the field `part` are excluded """
|
||||
self.aggregate = Aggregate
|
||||
""" [list(dict)] Add components from other projects """
|
||||
self.ref_id = ''
|
||||
|
|
@ -459,6 +459,9 @@ class BoMOptions(BaseOptions):
|
|||
if isinstance(self.no_conflict, type):
|
||||
no_conflict.add(self.fit_field)
|
||||
no_conflict.add('part')
|
||||
var_field = self.variant.get_variant_field()
|
||||
if var_field is not None:
|
||||
no_conflict.add(var_field)
|
||||
else:
|
||||
for field in self.no_conflict:
|
||||
no_conflict.add(field.lower())
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ class BaseVariant(RegVariant):
|
|||
""" [string|list(string)=''] Name of the filter to mark components as 'Do Not Change'.
|
||||
Use '_kibom_dnc' for the default KiBoM behavior """
|
||||
|
||||
def get_variant_field(self):
|
||||
''' Returns the name of the field used to determine if the component belongs to teh variant '''
|
||||
return None
|
||||
|
||||
def filter(self, comps):
|
||||
# Apply all the filters
|
||||
comps = apply_pre_transform(comps, self.pre_transform)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ class IBoM(BaseVariant): # noqa: F821
|
|||
self.variants_whitelist = Optionable
|
||||
""" [string|list(string)=''] List of board variants to include in the BOM """
|
||||
|
||||
def get_variant_field(self):
|
||||
''' Returns the name of the field used to determine if the component belongs to teh variant '''
|
||||
return self.variant_field
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
self.pre_transform = BaseFilter.solve_filter(self.pre_transform, 'pre_transform', is_transform=True)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ class KiBoM(BaseVariant): # noqa: F821
|
|||
self.variant = Optionable
|
||||
""" [string|list(string)=''] Board variant(s) """
|
||||
|
||||
def get_variant_field(self):
|
||||
''' Returns the name of the field used to determine if the component belongs to teh variant '''
|
||||
return self.config_field
|
||||
|
||||
def set_def_filters(self, exclude_filter, dnf_filter, dnc_filter):
|
||||
""" Filters delegated to the variant """
|
||||
self._def_exclude_filter = exclude_filter
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ class KiCost(BaseVariant): # noqa: F821
|
|||
""" Valid separators for variants in the variant field.
|
||||
Each character is a valid separator """
|
||||
|
||||
def get_variant_field(self):
|
||||
''' Returns the name of the field used to determine if the component belongs to teh variant '''
|
||||
return self.variant_field
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
self.pre_transform = BaseFilter.solve_filter(self.pre_transform, 'pre_transform',
|
||||
|
|
|
|||
Loading…
Reference in New Issue