[Added] Sub-PCB support to drill outputs
This commit is contained in:
parent
b2b528e4ec
commit
421dcf34b7
12
README.md
12
README.md
|
|
@ -2006,6 +2006,8 @@ Notes:
|
|||
- **`mirror_y_axis`**: [boolean=false] Invert the Y axis.
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options.
|
||||
- **`pth_and_npth_single_file`**: [boolean=true] Generate one file for both, plated holes and non-plated holes, instead of two separated files.
|
||||
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||
A short-cut to use for simple cases where a variant is an overkill.
|
||||
- `left_digits`: [number=0] number of digits for integer part of coordinates (0 is auto).
|
||||
- `map`: [dict|string] [hpgl,ps,gerber,dxf,svg,pdf] Format for a graphical drill map.
|
||||
Not generated unless a format is specified.
|
||||
|
|
@ -2014,6 +2016,8 @@ Notes:
|
|||
- `type`: [string='pdf'] [hpgl,ps,gerber,dxf,svg,pdf] Format for a graphical drill map.
|
||||
- `minimal_header`: [boolean=false] Use a minimal header in the file.
|
||||
- `npth_id`: [string] Force this replacement for %i when generating NPTH files.
|
||||
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||
A short-cut to use for simple cases where a variant is an overkill.
|
||||
- `pth_id`: [string] Force this replacement for %i when generating PTH and unified files.
|
||||
- `report`: [dict|string] Name of the drill report. Not generated unless a name is specified.
|
||||
* Valid keys:
|
||||
|
|
@ -2022,6 +2026,8 @@ Notes:
|
|||
- `right_digits`: [number=0] number of digits for mantissa part of coordinates (0 is auto).
|
||||
- `route_mode_for_oval_holes`: [boolean=true] Use route command for oval holes (G00), otherwise use G85.
|
||||
- `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates.
|
||||
- `variant`: [string=''] Board variant to apply.
|
||||
Used for sub-PCBs.
|
||||
- `zeros_format`: [string='DECIMAL_FORMAT'] [DECIMAL_FORMAT,SUPPRESS_LEADING,SUPPRESS_TRAILING,KEEP_ZEROS] How to handle the zeros.
|
||||
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
|
||||
Categories looks like file system paths, i.e. PCB/fabrication/gerber.
|
||||
|
|
@ -2076,18 +2082,24 @@ Notes:
|
|||
- **`options`**: [dict] Options for the `gerb_drill` output.
|
||||
* Valid keys:
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options.
|
||||
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||
A short-cut to use for simple cases where a variant is an overkill.
|
||||
- `map`: [dict|string] [hpgl,ps,gerber,dxf,svg,pdf] Format for a graphical drill map.
|
||||
Not generated unless a format is specified.
|
||||
* Valid keys:
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] Name for the map file, KiCad defaults if empty (%i='PTH_drill_map'). Affected by global options.
|
||||
- `type`: [string='pdf'] [hpgl,ps,gerber,dxf,svg,pdf] Format for a graphical drill map.
|
||||
- `npth_id`: [string] Force this replacement for %i when generating NPTH files.
|
||||
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||
A short-cut to use for simple cases where a variant is an overkill.
|
||||
- `pth_id`: [string] Force this replacement for %i when generating PTH and unified files.
|
||||
- `report`: [dict|string] Name of the drill report. Not generated unless a name is specified.
|
||||
* Valid keys:
|
||||
- `filename`: [string=''] Name of the drill report. Not generated unless a name is specified.
|
||||
(%i='drill_report' %x='txt').
|
||||
- `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates.
|
||||
- `variant`: [string=''] Board variant to apply.
|
||||
Used for sub-PCBs.
|
||||
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
|
||||
Categories looks like file system paths, i.e. PCB/fabrication/gerber.
|
||||
- `disable_run_by_default`: [string|boolean] Use it to disable the `run_by_default` status of other output.
|
||||
|
|
|
|||
|
|
@ -671,6 +671,9 @@ outputs:
|
|||
type: 'excellon'
|
||||
dir: 'Example/excellon_dir'
|
||||
options:
|
||||
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||
# A short-cut to use for simple cases where a variant is an overkill
|
||||
dnf_filter: '_none'
|
||||
# [number=0] number of digits for integer part of coordinates (0 is auto)
|
||||
left_digits: 0
|
||||
# [dict|string] [hpgl,ps,gerber,dxf,svg,pdf] Format for a graphical drill map.
|
||||
|
|
@ -690,6 +693,9 @@ outputs:
|
|||
npth_id: null
|
||||
# [string='%f-%i%I%v.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options
|
||||
output: '%f-%i%I%v.%x'
|
||||
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||
# A short-cut to use for simple cases where a variant is an overkill
|
||||
pre_transform: '_none'
|
||||
# [boolean=true] Generate one file for both, plated holes and non-plated holes, instead of two separated files
|
||||
pth_and_npth_single_file: true
|
||||
# [string] Force this replacement for %i when generating PTH and unified files
|
||||
|
|
@ -705,6 +711,9 @@ outputs:
|
|||
route_mode_for_oval_holes: true
|
||||
# [boolean=false] Use the auxiliary axis as origin for coordinates
|
||||
use_aux_axis_as_origin: false
|
||||
# [string=''] Board variant to apply.
|
||||
# Used for sub-PCBs
|
||||
variant: ''
|
||||
# [string='DECIMAL_FORMAT'] [DECIMAL_FORMAT,SUPPRESS_LEADING,SUPPRESS_TRAILING,KEEP_ZEROS] How to handle the zeros
|
||||
zeros_format: 'DECIMAL_FORMAT'
|
||||
# GenCAD:
|
||||
|
|
@ -735,6 +744,9 @@ outputs:
|
|||
type: 'gerb_drill'
|
||||
dir: 'Example/gerb_drill_dir'
|
||||
options:
|
||||
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||
# A short-cut to use for simple cases where a variant is an overkill
|
||||
dnf_filter: '_none'
|
||||
# [dict|string] [hpgl,ps,gerber,dxf,svg,pdf] Format for a graphical drill map.
|
||||
# Not generated unless a format is specified
|
||||
map:
|
||||
|
|
@ -746,6 +758,9 @@ outputs:
|
|||
npth_id: null
|
||||
# [string='%f-%i%I%v.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options
|
||||
output: '%f-%i%I%v.%x'
|
||||
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||
# A short-cut to use for simple cases where a variant is an overkill
|
||||
pre_transform: '_none'
|
||||
# [string] Force this replacement for %i when generating PTH and unified files
|
||||
pth_id: null
|
||||
# [dict|string] Name of the drill report. Not generated unless a name is specified
|
||||
|
|
@ -755,6 +770,9 @@ outputs:
|
|||
filename: ''
|
||||
# [boolean=false] Use the auxiliary axis as origin for coordinates
|
||||
use_aux_axis_as_origin: false
|
||||
# [string=''] Board variant to apply.
|
||||
# Used for sub-PCBs
|
||||
variant: ''
|
||||
# Gerber format:
|
||||
# This output is what you get from the File/Plot menu in pcbnew.
|
||||
- name: 'gerber_example'
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import os
|
|||
import re
|
||||
from pcbnew import (PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER, PLOT_FORMAT_DXF, PLOT_FORMAT_SVG,
|
||||
PLOT_FORMAT_PDF, wxPoint)
|
||||
from .optionable import (Optionable, BaseOptions)
|
||||
from .optionable import Optionable
|
||||
from .out_base import VariantOptions
|
||||
from .gs import GS
|
||||
from .layer import Layer
|
||||
from .macros import macros, document # noqa: F401
|
||||
|
|
@ -37,7 +38,7 @@ class DrillReport(Optionable):
|
|||
self._unkown_is_error = True
|
||||
|
||||
|
||||
class AnyDrill(BaseOptions):
|
||||
class AnyDrill(VariantOptions):
|
||||
def __init__(self):
|
||||
# Options
|
||||
with document:
|
||||
|
|
@ -66,6 +67,7 @@ class AnyDrill(BaseOptions):
|
|||
}
|
||||
self._map_ext = {'hpgl': 'plt', 'ps': 'ps', 'gerber': 'gbr', 'dxf': 'dxf', 'svg': 'svg', 'pdf': 'pdf'}
|
||||
self._unified_output = False
|
||||
self.add_to_doc('variant', 'Used for sub-PCBs')
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
|
|
@ -156,6 +158,8 @@ class AnyDrill(BaseOptions):
|
|||
return filenames
|
||||
|
||||
def run(self, output_dir):
|
||||
super().run(output_dir)
|
||||
self.filter_pcb_components(GS.board)
|
||||
if self.output:
|
||||
output_dir = os.path.dirname(output_dir)
|
||||
# dialog_gendrill.cpp:357
|
||||
|
|
@ -183,6 +187,7 @@ class AnyDrill(BaseOptions):
|
|||
drill_report_file = self.expand_filename(output_dir, self.report, 'drill_report', 'txt')
|
||||
logger.debug("Generating drill report: "+drill_report_file)
|
||||
drill_writer.GenDrillReportFile(drill_report_file)
|
||||
self.unfilter_pcb_components(GS.board)
|
||||
|
||||
def get_targets(self, out_dir):
|
||||
targets = []
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ pytest-3 --log-cli-level debug
|
|||
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import os
|
||||
import sys
|
||||
from . import context
|
||||
|
|
@ -99,3 +100,16 @@ def test_drill_legacy_3Rs(test_dir):
|
|||
|
||||
def test_drill_legacy_s_3Rs(test_dir):
|
||||
do_3Rs(test_dir, 'drill_legacy_s', False, True)
|
||||
|
||||
|
||||
@pytest.mark.skipif(context.ki5(), reason="KiKit currently supports KiCad 6 only")
|
||||
def test_drill_sub_pcb_bp(test_dir):
|
||||
""" Test a multiboard example """
|
||||
prj = 'batteryPack'
|
||||
ctx = context.TestContext(test_dir, prj, 'drill_sub_pcb', 'Drill')
|
||||
ctx.run()
|
||||
# Check all outputs are there
|
||||
fname = prj+'-drill_connector.drl'
|
||||
ctx.search_in_file_d(fname, ['X29.75Y-28.09', 'T3C3.200'])
|
||||
ctx.search_not_in_file_d(fname, ['X189.0Y-59.0', 'T1C0.400'])
|
||||
ctx.clean_up(keep_project=True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
# Drills and Gerber drills
|
||||
kibot:
|
||||
version: 1
|
||||
|
||||
variants:
|
||||
- name: 'default'
|
||||
comment: 'Default variant'
|
||||
type: ibom
|
||||
sub_pcbs:
|
||||
- name: charger
|
||||
tlx: 175
|
||||
tly: 50
|
||||
brx: 245
|
||||
bry: 90
|
||||
- name: battery
|
||||
tlx: 20
|
||||
tly: 20
|
||||
brx: 90
|
||||
bry: 118
|
||||
- name: connector
|
||||
tlx: 116
|
||||
tly: 52
|
||||
brx: 146
|
||||
bry: 88
|
||||
|
||||
outputs:
|
||||
- name: excellon_drill
|
||||
comment: "Excellon drill files"
|
||||
type: excellon
|
||||
dir: Drill
|
||||
options:
|
||||
variant: default[connector]
|
||||
metric_units: true
|
||||
use_aux_axis_as_origin: false
|
||||
minimal_header: false
|
||||
mirror_y_axis: false
|
||||
report: '%f-%i.%x'
|
||||
map: 'pdf'
|
||||
Loading…
Reference in New Issue