[PCB][Added] Invalidate the text variables cache
- Only when `set_text_variables` is used - Can be controlled by global option `invalidate_pcb_text_cache` - Not even the KiCad developers agree about if the cached values should be reset or not, see https://gitlab.com/kicad/code/kicad/-/issues/14360 But if we don't reset them the user will think KiBot is failing to set them. As using `set_text_variables` is a clear intention of change I think this is the right behavior. Closes #441
This commit is contained in:
parent
5d190aee5d
commit
d6e008ff48
|
|
@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- General:
|
||||
- OS environment expansion in ${VAR}
|
||||
- Now outputs can request to be added to one or more groups (#435)
|
||||
- PCB text variables cached in the PCB are now reset when the config
|
||||
uses `set_text_variables`. This is a complex dilemma of KiCad 6/7
|
||||
policy implementation. See
|
||||
[KiCad issue 14360](https://gitlab.com/kicad/code/kicad/-/issues/14360).
|
||||
(#441)
|
||||
- Command line:
|
||||
- `--list-variants` List all available variants (See #434)
|
||||
- `--only-names` to make `--list` list only output names
|
||||
|
|
@ -23,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `field_temp_coef` Name/s of the field/s used for the temperature
|
||||
coefficient
|
||||
- `field_power` Name/s of the field/s used for the power raiting
|
||||
- `invalidate_pcb_text_cache` controls if we reset the text variables cached
|
||||
in the PCB file.
|
||||
- Filters:
|
||||
- New `value_split` to extract information from the Value field and put it in
|
||||
separated fields. I.e. tolerance, voltage, etc.
|
||||
|
|
|
|||
|
|
@ -838,6 +838,10 @@ global:
|
|||
- `hide_excluded`: [boolean=false] Default value for the `hide_excluded` option of various PCB outputs.
|
||||
- `impedance_controlled`: [boolean=false] The PCB needs specific dielectric characteristics.
|
||||
KiCad 6: you should set this in the Board Setup -> Physical Stackup.
|
||||
- `invalidate_pcb_text_cache`: [string='auto'] [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.
|
||||
The `auto` value will remove the cached values only when using `set_text_variables`.
|
||||
- `kiauto_time_out_scale`: [number=0.0] Time-out multiplier for KiAuto operations.
|
||||
- `kiauto_wait_start`: [number=0] Time to wait for KiCad in KiAuto operations.
|
||||
- `kicad_dnp_applied`: [boolean=true] The KiCad v7 PCB flag *Do Not Populate* is applied to our fitted flag before running any filter.
|
||||
|
|
|
|||
|
|
@ -338,6 +338,11 @@ class Globals(FiltersOptions):
|
|||
""" [string|list(string)] Name/s of the field/s used for the power raiting.
|
||||
Used for the value split filter.
|
||||
The default is ['power', 'pow'] """
|
||||
self.invalidate_pcb_text_cache = 'auto'
|
||||
""" [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.
|
||||
The `auto` value will remove the cached values only when using `set_text_variables` """
|
||||
self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ")
|
||||
self._filter_what = 'KiBot warnings'
|
||||
self.filters = FilterOptionsKiBot
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ class GS(object):
|
|||
global_field_voltage = None
|
||||
global_hide_excluded = None
|
||||
global_impedance_controlled = None
|
||||
global_invalidate_pcb_text_cache = None
|
||||
global_kiauto_time_out_scale = None
|
||||
global_kiauto_wait_start = None
|
||||
# This value will overwrite GS.def_global_output if defined
|
||||
|
|
|
|||
|
|
@ -212,6 +212,10 @@ def load_board(pcb_file=None, forced=False):
|
|||
try:
|
||||
with hide_stderr():
|
||||
board = pcbnew.LoadBoard(pcb_file)
|
||||
if GS.global_invalidate_pcb_text_cache == 'yes' and GS.ki6:
|
||||
logger.debug('Current PCB text variables cache: {}'.format(board.GetProperties().items()))
|
||||
logger.debug('Removing cached text variables')
|
||||
board.SetProperties(pcbnew.MAP_STRING_STRING())
|
||||
if BasePreFlight.get_option('check_zone_fills'):
|
||||
GS.fill_zones(board)
|
||||
if GS.global_units and GS.ki6:
|
||||
|
|
|
|||
|
|
@ -165,3 +165,7 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821
|
|||
if GS.board:
|
||||
# Force a project and PCB reload
|
||||
GS.reload_project(pro_name)
|
||||
# Check if we need to force a PCB text variables reset
|
||||
if GS.global_invalidate_pcb_text_cache == 'auto':
|
||||
logger.debug('Forcing PCB text variables reset')
|
||||
GS.global_invalidate_pcb_text_cache = 'yes'
|
||||
|
|
|
|||
Loading…
Reference in New Issue