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
This commit is contained in:
Salvador E. Tropea 2022-04-18 13:18:32 -03:00
parent e701e69a53
commit 36987cfcec
1 changed files with 4 additions and 0 deletions

View File

@ -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: