[PCB Variant] Options for title and conditional project copy
This commit is contained in:
parent
4dc93da42b
commit
2111eaf6d2
|
|
@ -2283,9 +2283,12 @@ Notes:
|
|||
- **`options`**: [dict] Options for the `pcb_variant` output.
|
||||
* Valid keys:
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=variant, %x=kicad_pcb). Affected by global options.
|
||||
- `copy_project`: [boolean=true] Copy the KiCad project to the destination directory.
|
||||
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||
A short-cut to use for simple cases where a variant is an overkill.
|
||||
- `hide_excluded`: [boolean=false] Hide components in the Fab layer that are marked as excluded by a variant.
|
||||
- `title`: [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
|
||||
If it starts with `+` the text is concatenated.
|
||||
- `variant`: [string=''] Board variant to apply.
|
||||
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
|
||||
Categories looks like file system paths, i.e. PCB/fabrication/gerber.
|
||||
|
|
|
|||
|
|
@ -1202,6 +1202,8 @@ outputs:
|
|||
type: 'pcb_variant'
|
||||
dir: 'Example/pcb_variant_dir'
|
||||
options:
|
||||
# [boolean=true] Copy the KiCad project to the destination directory
|
||||
copy_project: true
|
||||
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||
# A short-cut to use for simple cases where a variant is an overkill
|
||||
dnf_filter: '_none'
|
||||
|
|
@ -1209,6 +1211,9 @@ outputs:
|
|||
hide_excluded: false
|
||||
# [string='%f-%i%I%v.%x'] Filename for the output (%i=variant, %x=kicad_pcb). Affected by global options
|
||||
output: '%f-%i%I%v.%x'
|
||||
# [string=''] Text used to replace the sheet title. %VALUE expansions are allowed.
|
||||
# If it starts with `+` the text is concatenated
|
||||
title: ''
|
||||
# [string=''] Board variant to apply
|
||||
variant: ''
|
||||
# PcbDraw - Beautiful 2D PCB render:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ class PCB_Variant_Options(VariantOptions):
|
|||
""" Hide components in the Fab layer that are marked as excluded by a variant """
|
||||
self.output = GS.def_global_output
|
||||
""" *Filename for the output (%i=variant, %x=kicad_pcb) """
|
||||
self.copy_project = True
|
||||
""" Copy the KiCad project to the destination directory """
|
||||
self.title = ''
|
||||
""" Text used to replace the sheet title. %VALUE expansions are allowed.
|
||||
If it starts with `+` the text is concatenated """
|
||||
super().__init__()
|
||||
self._expand_id = 'variant'
|
||||
self._expand_ext = 'kicad_pcb'
|
||||
|
|
@ -27,11 +32,14 @@ class PCB_Variant_Options(VariantOptions):
|
|||
|
||||
def run(self, output):
|
||||
super().run(output)
|
||||
self.set_title(self.title)
|
||||
self.filter_pcb_components(GS.board, do_3D=True)
|
||||
logger.debug('Saving PCB to '+output)
|
||||
GS.board.Save(output)
|
||||
GS.copy_project(output)
|
||||
if self.copy_project:
|
||||
GS.copy_project(output)
|
||||
self.unfilter_pcb_components(GS.board, do_3D=True)
|
||||
self.restore_title()
|
||||
|
||||
|
||||
@output_class
|
||||
|
|
|
|||
|
|
@ -14,5 +14,4 @@ outputs:
|
|||
type: pcb_variant
|
||||
options:
|
||||
variant: default
|
||||
scaling: 0
|
||||
title: 'Hello %V'
|
||||
|
|
|
|||
Loading…
Reference in New Issue