libcad

Overview

libcad is a compact CAD runtime intended for portable deployments. This documentation is structured as a practical reference first: each section aims to help developers integrate, inspect behavior, and ship.

Quick Start

Use this as the baseline integration flow.

npm install libcad

import { createModel, Box, exportMesh } from "libcad";

const model = createModel();
model.add(new Box({ width: 10, height: 6, depth: 4 }));
const mesh = exportMesh(model);

Core Concepts

Model

Container for geometry, constraints, and metadata.

Primitive

Parameterized shape definition (box, cylinder, polyline, etc.).

Constraint

Relationship rule used to preserve intent through edits.

Export

Serialized output for rendering, interop, or persistence.

API Reference

createModel(options?) -> Model

Creates a new model workspace and initializes default units.

model.add(entity) -> void

Registers geometry or operation nodes in the model graph.

exportMesh(model, format?) -> MeshData

Builds triangulated output for rendering or external tooling.

Examples

Roadmap

  • Replace placeholder signatures with generated API docs.
  • Add versioned behavior notes and migration guidance.
  • Document browser and native embedding patterns.