From 36987cfcecfcabbf85e31dadb2b5ee401af96e21 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 18 Apr 2022 13:18:32 -0300 Subject: [PATCH] Fixed kicad2step not loading 3D models (bizarre case) - If we saved the PCB to /tmp and then we reverted the changes to use the PCB the KIPRJMOD environment var pointed to the temporal. - KiCad defines it during Save and Python becomes unsync, so we can't even notice it! Fixes #186 --- kibot/out_step.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kibot/out_step.py b/kibot/out_step.py index 7d512f81..e4d3bc44 100644 --- a/kibot/out_step.py +++ b/kibot/out_step.py @@ -82,6 +82,10 @@ class STEPOptions(Base3DOptions): cmd, video_remove = add_extra_options(cmd) # Execute and inform is successful logger.debug('Executing: '+str(cmd)) + # Ensure KIPRJMOD is correct: + # KiCad sets KIPRJMOD each time we call BOARD.Save() but then Python `os.environ` becomes unsynchronized + # We don't even know the actual value and any call to Save could destroy it + os.environ['KIPRJMOD'] = os.path.dirname(board_name) try: cmd_output = check_output(cmd, stderr=STDOUT) except CalledProcessError as e: