Skip to content

building ​

Levels, grids, walls, doors, windows, floors, ceilings, roofs, stairs, rooms and spaces.

Every example below is a complete script that passes the kit's checks; the kit's tests run each one.

  • building.walls: Walls along the points, one per leg; closed joins the last point to the first.
  • building.wall: One wall from from to to; returns its id. height, top and base as for building.walls: a partition run to the ceiling, an exterior wall up to the structure above.
  • building.floor: A floor slab with this outline (and optional stairwell/atrium holes) and material; returns its id.
  • building.roof: A flat, single-slope shed, two-slope gable, or four-slope hip roof (architecture.roof) with optional form, slopeRise, slopeDirectionDeg, baseOffset, and material; returns its id.
  • building.stair: A stair (architecture.stair) supporting straight runs, 90° L-shape, and 180° U-shape switchbacks with landings; returns its id.
  • building.grid: A structural column grid line (grid, e.g. 1, A) drawn with Revit circular bubbles across every plan, RCP, and building section; returns its id.
  • building.column: A structural or architectural column at a plan point; returns its id.
  • building.curtainWall: A glazed architectural storefront / curtain wall from from to to with automatic 3D/plan mullions and optional mullionMaterial; returns its id.
  • building.moveWall: Move a wall by a plan delta, carrying joined walls and collinear slab/ceiling/roof edges unless disjoin: true.
  • building.moveOpening: Slide a hosted door or window along its host wall by a plan delta (without moving the host wall).
  • building.moveWallEnd: Stretch or move one end of a wall ("start" | "end") to a plan point, carrying joined corners unless disjoin: true.
  • building.materials: List every material registered in the active add-ons (kernel.material), with visual and building-envelope thermal properties.
  • building.assemblyThermal: Compute steady-state ISO 6946 / ASHRAE R-value and U-value of a layered wall/roof/floor assembly from registered kernel.material conductivities.
  • building.setMaterial: Assign a registered material id (building.materials()) to one or more elements so both 2D plan poché and 3D textures reflect it.
  • building.lock: Pin / lock elements so interactive selection and drags leave them alone.
  • building.unlock: Unpin / unlock previously locked elements.
  • building.elements: Any kind the registry draws on a line (a beam, a grid line, a pack's own kind), by its id, along the points.
  • building.door: A door in a wall, its centre along the wall from its start; returns its id.
  • building.window: A window in a wall, its centre along the wall from its start, its bottom sill above the wall's floor (the type's sill, else 900 mm, when left out; the kernel refuses a sill that puts the head above the wall); returns its id.
  • building.space: A space (room) with its number and name, on a level; returns its id.
  • building.level: A level at an elevation; returns its id.
  • building.spaceInWalls: A room found from the walls around a point: the kernel traces the enclosure and refuses an open room in words; returns the space's id.
  • building.ceiling: A ceiling on a level at a height above it (form: flat ACT grid, soffit with vertical fascia skirt, cloud, sloped, or open_to_structure) with optional material and holes; returns its id.
  • building.room: A room (number, name, outline) on a level: what receptacle spacing, room schedules and room circuit templates read.
  • building.surfacesAt: The floor or roof under an element or point, the ceiling and roof over it, and the structure above, each with its elevation and height above the floor (mm).
  • building.levelSyncPlan: What matching the model's levels to a linked model's storeys would do (add, update, match, unchanged), changing nothing.
  • building.syncLevels: Makes the model's levels match a linked model's storeys as one edit: levels already at that height are matched and keep their names, new storeys become levels.

building.walls ​

Walls along the points, one per leg; closed joins the last point to the first. A fixed height, or a top: { level, offset } (up to a level; topLevel / topOffset say the same), "structure above" (the underside of the slab or deck over it), "ceiling", "roof" (sloped under a pitched roof), or { to, offset }. The height then follows it. base: "slab below" (the top of the floor under it) or { offset } off the level. Returns the chain (element(1) is the first wall).

ts
walls(ctx: ScriptContext, spec: ChainSpec): ChainHandle

Topics: wall, walls, architecture, room, building outline, wall top, top level, floor to floor, tied to level, top, base, wall height, structure above, underside of slab, deck, ceiling, roof, sloped roof, top offset, base offset, attach top

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    // Exterior walls on Level 1 that run up to Level 2 and follow it if its elevation changes.
    building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(30) }, { x: units.ft(30), y: units.ft(30) }], thickness: units.in(8), topLevel: "L2" });
    // A floor on Level 2, partitions run to its underside, and one 6 in under Level 2 standing on the slab below.
    building.floor(ctx, { level: "L2", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], thickness: units.in(8) });
    building.walls(ctx, { level: "L1", points: [{ x: units.ft(10), y: units.ft(0) }, { x: units.ft(10), y: units.ft(20) }], thickness: units.in(5), top: "structure above" });
    building.walls(ctx, { level: "L1", points: [{ x: units.ft(20), y: units.ft(0) }, { x: units.ft(20), y: units.ft(20) }], thickness: units.in(5), top: { level: "L2", offset: units.in(-6) }, base: "slab below" });
  },
});

building.wall ​

One wall from from to to; returns its id. height, top and base as for building.walls: a partition run to the ceiling, an exterior wall up to the structure above.

ts
wall(ctx: ScriptContext, spec: WallSpec): string

Topics: wall, partition, one wall, top, structure above, ceiling, roof

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.floor(ctx, { level: "L2", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], thickness: units.in(8) });
    building.wall(ctx, { level: "L1", from: { x: units.ft(5), y: units.ft(2) }, to: { x: units.ft(5), y: units.ft(18) }, thickness: units.in(5), top: { to: "structure above", offset: units.in(-1) } });
  },
});

building.floor ​

A floor slab with this outline (and optional stairwell/atrium holes) and material; returns its id.

ts
floor(ctx: ScriptContext, spec: Omit<ChainSpec, "closed" | "topLevel" | "topOffset" | "top" | "base"> & { readonly holes?: readonly (readonly PlanPoint[])[] }): string

Topics: floor, slab, roof deck, holes, stairwell, material

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.floor(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], thickness: units.in(6), material: "architecture.concrete_slab" });
  },
});

building.roof ​

A flat, single-slope shed, two-slope gable, or four-slope hip roof (architecture.roof) with optional form, slopeRise, slopeDirectionDeg, baseOffset, and material; returns its id.

ts
roof(ctx: ScriptContext, spec: Omit<ChainSpec, "closed" | "topLevel" | "topOffset" | "top" | "base"> & { readonly form?: "flat" | "shed" | "gable" | "hip"; readonly slopeRise?: number; readonly slopeDirectionDeg?: number; readonly baseOffset?: Measure }): string

Topics: roof, gable, hip, shed, slope, metal roof, architecture, material

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.roof(ctx, { level: "L2", form: "gable", slopeRise: 0.5, slopeDirectionDeg: 90, points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], thickness: units.in(8), material: "architecture.asphalt_shingle" });
  },
});

building.stair ​

A stair (architecture.stair) supporting straight runs, 90° L-shape, and 180° U-shape switchbacks with landings; returns its id.

ts
stair(ctx: ScriptContext, spec: { readonly level: string; readonly from: PlanPoint; readonly to: PlanPoint; readonly width?: Measure; readonly topLevel?: string; readonly risers?: number; readonly form?: 'straight' | 'l_shape' | 'u_shape'; readonly turn?: 'left' | 'right'; readonly landingDepth?: Measure; readonly wellGap?: Measure; readonly material?: string; readonly id?: string }): string

Topics: stair, stairs, circulation, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.stair(ctx, { level: "L1", topLevel: "L2", form: "u_shape", turn: "right", from: { x: units.ft(4), y: units.ft(4) }, to: { x: units.ft(14), y: units.ft(4) }, width: units.in(44), landingDepth: units.ft(4) });
  },
});

building.grid ​

A structural column grid line (grid, e.g. 1, A) drawn with Revit circular bubbles across every plan, RCP, and building section; returns its id.

ts
grid(ctx: ScriptContext, spec: { readonly level: string; readonly from: PlanPoint; readonly to: PlanPoint; readonly label?: string; readonly id?: string }): string

Topics: grid, datum, structure, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.grid(ctx, { level: "L1", label: "1", from: { x: units.ft(0), y: units.ft(-4) }, to: { x: units.ft(0), y: units.ft(34) } });
  },
});

building.column ​

A structural or architectural column at a plan point; returns its id.

ts
column(ctx: ScriptContext, spec: { readonly level: string; readonly at: PlanPoint; readonly width?: Measure; readonly depth?: Measure; readonly height?: Measure; readonly topLevel?: string; readonly material?: string; readonly id?: string }): string

Topics: column, structure, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.column(ctx, { level: "L1", at: { x: units.ft(16), y: units.ft(12) }, width: units.in(12), depth: units.in(12), height: units.ft(12), material: "architecture.steel" });
  },
});

building.curtainWall ​

A glazed architectural storefront / curtain wall from from to to with automatic 3D/plan mullions and optional mullionMaterial; returns its id.

ts
curtainWall(ctx: ScriptContext, spec: WallSpec & { readonly mullionMaterial?: string }): string

Topics: curtain wall, storefront, glazing, facade, mullion, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.curtainWall(ctx, { level: "L1", from: { x: units.ft(0), y: units.ft(0) }, to: { x: units.ft(20), y: units.ft(0) }, thickness: units.in(5), height: units.ft(11), mullionMaterial: "architecture.bronze_mullion" });
  },
});

building.moveWall ​

Move a wall by a plan delta, carrying joined walls and collinear slab/ceiling/roof edges unless disjoin: true.

ts
moveWall(ctx: ScriptContext, wallId: string, delta: PlanPoint, opts?: { readonly disjoin?: boolean }): void

Topics: wall, move, join, disjoin, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.moveWall(ctx, walls.element(1), { x: units.ft(0), y: units.ft(-2) });
  },
});

building.moveOpening ​

Slide a hosted door or window along its host wall by a plan delta (without moving the host wall).

ts
moveOpening(ctx: ScriptContext, openingId: string, delta: PlanPoint): void

Topics: door, window, opening, move, slide, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    const d = building.door(ctx, { wall: walls.element(1), along: units.ft(8), width: units.in(36) });
    building.moveOpening(ctx, d, { x: units.ft(2), y: units.ft(0) });
  },
});

building.moveWallEnd ​

Stretch or move one end of a wall ("start" | "end") to a plan point, carrying joined corners unless disjoin: true.

ts
moveWallEnd(ctx: ScriptContext, wallId: string, end: "start" | "end", to: PlanPoint, opts?: { readonly disjoin?: boolean }): void

Topics: wall, stretch, endpoint, corner, join, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.moveWallEnd(ctx, walls.element(1), "end", { x: units.ft(32), y: units.ft(0) });
  },
});

building.materials ​

List every material registered in the active add-ons (kernel.material), with visual and building-envelope thermal properties.

ts
materials(): readonly { readonly id: string; readonly name: string; readonly category?: string; readonly color: string; readonly pattern?: string; readonly thermalConductivityWPerMK?: number; readonly densityKgPerM3?: number; readonly shgc?: number }[]

Topics: material, color, texture, poche, thermal, envelope, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const mats = building.materials();
    if (mats.length === 0) throw new Error("expected architectural materials");
    ctx.report("Materials", { count: mats.length });
  },
});

building.assemblyThermal ​

Compute steady-state ISO 6946 / ASHRAE R-value and U-value of a layered wall/roof/floor assembly from registered kernel.material conductivities.

ts
assemblyThermal(layers: readonly { readonly materialId: string; readonly thickness: Measure }[], opts?: { readonly includeAirFilms?: boolean }): AssemblyThermalSummary

Topics: envelope, thermal, r-value, u-value, insulation, energy, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const env = building.assemblyThermal([{ materialId: "architecture.brick_red", thickness: units.in(4) }, { materialId: "architecture.batt_insulation", thickness: units.in(5.5) }, { materialId: "architecture.gypsum_partition", thickness: units.in(0.625) }]);
    if (env.rImperial <= 0) throw new Error("expected positive R-value");
    ctx.report("Thermal", { rImperial: env.rImperial });
  },
});

building.setMaterial ​

Assign a registered material id (building.materials()) to one or more elements so both 2D plan poché and 3D textures reflect it.

ts
setMaterial(ctx: ScriptContext, elementIds: string | readonly string[], materialId: string): void

Topics: material, color, texture, poche, wall, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.setMaterial(ctx, walls.element(1), "architecture.brick_red");
  },
});

building.lock ​

Pin / lock elements so interactive selection and drags leave them alone.

ts
lock(ctx: ScriptContext, elementIds: string | readonly string[], reason?: string): void

Topics: lock, pin, selection, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.lock(ctx, walls.element(1), "Existing exterior wall");
  },
});

building.unlock ​

Unpin / unlock previously locked elements.

ts
unlock(ctx: ScriptContext, elementIds: string | readonly string[]): void

Topics: unlock, unpin, selection, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.lock(ctx, walls.element(1));
    building.unlock(ctx, walls.element(1));
  },
});

building.elements ​

Any kind the registry draws on a line (a beam, a grid line, a pack's own kind), by its id, along the points.

ts
elements(ctx: ScriptContext, kind: string, spec: ChainSpec): ChainHandle

Topics: elements, kind, linear

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.elements(ctx, "wall", { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(12), y: units.ft(0) }], thickness: units.in(5) });
  },
});

building.door ​

A door in a wall, its centre along the wall from its start; returns its id.

ts
door(ctx: ScriptContext, spec: OpeningSpec): string

Topics: door, opening, architecture

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.door(ctx, { wall: walls.element(1), along: units.ft(5), width: units.in(36), height: units.in(84), mark: "101" });
  },
});

building.window ​

A window in a wall, its centre along the wall from its start, its bottom sill above the wall's floor (the type's sill, else 900 mm, when left out; the kernel refuses a sill that puts the head above the wall); returns its id.

ts
window(ctx: ScriptContext, spec: OpeningSpec): string

Topics: window, opening, glazing, architecture, sill, sill height

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.window(ctx, { wall: walls.element(2), along: units.ft(10), width: units.in(48), height: units.in(48), sill: units.ft(3) });
  },
});

building.space ​

A space (room) with its number and name, on a level; returns its id. Loads, schedules and sizing read spaces.

ts
space(ctx: ScriptContext, spec: { level: string; number: string; name: string; outline?: PlanPoint[]; ceilingHeight?: Measure; occupants?: number; id?: string }): string

Topics: room, space, number, occupancy

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.space(ctx, { level: "L1", number: "101", name: "Office", outline: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(12), y: units.ft(0) }, { x: units.ft(12), y: units.ft(10) }, { x: units.ft(0), y: units.ft(10) }], ceilingHeight: units.ft(9) });
  },
});

building.level ​

A level at an elevation; returns its id. Every level argument in the kit takes a level's id (this one, or one from ctx.model.levels()); the kit's helpers also take the name of exactly one level the script read (reads.levels: true), and refuse an unknown or shared name with the levels there are.

ts
level(ctx: ScriptContext, spec: { name: string; elevation: Measure; id?: string }): string

Topics: level, levels, storey, floor level, roof level

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.level(ctx, { name: "Level 3", elevation: units.ft(24) });
  },
});

building.spaceInWalls ​

A room found from the walls around a point: the kernel traces the enclosure and refuses an open room in words; returns the space's id. It traces the walls in the script's model, so read them (reads.kinds: ["wall"]) unless the script draws them first; the kit stops with "you didn't read walls" otherwise.

ts
spaceInWalls(ctx: ScriptContext, spec: { level: string; inside: PlanPoint; number?: string; name?: string; id?: string }): string

Topics: rooms from walls, find rooms, room, space, trace rooms, enclosure

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    building.spaceInWalls(ctx, { level: "L1", inside: { x: units.ft(15), y: units.ft(10) }, number: "101", name: "Office" });
  },
});

building.ceiling ​

A ceiling on a level at a height above it (form: flat ACT grid, soffit with vertical fascia skirt, cloud, sloped, or open_to_structure) with optional material and holes; returns its id.

ts
ceiling(ctx: ScriptContext, spec: { level: string; outline: readonly PlanPoint[]; height: Measure; space?: string; form?: "flat" | "sloped" | "cloud" | "soffit" | "open_to_structure"; holes?: readonly (readonly PlanPoint[])[]; slope?: { directionDeg: number; pitch: number }; reference?: PlanPoint; typeId?: string; material?: string; id?: string }): string

Topics: ceiling, ceilings, ceiling height, sloped ceiling, soffit, cloud, acoustic tile, gypsum ceiling, reflected ceiling

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const walls = building.walls(ctx, { level: "L1", points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(30), y: units.ft(0) }, { x: units.ft(30), y: units.ft(20) }, { x: units.ft(0), y: units.ft(20) }], closed: true, thickness: units.in(8), height: units.ft(10) });
    const office = building.spaceInWalls(ctx, { level: "L1", inside: { x: units.ft(15), y: units.ft(10) }, number: "101", name: "Office" });
    const inside = [{ x: units.ft(1), y: units.ft(1) }, { x: units.ft(29), y: units.ft(1) }, { x: units.ft(29), y: units.ft(19) }, { x: units.ft(1), y: units.ft(19) }];
    const ceiling = building.ceiling(ctx, { level: "L1", space: office, form: "soffit", material: "architecture.gypsum_partition", outline: inside, height: units.ft(9) });
    ctx.report("Ceiling", ceiling);
  },
});

building.room ​

A room (number, name, outline) on a level: what receptacle spacing, room schedules and room circuit templates read. Returns its id.

ts
room(ctx: ScriptContext, spec: { level: string; number: string; name: string; outline: readonly PlanPoint[]; id?: string }): string

Topics: room, rooms, room outline, room number

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.room(ctx, { level: "L1", number: "101", name: "Office", outline: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(12), y: units.ft(0) }, { x: units.ft(12), y: units.ft(14) }, { x: units.ft(0), y: units.ft(14) }] });
  },
});

building.surfacesAt ​

The floor or roof under an element or point, the ceiling and roof over it, and the structure above, each with its elevation and height above the floor (mm). The model's own surfaces; linked models' slabs are the host's.

ts
surfacesAt(ctx: ScriptContext, target: { element: string } | { at: PlanPoint; level?: string; elevation?: Measure }): SurfacesAt

Topics: surfaces, ceiling height, floor under, slab, roof over, structure above, clearance

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const here = building.surfacesAt(ctx, { at: { x: units.ft(5), y: units.ft(5) }, level: "L1" });
    ctx.label(here.ceiling ? `Ceiling at ${Math.round(here.ceiling.elevationMm)} mm` : "No ceiling over this point");
    ctx.edit({ type: "create_level", levelId: ctx.id("level"), name: "Roof", elevationMm: 9000 });
  },
});

building.levelSyncPlan ​

What matching the model's levels to a linked model's storeys would do (add, update, match, unchanged), changing nothing. The storeys come from the host's link or the script's own values.

ts
levelSyncPlan(ctx: ScriptContext, spec: { reference: string; storeys: readonly { storeyId: string; name: string; elevation: Measure; levelId?: string }[] }): LevelSyncPlan

Topics: linked levels, sync levels, storeys, architect's model, levels from link

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    const storeys = { reference: "arch-link", storeys: [{ storeyId: "s3", name: "Level 3", elevation: units.ft(26) }, { storeyId: "s4", name: "Roof", elevation: units.ft(39) }] };
    const plan = building.levelSyncPlan(ctx, storeys);
    if (plan.changes) building.syncLevels(ctx, storeys);
    else ctx.edit({ type: "create_level", levelId: ctx.id("level"), name: "Roof", elevationMm: 9000 });
  },
});

building.syncLevels ​

Makes the model's levels match a linked model's storeys as one edit: levels already at that height are matched and keep their names, new storeys become levels.

ts
syncLevels(ctx: ScriptContext, spec: { reference: string; storeys: readonly { storeyId: string; name: string; elevation: Measure; levelId?: string }[] }): void

Topics: sync levels, linked levels, storeys

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "layout",
  reads: { levels: true },
  parameters: {},
  run(ctx) {
    building.syncLevels(ctx, { reference: "arch-link", storeys: [{ storeyId: "s3", name: "Level 3", elevation: units.ft(26) }] });
  },
});

Apache License 2.0. The reference is generated from the code on every change.