Docs/CAD

Getting started

Run the app

bash
yarn install
yarn dev            # app-server on :4000 + web app on :1420

Open <http://localhost:1420>, create a project, then add a sheet and choose CAD part or CAD assembly in the New sheet dialog.

The CAD editor is loaded as a lazy chunk: the app shell never imports OCCT or Babylon. Evaluation runs in a module Web Worker that loads the OCCT wasm once per page.

Create your first part

  1. New sheet → CAD part. The starter program evaluates to a simple block.
  2. Click Sketch in the feature toolbar at the bottom of the viewport. The viewport turns normal to the XY plane and enters sketch mode.
  3. Draw a rectangle (two clicks) — the sketch block is appended to the source.
  4. Click Extrude; the last sketch is picked automatically. Drag the yellow depth arrow or type a depth, choose an Operation, then click the green check. The block is committed and the part re-evaluates.
  5. Click the Extrude 1 row in the feature tree to re-open its dialog, or Show in source to jump to the generated statements.

Every action wrote source. Open the Source panel to see the marked blocks.

Commands for CAD work

CommandWhat it does
yarn test:cad-editorJest suite for the workbench source layer (tools, sketches, assembly placement, terrain, pipes).
yarn test:cad-kernelNode tests for the OCCT kernel: translation, tessellation, STEP import/export, assembly composition, pipe/DEM meshes.
yarn test:cad-featurescriptParser/interpreter, source spans, execution trace and history projection.
yarn test:cad-workbenchBrowser acceptance: creates CAD sheets, drives tools and gizmos, exports, reloads. Needs both dev servers.
yarn test:cad-cfdBrowser acceptance for the CFD mapping slice.
yarn cad:kernelBuild @indispec/cad-kernel (required before the kernel tests).

Where the code lives

PackageResponsibility
packages/cad/featurescriptVendored FeatureScript engine: lexer, parser, interpreter, regions, execution trace, history projection, assembly recorder.
packages/cad/kernelOCCT kernel of record: geometry translation, tessellation, exact metrics, STEP import/export, pipe and DEM meshes, assembly composition. Also exposes a browser entry point.
packages/editors/cadThe workbench UIs (CadPartEditor, CadAssemblyEditor), tool-to-source compilers, viewer, worker, CFD pane, terrain picker.
packages/types/sld-typesPage types, CAD payload types, starter sources.

The one rule

Never mutate derived geometry. The viewport, feature tree and metrics are read-only views of an evaluation. If you need to change the model, change the program — through a tool block compiler (tooling.ts, assembly-tooling.ts) or the source editor. That rule is what keeps undo, collaboration and review working.