Skip to content

checks ​

Checks a script runs on its own output before a person sees it.

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

  • checks.clashes: The coordination check on the model as the script has it so far (hard and soft clashes, clearances; or the default, documents or issue rule set), worst first, each with its rule, elements, place and words.

checks.clashes ​

The coordination check on the model as the script has it so far (hard and soft clashes, clearances; or the default, documents or issue rule set), worst first, each with its rule, elements, place and words. Read only: move things with ctx.edit.

ts
clashes(ctx: ScriptContext, spec?: { ruleset?: "default" | "coordination" | "documents" | "issue"; level?: string; ids?: readonly string[]; tolerance?: Measure; skipRules?: readonly string[] }): readonly Finding[]

Topics: clash, clash check, coordination, lint, interference, clearance

Example script
ts
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 plan = documents.planView(ctx, { level: "L1", name: "Level 1 - Mechanical", scale: 48, cutHeight: units.ft(10) });
    routes.along(ctx, { level: "L1", domain: "duct", size: routes.rect(units.in(20), units.in(12)), system: { id: "sa-1", kind: "supply_air" }, height: units.ft(9), points: [{ x: units.ft(2), y: units.ft(10) }, { x: units.ft(28), y: units.ft(10) }] });
    routes.along(ctx, { level: "L1", domain: "duct", size: routes.rect(units.in(20), units.in(12)), system: { id: "ra-1", kind: "return_air" }, height: units.ft(9), points: [{ x: units.ft(15), y: units.ft(2) }, { x: units.ft(15), y: units.ft(18) }] });
    const found = checks.clashes(ctx);
    ctx.label(found.length > 0 ? `Ducts routed; ${found.length} clash to resolve: ${found[0]?.message ?? ""}` : "Ducts routed, no clashes");
  },
});

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