Skip to content

Commit

Permalink
[Diff][Added] Option to un/fill zones before doing the comparison
Browse files Browse the repository at this point in the history
See #391
  • Loading branch information
set-soft committed Jan 3, 2024
1 parent db6dc95 commit ed84808
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions docs/samples/generic_plot.kibot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions docs/source/configuration/outputs/diff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/configuration/outputs/kiri.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions kibot/out_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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
Expand Down Expand Up @@ -108,6 +109,11 @@ def __init__(self):
""" 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'
Expand Down Expand Up @@ -143,6 +149,13 @@ def get_digest(self, file_path, restart=True):

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:
Expand Down
13 changes: 13 additions & 0 deletions kibot/out_kiri.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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

Expand Down Expand Up @@ -69,6 +70,11 @@ def __init__(self):
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'
Expand All @@ -94,6 +100,13 @@ def get_targets(self, out_dir):
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:
Expand Down
1 change: 1 addition & 0 deletions tests/yaml_samples/diff_file_k7.kibot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ outputs:
old: tests/board_samples/kicad_7/light_control.kicad_pcb
old_type: file
cache_dir: .cache
# zones: unfill

0 comments on commit ed84808

Please sign in to comment.