Skip to content

PartBuilder ​

The builder parts.part() returns: boxes, extrusions, sweeps, connectors and parameters on one part type.

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

  • PartBuilder.planSymbol: Adds 2D plan symbol primitives (circle, rect, line, arc, polyline, text) with units: "paper", minPaperMm floors, fill: "mask" | "solid", conditional when parameter rules (e.g. emergency battery shading), mask: true text wipeouts, and upright / uprightOffset wall-safe subscripts.
  • PartBuilder.param: A type parameter; pass the returned dimension to a body or connector and it follows the parameter on every size.
  • PartBuilder.box: A box standing on the base.
  • PartBuilder.cylinder: A cylinder along x, y or z (z stands on the base): a tank, a water heater, a fan.
  • PartBuilder.transition: A taper along x between two rectangular openings: width and height both change (fromHeight / toHeight), and offset moves the outlet.
  • PartBuilder.connector: A connector on a face, pointing out of it: duct, pipe, gas or electrical, with its system kind and size.
  • PartBuilder.build: The part-type definition, checked with the kernel's schema and part rules (a problem fails here, in the kernel's words).
  • PartBuilder.check: build plus the kernel's connector placement warnings (a part with warnings still saves).
  • PartBuilder.extrude: Push a profile (any outline, with holes) straight out of its view between from and to; cut: true removes material instead.
  • PartBuilder.cut: Remove material with a profile pushed out of its view: openings, recesses, holes through a casing.
  • PartBuilder.revolve: Turn a profile about a line drawn in the same view (default 360 degrees): bells, domes, nozzles, round tanks with heads.
  • PartBuilder.sweep: Carry a profile along straights and bends drawn in a view: elbows, offsets, coil returns, handrails.
  • PartBuilder.loft: A solid through two or more sections, each a profile on its own plane: square-to-round transitions, hoods, cones, wye legs.
  • PartBuilder.pattern: Repeat earlier bodies (by id, or "last") in a line or around an axis: coil fins, louvre blades, bolt circles, breaker rows.
  • PartBuilder.mirror: A mirrored copy of earlier bodies across the plane square to an axis (at along it; default the centre).
  • PartBuilder.importBody: A body from a vendor's glTF or OBJ library file, pinned by its content hash (read sanitized and size-capped by the host); at places its origin, turn turns it about z.
  • PartBuilder.symbol: Plan symbol drawn instead of the solid at chosen detail levels: shapes, lines, texts, optional paper-space scaling (units: "paper"), minimum plotted paper floor (minPaperMm on model-size symbols so true-scale equipment stays legible when zoomed out), opaque white mask (mask: true), solid black fill (filled: true), and pen weight.
  • PartBuilder.symbolRef: Attach a registered plan symbol from SYMBOL_POINT (e.g. electrical.plan_duplex, electrical.plan_gfci, electrical.plan_switch, electrical.plan_occ_sensor, electrical.plan_downlight_em) at chosen detail levels.
  • PartBuilder.clearance: Space kept clear in front of a face (service access, combustibles, working space); never solid, checked by clash.
  • PartBuilder.connectorAt: A connector at an exact point of the part (x to the front, y to the left, z up), facing out of a face: an outlet on a section, a stub on a hood.
  • PartBuilder.instanceParam: A value each placed copy carries for itself (a panel's name, its mains), with an optional default; shown in properties and schedules, not in the shape.
  • PartBuilder.draft: The definition as built so far, unchecked.

PartBuilder.planSymbol ​

Adds 2D plan symbol primitives (circle, rect, line, arc, polyline, text) with units: "paper", minPaperMm floors, fill: "mask" | "solid", conditional when parameter rules (e.g. emergency battery shading), mask: true text wipeouts, and upright / uprightOffset wall-safe subscripts.

ts
planSymbol(primitives: readonly SymbolPrimitive[]): PartBuilder

Topics: plan symbol, annotative, paper units, minPaperMm, conditional symbol, when, mask, circle, wall_face

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Wall Sensor", { type: "24V", category: "electrical_device", hosting: "wall_face" });
    b.box({ length: units.in(3), width: units.in(1), height: units.in(4.5) });
    b.planSymbol([{ kind: "line", from: [0, 0], to: [0, 1.4], pen: "medium", units: "paper" }, { kind: "circle", center: [0, 2.8], radius: 1.4, fill: "mask", pen: "medium", units: "paper" }, { kind: "text", at: [0, 2.8], text: "WS", heightMm: 1.5, mask: true, units: "paper" }]);
    ctx.parts.define("acme.wall_sensor.24v", b.build());
  },
});

PartBuilder.param ​

A type parameter; pass the returned dimension to a body or connector and it follows the parameter on every size.

ts
param(name: string, spec: { label: string; value: Measure | number | string | boolean; unit?: string }): Dim

Topics: parameter, size, formula, type parameter

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    const w = b.param("width", { label: "Width", value: v.width });
    b.box({ length: w, width: units.in(12), height: units.in(12) });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.box ​

A box standing on the base. The first body is the part's envelope: connectors go on its faces.

ts
box(size: { length: Length; width: Length; height: Length }, at?: { x?: Length; y?: Length; base?: Length } & BodyOptions): PartBuilder

Topics: box, casing, cabinet, rooftop unit, panel, body

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.box({ length: units.in(6), width: units.in(6), height: units.in(4) }, { base: units.in(12) });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.cylinder ​

A cylinder along x, y or z (z stands on the base): a tank, a water heater, a fan.

ts
cylinder(spec: { diameter: Length; length: Length; axis: "x" | "y" | "z" }, at?: { x?: Length; y?: Length; z?: Length } & BodyOptions): PartBuilder

Topics: cylinder, tank, water heater, fan, round body

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Water heater", { type: "50 gal", category: "plumbing_fixture" });
    b.cylinder({ diameter: units.in(22), length: units.in(60), axis: "z" });
    b.connector("top", { id: "cw", label: "Cold water", domain: "pipe", systemKind: "domestic_cold_water", shape: "round", diameter: units.in(0.75), offset: [units.in(-4), units.in(0)], endType: "plumbing_gas.sweat" });
    ctx.parts.define("acme.wh.50", b.build());
  },
});

PartBuilder.transition ​

A taper along x between two rectangular openings: width and height both change (fromHeight / toHeight), and offset moves the outlet. A loft underneath.

ts
transition(spec: { length: Length; fromWidth: Length; toWidth: Length; height?: Length; fromHeight?: Length; toHeight?: Length; offset?: [Length, Length] } & BodyOptions): PartBuilder

Topics: transition, reducer, taper, offset transition

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Transition", { type: "24x16-12x8", category: "duct_accessory" });
    b.transition({ length: units.in(18), fromWidth: v.width, toWidth: units.in(12), fromHeight: units.in(16), toHeight: units.in(8) });
    b.connector("back", { id: "in", label: "Inlet", domain: "duct", systemKind: "supply_air", shape: "rect", width: v.width, height: units.in(16), endType: "mechanical.slip" });
    ctx.parts.define("acme.tr.24x16", b.build());
  },
});

PartBuilder.connector ​

A connector on a face, pointing out of it: duct, pipe, gas or electrical, with its system kind and size. Faces are the first body's (envelope) or, with of "body", the box around everything built.

ts
connector(face: Face, c: ConnectorSpec & { offset?: [Length, Length] }, of?: "envelope" | "body"): PartBuilder

Topics: connector, duct connection, pipe connection, gas, electrical connection, power

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.connector("top", { id: "supply", label: "Supply", domain: "duct", systemKind: "supply_air", shape: "rect", width: units.in(12), height: units.in(8), endType: "mechanical.slip" });
    b.connector("left", { id: "power", label: "Power", domain: "electrical", systemKind: "power", shape: "none" });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.build ​

The part-type definition, checked with the kernel's schema and part rules (a problem fails here, in the kernel's words).

ts
build(): PartTypeDefinition

Topics: build, finish part

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.check ​

build plus the kernel's connector placement warnings (a part with warnings still saves).

ts
check(): { definition: PartTypeDefinition; warnings: readonly string[] }

Topics: check, warnings

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    const checked = b.check();
    ctx.parts.define("acme.box.24", checked.definition);
  },
});

PartBuilder.extrude ​

Push a profile (any outline, with holes) straight out of its view between from and to; cut: true removes material instead.

ts
extrude(profile: Profile, spec: { on?: View; at?: Length; from?: Length; to: Length } & BodyOptions): PartBuilder

Topics: extrude, profile, hole, curb, casing, body

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Curb", { type: "24", category: "generic" });
    b.extrude(parts.rect(v.width, units.in(48)).hole(parts.rect(units.in(20), units.in(44))), { to: units.in(14), material: "Galvanized steel" });
    ctx.parts.define("acme.curb.24", b.build());
  },
});

PartBuilder.cut ​

Remove material with a profile pushed out of its view: openings, recesses, holes through a casing.

ts
cut(profile: Profile, spec: { on?: View; at?: Length; from?: Length; to: Length } & BodyOptions): PartBuilder

Topics: cut, opening, hole, recess, subtract, boolean

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.cut(parts.rect(units.in(10), units.in(8), { center: [units.in(0), units.in(6)] }), { on: "front", from: units.in(0), to: units.in(20) });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.revolve ​

Turn a profile about a line drawn in the same view (default 360 degrees): bells, domes, nozzles, round tanks with heads.

ts
revolve(profile: Profile, spec: { on?: View; at?: Length; axis: [[Length, Length], [Length, Length]]; angle?: number; startAngle?: number } & BodyOptions): PartBuilder

Topics: revolve, turn, lathe, round body, dome, nozzle

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Bell", { type: "12", category: "generic" });
    b.revolve(parts.polygon([[units.in(4), units.in(0)], [units.in(6), units.in(0)], [units.in(4.5), units.in(8)], [units.in(4), units.in(8)]]), { on: "front", axis: [[units.in(0), units.in(0)], [units.in(0), units.in(1)]] });
    ctx.parts.define("acme.bell.12", b.build());
  },
});

PartBuilder.sweep ​

Carry a profile along straights and bends drawn in a view: elbows, offsets, coil returns, handrails. The profile is drawn across the path where it starts.

ts
sweep(profile: Profile, path: SweepPath, opts?: BodyOptions): PartBuilder

Topics: sweep, elbow, bend, offset, fitting, path

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Elbow", { type: "10 in 90", category: "duct_accessory" });
    b.sweep(parts.circle(units.in(10)), { on: "plan", at: units.in(12), start: [units.in(0), units.in(0)], heading: "right", segments: [{ straight: units.in(4) }, { bend: { radius: units.in(15), angle: 90, turn: "left" } }, { straight: units.in(4) }] });
    ctx.parts.define("acme.elbow.10", b.build());
  },
});

PartBuilder.loft ​

A solid through two or more sections, each a profile on its own plane: square-to-round transitions, hoods, cones, wye legs.

ts
loft(sections: { profile: Profile; on?: View; at: Length }[], opts?: BodyOptions): PartBuilder

Topics: loft, square to round, transition, taper, wye, cone

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Square to round", { type: "24-16", category: "duct_accessory" });
    b.loft([{ profile: parts.rect(v.width, v.width), at: units.in(0) }, { profile: parts.circle(units.in(16)), at: units.in(18) }]);
    ctx.parts.define("acme.s2r.24", b.build());
  },
});

PartBuilder.pattern ​

Repeat earlier bodies (by id, or "last") in a line or around an axis: coil fins, louvre blades, bolt circles, breaker rows.

ts
pattern(ids: string[] | "last", spec: { along: "x" | "y" | "z"; count: number; spacing: Length } | { around: "x" | "y" | "z"; count: number; angle?: number; center?: [Length, Length, Length] }, opts?: { id?: string }): PartBuilder

Topics: pattern, repeat, array, louvre, fins, bolt circle

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.extrude(parts.rect(units.in(0.5), units.in(12)), { from: units.in(12), to: units.in(13), id: "blade" });
    b.pattern(["blade"], { along: "x", count: 6, spacing: units.in(3) });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.mirror ​

A mirrored copy of earlier bodies across the plane square to an axis (at along it; default the centre).

ts
mirror(ids: string[] | "last", spec: { across: "x" | "y" | "z"; at?: Length }, opts?: { id?: string }): PartBuilder

Topics: mirror, symmetric, copy, opposite side

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.extrude(parts.rect(units.in(2), units.in(2), { center: [units.in(8), units.in(4)] }), { from: units.in(12), to: units.in(14), id: "foot" });
    b.mirror(["foot"], { across: "y" });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.importBody ​

A body from a vendor's glTF or OBJ library file, pinned by its content hash (read sanitized and size-capped by the host); at places its origin, turn turns it about z.

ts
importBody(body: ImportedBodyRef, at?: { x?: Length; y?: Length; z?: Length; turn?: number }, opts?: BodyOptions): PartBuilder

Topics: import, gltf, obj, vendor model, manufacturer model, 3d file

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Vendor fan", { type: "24", category: "mechanical_equipment" });
    b.box({ length: v.width, width: v.width, height: units.in(2) });
    b.importBody({ fileId: "library-file-1", format: "gltf", contentHash: "sha256:demo", mmPerUnit: 1000, upAxis: "y" }, { z: units.in(2) });
    ctx.parts.define("acme.fan.24", b.build());
  },
});

PartBuilder.symbol ​

Plan symbol drawn instead of the solid at chosen detail levels: shapes, lines, texts, optional paper-space scaling (units: "paper"), minimum plotted paper floor (minPaperMm on model-size symbols so true-scale equipment stays legible when zoomed out), opaque white mask (mask: true), solid black fill (filled: true), and pen weight. Levels without a symbol fall back to the solid seen from above.

ts
symbol(levels: DetailLevel | DetailLevel[], draw: { shapes?: Profile[]; lines?: [[Length, Length], [Length, Length]][]; texts?: { at: [Length, Length]; text: string; heightMm?: number; anchor?: "start" | "middle" | "end" }[]; units?: "model" | "paper"; minPaperMm?: number; pen?: "thin" | "medium" | "wide" | "heavy"; filled?: boolean; mask?: boolean }, view?: "plan" | "below"): PartBuilder

Topics: symbol, plan symbol, custom symbol, paper scale, annotative, minPaperMm, minimum paper height, mask, fill, detail level, coarse, fine, drafting

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.symbol(["coarse", "medium"], { units: "paper", mask: true, shapes: [parts.circle(units.mm(3.2))], lines: [[[units.mm(-0.65), units.mm(-2.5)], [units.mm(-0.65), units.mm(1.45)]], [[units.mm(0.65), units.mm(-2.5)], [units.mm(0.65), units.mm(1.45)]]], texts: [{ at: [units.mm(2.2), units.mm(1.7)], text: "WP", heightMm: 1.7, anchor: "start" }] });
    b.symbol("fine", { units: "model", minPaperMm: 4, mask: true, shapes: [parts.rect(units.in(24), units.in(24))] });
    ctx.parts.define("acme.wp_receptacle", b.build());
  },
});

PartBuilder.symbolRef ​

Attach a registered plan symbol from SYMBOL_POINT (e.g. electrical.plan_duplex, electrical.plan_gfci, electrical.plan_switch, electrical.plan_occ_sensor, electrical.plan_downlight_em) at chosen detail levels.

ts
symbolRef(levels: DetailLevel | DetailLevel[], symbolId: string, view?: "plan" | "below"): PartBuilder

Topics: symbol, symbolRef, electrical symbol, plan symbol, receptacle, switch, detail level

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.symbolRef(["coarse", "medium", "fine"], "electrical.plan_gfci");
    ctx.parts.define("acme.gfci_custom", b.build());
  },
});

PartBuilder.clearance ​

Space kept clear in front of a face (service access, combustibles, working space); never solid, checked by clash.

ts
clearance(zone: { id: string; name: string; purpose: string; face: Face; depth: Length; width?: Length; height?: Length; fromFloor?: boolean }): PartBuilder

Topics: clearance, service access, working space, keep clear

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.clearance({ id: "service", name: "Service", purpose: "service_access", face: "front", depth: units.in(36) });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.connectorAt ​

A connector at an exact point of the part (x to the front, y to the left, z up), facing out of a face: an outlet on a section, a stub on a hood.

ts
connectorAt(c: ConnectorSpec & { at: [Length, Length, Length]; facing: Face }): PartBuilder

Topics: connector, condensate, drain connection, exact position

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.connectorAt({ id: "drain", label: "Condensate drain", domain: "pipe", systemKind: "sanitary", shape: "round", diameter: units.in(0.75), at: [units.in(12), units.in(-4), units.in(2)], facing: "front", endType: "plumbing_gas.threaded" });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.instanceParam ​

A value each placed copy carries for itself (a panel's name, its mains), with an optional default; shown in properties and schedules, not in the shape.

ts
instanceParam(name: string, spec: { label: string; kind: "text" | "number" | "boolean" | "choice"; default?: string | number | boolean; unit?: string; choices?: string[] }): PartBuilder

Topics: instance parameter, per copy, panel name, property

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    b.instanceParam("panel_name", { label: "Panel name", kind: "text", default: "LP-1" });
    ctx.parts.define("acme.box.24", b.build());
  },
});

PartBuilder.draft ​

The definition as built so far, unchecked.

ts
draft(): PartTypeDefinition

Topics: draft

Example script
ts
import { defineScript, units, routes, parts, building, equipment, documents, checks } from "@permitzip/bim-script";
export default defineScript({
  kind: "part",
  reads: {},
  parameters: { width: { type: "quantity", kind: "length", unit: "in", label: "Width", default: units.in(24) } },
  run(ctx, v) {
    const b = parts.part("Box", { type: "24", category: "generic" });
    b.box({ length: v.width, width: units.in(12), height: units.in(12) });
    const draft = b.draft();
    ctx.parts.define("acme.box.24", { ...draft, description: "A drafted box" });
  },
});

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