diff --git a/CHANGELOG.md b/CHANGELOG.md index e16afe42..c62b424e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Help for the error levels - Warnings: - Explain about wrong dir/output separation (#493) +- Diff: + - Added option to un/fill zones before doing the comparison (See #391) ### Changed - Documentation: @@ -99,6 +101,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Quick Start: - Now we generate if for projects, not separated files. This avoids problems for sub-sheets in separated dirs. +- Diff: + - When *check_zone_fills* is enabled now we do a refill for the boards ### Fixed - Schematics: problems with deep nested and recycled sheets (#520) diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index 03c7c075..6d05e979 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -823,6 +823,11 @@ outputs: use_file_id: false # [string=''] Board variant to apply variant: '' + # [string='global'] [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we + # fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces + # a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. + # Be careful with the cache when changing this setting + zones: 'global' layers: all # Datasheets downloader: - name: 'download_datasheets_example' @@ -1676,6 +1681,11 @@ outputs: revision: 'HEAD' # [string=''] Board variant to apply variant: '' + # [string='global'] [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we + # fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces + # a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. + # Be careful with the *keep_generated* option when changing this setting + zones: 'global' layers: all # Navigate Results: - name: 'navigate_results_example' diff --git a/docs/source/configuration/outputs/diff.rst b/docs/source/configuration/outputs/diff.rst index 578db8c5..7762e86c 100644 --- a/docs/source/configuration/outputs/diff.rst +++ b/docs/source/configuration/outputs/diff.rst @@ -91,6 +91,10 @@ Parameters: - ``use_file_id`` :index:`: ` [boolean=false] When creating the link name of an output file related to a variant use the variant `file_id` instead of its name. - ``variant`` :index:`: ` [string=''] Board variant to apply. + - ``zones`` :index:`: ` [string='global'] [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we + fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces + a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. + Be careful with the cache when changing this setting. - **type** :index:`: ` [string=''] Type of output. - ``category`` :index:`: ` [string|list(string)=''] The category for this output. If not specified an internally defined category is used. diff --git a/docs/source/configuration/outputs/kiri.rst b/docs/source/configuration/outputs/kiri.rst index 98ef55a4..8032accf 100644 --- a/docs/source/configuration/outputs/kiri.rst +++ b/docs/source/configuration/outputs/kiri.rst @@ -52,6 +52,10 @@ Parameters: - ``revision`` :index:`: ` [string='HEAD'] Starting point for the commits, can be a branch, a hash, etc. Note that this can be a revision-range, consult the gitrevisions manual for more information. - ``variant`` :index:`: ` [string=''] Board variant to apply. + - ``zones`` :index:`: ` [string='global'] [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we + fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces + a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. + Be careful with the *keep_generated* option when changing this setting. - **type** :index:`: ` [string=''] Type of output. - ``category`` :index:`: ` [string|list(string)=''] The category for this output. If not specified an internally defined category is used. diff --git a/kibot/out_diff.py b/kibot/out_diff.py index f444ec4e..0afe819d 100644 --- a/kibot/out_diff.py +++ b/kibot/out_diff.py @@ -32,6 +32,7 @@ from .kiplot import load_any_sch, run_command, config_output, get_output_dir, ru from .layer import Layer from .misc import DIFF_TOO_BIG, FAILED_EXECUTE from .out_base import VariantOptions +from .pre_base import BasePreFlight from .registrable import RegOutput from .macros import macros, document, output_class # noqa: F401 from . import log @@ -108,6 +109,11 @@ class DiffOptions(VariantOptions): """ Always fail if the old/new file doesn't exist. Currently we don't fail if they are from a repo. So if you refer to a repo point where the file wasn't created KiBot will use an empty file. Enabling this option KiBot will report an error """ + self.zones = 'global' + """ [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we + fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces + a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. + Be careful with the cache when changing this setting""" super().__init__() self._expand_id = 'diff' self._expand_ext = 'pdf' @@ -143,6 +149,13 @@ class DiffOptions(VariantOptions): def add_to_cache(self, name, hash): cmd = [self.command, '--no_reader', '--only_cache', '--old_file_hash', hash, '--cache_dir', self.cache_dir] + if self.zones == 'global': + if BasePreFlight.get_option('check_zone_fills'): + cmd.extend(['--zones', 'fill']) + elif self.zones == 'fill': + cmd.extend(['--zones', 'fill']) + elif self.zones == 'unfill': + cmd.extend(['--zones', 'unfill']) if self.incl_file: cmd.extend(['--layers', self.incl_file]) if not self.only_first_sch_page: diff --git a/kibot/out_kiri.py b/kibot/out_kiri.py index 897aeb02..81772dc1 100644 --- a/kibot/out_kiri.py +++ b/kibot/out_kiri.py @@ -33,6 +33,7 @@ from .kiplot import load_any_sch, run_command from .layer import Layer from .misc import W_NOTHCMP from .out_base import VariantOptions +from .pre_base import BasePreFlight from .macros import macros, document, output_class # noqa: F401 from . import log @@ -69,6 +70,11 @@ class KiRiOptions(VariantOptions): Note that this can be a revision-range, consult the gitrevisions manual for more information """ self.keep_generated = False """ *Avoid PCB and SCH images regeneration. Useful for incremental usage """ + self.zones = 'global' + """ [global,fill,unfill,none] How to handle PCB zones. The default is *global* and means that we + fill zones if the *check_zone_fills* preflight is enabled. The *fill* option always forces + a refill, *unfill* forces a zone removal and *none* lets the zones unchanged. + Be careful with the *keep_generated* option when changing this setting """ super().__init__() self._expand_id = 'diff' self._expand_ext = 'pdf' @@ -94,6 +100,13 @@ class KiRiOptions(VariantOptions): def add_to_cache(self, name, hash): cmd = [self.command, '--no_reader', '--only_cache', '--old_file_hash', hash[:7], '--cache_dir', self.cache_dir, '--kiri_mode', '--all_pages'] + if self.zones == 'global': + if BasePreFlight.get_option('check_zone_fills'): + cmd.extend(['--zones', 'fill']) + elif self.zones == 'fill': + cmd.extend(['--zones', 'fill']) + elif self.zones == 'unfill': + cmd.extend(['--zones', 'unfill']) if self.incl_file: cmd.extend(['--layers', self.incl_file]) if GS.debug_enabled: diff --git a/tests/yaml_samples/diff_file_k7.kibot.yaml b/tests/yaml_samples/diff_file_k7.kibot.yaml index 290a8d7e..d76e1060 100644 --- a/tests/yaml_samples/diff_file_k7.kibot.yaml +++ b/tests/yaml_samples/diff_file_k7.kibot.yaml @@ -10,3 +10,4 @@ outputs: old: tests/board_samples/kicad_7/light_control.kicad_pcb old_type: file cache_dir: .cache + # zones: unfill