diff --git a/CHANGELOG.md b/CHANGELOG.md index f696438d..d76a6031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Internal templates import - New output: - `vrml` export the 3D model in Virtual Reality Modeling Language (#349) +- Internal templates: + - FusionPCB: gerber, drill and compress + - Elecrow: gerber, drill and compress + - JLCPCB: gerber, drill, position, BoM and compress + - P-Ban: gerber, drill and compress + - PCBWay: gerber, drill and compress - Plot related outputs and PCB_Print: - Added support for the KiCad 6 "sketch_pads_on_fab_layers" option. (#356) - Variants: diff --git a/README.md b/README.md index b4c91e33..97364d69 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ * [Consolidating BoMs](#consolidating-boms) * [Importing outputs from another file](#importing-outputs-from-another-file) * [Importing other stuff from another file](#importing-other-stuff-from-another-file) + * [Importing internal templates](#importing-internal-templates) * [Using other output as base for a new one](#using-other-output-as-base-for-a-new-one) * [Grouping outputs](#grouping-outputs) * [Doing YAML substitution or preprocessing](#doing-yaml-substitution-or-preprocessing) @@ -368,8 +369,9 @@ The file is divided in various sections. Some of them are optional. The order in which they are declared is not relevant, they are interpreted in the following order: - `kiplot`/`kibot` see [The header](#the-header) -- `import` see [Importing outputs from another file](#importing-outputs-from-another-file) and - [Importing filters and variants from another file](#importing-other-stuff-from-another-file) +- `import` see [Importing outputs from another file](#importing-outputs-from-another-file), + [Importing filters and variants from another file](#importing-other-stuff-from-another-file) and + [Importing internal templates](#importing-internal-templates) - `global` see [Default global options](#default-global-options) - `filters` see [Filters and variants](#filters-and-variants) - `variants` see [Filters and variants](#filters-and-variants) @@ -4658,6 +4660,55 @@ Another important detail is that global options that are lists gets the values m The last set of values found is inserted at the beginning of the list. You can collect filters for all the imported global sections. +#### Importing internal templates + +KiBot has some internally defined outputs, groups and filters. +You can easily use them with the `import` mechanism. +Use the `file` mechanism and add the `is_internal` option. +When importing an internal template you don't need to specify its location and/or file extension. +Here is an example: + +```yaml +import: + - file: Elecrow + is_internal: true +``` + +This will import the definitions for the internal Elecrow configuration. +Here is a list of currently defined templates: + +They include support for: + +- [Elecrow](https://www.elecrow.com/): contain fabrication outputs compatible with Elecrow + - _Elecrow_gerbers: Gerbers + - _Elecrow_drill: Drill files + - _Elecrow_compress: Gerbers and drill files compressed in a ZIP + - _Elecrow: _Elecrow_gerbers+_Elecrow_drill +- [FusionPCB](https://www.seeedstudio.io/fusion.html): contain fabrication outputs compatible with FusionPCB + - _FusionPCB_gerbers: Gerbers + - _FusionPCB_drill: Drill files + - _FusionPCB_compress: Gerbers and drill files compressed in a ZIP + - _FusionPCB: _FusionPCB_gerbers+_FusionPCB_drill +- [JLCPCB](https://jlcpcb.com/): contain fabrication outputs compatible with JLC PCB + - _JLCPCB_gerbers: Gerbers. You need to define the layers for more than 8. + - _JLCPCB_gerbers_stencil: Gerbers for the solder paste stencils. Disabled by default. + - _JLCPCB_drill: Drill files + - _JLCPCB_position: Pick and place, applies the `_rot_footprint` filter. You can change this filter. + - _JLCPCB_bom: List of LCSC parts, assumes a field named `LCSC#` contains the LCSC codes. You can change this filter. + - _JLCPCB_compress: Gerbers, drill, position and BoM files compressed in a ZIP + - _JLCPCB_fab: _JLCPCB_gerbers+_JLCPCB_drill + - _JLCPCB_assembly: _JLCPCB_position+_JLCPCB_bom + - _JLCPCB: _JLCPCB_fab+_JLCPCB_assembly +- [P-Ban](https://www.p-ban.com/): contain fabrication outputs compatible with P-Ban + - _P-Ban_gerbers: Gerbers. You need to define the layers for more than 8. + - _P-Ban_drill: Drill files + - _P-Ban: _P-Ban_gerbers+_P-Ban_drill +- [PCBWay](https://www.pcbway.com): contain fabrication outputs compatible with PCBWay + - _PCBWay_gerbers: Gerbers + - _PCBWay_drill: Drill files + - _PCBWay_compress: Gerbers and drill files compressed in a ZIP + - _PCBWay: _PCBWay_gerbers+_PCBWay_drill + #### Using other output as base for a new one @@ -5151,14 +5202,7 @@ If your manufacturer has problems with your files check the following: * Disable **aperture macros** (KiCad 6 only: `disable_aperture_macros` set to `true`) The [kicad-gerberzipper](https://github.com/g200kg/kicad-gerberzipper) is an action plugin for KiCad oriented to help to generate gerber and drill files for some manufacturers. -I adapted the configurations from kicad-gerberzipper to KiBot configurations, you can find them in the `docs/samples/` directory. -They include support for: - -- [Elecrow](https://www.elecrow.com/) -- [FusionPCB](https://www.seeedstudio.io/fusion.html) -- [JLCPCB](https://jlcpcb.com/) -- [P-Ban](https://www.p-ban.com/) -- [PCBWay](https://www.pcbway.com) +I adapted the configurations from kicad-gerberzipper to KiBot configurations, they are available as [internal templates](#importing-internal-templates). ## Notes about the position file diff --git a/docs/README.in b/docs/README.in index 5bc4f767..61a5e114 100644 --- a/docs/README.in +++ b/docs/README.in @@ -65,6 +65,7 @@ * [Consolidating BoMs](#consolidating-boms) * [Importing outputs from another file](#importing-outputs-from-another-file) * [Importing other stuff from another file](#importing-other-stuff-from-another-file) + * [Importing internal templates](#importing-internal-templates) * [Using other output as base for a new one](#using-other-output-as-base-for-a-new-one) * [Grouping outputs](#grouping-outputs) * [Doing YAML substitution or preprocessing](#doing-yaml-substitution-or-preprocessing) @@ -267,8 +268,9 @@ The file is divided in various sections. Some of them are optional. The order in which they are declared is not relevant, they are interpreted in the following order: - `kiplot`/`kibot` see [The header](#the-header) -- `import` see [Importing outputs from another file](#importing-outputs-from-another-file) and - [Importing filters and variants from another file](#importing-other-stuff-from-another-file) +- `import` see [Importing outputs from another file](#importing-outputs-from-another-file), + [Importing filters and variants from another file](#importing-other-stuff-from-another-file) and + [Importing internal templates](#importing-internal-templates) - `global` see [Default global options](#default-global-options) - `filters` see [Filters and variants](#filters-and-variants) - `variants` see [Filters and variants](#filters-and-variants) @@ -1241,6 +1243,55 @@ Another important detail is that global options that are lists gets the values m The last set of values found is inserted at the beginning of the list. You can collect filters for all the imported global sections. +#### Importing internal templates + +KiBot has some internally defined outputs, groups and filters. +You can easily use them with the `import` mechanism. +Use the `file` mechanism and add the `is_internal` option. +When importing an internal template you don't need to specify its location and/or file extension. +Here is an example: + +```yaml +import: + - file: Elecrow + is_internal: true +``` + +This will import the definitions for the internal Elecrow configuration. +Here is a list of currently defined templates: + +They include support for: + +- [Elecrow](https://www.elecrow.com/): contain fabrication outputs compatible with Elecrow + - _Elecrow_gerbers: Gerbers + - _Elecrow_drill: Drill files + - _Elecrow_compress: Gerbers and drill files compressed in a ZIP + - _Elecrow: _Elecrow_gerbers+_Elecrow_drill +- [FusionPCB](https://www.seeedstudio.io/fusion.html): contain fabrication outputs compatible with FusionPCB + - _FusionPCB_gerbers: Gerbers + - _FusionPCB_drill: Drill files + - _FusionPCB_compress: Gerbers and drill files compressed in a ZIP + - _FusionPCB: _FusionPCB_gerbers+_FusionPCB_drill +- [JLCPCB](https://jlcpcb.com/): contain fabrication outputs compatible with JLC PCB + - _JLCPCB_gerbers: Gerbers. You need to define the layers for more than 8. + - _JLCPCB_gerbers_stencil: Gerbers for the solder paste stencils. Disabled by default. + - _JLCPCB_drill: Drill files + - _JLCPCB_position: Pick and place, applies the `_rot_footprint` filter. You can change this filter. + - _JLCPCB_bom: List of LCSC parts, assumes a field named `LCSC#` contains the LCSC codes. You can change this filter. + - _JLCPCB_compress: Gerbers, drill, position and BoM files compressed in a ZIP + - _JLCPCB_fab: _JLCPCB_gerbers+_JLCPCB_drill + - _JLCPCB_assembly: _JLCPCB_position+_JLCPCB_bom + - _JLCPCB: _JLCPCB_fab+_JLCPCB_assembly +- [P-Ban](https://www.p-ban.com/): contain fabrication outputs compatible with P-Ban + - _P-Ban_gerbers: Gerbers. You need to define the layers for more than 8. + - _P-Ban_drill: Drill files + - _P-Ban: _P-Ban_gerbers+_P-Ban_drill +- [PCBWay](https://www.pcbway.com): contain fabrication outputs compatible with PCBWay + - _PCBWay_gerbers: Gerbers + - _PCBWay_drill: Drill files + - _PCBWay_compress: Gerbers and drill files compressed in a ZIP + - _PCBWay: _PCBWay_gerbers+_PCBWay_drill + #### Using other output as base for a new one @@ -1671,14 +1722,7 @@ If your manufacturer has problems with your files check the following: * Disable **aperture macros** (KiCad 6 only: `disable_aperture_macros` set to `true`) The [kicad-gerberzipper](https://github.com/g200kg/kicad-gerberzipper) is an action plugin for KiCad oriented to help to generate gerber and drill files for some manufacturers. -I adapted the configurations from kicad-gerberzipper to KiBot configurations, you can find them in the `docs/samples/` directory. -They include support for: - -- [Elecrow](https://www.elecrow.com/) -- [FusionPCB](https://www.seeedstudio.io/fusion.html) -- [JLCPCB](https://jlcpcb.com/) -- [P-Ban](https://www.p-ban.com/) -- [PCBWay](https://www.pcbway.com) +I adapted the configurations from kicad-gerberzipper to KiBot configurations, they are available as [internal templates](#importing-internal-templates). ## Notes about the position file diff --git a/kibot/resources/config_templates/FusionPCB.kibot.yaml b/kibot/resources/config_templates/FusionPCB.kibot.yaml new file mode 100644 index 00000000..d316e512 --- /dev/null +++ b/kibot/resources/config_templates/FusionPCB.kibot.yaml @@ -0,0 +1,65 @@ +# 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) +kibot: + version: 1 + +groups: + - name: _FusionPCB + outputs: + - _FusionPCB_gerbers + - _FusionPCB_drill + +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 + + - 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" + + - name: _FusionPCB_compress + comment: ZIP file for FusionPCB + type: compress + dir: FusionPCB + options: + files: + - from_output: _FusionPCB_gerbers + dest: / + - from_output: _FusionPCB_drill + dest: / diff --git a/kibot/resources/config_templates/JLCPCB.kibot.yaml b/kibot/resources/config_templates/JLCPCB.kibot.yaml new file mode 100644 index 00000000..16887616 --- /dev/null +++ b/kibot/resources/config_templates/JLCPCB.kibot.yaml @@ -0,0 +1,141 @@ +# 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) +kibot: + version: 1 + +filters: + - name: _only_jlc_parts + comment: 'Only parts with JLC (LCSC) code' + type: generic + include_only: + - column: 'LCSC#' + regex: '^C\d+' + +groups: + - name: _JLCPCB_fab + outputs: + - _JLCPCB_gerbers + - _JLCPCB_drill + - name: _JLCPCB_assembly + outputs: + - _JLCPCB_position + - _JLCPCB_bom + - name: _JLCPCB + outputs: + - _JLCPCB_fab + - _JLCPCB_assembly + +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: + - copper + - F.SilkS + - B.SilkS + - F.Mask + - B.Mask + - Edge.Cuts + + - name: _JLCPCB_gerbers_stencil + comment: Gerbers for the stencils compatible with JLCPCB + type: gerber + dir: JLCPCB + run_by_default: false + options: *gerber_options + layers: + - F.Paste + - B.Paste + + - 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" + + - name: _JLCPCB_position + comment: "Pick and place file, JLCPCB style" + type: position + dir: JLCPCB + options: + pre_transform: _rot_footprint + 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 + + - 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 + + - name: _JLCPCB_compress + 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: / diff --git a/kibot/resources/config_templates/P-Ban.kibot.yaml b/kibot/resources/config_templates/P-Ban.kibot.yaml new file mode 100644 index 00000000..08c9e65e --- /dev/null +++ b/kibot/resources/config_templates/P-Ban.kibot.yaml @@ -0,0 +1,78 @@ +# Gerber and drill files for P-Ban, without stencil +# URL: https://www.p-ban.com/ +# Based on setting used by Gerber Zipper (https://github.com/g200kg/kicad-gerberzipper) +kibot: + version: 1 + +groups: + - name: _P-Ban + outputs: + - _P-Ban_gerbers + - _P-Ban_drill + +outputs: + - name: _P-Ban_gerbers + comment: Gerbers compatible with P-Ban + type: gerber + dir: P-Ban + 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 + gerber_precision: 4.6 + use_gerber_x2_attributes: true + use_gerber_net_attributes: false + line_width: 0.15 + subtract_mask_from_silk: false + inner_extension_pattern: '.g%n' + custom_reports: + - output: '製造基準書.txt' + content: '部品面パターン : ${filename(F.Cu)}\r\n半田面パターン : ${filename(B.Cu)}\r\n内層パターン1 : ${filename(In1.Cu)}\r\n内層パターン2 : ${filename(In2.Cu)}\r\n内層パターン3 : ${filename(In3.Cu)}\r\n内層パターン4 : ${filename(In4.Cu)}\r\n内層パターン5 : ${filename(In5.Cu)}\r\n内層パターン6 : ${filename(In6.Cu)}\r\n部品面レジスト : ${filename(F.Mask)}\r\n半田面レジスト : ${filename(B.Mask)}\r\n部品面シルク : ${filename(F.SilkS)}\r\n半田面シルク : ${filename(B.SilkS)}\r\n基板外形 : ${filename(Edge.Cuts)}\r\n\nドリルデータ : ${basename}.drl\r\nドリルマップ : ${basename}-drl_map.gbr\r\nドリルリスト : ${basename}-drl.rpt\r\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 + + - name: _P-Ban_drill + comment: Drill files compatible with P-Ban + type: excellon + dir: P-Ban + options: + pth_and_npth_single_file: true + map: + type: gerber + report: + filename: '%f-drl.rpt' + zeros_format: SUPPRESS_LEADING + left_digits: 3 + right_digits: 3 + output: "%f.drl" + + - name: _P-Ban_compress + comment: ZIP file for P-Ban + type: compress + dir: P-Ban + options: + files: + - from_output: _P-Ban_gerbers + dest: / + - from_output: _P-Ban_drill + dest: / diff --git a/kibot/resources/config_templates/PCBWay.kibot.yaml b/kibot/resources/config_templates/PCBWay.kibot.yaml new file mode 100644 index 00000000..6d27a692 --- /dev/null +++ b/kibot/resources/config_templates/PCBWay.kibot.yaml @@ -0,0 +1,75 @@ +# 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) +kibot: + version: 1 + +groups: + - name: _PCBWay + outputs: + - _PCBWay_gerbers + - _PCBWay_drill + +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 + + - 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" + + - name: _PCBWay_compress + comment: ZIP file for PCBWay + type: compress + dir: PCBWay + options: + format: ZIP + files: + - from_output: _PCBWay_gerbers + dest: / + - from_output: _PCBWay_drill + dest: / diff --git a/tests/yaml_samples/import_test_internal_jlc.kibot.yaml b/tests/yaml_samples/import_test_internal_jlc.kibot.yaml new file mode 100644 index 00000000..9b8d711e --- /dev/null +++ b/tests/yaml_samples/import_test_internal_jlc.kibot.yaml @@ -0,0 +1,6 @@ +kibot: + version: 1 + +import: + - file: JLCPCB + is_internal: true diff --git a/tests/yaml_samples/import_test_internal_pban.kibot.yaml b/tests/yaml_samples/import_test_internal_pban.kibot.yaml new file mode 100644 index 00000000..7dd4d573 --- /dev/null +++ b/tests/yaml_samples/import_test_internal_pban.kibot.yaml @@ -0,0 +1,6 @@ +kibot: + version: 1 + +import: + - file: P-Ban + is_internal: true