Added number, variant, conf and separator KiBoM options.
This commit is contained in:
parent
b48998bb86
commit
ee11ecf8e7
|
|
@ -29,6 +29,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- pen_number
|
||||
- pen_speed
|
||||
- Added metric_units to DXF options
|
||||
- Added KiBoM options
|
||||
- number
|
||||
- variant
|
||||
- conf
|
||||
- separator
|
||||
- Added the following InteractiveHtmlBom options:
|
||||
- dark_mode
|
||||
- hide_pads
|
||||
|
|
|
|||
|
|
@ -335,7 +335,14 @@ Most options are the same you'll find in the KiCad dialogs.
|
|||
For more information: https://github.com/INTI-CMNB/KiBoM
|
||||
This output is what you get from the 'Tools/Generate Bill of Materials' menu in eeschema.
|
||||
* Options:
|
||||
- `conf`: [string='bom.ini'] BoM configuration file, relative to PCB.
|
||||
- `format`: [string='HTML'] [HTML,CSV] format for the BoM.
|
||||
- `number`: [number=1] Number of boards to build (components multiplier).
|
||||
- `separator`: [string=','] CSV Separator.
|
||||
- `variant`: [string=''] Board variant(s), used to determine which components
|
||||
are output to the BoM. To specify multiple variants,
|
||||
with a BOM file exported for each variant, separate
|
||||
variants with the ';' (semicolon) character.
|
||||
|
||||
* PDF (Portable Document Format)
|
||||
* Type: `pdf`
|
||||
|
|
|
|||
|
|
@ -422,8 +422,19 @@ outputs:
|
|||
type: 'kibom'
|
||||
dir: 'Example/kibom_dir'
|
||||
options:
|
||||
# [string='bom.ini'] BoM configuration file, relative to PCB
|
||||
conf: 'bom.ini'
|
||||
# [string='HTML'] [HTML,CSV] format for the BoM
|
||||
format: 'HTML'
|
||||
# [number=1] Number of boards to build (components multiplier)
|
||||
number: 1
|
||||
# [string=','] CSV Separator
|
||||
separator: ','
|
||||
# [string=''] Board variant(s), used to determine which components
|
||||
# are output to the BoM. To specify multiple variants,
|
||||
# with a BOM file exported for each variant, separate
|
||||
# variants with the ';' (semicolon) character
|
||||
variant: ''
|
||||
|
||||
# PDF (Portable Document Format):
|
||||
# Note that this output isn't the best for documating your project.
|
||||
|
|
|
|||
|
|
@ -21,15 +21,35 @@ class KiBoM(BaseOutput): # noqa: F821
|
|||
self._sch_related = True
|
||||
# Options
|
||||
with document:
|
||||
self.number = 1
|
||||
""" Number of boards to build (components multiplier) """
|
||||
self.variant = ''
|
||||
""" Board variant(s), used to determine which components
|
||||
are output to the BoM. To specify multiple variants,
|
||||
with a BOM file exported for each variant, separate
|
||||
variants with the ';' (semicolon) character """
|
||||
self.conf = 'bom.ini'
|
||||
""" BoM configuration file, relative to PCB """
|
||||
self.separator = ','
|
||||
""" CSV Separator """
|
||||
self.format = 'HTML'
|
||||
""" [HTML,CSV] format for the BoM """ # pragma: no cover
|
||||
|
||||
def run(self, output_dir, board):
|
||||
check_script(CMD_KIBOM, URL_KIBOM)
|
||||
format = self.format.lower()
|
||||
prj = os.path.splitext(os.path.relpath(GS.pcb_file))[0]
|
||||
logger.debug('Doing BoM, format '+format+' prj: '+prj)
|
||||
cmd = [CMD_KIBOM, prj+'.xml', os.path.join(output_dir, os.path.basename(prj))+'.'+format]
|
||||
prj = os.path.splitext(os.path.abspath(GS.pcb_file))[0]
|
||||
config = os.path.join(os.path.dirname(os.path.abspath(GS.pcb_file)), self.conf)
|
||||
logger.debug('Doing BoM, format {} prj: {} config: {}'.format(format, prj, config))
|
||||
cmd = [CMD_KIBOM,
|
||||
'-n', str(self.number),
|
||||
'--cfg', config,
|
||||
'-s', self.separator]
|
||||
if GS.debug_enabled:
|
||||
cmd.append('-v')
|
||||
if self.variant:
|
||||
cmd.extend(['-r', self.variant])
|
||||
cmd.extend([prj+'.xml', os.path.join(output_dir, os.path.basename(prj))+'.'+format])
|
||||
logger.debug('Running: '+str(cmd))
|
||||
try:
|
||||
cmd_output = check_output(cmd, stderr=STDOUT)
|
||||
|
|
|
|||
Loading…
Reference in New Issue