diff --git a/kibot/kiplot.py b/kibot/kiplot.py index 7ad07e2e..a88e2cb0 100644 --- a/kibot/kiplot.py +++ b/kibot/kiplot.py @@ -852,12 +852,9 @@ def generate_one_example(dest_dir, types): glb = {'filters': fil} yaml_dump(f, {'global': glb}) f.write('\n') - # A helper for the JLCPCB stuff - fil = {'name': 'only_jlc_parts'} - fil['comment'] = 'Only parts with JLC (LCSC) code' - fil['type'] = 'generic' - fil['include_only'] = [{'column': 'LCSC#', 'regex': r'^C\d+'}] - yaml_dump(f, {'filters': [fil]}) + # A helper for the internal templates + imports = [{'file': man} for man in ['Elecrow', 'FusionPCB', 'JLCPCB', 'PCBWay']] + yaml_dump(f, {'import': imports}) f.write('\n') # A helper for KiCost demo var = {'name': 'place_holder'} diff --git a/kibot/out_gerber.py b/kibot/out_gerber.py index 14146e8f..78ed0e81 100644 --- a/kibot/out_gerber.py +++ b/kibot/out_gerber.py @@ -123,30 +123,35 @@ class Gerber(AnyLayer): useful = GS.get_useful_layers(USEFUL_LAYERS, layers, include_copper=True) tpl_layers = [AnyLayer.layer2dict(la) for la in useful] # Add the list of layers to the templates - skipped = [] for tpl in templates: + outs_used = [] for out in tpl: skip = False if out['type'] == 'gerber': out['layers'] = tpl_layers elif out['type'] == 'position': - out['options']['variant'] = 'place_holder' if not GS.sch: # We need the schematic for the variant skip = True + out['run_by_default'] = False + out['options'] = {'pre_transform': ['_kicost_rename', '_rot_footprint']} if out['type'] == 'bom' and not GS.sch_file: skip = True + out['run_by_default'] = False if out['type'] == 'compress': out['dir'] = 'Manufacturers' + # We must disable the template and create a new one + # If we don't do it the parent is configured and, in the JLCPCB case, it needs an schematic + out['disable_run_by_default'] = out['extends'] + out['extends'] = '' # Moving files makes the `navigate_results` less powerful # out['options']['move_files'] = True - if skipped: + if outs_used: # Compress only the ones we didn't skip - out['options']['files'] = [f for f in out['options']['files'] if f['from_output'] not in skipped] + out['options'] = {'files': [{'from_output': f, 'dest': '/'} for f in outs_used]} else: out['dir'] = os.path.join('Manufacturers', out['dir']) - if skip: - skipped.append(out['name']) - else: - outs.append(out) + outs.append(out) + if not skip: + outs_used.append(out['name']) return outs diff --git a/kibot/resources/config_templates/gerber/Elecrow.kibot.yaml b/kibot/resources/config_templates/gerber/Elecrow.kibot.yaml index 5fdb551e..b68791d2 100644 --- a/kibot/resources/config_templates/gerber/Elecrow.kibot.yaml +++ b/kibot/resources/config_templates/gerber/Elecrow.kibot.yaml @@ -1,59 +1,29 @@ # Gerber and drill files for Elecrow, without stencil -# URL: https://www.elecrow.com/ -# Based on setting used by Gerber Zipper (https://github.com/g200kg/kicad-gerberzipper) +# This is just a template for the quick-start kibot: version: 1 +import: + - file: Elecrow + outputs: - name: Elecrow_gerbers comment: Gerbers compatible with Elecrow type: gerber dir: Elecrow - options: &gerber_options - exclude_edge_layer: true - exclude_pads_from_silkscreen: true - plot_sheet_reference: false - plot_footprint_refs: true - plot_footprint_values: true - force_plot_invisible_refs_vals: false - tent_vias: true - use_protel_extensions: true - create_gerber_job_file: false - output: "%f.%x" - gerber_precision: 4.6 - use_gerber_x2_attributes: false - use_gerber_net_attributes: false - disable_aperture_macros: true - line_width: 0.1 - uppercase_extensions: true - subtract_mask_from_silk: true - inner_extension_pattern: '.g%n' - edge_cut_extension: '.gml' - layers: - - copper - - F.SilkS - - B.SilkS - - F.Mask - - B.Mask - - Edge.Cuts + extends: _Elecrow_gerbers + disable_run_by_default: true - name: Elecrow_drill comment: Drill files compatible with Elecrow type: excellon dir: Elecrow - options: - pth_and_npth_single_file: false - pth_id: '' - npth_id: '-NPTH' - output: "%f%i.TXT" + extends: _Elecrow_drill + disable_run_by_default: true - name: Elecrow comment: ZIP file for Elecrow type: compress dir: Elecrow - options: - files: - - from_output: Elecrow_gerbers - dest: / - - from_output: Elecrow_drill - dest: / + extends: _Elecrow_compress + disable_run_by_default: true diff --git a/kibot/resources/config_templates/gerber/FusionPCB.kibot.yaml b/kibot/resources/config_templates/gerber/FusionPCB.kibot.yaml index fd49fab3..e739603c 100644 --- a/kibot/resources/config_templates/gerber/FusionPCB.kibot.yaml +++ b/kibot/resources/config_templates/gerber/FusionPCB.kibot.yaml @@ -1,59 +1,29 @@ # Gerber and drill files for FusionPCB, without stencil -# URL: https://www.seeedstudio.io/fusion.html -# Based on setting used by Gerber Zipper (https://github.com/g200kg/kicad-gerberzipper) +# This is just a template for the quick-start kibot: version: 1 +import: + - file: FusionPCB + outputs: - name: FusionPCB_gerbers comment: Gerbers compatible with FusionPCB type: gerber dir: FusionPCB - options: &gerber_options - exclude_edge_layer: true - exclude_pads_from_silkscreen: true - plot_sheet_reference: false - plot_footprint_refs: true - plot_footprint_values: true - force_plot_invisible_refs_vals: false - tent_vias: true - use_protel_extensions: true - create_gerber_job_file: false - output: "%f.%x" - gerber_precision: 4.6 - use_gerber_x2_attributes: false - use_gerber_net_attributes: false - disable_aperture_macros: true - line_width: 0.1 - uppercase_extensions: true - subtract_mask_from_silk: false - use_aux_axis_as_origin: true - inner_extension_pattern: '.gl%N' - edge_cut_extension: '.gml' - layers: - - copper - - F.SilkS - - B.SilkS - - F.Mask - - B.Mask - - Edge.Cuts + extends: _FusionPCB_gerbers + disable_run_by_default: true - name: FusionPCB_drill comment: Drill files compatible with FusionPCB type: excellon dir: FusionPCB - options: - pth_and_npth_single_file: true - use_aux_axis_as_origin: true - output: "%f.TXT" + extends: _FusionPCB_drill + disable_run_by_default: true - name: FusionPCB comment: ZIP file for FusionPCB type: compress dir: FusionPCB - options: - files: - - from_output: FusionPCB_gerbers - dest: / - - from_output: FusionPCB_drill - dest: / + extends: _FusionPCB_compress + disable_run_by_default: true diff --git a/kibot/resources/config_templates/gerber/JLCPCB.kibot.yaml b/kibot/resources/config_templates/gerber/JLCPCB.kibot.yaml index c79a1dbd..2739fbff 100644 --- a/kibot/resources/config_templates/gerber/JLCPCB.kibot.yaml +++ b/kibot/resources/config_templates/gerber/JLCPCB.kibot.yaml @@ -1,133 +1,43 @@ # Gerber and drill files for JLCPCB, without stencil -# URL: https://jlcpcb.com/ -# Based on setting used by Gerber Zipper (https://github.com/g200kg/kicad-gerberzipper) +# This is just a template for the quick-start kibot: version: 1 -filters: - - name: only_jlc_parts - comment: 'Only parts with JLC (LCSC) code' - type: generic - include_only: - - column: 'LCSC#' - regex: '^C\d+' - -variants: - - name: rotated - comment: 'Just a place holder for the rotation filter' - type: kibom - variant: rotated - pre_transform: _rot_footprint +import: + - file: JLCPCB outputs: - name: JLCPCB_gerbers comment: Gerbers compatible with JLCPCB type: gerber dir: JLCPCB - options: &gerber_options - exclude_edge_layer: true - exclude_pads_from_silkscreen: true - plot_sheet_reference: false - plot_footprint_refs: true - plot_footprint_values: false - force_plot_invisible_refs_vals: false - tent_vias: true - use_protel_extensions: true - create_gerber_job_file: false - disable_aperture_macros: true - gerber_precision: 4.6 - use_gerber_x2_attributes: false - use_gerber_net_attributes: false - line_width: 0.1 - subtract_mask_from_silk: true - inner_extension_pattern: '.g%n' - layers: - # Note: a more generic approach is to use 'copper' but then the filenames - # are slightly different. - - F.Cu - - B.Cu - - In1.Cu - - In2.Cu - - In3.Cu - - In4.Cu - - In5.Cu - - In6.Cu - - F.SilkS - - B.SilkS - - F.Mask - - B.Mask - - Edge.Cuts + extends: _JLCPCB_gerbers + disable_run_by_default: true - name: JLCPCB_drill comment: Drill files compatible with JLCPCB type: excellon dir: JLCPCB - options: - pth_and_npth_single_file: false - pth_id: '-PTH' - npth_id: '-NPTH' - metric_units: true - map: gerber - route_mode_for_oval_holes: false - output: "%f%i.%x" + extends: _JLCPCB_drill + disable_run_by_default: true - - name: 'JLCPCB_position' - comment: "Pick and place file, JLCPCB style" + - name: JLCPCB_position + comment: Pick and place file, JLCPCB style type: position dir: JLCPCB - options: - variant: rotated - output: '%f_cpl_jlc.%x' - format: CSV - units: millimeters - separate_files_for_front_and_back: false - only_smd: true - columns: - - id: Ref - name: Designator - - Val - - Package - - id: PosX - name: "Mid X" - - id: PosY - name: "Mid Y" - - id: Rot - name: Rotation - - id: Side - name: Layer + extends: _JLCPCB_position + disable_run_by_default: true - - name: 'JLCPCB_bom' - comment: "BoM for JLCPCB" + - name: JLCPCB_bom + comment: BoM for JLCPCB type: bom dir: JLCPCB - options: - output: '%f_%i_jlc.%x' - exclude_filter: 'only_jlc_parts' - ref_separator: ',' - columns: - - field: Value - name: Comment - - field: References - name: Designator - - Footprint - - field: 'LCSC#' - name: 'LCSC Part #' - csv: - hide_pcb_info: true - hide_stats_info: true - quote_all: true + extends: _JLCPCB_bom + disable_run_by_default: true - name: JLCPCB comment: ZIP file for JLCPCB type: compress dir: JLCPCB - options: - files: - - from_output: JLCPCB_gerbers - dest: / - - from_output: JLCPCB_drill - dest: / - - from_output: JLCPCB_position - dest: / - - from_output: JLCPCB_bom - dest: / + extends: _JLCPCB_compress + disable_run_by_default: true diff --git a/kibot/resources/config_templates/gerber/PCBWay.kibot.yaml b/kibot/resources/config_templates/gerber/PCBWay.kibot.yaml index 12670b0a..a42f961a 100644 --- a/kibot/resources/config_templates/gerber/PCBWay.kibot.yaml +++ b/kibot/resources/config_templates/gerber/PCBWay.kibot.yaml @@ -1,69 +1,29 @@ # Gerber and drill files for PCBWay, with stencil (solder paste) -# URL: https://www.pcbway.com -# Based on setting used by Gerber Zipper (https://github.com/g200kg/kicad-gerberzipper) +# This is just a template for the quick-start kibot: version: 1 +import: + - file: PCBWay + outputs: - name: PCBWay_gerbers comment: Gerbers compatible with PCBWay type: gerber dir: PCBWay - options: &gerber_options - exclude_edge_layer: true - exclude_pads_from_silkscreen: true - plot_sheet_reference: false - plot_footprint_refs: true - plot_footprint_values: true - force_plot_invisible_refs_vals: false - tent_vias: true - use_protel_extensions: true - create_gerber_job_file: false - output: "%f.%x" - gerber_precision: 4.6 - use_gerber_x2_attributes: false - use_gerber_net_attributes: false - disable_aperture_macros: true - line_width: 0.1 - subtract_mask_from_silk: false - inner_extension_pattern: '.gl%N' - layers: - - copper - - F.SilkS - - B.SilkS - - F.Mask - - B.Mask - - F.Paste - - B.Paste - - Edge.Cuts + extends: _PCBWay_gerbers + disable_run_by_default: true - name: PCBWay_drill comment: Drill files compatible with PCBWay type: excellon dir: PCBWay - options: - metric_units: false - minimal_header: true - zeros_format: SUPPRESS_LEADING - # left_digits: 3 - # right_digits: 3 - # See https://github.com/INTI-CMNB/kicad-ci-test-spora/issues/1 - # and https://docs.oshpark.com/design-tools/gerbv/fix-drill-format/ - left_digits: 2 - right_digits: 4 - pth_and_npth_single_file: false - pth_id: '' - npth_id: '-NPTH' - output: "%f%i.drl" + extends: _PCBWay_drill + disable_run_by_default: true - name: PCBWay comment: ZIP file for PCBWay type: compress dir: PCBWay - options: - format: ZIP - files: - - from_output: PCBWay_gerbers - dest: / - - from_output: PCBWay_drill - dest: / + extends: _PCBWay_compress + disable_run_by_default: true