Appearance
Doors
Door-specific reads and edits. Creation lives at design.create.door; generic reads (listDoors / getHost / getProperties) live at design.query.*. Door targets are ComponentHandles. Accessed via snaptrude.design.doors.
getSwingDirection is a derived read (no persisted field) — it is computed from the door mesh reflection state. mirror reflects the door across an axis (undoable, one command). There is intentionally no setType — the engine has no in-place re-type (it would require delete + recreate).
Types
PluginMirrorAxis
Mirror axis — tokens mirror the engine FlipDirection verbatim.
| Value | Description |
|---|---|
'x' | Mirror across the X axis |
'y' | Mirror across the Y axis |
'z' | Mirror across the Z axis |
PluginDesignChangeResult
Shared result for design mutations — echoes the handles actually affected. Errors throw (the RPC call rejects); there is no Result<> monad in the SDK.
| Property | Type | Description |
|---|---|---|
affected | ComponentHandle[] | The entities affected by the mutation |
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' | Whether the group is a built-in or a 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.door) |
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(door)
Get a door's type name.
- Parameters:
door:ComponentHandle— The door to query
- Returns:
string | null— The type name, ornull
ts
const type = await snaptrude.design.doors.getType(door);getFamily(door)
Get a door's family name (Revit/native).
- Parameters:
door:ComponentHandle— The door to query
- Returns:
string | null— The family name, ornull
getWidth(door)
Get a door's width.
- Parameters:
door:ComponentHandle— The door to query
- Returns:
number | null— The width, ornull
getHeight(door)
Get a door's height.
- Parameters:
door:ComponentHandle— The door to query
- Returns:
number | null— The height, ornull
getDimensions(door)
Get a door's full dimensions in one call — width along the wall, vertical height, and thickness through the wall — measured in the door's local oriented space. Parity with design.windows.getDimensions.
- Parameters:
door:ComponentHandle— The door to query
- Returns:
{ width: number; height: number; thickness: number } | null— The dimensions, ornull
ts
const [door] = await snaptrude.design.query.listDoors({ isSelected: true });
const dims = await snaptrude.design.doors.getDimensions(door);
if (dims) console.log(dims.width, dims.height, dims.thickness);getSupportFloor(door)
Get the floor a door is hosted on.
- Parameters:
door:ComponentHandle— The door to query
- Returns:
ComponentHandle | null— The support floor, ornull
getSwingDirection(door)
Get a door's swing (hinge) handedness — derived from the mesh reflection state.
- Parameters:
door:ComponentHandle— The door to query
- Returns:
'left' | 'right' | null— The swing handedness, ornullif indeterminate
ts
const swing = await snaptrude.design.doors.getSwingDirection(door);
if (swing === "left") {
// ...
}mirror(door, axis?)
Mirror a door across an axis (reflect its swing). Undoable (one command).
- Parameters:
door:ComponentHandle— The door to mirroraxis:PluginMirrorAxis(optional, default'x') — Reflection axis ('x'is the swing-flip axis)
- Returns:
PluginDesignChangeResult— The affected door(s)
ts
const { affected } = await snaptrude.design.doors.mirror(door);setWidth(doors, width)
Set the width of one or more doors (Snaptrude units; re-cuts the host wall). Undoable. To work in real-world units, convert first with snaptrude.core.units.convert(value, from, to).
- Parameters:
doors:ComponentHandle[]— The doors to resizewidth:number— New width, in Snaptrude units
- Returns:
PluginDesignChangeResult— The affected doors
ts
const width = await snaptrude.core.units.convert(0.9, "meters", "babylon");
const { affected } = await snaptrude.design.doors.setWidth([door], width);setHeight(doors, height)
Set the height of one or more doors (Snaptrude units; re-cuts the host wall). Undoable.
- Parameters:
doors:ComponentHandle[]— The doors to resizeheight:number— New height, in Snaptrude units
- Returns:
PluginDesignChangeResult— The affected doors
listCatalogGroups()
List the door catalog groups (families / option groupings). Network-backed.
- Returns:
PluginObjectCatalogGroup[]
ts
const groups = await snaptrude.design.doors.listCatalogGroups();listCatalog(group?)
List placeable door catalog items, optionally filtered to one group. Network-backed.
- Parameters:
group:string(optional) — Restrict to this group's db-type
- Returns:
PluginObjectCatalogItem[]
ts
const doors = await snaptrude.design.doors.listCatalog();
await snaptrude.design.create.door(doors[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 door 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 door handle cannot be resolved to a live entity | — |
PRECONDITION_FAILED | setWidth, setHeight | A door's current dimension reads as degenerate (cold or broken instanced geometry) — every door is validated up front, before any command executes | handles — the offending door, current — the degenerate value |
OPERATION_FAILED | mirror | The engine flip operation fails | engineCode — the engine's failure code, handles — the door |
The get* reads never throw for a resolvable component that is not a door (or lacks the requested data) — they return null instead.