Skip to content

Commit

Permalink
[PCB Print][Fixed] drill map needs KiCad 7 or newer
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Jan 10, 2025
1 parent eec9997 commit 2c0fe98
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
7 changes: 4 additions & 3 deletions docs/samples/generic_plot.kibot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3062,12 +3062,13 @@ outputs:
# [boolean=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
repeat_inherit: true
# [list(dict)|list(string)|string='inners'] [all,selected,copper,technical,user,inners,outers,*]
# List of layers to replace `repeat_for_layer`.
# [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`.
# 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, which might contain
# a group used to insert the drill table (like in the `include_table` preflight)
# a group used to insert the drill table (like in the `include_table` preflight).
# The drill map needs KiCad 7 or newer
repeat_layers:
# [string=''] Color used for this layer.
# KiCad 6+: don't forget the alpha channel for layers like the solder mask
Expand Down
8 changes: 7 additions & 1 deletion docs/source/configuration/outputs/PagesOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ PagesOptions parameters
See `repeat_layers`.
- ``repeat_inherit`` :index:`: <pair: output - pcb_print - options - pages; repeat_inherit>` [:ref:`boolean <boolean>`] (default: ``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.
- ``repeat_layers`` :index:`: <pair: output - pcb_print - options - pages; repeat_layers>` [:ref:`LayerOptions parameters <LayerOptions>`] [:ref:`list(dict) <list(dict)>` | :ref:`list(string) <list(string)>` | :ref:`string <string>`] (default: ``'inners'``) (choices: "all", "selected", "copper", "technical", "user", "inners", "outers") (also accepts any string).
- ``repeat_layers`` :index:`: <pair: output - pcb_print - options - pages; repeat_layers>` [:ref:`LayerOptions parameters <LayerOptions>`] [:ref:`list(dict) <list(dict)>` | :ref:`list(string) <list(string)>` | :ref:`string <string>`] (default: ``'inners'``) (choices: "all", "selected", "copper", "technical", "user", "inners", "outers") (also accepts any string) List
of layers to replace `repeat_for_layer`. |br|
This can be used to generate a page for each copper layer, here you put `copper`. |br|
You can also use it to generate pages with drill maps, in this case use `drill_pairs` here. |br|
Note that in this case the `repeat_for_layer` should be some drawing layer, which might contain
a group used to insert the drill table (like in the `include_table` preflight). |br|
The drill map needs KiCad 7 or newer.
- ``sheet`` :index:`: <pair: output - pcb_print - options - pages; sheet>` [:ref:`string <string>`] (default: ``'Assembly'``) Text to use for the `SHEET` in the title block.
Pattern (%*) and text variables are expanded. |br|
The %ll is the list of layers included in this page. |br|
Expand Down
16 changes: 10 additions & 6 deletions kibot/out_pcb_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,13 @@ def __init__(self):
This can be used to generate a page for each copper layer, here you put `F.Cu`.
See `repeat_layers` """
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`.
""" [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`.
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, which might contain
a group used to insert the drill table (like in the `include_table` preflight)"""
a group used to insert the drill table (like in the `include_table` preflight).
The drill map needs KiCad 7 or newer """
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 """
Expand Down Expand Up @@ -998,6 +999,8 @@ def search_text(self, svg, texts):

def add_drill_map_drawing(self, p, g):
if p._is_drill:
if not GS.ki7:
raise KiPlotConfigurationError('The `pcb_print` drill map needs KiCad 7 or newer')
layer = p._drill_map_layer
index = p._drill_pair_index
draw_drill_map(g, layer, index, self._drill_unify_pth_and_npth,
Expand Down Expand Up @@ -1745,9 +1748,10 @@ def get_conf_examples(name, layers):
ly['color'] = '#14332440'
pages.append(page)
# Drill map
page = {'repeat_for_layer': 'User.Drawings', 'repeat_layers': 'drill_pairs', 'layers':
[{'layer': 'User.Drawings', 'color': '#000000'}, {'layer': 'Edge.Cuts', 'color': '#000000'}]}
pages.append(page)
if GS.ki7:
page = {'repeat_for_layer': 'User.Drawings', 'repeat_layers': 'drill_pairs', 'layers':
[{'layer': 'User.Drawings', 'color': '#000000'}, {'layer': 'Edge.Cuts', 'color': '#000000'}]}
pages.append(page)
ops = {'format': fmt, 'pages': pages, 'keep_temporal_files': True}
if fmt in ['PNG', 'SVG']:
ops['add_background'] = True
Expand Down

0 comments on commit 2c0fe98

Please sign in to comment.