Added support for new KiCost options `split_extra_fields` and `board_qty`.

Closes #120
This commit is contained in:
Diego Capusotto 2021-12-15 17:39:01 -03:00
parent 3eb82bc86d
commit 96a5f3da21
4 changed files with 23 additions and 0 deletions

View File

@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Now you can compress files relative to the current working directory.
So you can create a compressed file containing the source schematic and
PCB files. (#93)
- Support for new KiCost options `split_extra_fields` and `board_qty`. (#120)
### Changed
- Internal BoM: now components with different Tolerance, Voltage, Current

View File

@ -1319,6 +1319,7 @@ Next time you need this list just use an alias, like this:
- `aggregate`: [list(dict)] Add components from other projects.
* Valid keys:
- `file`: [string=''] Name of the XML to aggregate.
- `number`: [number=100] Number of boards to build (components multiplier).
- `variant`: [string=' '] Variant for this project.
- `currency`: [string|list(string)=USD] Currency priority. Use ISO4217 codes (i.e. USD, EUR).
- `distributors`: [string|list(string)] Include this distributors list. Default is all the available.
@ -1333,8 +1334,10 @@ Next time you need this list just use an alias, like this:
- `no_collapse`: [boolean=false] Do not collapse the part references (collapse=R1-R4).
- `no_distributors`: [string|list(string)] Exclude this distributors list. They are removed after computing `distributors`.
- `no_price`: [boolean=false] Do not look for components price. For testing purposes.
- `number`: [number=100] Number of boards to build (components multiplier).
- `output`: [string='%f-%i%v.%x'] Filename for the output (%i=kicost, %x=xlsx). Affected by global options.
- `show_cat_url`: [boolean=false] Include the catalogue links in the catalogue code.
- `split_extra_fields`: [string|list(string)] Declare part fields to include in multipart split process.
- `translate_fields`: [list(dict)] Fields to rename (KiCost option, not internal filters).
* Valid keys:
- `field`: [string=''] Name of the field to rename.

View File

@ -767,6 +767,8 @@ outputs:
aggregate:
# [string=''] Name of the XML to aggregate
- file: ''
# [number=100] Number of boards to build (components multiplier)
number: 100
# [string=' '] Variant for this project
variant: ' '
# [string|list(string)=USD] Currency priority. Use ISO4217 codes (i.e. USD, EUR)
@ -792,10 +794,14 @@ outputs:
no_distributors:
# [boolean=false] Do not look for components price. For testing purposes
no_price: false
# [number=100] Number of boards to build (components multiplier)
number: 100
# [string='%f-%i%v.%x'] Filename for the output (%i=kicost, %x=xlsx). Affected by global options
output: '%f-%i%v.%x'
# [boolean=false] Include the catalogue links in the catalogue code
show_cat_url: false
# [string|list(string)] Declare part fields to include in multipart split process
split_extra_fields:
# [list(dict)] Fields to rename (KiCost option, not internal filters)
translate_fields:
# [string=''] Name of the field to rename

View File

@ -27,6 +27,8 @@ class Aggregate(Optionable):
""" Name of the XML to aggregate """
self.variant = ' '
""" Variant for this project """
self.number = 100
""" Number of boards to build (components multiplier) """
def config(self, parent):
super().config(parent)
@ -54,6 +56,8 @@ class KiCostOptions(VariantOptions):
self.group_fields = Optionable
""" [string|list(string)] List of fields that can be different for a group.
Parts with differences in these fields are grouped together, but displayed individually """
self.split_extra_fields = Optionable
""" [string|list(string)] Declare part fields to include in multipart split process """
self.ignore_fields = Optionable
""" [string|list(string)] List of fields to be ignored """
self.fields = Optionable
@ -64,6 +68,8 @@ class KiCostOptions(VariantOptions):
""" Regular expression to match the variant field (KiCost option, not internal variants) """
self.aggregate = Aggregate
""" [list(dict)] Add components from other projects """
self.number = 100
""" Number of boards to build (components multiplier) """
super().__init__()
self.add_to_doc('variant', WARNING_MIX)
@ -95,6 +101,7 @@ class KiCostOptions(VariantOptions):
self.no_distributors = self._validate_dis(self.no_distributors)
self.currency = self._validate_cur(self.currency)
self.group_fields = Optionable.force_list(self.group_fields)
self.split_extra_fields = Optionable.force_list(self.split_extra_fields)
self.ignore_fields = Optionable.force_list(self.ignore_fields)
self.fields = Optionable.force_list(self.fields)
# Adapt translate_fields to its use
@ -149,10 +156,15 @@ class KiCostOptions(VariantOptions):
cmd.append(self.kicost_variant if self.kicost_variant else ' ')
for p in self.aggregate:
cmd.append(p.variant if p.variant else ' ')
cmd.extend(['--board_qty', str(self.number)])
for p in self.aggregate:
cmd.append(str(p.number))
else:
# Just this project
if self.kicost_variant:
cmd.extend(['--variant', self.kicost_variant])
if self.number != 100:
cmd.extend(['--board_qty', str(self.number)])
# Pass the debug level
if GS.debug_enabled:
cmd.append('--debug={}'.format(GS.debug_level))
@ -165,6 +177,7 @@ class KiCostOptions(VariantOptions):
self.add_list_opt(cmd, 'exclude', self.no_distributors)
self.add_list_opt(cmd, 'currency', self.currency)
self.add_list_opt(cmd, 'group_fields', self.group_fields)
self.add_list_opt(cmd, 'split_extra_fields', self.split_extra_fields)
self.add_list_opt(cmd, 'ignore_fields', self.ignore_fields)
self.add_list_opt(cmd, 'fields', self.fields)
# Field translation