Appearance
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 is a separate tab
In the product, Program mode opens in its own browser tab paired with the model tab. set("program") opens that tab through the same path as the top bar's Program button and resolves once it has connected (up to ~90s). Because a plugin call is not a user gesture, the browser may block the pop-up; the editor then shows its "Allow pop-up to continue" modal and the call waits for the user to confirm. get() reports "program" only for a plugin running in the Program tab — where switching to the other modes is rejected. When you need the tab ready before program.spreadsheet.* work, prefer workspace.openProgramMode().
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"("program"opens the Program tab, see above)- Returns:
{ mode }— the committed mode. - Throws:
VALIDATIONfor an unknown token;PRECONDITION_FAILEDwhen running in the Program tab, or for"program"when the user dismisses the pop-up modal or the tab does not connect in time.
ts
await snaptrude.core.mode.set("present");
// ... presentation work (e.g. presentation.export needs Present open) ...
await snaptrude.core.mode.set("design");