bimtex
Reference

Public API

The small stable surface for parsing, compiling, drawing, validating, editing and agent integration.

import {
  parseNdjson,
  compile,
  validate,
  drawPlan,
  drawElevation,
  drawSection,
  drawAxonometric,
  buildSheetSet,
  exportIfc,
  exportGlb,
  exportObj,
  deriveViewSet,
  applyOps,
  getIndex
} from 'bimtex';

For browser bundles import submodules so writeSheetSet() does not pull node:fs into the client:

import { compile, parseNdjson } from 'bimtex/lib/compile';
import { drawPlan, drawElevation } from 'bimtex/lib/draw';
import { validate } from 'bimtex/lib/validate';

Drawing functions return SVG fragments. buildSheetSet(sourceOrCompiled) returns framed SVG documents and reuses a supplied compile() result. Passing source entities remains supported. validate() is a separate, non-mutating pass.

deriveViewSet(compiled, entities) answers what can this model honestly show — the derived reveals plus whatever the model authored. See Views and 3D.

exportIfc(compiled, options) returns an IFC4 STEP string with BIM semantics; await exportGlb(compiled) returns a binary glTF Uint8Array from the same scene as the live viewer; and await exportObj(compiled) returns a geometry-only Wavefront OBJ string in metres with z-up coordinates. See interchange exports.

Two further entry points serve agents: bimtex/ai (the syntax card, vocabulary, tool schemas, validateNdjson and inspect — see For agents) and bimtex/drafter (the shipped loop — see The drafter loop; requires the optional peer dependencies ai, zod and @openrouter/ai-sdk-provider).