Skip to content

Commit 0ddc114

Browse files
committed
[Added][Globals] disable_kicad_cross_on_fab to disable KiCad crosses
- KiCad 9 changes its default behavior and crosses DNPs on Fab layer, making impossible to have no crosses. - So now we disable it. Fixes #866
1 parent fe77b29 commit 0ddc114

7 files changed

Lines changed: 17 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Global options:
1414
- `update_pcb_text_cache`: Used to copy the text variables from the project
1515
to the PCB file (#860 #861)
16+
- `disable_kicad_cross_on_fab`: To avoid KiCad 9 crosses on Fab layer, so
17+
only KiBot controls it (#866)
1618
- Internal templates:
1719
- PCB2Blender_2_17: generates a pcb2blender 2.17 file to import on Blender
1820
- Pre-flights:

docs/source/Changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Added
2828

2929
- ``update_pcb_text_cache``: Used to copy the text variables from
3030
the project to the PCB file (#860 #861)
31+
- ``disable_kicad_cross_on_fab``: To avoid KiCad 9 crosses on Fab
32+
layer, so only KiBot controls it (#866)
3133

3234
- Internal templates:
3335

docs/source/configuration/sup_globals.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
- ``copper_thickness`` :index:`: <pair: global options; copper_thickness>` [:ref:`number <number>` | :ref:`string <string>`] Copper thickness in micrometers (1 Oz is 35 micrometers).
3636
KiCad 6: you should set this in the Board Setup -> Physical Stackup.
3737
- ``cross_footprints_for_dnp`` :index:`: <pair: global options; cross_footprints_for_dnp>` [:ref:`boolean <boolean>`] (default: ``true``) Draw a cross for excluded components in the `Fab` layer.
38-
- ``cross_no_body`` :index:`: <pair: global options; cross_no_body>` [:ref:`boolean <boolean>`] (default: ``false``) Cross components even when they don't have a body. Only for KiCad 6 and internal cross.
39-
- ``cross_using_kicad`` :index:`: <pair: global options; cross_using_kicad>` [:ref:`boolean <boolean>`] (default: ``true``) When using KiCad 7+ let KiCad cross the components.
38+
- ``cross_no_body`` :index:`: <pair: global options; cross_no_body>` [:ref:`boolean <boolean>`] (default: ``false``) Cross components even when they don't have a body. Only for KiCad 6 and internal cross (Schematic).
39+
- ``cross_using_kicad`` :index:`: <pair: global options; cross_using_kicad>` [:ref:`boolean <boolean>`] (default: ``true``) When using KiCad 7+ let KiCad cross the components (Schematic).
4040
- ``csv_accept_no_ref`` :index:`: <pair: global options; csv_accept_no_ref>` [:ref:`boolean <boolean>`] (default: ``false``) Accept aggregating CSV files without references (Experimental).
4141
- ``date_format`` :index:`: <pair: global options; date_format>` [:ref:`string <string>`] (default: ``'%Y-%m-%d'``) Format used for the day we started the script.
4242
Is also used for the PCB/SCH date formatting when `time_reformat` is enabled (default behavior). |br|
@@ -48,6 +48,7 @@
4848
- ``dir`` :index:`: <pair: global options; dir>` [:ref:`string <string>`] (default: ``''``) Default pattern for the output directories. It also applies to the preflights, unless
4949
`use_dir_for_preflights` is disabled.
5050
- ``disable_3d_alias_as_env`` :index:`: <pair: global options; disable_3d_alias_as_env>` [:ref:`boolean <boolean>`] (default: ``false``) Disable the use of environment and text variables as 3D models aliases.
51+
- ``disable_kicad_cross_on_fab`` :index:`: <pair: global options; disable_kicad_cross_on_fab>` [:ref:`boolean <boolean>`] (default: ``true``) Disable KiCad cross on Fab layers, so only KiBot does it (KiCad 9+).
5152
- ``dnp_cross_bottom_layer`` :index:`: <pair: global options; dnp_cross_bottom_layer>` [:ref:`string <string>`] (default: ``'B.Fab'``) Layer on which to add DNP cross for the bottom components.
5253
- ``dnp_cross_top_layer`` :index:`: <pair: global options; dnp_cross_top_layer>` [:ref:`string <string>`] (default: ``'F.Fab'``) Layer on which to add DNP cross for the top components.
5354
- ``drc_exclusions_workaround`` :index:`: <pair: global options; drc_exclusions_workaround>` [:ref:`boolean <boolean>`] (default: ``false``) KiCad 6 introduced DRC exclusions. They are stored in the project but ignored by the Python API.

kibot/globals.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,12 @@ def __init__(self):
200200
""" Layer on which to add DNP cross for the top components """
201201
self.dnp_cross_bottom_layer = 'B.Fab'
202202
""" Layer on which to add DNP cross for the bottom components """
203+
self.disable_kicad_cross_on_fab = True
204+
""" Disable KiCad cross on Fab layers, so only KiBot does it (KiCad 9+) """
203205
self.cross_no_body = False
204-
""" Cross components even when they don't have a body. Only for KiCad 6 and internal cross """
206+
""" Cross components even when they don't have a body. Only for KiCad 6 and internal cross (Schematic) """
205207
self.cross_using_kicad = True
206-
""" When using KiCad 7+ let KiCad cross the components """
208+
""" When using KiCad 7+ let KiCad cross the components (Schematic) """
207209
self.csv_accept_no_ref = False
208210
""" Accept aggregating CSV files without references (Experimental) """
209211
self.date_format = '%Y-%m-%d'

kibot/gs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ class GS(object):
227227
global_kicad_dnp_applies_to_3D = None
228228
global_cross_using_kicad = None
229229
global_work_layer = None
230+
# Only for KiCad 9+
231+
global_disable_kicad_cross_on_fab = None
230232
pasteable_cmd = shlex.join if hasattr(shlex, 'join') else lambda x: str(x) # novermin
231233

232234
@staticmethod

kibot/out_any_layer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def run(self, output_dir, layers):
170170
plot_ctrl = PLOT_CONTROLLER(GS.board)
171171
# set up plot options for the whole output
172172
po = plot_ctrl.GetPlotOptions()
173+
if GS.global_disable_kicad_cross_on_fab and hasattr(po, "SetCrossoutDNPFPsOnFabLayers"):
174+
po.SetCrossoutDNPFPsOnFabLayers(False)
173175
self._configure_plot_ctrl(po, output_dir)
174176
# Gerber Job files aren't automagically created
175177
# We need to assist KiCad

kibot/out_pcb_print.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,8 @@ def init_plot_controller(self):
14271427
po.SetUseAuxOrigin(False)
14281428
po.SetAutoScale(False)
14291429
GS.SetSvgPrecision(po, self.svg_precision)
1430+
if GS.global_disable_kicad_cross_on_fab and hasattr(po, "SetCrossoutDNPFPsOnFabLayers"):
1431+
po.SetCrossoutDNPFPsOnFabLayers(False)
14301432
return pc, po
14311433

14321434
def set_visible(self, edge_id):

0 commit comments

Comments
 (0)