[Templates][Added] CheckZoneFill aborts on big changes

- Enables the check_zone_fill preflight
- Creates graphical diff
- Computes the number of changes

Closes #431
This commit is contained in:
Salvador E. Tropea 2023-05-18 11:28:06 -03:00
parent d6e008ff48
commit a35e9fc2c7
6 changed files with 51 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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