Model File Import / Export
.tmm is the local model file format for Dreapex TMM. It saves the current structure, optics, sweep configuration, and optimizer settings into a single JSON file that can be reopened in any future version of Dreapex TMM.
| Use case | Description |
|---|---|
| Project archive | Save multiple candidate designs as separate .tmm files for offline archiving |
| Cross-machine migration | Replaces manually copying localStorage; transfer via cloud storage or email |
| Backup before risky operations | Safety net before loading a Case Library entry or importing a URL config |
| Peer review | Send .tmm plus result screenshots to a colleague for one-click reproduction |
Entry Points
Two icon buttons on the right side of the top toolbar:
| Icon | Action | testid |
|---|---|---|
pi pi-file-import | Import a local .tmm file | layout-toolbar-import-model |
pi pi-download | Export the current model as a .tmm file | layout-toolbar-export-model |
File Format
| Item | Value |
|---|---|
| Extension | .tmm |
| Content | Pretty-printed JSON with 2-space indentation, readable in any text editor |
| Top-level shape | { version, savedAt, data }, identical to the browser localStorage autosave format |
data field | Contains five modules: structure / optics / surroundings / sweepList / optimizer |
| Not included | Results (recomputable), Settings (user preferences), Logs, UI state |
{
"version": 1,
"savedAt": "2026-04-21T00:12:34.567Z",
"data": {
"structure": [ ... ],
"optics": { ... },
"surroundings": { ... },
"sweepList": [ ... ],
"optimizer": {
"objectives": [ ... ],
"variables": [ ... ],
"algorithmSettings": { ... }
}
}
}
Export Flow
- Click the
pi pi-downloadbutton in the toolbar. - The browser downloads the file immediately. Default name:
tmm-project-{YYYY-MM-DD}.tmm. - A toast confirms:
Downloaded {fileName}.
No extra validation runs before export. Even if the current model has configuration issues (for example, a missing material), it can still be exported — useful for offline troubleshooting.
Import Flow
- Click the
pi pi-file-importbutton in the toolbar. - Pick a
.tmmor.jsonfile in the file picker. - Files larger than 10 MB are rejected with a
File too largetoast. - JSON is parsed; failure shows
Not valid JSON. - Version pre-check runs based on the
versionfield; migrations run if needed. - A confirmation dialog appears: "This will replace the current model. Continue?"
- After confirmation, the model is written to the store and a toast confirms:
Loaded model from file.
| Failure case | Message | Suggested fix |
|---|---|---|
| Not JSON | Not valid JSON | Check the first lines in a text editor for corruption |
Missing version field | Not a TMM project file | Confirm the file was exported from Dreapex TMM |
| Newer than the app | File is from a newer version of TMM; please upgrade | Upgrade Dreapex TMM, or ask the sender to export a backward-compatible file |
| Shape mismatch / migration failed | File is corrupted or incompatible with current schema | Inspect each data module in a text editor to locate the issue |
| Partial module fallback | Warning toast, defaults substituted | After loading, verify Optics / Sweep / Optimizer |
Backward Compatibility Promise
A .tmm file saved today opens in any future schema version of Dreapex TMM.
How:
- Every snapshot entering the store (
.tmm/ URL config /localStorage) goes through a version-aware migration pipeline; - Older versions are migrated step-by-step to the current version;
- Final shape is validated against the current schema.
version field at export time. On import, files newer than the app's supported version are rejected. Before sharing a model with someone on an older app version, verify their version is compatible.Relationship to Other Persistence
| Mechanism | Scope | Trigger | When to use |
|---|---|---|---|
.tmm file | Model snapshot | Manual export / import | Project archive, cross-machine migration, offline review |
localStorage autosave | Model snapshot | Automatic on edit | In-browser safety net for accidental closes / restarts |
| URL config sharing | Model snapshot + selected Settings | Explicit URL generation | Remote collaboration, paste-link reproduction |
| Case Library | 9 fixed built-in models | Manual selection | Quick entry into a working model; not persisted |
When the goal is to transfer the exact UI state to a colleague, prefer .tmm files: bounded size, no URL-length limit, and the file content is independent of any attachment-handling on the path.
For URL-based sharing, see URL Config Sharing.