diff --git a/CHANGELOG.md b/CHANGELOG.md index 37fc59eb..4f1d3fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `_value_split` splits the Value field but the field remains and the extra data is not visible - `_value_split_replace` splits the Value field and replaces it +- Internal templates: + - CheckZoneFill: Used to check if a zone fill operation makes the PCB quite + different (#431) ### Changed - Command line: diff --git a/README.md b/README.md index 7fe129d4..c9a830ca 100644 --- a/README.md +++ b/README.md @@ -421,7 +421,8 @@ This section is used to specify tasks that will be executed before generating an This preflight modifies the schematic, use it only in revision control environments. Used to solve ERC problems when using filters that remove power reference numbers. - `check_zone_fills`: [boolean=false] Zones are filled before doing any operation involving PCB layers. - The original PCB remains unchanged. + The original PCB remains unchanged. If you need to abort when the zone fill + creates significant changes to a layer use the CheckZoneFill internal template. - `erc_warnings`: [boolean=false] Option for `run_erc`. ERC warnings are considered errors. - `fill_zones`: [boolean=false] Fill all zones again and save the PCB. - `filters`: [list(dict)] A list of entries to filter out ERC/DRC messages. @@ -5403,6 +5404,10 @@ Here is a list of currently defined templates: They include support for: +- CheckZoneFill: enables the `check_zone_fills` preflight and checks the refilled PCB doesn't changed too much. + - _diff_cur_pcb_show: Makes a diff between the PCB in memory and the one on disk + - _diff_cur_pcb_check: Computes the difference between PCB in memory and the one on disk. Aborts if more than + 100 pixels changed. - [Elecrow](https://www.elecrow.com/): contain fabrication outputs compatible with Elecrow - _Elecrow_gerbers: Gerbers - _Elecrow_drill: Drill files diff --git a/docs/README.in b/docs/README.in index 41a8fdd2..bd9bff58 100644 --- a/docs/README.in +++ b/docs/README.in @@ -1295,6 +1295,10 @@ Here is a list of currently defined templates: They include support for: +- CheckZoneFill: enables the `check_zone_fills` preflight and checks the refilled PCB doesn't changed too much. + - _diff_cur_pcb_show: Makes a diff between the PCB in memory and the one on disk + - _diff_cur_pcb_check: Computes the difference between PCB in memory and the one on disk. Aborts if more than + 100 pixels changed. - [Elecrow](https://www.elecrow.com/): contain fabrication outputs compatible with Elecrow - _Elecrow_gerbers: Gerbers - _Elecrow_drill: Drill files diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index e4a90705..422390e8 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -26,7 +26,8 @@ preflight: # Used to solve ERC problems when using filters that remove power reference numbers. annotate_power: true # [boolean=false] Zones are filled before doing any operation involving PCB layers. - # The original PCB remains unchanged. + # The original PCB remains unchanged. If you need to abort when the zone fill + # creates significant changes to a layer use the CheckZoneFill internal template. check_zone_fills: true # [boolean=false] Option for `run_erc`. ERC warnings are considered errors. erc_warnings: false diff --git a/kibot/pre_check_zone_fills.py b/kibot/pre_check_zone_fills.py index c2932511..8dfc622b 100644 --- a/kibot/pre_check_zone_fills.py +++ b/kibot/pre_check_zone_fills.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2020-2022 Salvador E. Tropea -# Copyright (c) 2020-2022 Instituto Nacional de TecnologĂ­a Industrial +# Copyright (c) 2020-2023 Salvador E. Tropea +# Copyright (c) 2020-2023 Instituto Nacional de TecnologĂ­a Industrial # License: GPL-3.0 # Project: KiBot (formerly KiPlot) from .error import (KiPlotConfigurationError) @@ -10,7 +10,8 @@ from .macros import macros, pre_class # noqa: F401 @pre_class class Check_Zone_Fills(BasePreFlight): # noqa: F821 """ [boolean=false] Zones are filled before doing any operation involving PCB layers. - The original PCB remains unchanged """ + The original PCB remains unchanged. If you need to abort when the zone fill + creates significant changes to a layer use the CheckZoneFill internal template """ def __init__(self, name, value): super().__init__(name, value) if not isinstance(value, bool): diff --git a/kibot/resources/config_templates/CheckZoneFill.kibot.yaml b/kibot/resources/config_templates/CheckZoneFill.kibot.yaml new file mode 100644 index 00000000..c948dfee --- /dev/null +++ b/kibot/resources/config_templates/CheckZoneFill.kibot.yaml @@ -0,0 +1,32 @@ +# Run a diff between the current PCB on disk and the one loaded in memory after +# refilling the zones. +# Can be used to implement a check to detect if the committed file needs a +# zone refill. +kibot: + version: 1 + +preflight: + check_zone_fills: true + +outputs: + - name: '_diff_cur_pcb_show' + comment: "Show differences for the zone fill" + type: diff + layers: copper + options: + cache_dir: .cache + old: '' + old_type: file + new_type: current + + - name: '_diff_cur_pcb_check' + comment: "Check the zone fill doesn't generate important changes" + type: diff + layers: copper + options: + cache_dir: .cache + diff_mode: stats + threshold: 100 + old: '' + old_type: file + new_type: current