Skip to content

Windows

Window-specific reads and dimension mutations. Accessed via snaptrude.design.windows. Creation lives at design.create.window; generic reads (listWindows/getHost/getProperties) live at design.query.*. Window targets are ComponentHandles.

listTypes (UI-const catalog), getSillHeight (bounds-derived), and the command-wired mirror land in a later pass.

Types

PluginWindowDimensions

A window's dimensions.

PropertyTypeDescription
widthnumberAlong the wall
heightnumberVertical
thicknessnumberThrough the wall (engine length axis)

PluginDesignChangeResult

Shared result for scene-state change mutations — echoes the handles actually affected. Errors throw (the RPC rejects); there is no Result<> monad in the SDK.

PropertyTypeDescription
affectedComponentHandle[]The affected components

PluginObjectCatalogGroup

A catalog group (a family / option grouping) surfaced by listCatalogGroups.

PropertyTypeDescription
dbTypestringGroup db-type token (empty for shutter/option groups)
labelstringDisplay label
source'default' | 'team'Built-in or team upload

PluginObjectCatalogItem

A placeable catalog item surfaced by listCatalog / getCatalogItem. The raw .babylon URL is never exposed.

PropertyTypeDescription
idstringCatalog id (pass to design.create.window)
namestringDisplay name
source'team' | 'general'Which library it comes from
dbTypestringEngine db-type token
subTypestring?Sub-type / category
thumbnailUrlstring?Preview image URL
costnumber?Unit cost, when set
familyNamestring?Revit/native family name

Functions

getType(window)

Get a window's type name.

  • Parameters:
    • window: ComponentHandle — The window to query
  • Returns: string | null — The type as a string, or null

getWidth(window)

Get a window's width.

  • Parameters:
    • window: ComponentHandle — The window to query
  • Returns: number | null — The width as a number, or null

getHeight(window)

Get a window's height.

  • Parameters:
    • window: ComponentHandle — The window to query
  • Returns: number | null — The height as a number, or null

getDimensions(window)

Get a window's dimensions (local oriented space; thickness = through-wall depth).

  • Parameters:
    • window: ComponentHandle — The window to query
  • Returns: PluginWindowDimensions | null — The dimensions, or null
ts
const windows = await snaptrude.design.query.listWindows();
const dims = await snaptrude.design.windows.getDimensions(windows[0]);
if (dims) {
  console.log(dims.width, dims.height, dims.thickness);
}

setWidth(window, width)

Set a window's width (engine units; re-cuts the host wall). Undoable.

  • Parameters:
    • window: ComponentHandle — The window to resize
    • width: number — New width (engine units)
  • Returns: PluginDesignChangeResult — The affected window
ts
// Widths are in Snaptrude's internal (engine) units — convert from millimeters first
const width = await snaptrude.core.units.convert(1200, "millimeters", "babylon");
const result = await snaptrude.design.windows.setWidth(window, width);
console.log(result.affected);

setHeight(window, height)

Set a window's height (engine units; re-cuts the host wall). Undoable.

  • Parameters:
    • window: ComponentHandle — The window to resize
    • height: number — New height (engine units)
  • Returns: PluginDesignChangeResult — The affected window

listCatalogGroups()

List the window catalog groups (families / option groupings). Network-backed.


listCatalog(group?)

List placeable window catalog items, optionally filtered to one group. Network-backed.

ts
const windows = await snaptrude.design.windows.listCatalog();
await snaptrude.design.create.window(windows[0].id, wall, position);

getCatalogItem(id)

Fetch one catalog item by id.


exists(id)

Whether a window catalog id resolves to a placeable item.

  • Parameters:
    • id: string — Catalog id
  • Returns: boolean

Errors

Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe window handle cannot be resolved to a live entity
PRECONDITION_FAILEDsetWidth, setHeightThe window's current dimension reads as degenerate (cold or broken instanced geometry) — thrown before any command executeshandles — the window, currentWidth/currentHeight — the degenerate value

The get* reads never throw for a resolvable component that is not a window (or lacks the requested data) — they return null instead.