diff --git a/CHANGELOG.md b/CHANGELOG.md index bc0a5119..040d1c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A mechanism to filter components for a particular layer (#706) - Workaround for Ghostscript handling %d wrong when followed by an hex digit (#763) + - Now you can include drill maps using `drill_pairs` as `repeat_layers` (#764) - Report: - `top_total`, `bot_total`, `total_smd`, `total_tht` and `total_all` component counts (See #730) diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index aa0ee241..0e6fadc4 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -2882,6 +2882,14 @@ outputs: # [number=360] [36,1200] Resolution (Dots Per Inch) for the output file. Most objects are vectors, but thing # like the the solder mask are handled as images by the conversion tools dpi: 360 + # [boolean|dict=false] Use a boolean for simple cases or fine-tune its behavior + drill: + # [boolean=true] By default KiCad groups slots and rounded holes if they can be cut from the same tool (same diameter) + group_slots_and_round_holes: true + # [string='auto'] [yes,no,auto] Choose whether to unify plated and non-plated + # holes in the same table. If 'auto' is chosen, the setting is copied + # from the `excellon` output's `pth_and_npth_single_file` + unify_pth_and_npth: 'auto' # [string='full'] [none,small,full] What to use to indicate the drill places, can be none, small or full (for real scale) drill_marks: 'full' # [string|list(string)='_null'] Name of the filter to exclude components from processing. @@ -3005,7 +3013,9 @@ outputs: repeat_inherit: true # [list(dict)|list(string)|string='inners'] [all,selected,copper,technical,user,inners,outers,*] # List of layers to replace `repeat_for_layer`. - # This can be used to generate a page for each copper layer, here you put `copper` + # This can be used to generate a page for each copper layer, here you put `copper`. + # You can also use it to generate pages with drill maps, in this case use `drill_pairs` here. + # Note that in this case the `repeat_for_layer` should be some drawing layer repeat_layers: # [string=''] Color used for this layer. # KiCad 6+: don't forget the alpha channel for layers like the solder mask @@ -3040,7 +3050,9 @@ outputs: # Pattern (%*) and text variables are expanded. # The %ll is the list of layers included in this page. # In addition when you use `repeat_for_layer` the following patterns are available: - # %ln layer name, %ls layer suffix and %ld layer description + # %ln layer name, %ls layer suffix and %ld layer description. + # When `repeat_layers` is `drill_pairs`, the following additional patterns are available: + # %lnp layer name pair, %lp layer pair sheet: 'Assembly' # [string=''] Color to use for the frame and title block sheet_reference_color: '' diff --git a/docs/source/Changelog.rst b/docs/source/Changelog.rst index b6f11662..91c155a4 100644 --- a/docs/source/Changelog.rst +++ b/docs/source/Changelog.rst @@ -87,6 +87,8 @@ Added - A mechanism to filter components for a particular layer (#706) - Workaround for Ghostscript handling %d wrong when followed by an hex digit (#763) + - Now you can include drill maps using ``drill_pairs`` as + ``repeat_layers`` (#764) - Report: diff --git a/docs/source/configuration/outputs/PCB_PrintOptions.rst b/docs/source/configuration/outputs/PCB_PrintOptions.rst index bbcb28cb..5c1d58fc 100644 --- a/docs/source/configuration/outputs/PCB_PrintOptions.rst +++ b/docs/source/configuration/outputs/PCB_PrintOptions.rst @@ -32,6 +32,7 @@ PCB_PrintOptions parameters - ``dpi`` :index:`: ` [:ref:`number `] (default: ``360``) (range: 36 to 1200) Resolution (Dots Per Inch) for the output file. Most objects are vectors, but thing like the the solder mask are handled as images by the conversion tools. +- ``drill`` :index:`: ` [:ref:`DrillOptions parameters `] [:ref:`boolean ` | :ref:`dict `] (default: ``false``) Use a boolean for simple cases or fine-tune its behavior. - ``drill_marks`` :index:`: ` [:ref:`string `] (default: ``'full'``) (choices: "none", "small", "full") What to use to indicate the drill places, can be none, small or full (for real scale). - ``exclude_filter`` :index:`: ` [:ref:`string ` | :ref:`list(string) `] (default: ``'_null'``) Name of the filter to exclude components from processing. Is a short-cut to use for simple cases where a variant is an overkill. |br| @@ -87,4 +88,5 @@ PCB_PrintOptions parameters .. toctree:: :caption: Used dicts + DrillOptions PagesOptions diff --git a/docs/source/configuration/outputs/PagesOptions.rst b/docs/source/configuration/outputs/PagesOptions.rst index e3251c55..567457d5 100644 --- a/docs/source/configuration/outputs/PagesOptions.rst +++ b/docs/source/configuration/outputs/PagesOptions.rst @@ -34,7 +34,9 @@ PagesOptions parameters Pattern (%*) and text variables are expanded. |br| The %ll is the list of layers included in this page. |br| In addition when you use `repeat_for_layer` the following patterns are available: - %ln layer name, %ls layer suffix and %ld layer description. + %ln layer name, %ls layer suffix and %ld layer description. |br| + When `repeat_layers` is `drill_pairs`, the following additional patterns are available: + %lnp layer name pair, %lp layer pair. - ``sheet_reference_color`` :index:`: ` [:ref:`string `] (default: ``''``) Color to use for the frame and title block. - ``sketch_pad_line_width`` :index:`: ` [:ref:`number `] (default: ``0.1``) Line width for the sketched pads [mm], see `sketch_pads_on_fab_layers` (KiCad 6+) Note that this value is currently ignored by KiCad (6.0.9). diff --git a/kibot/out_pcb_print.py b/kibot/out_pcb_print.py index a2abc523..2fa564dc 100644 --- a/kibot/out_pcb_print.py +++ b/kibot/out_pcb_print.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2022-2024 Salvador E. Tropea -# Copyright (c) 2022-2024 Instituto Nacional de TecnologĂ­a Industrial +# Copyright (c) 2022-2025 Salvador E. Tropea +# Copyright (c) 2022-2025 Instituto Nacional de TecnologĂ­a Industrial # License: AGPL-3.0 # Project: KiBot (formerly KiPlot) # Base idea: https://gitlab.com/dennevi/Board2Pdf/ (Released as Public Domain) +# Drill maps contributed by Nguyen Vincent (@nguyen-v) """ Dependencies: - from: RSVG @@ -268,7 +269,9 @@ def __init__(self): self.repeat_layers = LayerOptions """ [list(dict)|list(string)|string='inners'] [all,selected,copper,technical,user,inners,outers,*] List of layers to replace `repeat_for_layer`. - This can be used to generate a page for each copper layer, here you put `copper` """ + This can be used to generate a page for each copper layer, here you put `copper`. + You can also use it to generate pages with drill maps, in this case use `drill_pairs` here. + Note that in this case the `repeat_for_layer` should be some drawing layer """ self.repeat_inherit = True """ If we will inherit the options of the layer we are replacing. Disable it if you specify the options in `repeat_layers`, which is unlikely """ diff --git a/tests/GUI/outputs b/tests/GUI/outputs index 5c262398..f81340bf 100644 --- a/tests/GUI/outputs +++ b/tests/GUI/outputs @@ -8953,6 +8953,29 @@ ], null ], + [ + "drill", + [ + "DataTypeDict", + "DataTypeBoolean" + ], + [ + [ + "unify_pth_and_npth", + [ + "DataTypeChoice" + ], + null + ], + [ + "group_slots_and_round_holes", + [ + "DataTypeBoolean" + ], + null + ] + ] + ], [ "drill_marks", [ diff --git a/tests/GUI/stats b/tests/GUI/stats index f9f9acc3..15649cb2 100644 --- a/tests/GUI/stats +++ b/tests/GUI/stats @@ -1,6 +1,6 @@ -48 outputs types with a total of 1948 different parameters -Single type parameters: 1772 (91 %) -Multi type parameters: 176 (9 %) +48 outputs types with a total of 1951 different parameters +Single type parameters: 1774 (91 %) +Multi type parameters: 177 (9 %) Average parameters: 41 Maximum number of parameters: 217 Minimum number of parameters: 14 @@ -73,7 +73,7 @@ Outputs sorted by parameters: - pdf: 65 - render_3d: 67 - blender_export: 76 -- pcb_print: 94 +- pcb_print: 97 - bom: 149 - panelize: 217 Average depth: 2.5833333333333335 @@ -138,11 +138,11 @@ Outputs sorted by depth: -------------------------------------------------------------------------------- 14 different data types - String: 854 -- Boolean: 479 +- Boolean: 481 - Number: 270 - ListStringSingular: 265 -- Choice: 99 -- Dict: 81 +- Choice: 100 +- Dict: 82 - ListDictOrString: 23 - ListDict: 20 - Combo: 14 @@ -154,10 +154,10 @@ Outputs sorted by depth: -------------------------------------------------------------------------------- Used as single data type: - String: 698 -- Boolean: 423 +- Boolean: 424 - ListStringSingular: 262 - Number: 176 -- Choice: 96 +- Choice: 97 - Dict: 70 - ListDict: 20 - ListString: 9 ['blender_export.options.pcb3d.highlight', 'bom.options.group_fields', 'bom.options.group_fields_fallbacks', 'bom.options.no_conflict', 'kibom.options.conf.group_fields', 'pcbdraw.options.libs', 'pcbdraw.options.highlight', 'render_3d.options.highlight', 'vrml.options.highlight'] @@ -168,7 +168,7 @@ Used as single data type: - StringDict: 1 ['download_datasheets.options.classify_extra'] - NumberChoice: 1 ['gerber.options.gerber_precision'] -------------------------------------------------------------------------------- -10 different data type combinations +11 different data type combinations - Number,String: 92 - Boolean,String: 52 - Combo,ListDictOrString: 12 @@ -178,6 +178,7 @@ Used as single data type: - Choice,Dict: 2 ['excellon.options.map', 'gerb_drill.options.map'] - Dict,Number: 2 ['pcbdraw.options.margin', 'svg.options.margin'] - Boolean,Choice: 1 ['ibom.options.highlight_pin1'] +- Boolean,Dict: 1 ['pcb_print.options.drill'] - String,StringDict: 1 ['pcbdraw.options.remap'] ================================================================================ ================================================================================ @@ -392,9 +393,9 @@ Used as single data type: - Number,String: 15 ================================================================================ ================================================================================ -87 totals types with a total of 2322 different parameters -Single type parameters: 2122 (91 %) -Multi type parameters: 200 (9 %) +87 totals types with a total of 2325 different parameters +Single type parameters: 2124 (91 %) +Multi type parameters: 201 (9 %) Average parameters: 27 Maximum number of parameters: 217 Minimum number of parameters: 1 @@ -506,7 +507,7 @@ Totals sorted by parameters: - pdf: 65 - render_3d: 67 - blender_export: 76 -- pcb_print: 94 +- pcb_print: 97 - bom: 149 - panelize: 217 Average depth: 2.206896551724138 @@ -610,11 +611,11 @@ Totals sorted by depth: -------------------------------------------------------------------------------- 14 different data types - String: 1007 -- Boolean: 578 +- Boolean: 580 - Number: 320 - ListStringSingular: 294 -- Choice: 131 -- Dict: 92 +- Choice: 132 +- Dict: 93 - ListDict: 30 - ListDictOrString: 26 - Combo: 14 @@ -626,10 +627,10 @@ Totals sorted by depth: -------------------------------------------------------------------------------- Used as single data type: - String: 835 -- Boolean: 514 +- Boolean: 515 - ListStringSingular: 291 - Number: 211 -- Choice: 128 +- Choice: 129 - Dict: 73 - ListDict: 30 - ListString: 12 @@ -644,7 +645,7 @@ Used as single data type: - Number,String: 107 - Boolean,String: 52 - Combo,ListDictOrString: 12 -- Boolean,Dict: 8 ['draw_fancy_stackup.draw_fancy_stackup', 'draw_stackup.draw_stackup', 'drc.drc', 'erc.erc', 'include_table.include_table', 'run_drc.run_drc', 'run_erc.run_erc', 'update_xml.update_xml'] +- Boolean,Dict: 9 ['pcb_print.options.drill', 'draw_fancy_stackup.draw_fancy_stackup', 'draw_stackup.draw_stackup', 'drc.drc', 'erc.erc', 'include_table.include_table', 'run_drc.run_drc', 'run_erc.run_erc', 'update_xml.update_xml'] - Dict,String: 7 ['blender_export.options.pcb3d', 'excellon.options.report', 'excellon.options.table', 'gerb_drill.options.report', 'gerb_drill.options.table', 'kibom.options.conf', 'pcbdraw.options.style'] - ListDictOrString,String: 5 ['bom.options.columns.join', 'bom.options.cost_extra_columns.join', 'bom.options.xlsx.specs_columns.join', 'panelize.options.configs', 'include_table.include_table.outputs'] - Boolean,ListStringSingular: 3 ['bom.options.html.lcsc_link', 'bom.options.xlsx.lcsc_link', 'kibom.options.conf.lcsc_link']