Added a preflight option to save the PCB with refilled zones.
Closes #165
This commit is contained in:
parent
b5d5bea324
commit
7e2e844a4b
|
|
@ -119,6 +119,7 @@ This section is used to specify tasks that will be executed before generating an
|
|||
- `check_zone_fills`: [boolean=false] Zones are filled before doing any operation involving PCB layers.
|
||||
The original PCB remains unchanged.
|
||||
- `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.
|
||||
* Valid keys:
|
||||
- `error`: [string=''] Error id we want to exclude. A name for KiCad 6 or a number for KiCad 5, but always a string.
|
||||
|
|
@ -131,7 +132,7 @@ This section is used to specify tasks that will be executed before generating an
|
|||
- `ignore_unconnected`: [boolean=false] Option for `run_drc`. Ignores the unconnected nets. Useful if you didn't finish the routing.
|
||||
- `pcb_replace`: [dict] Replaces tags in the PCB. I.e. to insert the git hash or last revision date.
|
||||
This is useful for KiCad 5, use `set_text_variables` when using KiCad 6.
|
||||
This pre-flight modifies the PCB. Even when a back-up is done use it carefully.
|
||||
This preflight modifies the PCB. Even when a back-up is done use it carefully.
|
||||
* Valid keys:
|
||||
- `date_command`: [string=''] Command to get the date to use in the PCB.\
|
||||
```git log -1 --format='%as' -- $KIBOT_PCB_NAME```\
|
||||
|
|
@ -156,7 +157,7 @@ This section is used to specify tasks that will be executed before generating an
|
|||
The report file name is controlled by the global output pattern (%i=erc %x=txt).
|
||||
- `sch_replace`: [dict] Replaces tags in the schematic. I.e. to insert the git hash or last revision date.
|
||||
This is useful for KiCad 5, use `set_text_variables` when using KiCad 6.
|
||||
This pre-flight modifies the schematics. Even when a back-up is done use it carefully.
|
||||
This preflight modifies the schematics. Even when a back-up is done use it carefully.
|
||||
* Valid keys:
|
||||
- `date_command`: [string=''] Command to get the date to use in the SCH.\
|
||||
```git log -1 --format='%as' -- $KIBOT_SCH_NAME```\
|
||||
|
|
@ -179,7 +180,7 @@ This section is used to specify tasks that will be executed before generating an
|
|||
- `set_text_variables`: [dict|list(dict)] Defines KiCad 6 variables.
|
||||
They are expanded using ${VARIABLE}, and stored in the project file.
|
||||
This preflight replaces `pcb_replace` and `sch_replace` when using KiCad 6.
|
||||
This pre-flight modifies the KiCad project file.
|
||||
The KiCad project file is modified.
|
||||
- `update_qr`: [boolean=false] Update the QR codes.
|
||||
Complements the `qr_lib` output.
|
||||
The KiCad 6 files and the KiCad 5 PCB needs manual update, generating a new library isn't enough.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ preflight:
|
|||
check_zone_fills: true
|
||||
# [boolean=false] Option for `run_erc`. ERC warnings are considered errors.
|
||||
erc_warnings: false
|
||||
# [boolean=false] Fill all zones again and save the PCB.
|
||||
fill_zones: true
|
||||
# [list(dict)] A list of entries to filter out ERC/DRC messages.
|
||||
filters:
|
||||
- filter: 'Filter description'
|
||||
|
|
@ -39,7 +41,7 @@ preflight:
|
|||
ignore_unconnected: false
|
||||
# [dict] Replaces tags in the PCB. I.e. to insert the git hash or last revision date.
|
||||
# This is useful for KiCad 5, use `set_text_variables` when using KiCad 6.
|
||||
# This pre-flight modifies the PCB. Even when a back-up is done use it carefully.
|
||||
# This preflight modifies the PCB. Even when a back-up is done use it carefully.
|
||||
pcb_replace:
|
||||
date_command: "git log -1 --format='%as' -- $KIBOT_PCB_NAME"
|
||||
replace_tags:
|
||||
|
|
@ -55,7 +57,7 @@ preflight:
|
|||
run_erc: true
|
||||
# [dict] Replaces tags in the schematic. I.e. to insert the git hash or last revision date.
|
||||
# This is useful for KiCad 5, use `set_text_variables` when using KiCad 6.
|
||||
# This pre-flight modifies the schematics. Even when a back-up is done use it carefully.
|
||||
# This preflight modifies the schematics. Even when a back-up is done use it carefully.
|
||||
sch_replace:
|
||||
date_command: "git log -1 --format='%as' -- $KIBOT_SCH_NAME"
|
||||
replace_tags:
|
||||
|
|
@ -66,7 +68,7 @@ preflight:
|
|||
# [dict|list(dict)] Defines KiCad 6 variables.
|
||||
# They are expanded using ${VARIABLE}, and stored in the project file.
|
||||
# This preflight replaces `pcb_replace` and `sch_replace` when using KiCad 6.
|
||||
# This pre-flight modifies the KiCad project file.
|
||||
# The KiCad project file is modified.
|
||||
set_text_variables:
|
||||
- name: 'git_hash'
|
||||
command: 'git log -1 --format="%h" $KIBOT_PCB_NAME'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2022 Salvador E. Tropea
|
||||
# Copyright (c) 2022 Instituto Nacional de Tecnología Industrial
|
||||
# License: GPL-3.0
|
||||
# Project: KiBot (formerly KiPlot)
|
||||
import pcbnew
|
||||
from .error import KiPlotConfigurationError
|
||||
from .gs import GS
|
||||
from .kiplot import load_board
|
||||
from .macros import macros, pre_class # noqa: F401
|
||||
|
||||
|
||||
@pre_class
|
||||
class Fill_Zones(BasePreFlight): # noqa: F821
|
||||
""" [boolean=false] Fill all zones again and save the PCB """
|
||||
def __init__(self, name, value):
|
||||
super().__init__(name, value)
|
||||
if not isinstance(value, bool):
|
||||
raise KiPlotConfigurationError('must be boolean')
|
||||
self._enabled = value
|
||||
self._pcb_related = True
|
||||
|
||||
def apply(self):
|
||||
load_board()
|
||||
pcbnew.ZONE_FILLER(GS.board).Fill(GS.board.Zones())
|
||||
GS.make_bkp(GS.pcb_file)
|
||||
GS.board.Save(GS.pcb_file)
|
||||
|
|
@ -30,7 +30,7 @@ def test_pdf(test_dir):
|
|||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_pdf_refill(test_dir):
|
||||
def test_pdf_refill_1(test_dir):
|
||||
prj = 'zone-refill'
|
||||
ctx = context.TestContext(test_dir, 'Plot_PDF_Refill', prj, 'pdf_zone-refill', '')
|
||||
ctx.run()
|
||||
|
|
@ -40,6 +40,23 @@ def test_pdf_refill(test_dir):
|
|||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_pdf_refill_2(test_dir):
|
||||
prj = 'zone-refill'
|
||||
ctx = context.TestContext(test_dir, 'Plot_PDF_Refill', prj, 'pdf_zone-refill_2', '')
|
||||
ori = ctx.board_file
|
||||
bkp = ori+'-bak'
|
||||
try:
|
||||
ctx.run()
|
||||
b_cu = ctx.get_gerber_filename('B_Cu', '.pdf')
|
||||
ctx.expect_out_file(b_cu)
|
||||
ctx.compare_image(b_cu)
|
||||
assert os.path.isfile(bkp)
|
||||
finally:
|
||||
if os.path.isfile(bkp):
|
||||
os.rename(bkp, ori)
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
def test_pdf_variant_1(test_dir):
|
||||
prj = 'kibom-variant_4'
|
||||
ctx = context.TestContext(test_dir, 'test_pdf_variant_1', prj, 'pdf_variant_1', '')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
kiplot:
|
||||
version: 1
|
||||
|
||||
preflight:
|
||||
fill_zones: true
|
||||
|
||||
outputs:
|
||||
- name: PDF
|
||||
comment: "PDF files"
|
||||
type: pdf
|
||||
dir: .
|
||||
options:
|
||||
exclude_edge_layer: false
|
||||
exclude_pads_from_silkscreen: false
|
||||
use_aux_axis_as_origin: false
|
||||
plot_sheet_reference: false
|
||||
plot_footprint_refs: true
|
||||
plot_footprint_values: true
|
||||
force_plot_invisible_refs_vals: false
|
||||
tent_vias: true
|
||||
|
||||
# PDF options
|
||||
drill_marks: small
|
||||
mirror_plot: false
|
||||
negative_plot: false
|
||||
line_width: 0.01
|
||||
layers:
|
||||
- layer: B.Cu
|
||||
suffix: B_Cu
|
||||
Loading…
Reference in New Issue