Skip to content

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.

ValueDescription
'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.

PropertyTypeDescription
affectedComponentHandle[]The entities affected by the mutation

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'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.

PropertyTypeDescription
idstringCatalog id (pass to design.create.door)
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(door)

Get a door's type name.

  • Parameters:
    • door: ComponentHandle — The door to query
  • Returns: string | null — The type name, or null
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, or null

getWidth(door)

Get a door's width.

  • Parameters:
    • door: ComponentHandle — The door to query
  • Returns: number | null — The width, or null

getHeight(door)

Get a door's height.

  • Parameters:
    • door: ComponentHandle — The door to query
  • Returns: number | null — The height, or null

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, or null
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, or null

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, or null if 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 mirror
    • axis: 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 resize
    • width: 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 resize
    • height: number — New height, in Snaptrude units
  • Returns: PluginDesignChangeResult — The affected doors

listCatalogGroups()

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

ts
const groups = await snaptrude.design.doors.listCatalogGroups();

listCatalog(group?)

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

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.


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:

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe door handle cannot be resolved to a live entity
PRECONDITION_FAILEDsetWidth, setHeightA door's current dimension reads as degenerate (cold or broken instanced geometry) — every door is validated up front, before any command executeshandles — the offending door, current — the degenerate value
OPERATION_FAILEDmirrorThe engine flip operation failsengineCode — 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.