diff --git a/kibot/gs.py b/kibot/gs.py index 5b5ee222..e2580a31 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -432,6 +432,8 @@ class GS(object): sm = pcbnew.GetSettingsManager() sm.UnloadProject(GS.board.GetProject(), False) assert sm.LoadProject(pro_name) + # If we use the old project KiCad SIGSEGV + GS.board = None @staticmethod def get_resource_path(name): diff --git a/kibot/out_panelize.py b/kibot/out_panelize.py index 1e40db94..80f2567e 100644 --- a/kibot/out_panelize.py +++ b/kibot/out_panelize.py @@ -725,6 +725,9 @@ class PanelizeOptions(VariantOptions): board = GS.load_board_low_level(name) logger.debug('Creating preview image ...') out.options.create_image(img_name, board) + # KiCad loads the project automagically, so now we have the wrong project loaded + # We need to unload the current project to load the new one + # But we also need to reload the PCB, this is ridiculous ... GS.reload_project(GS.pro_file) def run(self, output): diff --git a/kibot/pre_set_text_variables.py b/kibot/pre_set_text_variables.py index 11c8307c..11d1117a 100644 --- a/kibot/pre_set_text_variables.py +++ b/kibot/pre_set_text_variables.py @@ -148,8 +148,5 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821 with open(pro_name, 'wt') as f: f.write(json.dumps(data, sort_keys=True, indent=2)) if GS.board: - # Force a project reload + # Force a project and PCB reload GS.reload_project(pro_name) - # TODO: Do we really need to reload the PCB? - # Force the PCB reload (will reload the project file) - GS.board = None