Skip to content

Application Mode

Read & switch the editor's top-bar application mode — the Program | Design | BIM | Present tabs a user clicks in the top menu bar. Accessed via snaptrude.core.mode.

Not to be confused with the viewport's 2D/3D camera mode (core.camera.setMode) or saved presentation views (presentation.views).

Mode tokens: "design" | "bim" | "present" | "program".

Program mode

set("program") is rejected with PRECONDITION_FAILED: in the product, Program mode opens in its own browser tab (paired with the model tab), and a plugin worker cannot open browser tabs. get() still truthfully reports "program" for a plugin running in the Program tab — where switching to the other modes is likewise rejected.

Functions

list()

List every application mode the editor has.

  • Returns: { modes: PluginAppMode[] } — all four mode tokens.
ts
const { modes } = await snaptrude.core.mode.list();
// ["design", "bim", "present", "program"]

get()

Get the currently active application mode.

  • Returns: PluginAppMode — e.g. "design".
ts
const mode = await snaptrude.core.mode.get();

set(mode)

Switch the editor to another application mode — the same action as clicking that tab in the top bar, including the UI's own side effects (e.g. leaving for BIM/Present cancels a running arrange/pack solver). Write-gated; idempotent when already in the target mode.

  • mode: PluginAppMode"design" | "bim" | "present" ("program" is rejected, see above)
  • Returns: { mode } — the committed mode.
  • Throws: VALIDATION for an unknown token; PRECONDITION_FAILED for "program" or when running in the Program tab.
ts
await snaptrude.core.mode.set("present");
// ... presentation work (e.g. presentation.export needs Present open) ...
await snaptrude.core.mode.set("design");