[Diff][Added] Option to un/fill zones before doing the comparison

See #391
This commit is contained in:
Salvador E. Tropea 2024-01-03 13:17:18 -03:00
parent db6dc95acb
commit ed84808566
7 changed files with 49 additions and 0 deletions

View File

@ -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)

View File

@ -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'

View File

@ -91,6 +91,10 @@ Parameters:
- ``use_file_id`` :index:`: <pair: output - diff - options; use_file_id>` [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:`: <pair: output - diff - options; variant>` [string=''] Board variant to apply.
- ``zones`` :index:`: <pair: output - diff - options; zones>` [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:`: <pair: output - diff; type>` [string=''] Type of output.
- ``category`` :index:`: <pair: output - diff; category>` [string|list(string)=''] The category for this output. If not specified an internally defined category is used.

View File

@ -52,6 +52,10 @@ Parameters:
- ``revision`` :index:`: <pair: output - kiri - options; revision>` [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:`: <pair: output - kiri - options; variant>` [string=''] Board variant to apply.
- ``zones`` :index:`: <pair: output - kiri - options; zones>` [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:`: <pair: output - kiri; type>` [string=''] Type of output.
- ``category`` :index:`: <pair: output - kiri; category>` [string|list(string)=''] The category for this output. If not specified an internally defined category is used.

View File

@ -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:

View File

@ -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:

View File

@ -10,3 +10,4 @@ outputs:
old: tests/board_samples/kicad_7/light_control.kicad_pcb
old_type: file
cache_dir: .cache
# zones: unfill