Skip to content

Commit

Permalink
[Changed] Stronger workaround for KiCad PCB text cache
Browse files Browse the repository at this point in the history
Fixes issues with external tools when not using variants
Fixes #652
  • Loading branch information
set-soft committed Aug 19, 2024
1 parent 9298905 commit 82f4e2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions kibot/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def __init__(self):
""" [auto,yes,no] Remove any cached text variable in the PCB. This is needed in order to force a text
variables update when using `set_text_variables`. You might want to disable it when applying some
changes to the PCB and create a new copy to send to somebody without changing the cached values.
Note that it will save the PCB with the cache erased.
The `auto` value will remove the cached values only when using `set_text_variables` """
self.git_diff_strategy = 'worktree'
""" [worktree,stash] When computing a PCB/SCH diff it configures how do we preserve the current
Expand Down
4 changes: 4 additions & 0 deletions kibot/kiplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,13 @@ def load_board(pcb_file=None, forced=False):
with hide_stderr():
board = pcbnew.LoadBoard(pcb_file)
if GS.global_invalidate_pcb_text_cache == 'yes' and GS.ki6:
# Workaround for unexpected KiCad behavior:
# https://gitlab.com/kicad/code/kicad/-/issues/14360
logger.debug('Current PCB text variables cache: {}'.format(board.GetProperties().items()))
logger.debug('Removing cached text variables')
board.SetProperties(pcbnew.MAP_STRING_STRING())
# Save the PCB, so external tools also gets the reset, i.e. panelize, see #652
board.Save(pcb_file)
if BasePreFlight.get_option('check_zone_fills'):
GS.fill_zones(board)
if GS.global_units and GS.ki6:
Expand Down

0 comments on commit 82f4e2e

Please sign in to comment.