diff --git a/CHANGELOG.md b/CHANGELOG.md index 32b4466b..8d13e362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Problems when trying to use groups of layers (i.e. copper) - Report: - Computed size when using circles and some arcs in the PCB edge (#375) +### Changed +- Downloaded 3D models are no longer discarded. + They are stored in ~/.cache/kibot/3d + You can change the directory using KIBOT_3D_MODELS ## [1.5.1] - 2022-12-16 ### Fixed diff --git a/kibot/out_base_3d.py b/kibot/out_base_3d.py index 3abab4fa..cab02029 100644 --- a/kibot/out_base_3d.py +++ b/kibot/out_base_3d.py @@ -6,7 +6,6 @@ from fnmatch import fnmatch import os import requests -import tempfile from .misc import W_MISS3D, W_FAILDL, W_DOWN3D, DISABLE_3D_MODEL_TEXT from .gs import GS from .optionable import Optionable @@ -86,12 +85,11 @@ class Base3DOptions(VariantOptions): if self._tmp_dir is None: self._tmp_dir = os.environ.get('KIBOT_3D_MODELS') if self._tmp_dir is None: - self._tmp_dir = tempfile.mkdtemp() - self._files_to_remove.append(self._tmp_dir) + self._tmp_dir = os.path.join(os.path.expanduser('~'), '.cache', 'kibot', '3d') else: self._tmp_dir = os.path.abspath(self._tmp_dir) rel_dirs.append(self._tmp_dir) - logger.debug('Using `{}` as temporal dir for downloaded files'.format(self._tmp_dir)) + logger.debug('Using `{}` as dir for downloaded 3D models'.format(self._tmp_dir)) dest = os.path.join(self._tmp_dir, fname) os.makedirs(os.path.dirname(dest), exist_ok=True) # Is already there?