[3D][Changed] Downloaded 3D models are no longer discarded

- They are stored in ~/.cache/kibot/3d
- You can change the directory using KIBOT_3D_MODELS
This commit is contained in:
Salvador E. Tropea 2023-01-28 11:26:34 -03:00
parent bd00731355
commit aa56322241
2 changed files with 6 additions and 4 deletions

View File

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

View File

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