[3D] Added option to enable the colored R cache

This commit is contained in:
Salvador E. Tropea 2023-03-21 10:40:27 -03:00
parent 92b7206eff
commit 786c94a80c
4 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `colored_tht_resistors` to disable the 3D colored resistors.
- `field_tolerance` field/s to look for resistor tolerance.
- `default_resistor_tolerance` which tolerance to use when none found.
- `cache_3d_resistors` to avoid generating them all the time.
- 3D: colored 3D models for THT resistors
### Fixed

View File

@ -274,6 +274,9 @@ class Globals(FiltersOptions):
""" When no tolerance is specified we use this value.
Note that I know 5% is a common default, but technically speaking 20% is the default.
Used while creating colored resistors """
self.cache_3d_resistors = False
""" Use a cache for the generated 3D models of colored resistors.
Will save time, but you could need to remove the cache if you need to regenerate them """
self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ")
self._filter_what = 'KiBot warnings'
self.filters = FilterOptionsKiBot

View File

@ -122,6 +122,7 @@ class GS(object):
def_global_output = '%f-%i%I%v.%x'
# The class that controls the global options
class_for_global_opts = None
global_cache_3d_resistors = None
global_castellated_pads = None
global_colored_tht_resistors = None
global_copper_thickness = None

View File

@ -405,7 +405,7 @@ class Base3DOptions(VariantOptions):
self.widths = self.widths[:-2]
# Create the name in the cache
cache_name = self.colored_tht_resistor_name(name, bars)
if os.path.isfile(cache_name):
if os.path.isfile(cache_name) and GS.global_cache_3d_resistors:
status = 'cached'
else:
status = 'created'