diff --git a/CHANGELOG.md b/CHANGELOG.md index 560a3e19..0524af55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Problems when using the `pdf_pcb_print` output and variants to remove a component with ridiculous pads that only has solder paste (no copper, nor even solder mask aperture). +- Excellon drill output when using unified output and not using default + KiCad names. ## [0.7.0] - 2020-09-11 diff --git a/kibot/out_any_drill.py b/kibot/out_any_drill.py index 12d1ad1a..0b2e6d11 100644 --- a/kibot/out_any_drill.py +++ b/kibot/out_any_drill.py @@ -67,6 +67,7 @@ class AnyDrill(BaseOptions): 'pdf': PLOT_FORMAT_PDF } self._map_ext = {'hpgl': 'plt', 'ps': 'ps', 'gerber': 'gbr', 'dxf': 'dxf', 'svg': 'svg', 'pdf': 'pdf'} + self._unified_output = False def config(self): super().config() @@ -103,19 +104,20 @@ class AnyDrill(BaseOptions): # We always generate the drill file drill_writer.CreateDrillandMapFilesSet(output_dir, True, gen_map) # Rename the files - for d in ['', 'N']: + files = [''] if self._unified_output else ['PTH', 'NPTH'] + for d in files: + kicad_id = '-'+d if d else d + kibot_id = d+'_drill' if d else 'drill' if self.output: - id = 'PTH_drill' if ext == 'drl': - k_file = self.expand_filename(output_dir, '%f-'+d+'PTH.%x', '', ext) + k_file = self.expand_filename(output_dir, '%f'+kicad_id+'.%x', '', ext) else: # gbr - k_file = self.expand_filename(output_dir, '%f-'+d+'PTH-drl.%x', '', ext) - file = self.expand_filename(output_dir, self.output, d+id, ext) + k_file = self.expand_filename(output_dir, '%f'+kicad_id+'-drl.%x', '', ext) + file = self.expand_filename(output_dir, self.output, kibot_id, ext) os.rename(k_file, file) if gen_map and self.map_output: - id = 'PTH_drill_map' - k_file = self.expand_filename(output_dir, '%f-'+d+'PTH-drl_map.%x', '', self.map_ext) - file = self.expand_filename(output_dir, self.map_output, d+id, self.map_ext) + k_file = self.expand_filename(output_dir, '%f'+kicad_id+'-drl_map.%x', '', self.map_ext) + file = self.expand_filename(output_dir, self.map_output, kibot_id+'_map', self.map_ext) os.rename(k_file, file) # Generate the report if self.report: diff --git a/kibot/out_excellon.py b/kibot/out_excellon.py index cc8f90e9..869ff5d9 100644 --- a/kibot/out_excellon.py +++ b/kibot/out_excellon.py @@ -25,6 +25,7 @@ class ExcellonOptions(AnyDrill): drill_writer = EXCELLON_WRITER(board) drill_writer.SetOptions(self.mirror_y_axis, self.minimal_header, offset, self.pth_and_npth_single_file) drill_writer.SetFormat(self.metric_units, EXCELLON_WRITER.DECIMAL_FORMAT) + self._unified_output = self.pth_and_npth_single_file return drill_writer, 'drl' diff --git a/tests/test_plot/test_drill.py b/tests/test_plot/test_drill.py index 3d673dcf..21a55722 100644 --- a/tests/test_plot/test_drill.py +++ b/tests/test_plot/test_drill.py @@ -23,16 +23,16 @@ DRILL_DIR = 'Drill' positions = {'R1': (105, 35, 'top'), 'R2': (110, 35, 'bottom'), 'R3': (110, 45, 'top')} -def do_3Rs(conf, dir, modern): +def do_3Rs(conf, dir, modern, single=False): ctx = context.TestContext(dir, '3Rs', conf, DRILL_DIR) ctx.run() # Check all outputs are there pth_drl = ctx.get_pth_drl_filename() npth_drl = ctx.get_npth_drl_filename() - pth_gbr_drl = ctx.get_pth_gbr_drl_filename() - npth_gbr_drl = ctx.get_npth_gbr_drl_filename() pth_pdf_drl = ctx.get_pth_pdf_drl_filename() npth_pdf_drl = ctx.get_npth_pdf_drl_filename() + pth_gbr_drl = ctx.get_pth_gbr_drl_filename() + npth_gbr_drl = ctx.get_npth_gbr_drl_filename() report = 'report.rpt' if modern: @@ -43,6 +43,16 @@ def do_3Rs(conf, dir, modern): pth_pdf_drl = pth_pdf_drl.replace('-drl', '_drill') npth_pdf_drl = npth_pdf_drl.replace('-drl', '_drill') report = '3Rs-drill_report.txt' + if single: + pth_drl = pth_drl.replace('PTH_', '') + npth_drl = npth_drl.replace('NPTH_', '') + pth_pdf_drl = pth_pdf_drl.replace('PTH_', '') + npth_pdf_drl = npth_pdf_drl.replace('NPTH_', '') + elif single: + pth_drl = pth_drl.replace('-PTH', '') + npth_drl = npth_drl.replace('-NPTH', '') + pth_pdf_drl = pth_pdf_drl.replace('-PTH', '') + npth_pdf_drl = npth_pdf_drl.replace('-NPTH', '') ctx.expect_out_file(os.path.join(DRILL_DIR, report)) ctx.expect_out_file(pth_drl) @@ -56,7 +66,7 @@ def do_3Rs(conf, dir, modern): ctx.expect_gerber_flash_at(pth_gbr_drl, 6, (110, -45)) ctx.expect_gerber_has_apertures(pth_gbr_drl, ['C,1.000000']) # We have a mounting hole at (120, 29) is 2.1 mm in diameter - ctx.search_in_file(npth_drl, ['X120.0Y-29.0', 'T1C2.100']) + ctx.search_in_file(npth_drl, ['X120.0Y-29.0', 'T.C2.100']) ctx.expect_gerber_flash_at(npth_gbr_drl, 6, (120, -29)) ctx.expect_gerber_has_apertures(npth_gbr_drl, ['C,2.100000']) ctx.clean_up() @@ -66,5 +76,13 @@ def test_drill_3Rs(): do_3Rs('drill', 'test_drill_3Rs', True) +def test_drill_single_3Rs(): + do_3Rs('drill_single', 'test_drill_single_3Rs', True, True) + + def test_drill_legacy_3Rs(): do_3Rs('drill_legacy', 'test_drill_legacy_3Rs', False) + + +def test_drill_legacy_s_3Rs(): + do_3Rs('drill_legacy_s', 'test_drill_legacy_s_3Rs', False, True) diff --git a/tests/yaml_samples/drill_legacy_s.kiplot.yaml b/tests/yaml_samples/drill_legacy_s.kiplot.yaml new file mode 100644 index 00000000..a9ba2e24 --- /dev/null +++ b/tests/yaml_samples/drill_legacy_s.kiplot.yaml @@ -0,0 +1,30 @@ +# Drills and Gerber drills +kiplot: + version: 1 + +outputs: + + - name: excellon_drill + comment: "Excellon drill files" + type: excellon + dir: Drill + options: + metric_units: true + use_aux_axis_as_origin: true + minimal_header: false + mirror_y_axis: false + output: '' + report: + filename: 'report.rpt' + map: + output: '' + type: 'pdf' + + - name: gerber_drills + comment: "Gerber drill files" + type: gerb_drill + dir: Drill + options: + output: '' + use_aux_axis_as_origin: false + diff --git a/tests/yaml_samples/drill_single.kibot.yaml b/tests/yaml_samples/drill_single.kibot.yaml new file mode 100644 index 00000000..766b2547 --- /dev/null +++ b/tests/yaml_samples/drill_single.kibot.yaml @@ -0,0 +1,25 @@ +# Drills and Gerber drills +kibot: + version: 1 + +outputs: + + - name: excellon_drill + comment: "Excellon drill files" + type: excellon + dir: Drill + options: + metric_units: true + use_aux_axis_as_origin: false + minimal_header: false + mirror_y_axis: false + report: '%f-%i.%x' + map: 'pdf' + + - name: gerber_drills + comment: "Gerber drill files" + type: gerb_drill + dir: Drill + options: + use_aux_axis_as_origin: false +