routes
Duct, pipe and conduit runs: sizes, systems, slopes, where a run starts and ends, and connecting into a run.
Every example below is a complete script that passes the kit's checks; the kit's tests run each one.
routes.rect: A rectangular duct size.routes.round: A round duct size.routes.oval: A flat-oval duct size.routes.pipe: A pipe size: nominal diameter and material.routes.atConnector: A route end at a placed part's connector (equipment, a fixture, a device).routes.atRunEnd: A route end at an open end of a run (continue a duct or pipe).routes.along: A duct, pipe, conduit or tray run through the points in order; the kernel places elbows, andslopemakes a drain fall along it.routes.branch: A branch off a trunk: the kernel places the tap, tee or wye where it leaves.routes.drop: The route, then straight down (or up) at its last point to a height above another level; the kernel cuts the riser at each floor.routes.connectInto: Connects open ends (fixture connectors, run ends) into a run or the nearest one, with the system's fittings and slope.routes.setSystemGraphics: Overrides a system's colour, line pattern, line weight, or repeating inline service code ("CW", "SAN", "G"; "" hides the code, null resets to default).routes.fittingTypes: The fitting library routing places (the model's add-ons' families included): id, what it fits, shapes, parameters, and for pipe its services and joints.
routes.rect
A rectangular duct size.
rect(width: Measure, height: Measure): RunSizeTopics: duct, rectangular, size
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "duct", size: routes.rect(units.in(12), units.in(8)), system: { id: "sa-1", kind: "supply_air" }, height: units.ft(9), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(20), y: units.ft(0) }] });
},
});routes.round
A round duct size.
round(diameter: Measure): RunSizeTopics: duct, round, size
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "duct", size: routes.round(units.in(10)), system: { id: "sa-1", kind: "supply_air" }, height: units.ft(9), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(15), y: units.ft(0) }] });
},
});routes.oval
A flat-oval duct size.
oval(width: Measure, height: Measure): RunSizeTopics: duct, oval, size
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "duct", size: routes.oval(units.in(18), units.in(8)), system: { id: "sa-1", kind: "supply_air" }, height: units.ft(9), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(15), y: units.ft(0) }] });
},
});routes.pipe
A pipe size: nominal diameter and material.
pipe(nominal: Measure, material: PipeMaterial): RunSizeTopics: pipe, piping, size, water
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "pipe", size: routes.pipe(units.in(1), "copper"), system: { id: "dcw-1", kind: "domestic_cold_water" }, height: units.ft(9), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(15), y: units.ft(0) }] });
},
});routes.atConnector
A route end at a placed part's connector (equipment, a fixture, a device).
atConnector(partId: string, connectorId: string): RouteEndTopics: connect, equipment, connector, from
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "duct", size: routes.round(units.in(10)), system: { id: "sa-1", kind: "supply_air" }, from: routes.atConnector("rtu-1", "supply"), points: [{ x: units.ft(10), y: units.ft(0) }] });
},
});routes.atRunEnd
A route end at an open end of a run (continue a duct or pipe).
atRunEnd(elementId: string, port: "start" | "end" | string): RouteEndTopics: continue, extend, run end
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "duct", size: routes.round(units.in(10)), system: { id: "sa-1", kind: "supply_air" }, from: routes.atRunEnd("run-1-s1", "end"), points: [{ x: units.ft(30), y: units.ft(0) }] });
},
});routes.along
A duct, pipe, conduit or tray run through the points in order; the kernel places elbows, and slope makes a drain fall along it. A height change between two points rises straight up (riseStyle: "vertical", the default) or on a slope of 60°, 45° or 22½° (riseStyle: "60" | "45" | "22.5") where the run's fittings make that bend (PVC and cast iron drains have 1/6 and 1/16 bends; the kernel refuses an angle the fittings don't make, in words).
along(ctx: ScriptContext, spec: RouteSpec): RouteHandleTopics: route, duct, pipe, run, slope, drain, sanitary, gravity, conduit, rise, 60 degree, 22.5 degree, offset
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "pipe", size: routes.pipe(units.in(3), "pvc"), system: { id: "san-1", kind: "sanitary" }, height: units.ft(-1), slope: { rise: units.in(0.25), per: units.ft(1) }, points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(40), y: units.ft(0) }] });
},
});routes.branch
A branch off a trunk: the kernel places the tap, tee or wye where it leaves.
branch(ctx: ScriptContext, spec: RouteSpec & { trunk: string; face?: "top" | "bottom" }): RouteHandleTopics: branch, tee, tap, wye, takeoff
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
const main = routes.along(ctx, { level: "L1", domain: "duct", size: routes.rect(units.in(16), units.in(10)), system: { id: "sa-1", kind: "supply_air" }, height: units.ft(9), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(40), y: units.ft(0) }] });
routes.branch(ctx, { trunk: main.segment(1), level: "L1", domain: "duct", size: routes.round(units.in(8)), system: { id: "sa-1", kind: "supply_air" }, points: [{ x: units.ft(10), y: units.ft(0) }, { x: units.ft(10), y: units.ft(10) }] });
},
});routes.drop
The route, then straight down (or up) at its last point to a height above another level; the kernel cuts the riser at each floor.
drop(ctx: ScriptContext, spec: RouteSpec & { toLevel: string; heightAbove: Measure }): RouteHandleTopics: riser, drop, vertical, stack
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.drop(ctx, { level: "L2", toLevel: "L1", heightAbove: units.ft(1), domain: "pipe", size: routes.pipe(units.in(2), "copper"), system: { id: "dcw-1", kind: "domestic_cold_water" }, height: units.ft(9), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(5), y: units.ft(0) }] });
},
});routes.connectInto
Connects open ends (fixture connectors, run ends) into a run or the nearest one, with the system's fittings and slope.
connectInto(ctx: ScriptContext, spec: { from: { elementId: string; port: string }[]; into: string; id?: string }): stringTopics: connect fixtures, drain, into, auto connect, many fixtures
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.connectInto(ctx, { from: [{ elementId: "wc-1", port: "waste" }, { elementId: "lav-1", port: "waste" }], into: "nearest" });
},
});routes.setSystemGraphics
Overrides a system's colour, line pattern, line weight, or repeating inline service code ("CW", "SAN", "G"; "" hides the code, null resets to default).
setSystemGraphics(ctx: ScriptContext, systemId: string, changes: { colour?: string | null; pattern?: SystemLinePattern | null; weight?: SystemLineWeight | null; lineCode?: string | null }): voidTopics: system graphics, line pattern, line weight, line code, schematic, colour, piping style
Example script
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
kind: "route",
reads: { levels: true },
parameters: {},
run(ctx) {
routes.along(ctx, { level: "L1", domain: "pipe", size: routes.pipe(units.in(4), "pvc"), system: { id: "san-1", kind: "sanitary" }, height: units.ft(-1), points: [{ x: units.ft(0), y: units.ft(0) }, { x: units.ft(40), y: units.ft(0) }] });
routes.setSystemGraphics(ctx, "san-1", { pattern: "solid", weight: "medium", lineCode: "SAN" });
},
});routes.fittingTypes
The fitting library routing places (the model's add-ons' families included): id, what it fits, shapes, parameters, and for pipe its services and joints. Use an id with swap_fitting or a system's design.
fittingTypes(ctx: ScriptContext, filter?: { domain?: "duct" | "pipe"; service?: "water" | "drainage" | "vent" | "gas" }): readonly FittingFamily[]Topics: fitting types, fitting library, elbows, takeoffs, pipe fittings, catalogue
Example script
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 elbows = routes.fittingTypes(ctx, { domain: "duct" }).filter((f) => f.fittingTypes.includes("elbow"));
ctx.label(`Duct elbows: ${elbows.map((f) => f.name).join(", ")}`);
ctx.edit({ type: "create_level", levelId: ctx.id("level"), name: "Roof", elevationMm: 9000 });
},
});