diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d91e60..f1d109d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,10 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - skip_bottom: bottom components aren't rotated. - XLSX BoM: option to control the logo scale (#84) - Import mechanism for filters, variants and globals (#88) -- PDF PCB Print: option `hide_excluded` to hide components marked by the - `exclude_filter`. - https://forum.kicad.info/t/fab-drawing-for-only-through-hole-parts/ -- PCB PDF Print: mechanism to change the block title. (#102) +- PDF/SVG PCB Print: + - option `hide_excluded` to hide components marked by the `exclude_filter`. + https://forum.kicad.info/t/fab-drawing-for-only-through-hole-parts/ + - mechanism to change the block title. (#102) + - KiCad 6 color theme selection. - Internal BoM: - option to avoid merging components with empty fields. Is named `merge_both_blank` and defaults to true. diff --git a/README.md b/README.md index 51286548..67f1176e 100644 --- a/README.md +++ b/README.md @@ -1647,6 +1647,9 @@ Next time you need this list just use an alias, like this: - `name`: [string=''] Used to identify this particular output definition. - `options`: [dict] Options for the `pdf_pcb_print` output. * Valid keys: + - `color_theme`: [string='_builtin_classic'] Selects the color theme. Onlyu applies to KiCad 6. + To use the KiCad 6 default colors select `_builtin_default`. + Usually user colors are stored as `user`, but you can give it another name. - `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. - `drill_marks`: [string='full'] What to use to indicate the drill places, can be none, small or full (for real scale). @@ -2039,6 +2042,9 @@ Next time you need this list just use an alias, like this: - `name`: [string=''] Used to identify this particular output definition. - `options`: [dict] Options for the `pdf_pcb_print` output. * Valid keys: + - `color_theme`: [string='_builtin_classic'] Selects the color theme. Onlyu applies to KiCad 6. + To use the KiCad 6 default colors select `_builtin_default`. + Usually user colors are stored as `user`, but you can give it another name. - `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. - `drill_marks`: [string='full'] What to use to indicate the drill places, can be none, small or full (for real scale). diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index fd2f5669..0ea41706 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -1074,6 +1074,10 @@ outputs: type: 'pdf_pcb_print' dir: 'Example/pdf_pcb_print_dir' options: + # [string='_builtin_classic'] Selects the color theme. Onlyu applies to KiCad 6. + # To use the KiCad 6 default colors select `_builtin_default`. + # Usually user colors are stored as `user`, but you can give it another name + color_theme: '_builtin_classic' # [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' @@ -1473,6 +1477,10 @@ outputs: type: 'svg_pcb_print' dir: 'Example/svg_pcb_print_dir' options: + # [string='_builtin_classic'] Selects the color theme. Onlyu applies to KiCad 6. + # To use the KiCad 6 default colors select `_builtin_default`. + # Usually user colors are stored as `user`, but you can give it another name + color_theme: '_builtin_classic' # [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' diff --git a/kibot/out_any_pcb_print.py b/kibot/out_any_pcb_print.py index e76066ed..0c21b7f4 100644 --- a/kibot/out_any_pcb_print.py +++ b/kibot/out_any_pcb_print.py @@ -48,6 +48,10 @@ class Any_PCB_PrintOptions(VariantOptions): """ Only useful for KiCad 6 when printing in one page, you can disable the edge here. KiCad 5 forces it by default, and you can't control it from config files. Same for KiCad 6 when printing to separated pages """ + self.color_theme = '_builtin_classic' + """ Selects the color theme. Onlyu applies to KiCad 6. + To use the KiCad 6 default colors select `_builtin_default`. + Usually user colors are stored as `user`, but you can give it another name """ super().__init__() @property @@ -100,7 +104,7 @@ class Any_PCB_PrintOptions(VariantOptions): def run(self, output, svg=False): super().run(self._layers) - check_script(CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, '1.6.4' if svg else '1.5.10') + check_script(CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, '1.6.7') # Output file name cmd = [CMD_PCBNEW_PRINT_LAYERS, 'export', '--output_name', output] if BasePreFlight.get_option('check_zone_fills'): @@ -114,6 +118,8 @@ class Any_PCB_PrintOptions(VariantOptions): cmd.append('--separate') if self.mirror: cmd.append('--mirror') + if self.color_theme != '_builtin_classic' and self.color_theme: + cmd.extend(['--color_theme', self.color_theme]) if svg: cmd.append('--svg') self.set_title(self.title) diff --git a/tests/reference/6_0_2/PCB_Bot_def.pdf b/tests/reference/6_0_2/PCB_Bot_def.pdf new file mode 100644 index 00000000..f85f6e61 Binary files /dev/null and b/tests/reference/6_0_2/PCB_Bot_def.pdf differ diff --git a/tests/test_plot/test_print_pcb.py b/tests/test_plot/test_print_pcb.py index 9588bfda..3f326c99 100644 --- a/tests/test_plot/test_print_pcb.py +++ b/tests/test_plot/test_print_pcb.py @@ -21,6 +21,7 @@ from utils import context PDF_DIR = 'Layers' PDF_FILE = 'bom-F_Cu+F_SilkS.pdf' PDF_FILE_B = 'PCB_Bot.pdf' +PDF_FILE_C = 'PCB_Bot_def.pdf' def test_print_pcb_simple(test_dir): @@ -32,7 +33,7 @@ def test_print_pcb_simple(test_dir): ctx.clean_up() -def test_print_pcb_refill(test_dir): +def test_print_pcb_refill_1(test_dir): prj = 'zone-refill' ctx = context.TestContext(test_dir, 'print_pcb_refill', prj, 'print_pcb_zone-refill', '') ctx.run() @@ -41,6 +42,18 @@ def test_print_pcb_refill(test_dir): ctx.clean_up() +def test_print_pcb_refill_2(test_dir): + """ Using KiCad 6 colors """ + if context.ki5(): + return + prj = 'zone-refill' + ctx = context.TestContext(test_dir, 'print_pcb_refill', prj, 'print_pcb_zone-refill_def', '') + ctx.run() + ctx.expect_out_file(PDF_FILE_B) + ctx.compare_image(PDF_FILE_B, PDF_FILE_C) + ctx.clean_up() + + def test_print_variant_1(test_dir): prj = 'kibom-variant_3' ctx = context.TestContext(test_dir, 'print_variant_1', prj, 'print_pcb_variant_1', '') diff --git a/tests/yaml_samples/print_pcb_zone-refill_def.kibot.yaml b/tests/yaml_samples/print_pcb_zone-refill_def.kibot.yaml new file mode 100644 index 00000000..3af2a3e2 --- /dev/null +++ b/tests/yaml_samples/print_pcb_zone-refill_def.kibot.yaml @@ -0,0 +1,18 @@ +# Example KiBot config file +kibot: + version: 1 + +preflight: + check_zone_fills: true + +outputs: + - name: 'print_front' + comment: "Print B.Cu (filling zones)" + type: pdf_pcb_print + dir: . + options: + output_name: PCB_Bot.pdf + scaling: 0 + color_theme: _builtin_default + layers: + - layer: B.Cu