Download frigidaire_fdpc4221as/source/export_components.py from shu4dev/dishsim-assets: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/datasets/shu4dev/dishsim-assets/resolve/main/frigidaire_fdpc4221as/source/export_components.py
- Command line
-
hf download hf://datasets/shu4dev/dishsim-assets/frigidaire_fdpc4221as/source/export_components.py
-
curl -L -o export_components.py https://huggingface.co/datasets/shu4dev/dishsim-assets/resolve/main/frigidaire_fdpc4221as/source/export_components.py
1.55 kB
| # Copyright (c) 2026, dishsim project. | |
| # SPDX-License-Identifier: BSD-3-Clause | |
| """Export ``geometry.build_components()`` to ``../components.json`` (2026-10-21). | |
| The runtime (``dishsim_frigidaire.geometry.components``) reads this file instead of rebuilding the meshes: per | |
| component its mass, visual meshes (material, points, faces), wire paths ``[name, path, radius]``, solids, sites and | |
| site quaternions. JSON keeps every float exactly (repr round trip). Normals are not exported (nothing reads them). | |
| code/util/run_py.sh data/assets/frigidaire_fdpc4221as/source/export_components.py | |
| """ | |
| import json | |
| from pathlib import Path | |
| from geometry import build_components | |
| def plain(value): | |
| return json.loads(json.dumps(value, default=lambda o: o.tolist() if hasattr(o, "tolist") else str(o))) | |
| def export(path): | |
| out = {name: {"mass": c["mass"], | |
| "meshes": {key: {"material": m.material, "points": plain(m.points), "faces": plain(m.faces)} | |
| for key, m in c["meshes"].items()}, | |
| "wires": [[key, plain(p), float(r)] for key, p, r in c["wires"]], | |
| "solids": plain(c["solids"]), "sites": plain(c.get("sites", {})), | |
| "site_quats": plain(c.get("site_quats", {}))} | |
| for name, c in build_components().items()} | |
| Path(path).write_text(json.dumps(out)) | |
| return path | |
| if __name__ == "__main__": | |
| target = export(Path(__file__).resolve().parents[1] / "components.json") | |
| print(f"[RESULT] PASS {target} ({target.stat().st_size} bytes)") | |