Appearance
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.
| Property | Type | Description |
|---|---|---|
width | number | Along the wall |
height | number | Vertical |
thickness | number | Through 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.
| Property | Type | Description |
|---|---|---|
affected | ComponentHandle[] | The affected components |
PluginObjectCatalogGroup
A catalog group (a family / option grouping) surfaced by listCatalogGroups.
| Property | Type | Description |
|---|---|---|
dbType | string | Group db-type token (empty for shutter/option groups) |
label | string | Display 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.
| Property | Type | Description |
|---|---|---|
id | string | Catalog id (pass to design.create.window) |
name | string | Display name |
source | 'team' | 'general' | Which library it comes from |
dbType | string | Engine db-type token |
subType | string? | Sub-type / category |
thumbnailUrl | string? | Preview image URL |
cost | number? | Unit cost, when set |
familyName | string? | 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 astring, ornull
getWidth(window)
Get a window's width.
- Parameters:
window:ComponentHandle— The window to query
- Returns:
number | null— The width as anumber, ornull
getHeight(window)
Get a window's height.
- Parameters:
window:ComponentHandle— The window to query
- Returns:
number | null— The height as anumber, ornull
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, ornull
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 resizewidth: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 resizeheight:number— New height (engine units)
- Returns:
PluginDesignChangeResult— The affected window
listCatalogGroups()
List the window catalog groups (families / option groupings). Network-backed.
- Returns:
PluginObjectCatalogGroup[]
listCatalog(group?)
List placeable window catalog items, optionally filtered to one group. Network-backed.
- Parameters:
group:string(optional) — Restrict to this group's db-type
- Returns:
PluginObjectCatalogItem[]
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.
- Parameters:
id:string— Catalog id
- Returns:
PluginObjectCatalogItem| null—nullwhen no item matches
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:
| Code | Thrown by | When | details |
|---|---|---|---|
HANDLE_INVALID | all methods | The window handle cannot be resolved to a live entity | — |
PRECONDITION_FAILED | setWidth, setHeight | The window's current dimension reads as degenerate (cold or broken instanced geometry) — thrown before any command executes | handles — 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.