feat: Default to Main Assembly V1 (2).stl model in repository and settings
This commit is contained in:
Binary file not shown.
@@ -151,6 +151,15 @@ class ControlApi:
|
|||||||
def _migrate_legacy_model(self):
|
def _migrate_legacy_model(self):
|
||||||
if self.model_cache.is_file():
|
if self.model_cache.is_file():
|
||||||
return
|
return
|
||||||
|
default_asset = Path(__file__).resolve().parent / "assets" / "Main Assembly V1 (2).stl"
|
||||||
|
if default_asset.is_file():
|
||||||
|
try:
|
||||||
|
self.model_cache.parent.mkdir(exist_ok=True)
|
||||||
|
shutil.copyfile(default_asset, self.model_cache)
|
||||||
|
self.model_cache_name.write_text(default_asset.name, encoding="utf-8")
|
||||||
|
return
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
path = Path(json.loads(self.model_path.read_text(encoding="utf-8"))["path"])
|
path = Path(json.loads(self.model_path.read_text(encoding="utf-8"))["path"])
|
||||||
if path.is_file() and path.suffix.lower() == ".stl" and path.stat().st_size <= 30 * 1024 * 1024:
|
if path.is_file() and path.suffix.lower() == ".stl" and path.stat().st_size <= 30 * 1024 * 1024:
|
||||||
|
|||||||
Reference in New Issue
Block a user