Advanced

Model File Import / Export

Save and restore complete model configurations as .tmm files

.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 caseDescription
Project archiveSave multiple candidate designs as separate .tmm files for offline archiving
Cross-machine migrationReplaces manually copying localStorage; transfer via cloud storage or email
Backup before risky operationsSafety net before loading a Case Library entry or importing a URL config
Peer reviewSend .tmm plus result screenshots to a colleague for one-click reproduction

Entry Points

Two icon buttons on the right side of the top toolbar:

IconActiontestid
pi pi-file-importImport a local .tmm filelayout-toolbar-import-model
pi pi-downloadExport the current model as a .tmm filelayout-toolbar-export-model

File Format

ItemValue
Extension.tmm
ContentPretty-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 fieldContains five modules: structure / optics / surroundings / sweepList / optimizer
Not includedResults (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

  1. Click the pi pi-download button in the toolbar.
  2. The browser downloads the file immediately. Default name: tmm-project-{YYYY-MM-DD}.tmm.
  3. 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

  1. Click the pi pi-file-import button in the toolbar.
  2. Pick a .tmm or .json file in the file picker.
  3. Files larger than 10 MB are rejected with a File too large toast.
  4. JSON is parsed; failure shows Not valid JSON.
  5. Version pre-check runs based on the version field; migrations run if needed.
  6. A confirmation dialog appears: "This will replace the current model. Continue?"
  7. After confirmation, the model is written to the store and a toast confirms: Loaded model from file.
Failure caseMessageSuggested fix
Not JSONNot valid JSONCheck the first lines in a text editor for corruption
Missing version fieldNot a TMM project fileConfirm the file was exported from Dreapex TMM
Newer than the appFile is from a newer version of TMM; please upgradeUpgrade Dreapex TMM, or ask the sender to export a backward-compatible file
Shape mismatch / migration failedFile is corrupted or incompatible with current schemaInspect each data module in a text editor to locate the issue
Partial module fallbackWarning toast, defaults substitutedAfter 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.
The version number is written into the 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

MechanismScopeTriggerWhen to use
.tmm fileModel snapshotManual export / importProject archive, cross-machine migration, offline review
localStorage autosaveModel snapshotAutomatic on editIn-browser safety net for accidental closes / restarts
URL config sharingModel snapshot + selected SettingsExplicit URL generationRemote collaboration, paste-link reproduction
Case Library9 fixed built-in modelsManual selectionQuick 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.

Copyright © 2026 Dreapex