brepjs 20.12.0 → 20.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -19
- package/dist/topology/apiTypes.d.ts +4 -2
- package/dist/topology.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# brepjs
|
|
4
4
|
|
|
5
|
-
CAD
|
|
5
|
+
Exact B-Rep CAD in TypeScript, built so AI agents can write parts and check them.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/brepjs)
|
|
8
8
|
[](https://github.com/andymai/brepjs/actions/workflows/ci.yml)
|
|
@@ -10,13 +10,26 @@ CAD modeling for JavaScript.
|
|
|
10
10
|
[](https://github.com/andymai/brepjs/commits/main)
|
|
11
11
|
[](./LICENSE)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
https://github.com/user-attachments/assets/a8dce262-2a86-4db2-8956-9d8ca8adcae4
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
</div>
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
In this real session, a coding agent (Claude Code) reads the official Raspberry Pi 5 drawing, writes the case as a brepjs part, gets an error back from `brep verify`, fixes it, and adds a fan mount on request. The exported STEP opens in FreeCAD. [Watch the narrated version](https://youtu.be/n8Cbg345NRI).
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Parts are plain TypeScript files and the checker is a CLI, so it isn't tied to one agent:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm i -D brepjs brepjs-cad occt-wasm
|
|
23
|
+
npx brep verify part.brep.ts
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
MCP clients can use the `brep-mcp` server instead, and Claude Code users can install the authoring skills as a plugin: `/plugin marketplace add andymai/brepjs`, then `/plugin install brepjs@brepjs`.
|
|
27
|
+
|
|
28
|
+
An agent rebuilt the 46 parts in our example gallery from their descriptions, and all 46 passed verify. [How we measured it](https://brepjs.dev/agent/eval).
|
|
29
|
+
|
|
30
|
+
## Or write it yourself
|
|
31
|
+
|
|
32
|
+
**[▶ Try the live playground](https://brepjs.dev/playground)** · **[Getting Started](./docs/getting-started.md)** · **[Cheat Sheet](./docs/cheat-sheet.md)** · **[Docs](https://brepjs.dev/)**
|
|
20
33
|
|
|
21
34
|
Shapes are exact mathematical boundaries (not triangle meshes), so booleans are precise, measurements are real, and you can export to STEP. TypeScript types prove the geometry is valid at compile time.
|
|
22
35
|
|
|
@@ -40,20 +53,6 @@ brepjs grew out of the love and care I put into [gridfinitylayouttool.com](https
|
|
|
40
53
|
|
|
41
54
|
Neither had the type safety I wanted, so brepjs leans hard on it: branded types, `Result<T,E>`, phantom types that prove invariants at compile time. If it compiles, the geometry is valid. It's strongest at exact, manufacturable geometry — precise booleans, fillets, chamfers and shells; real volumes, areas and clearances; watertight solids that round-trip through STEP — from a single part to a full assembly (enclosures, brackets, fixtures, gridfinity bins, machined and molded parts). It isn't built for organic sculpting or dense lattices; that's what field-based (implicit/voxel) modeling is for.
|
|
42
55
|
|
|
43
|
-
## Scope
|
|
44
|
-
|
|
45
|
-
To set expectations, this project deliberately does not:
|
|
46
|
-
|
|
47
|
-
- **Render or display geometry**: brepjs produces shape data; pass mesh output to Three.js, Babylon.js, or raw WebGL for rendering.
|
|
48
|
-
- **Support organic or sculpting workflows**: brepjs models exact mechanical solids — parts and assemblies; freeform/organic sculpting and dense lattices are out of scope (that's field-based implicit/voxel territory).
|
|
49
|
-
- **Output SVG or 2D files**: 2D drawing primitives exist solely as an intermediate step toward extruded 3D solids, not as a standalone 2D output format.
|
|
50
|
-
- **Run server-side (SSR)**: WASM requires a browser or Node.js environment with WASM support; server-side rendering frameworks (Next.js, Nuxt, Remix) need a client-only import.
|
|
51
|
-
- **Provide a GUI**: brepjs is a pure programmatic API; there is no visual editor, viewport, or file picker.
|
|
52
|
-
|
|
53
|
-
## Status
|
|
54
|
-
|
|
55
|
-
[occt-wasm](https://github.com/andymai/occt-wasm) (OpenCascade compiled to WebAssembly) is the default kernel. [brepkit](https://github.com/andymai/brepkit), a Rust-based kernel, is in active development as a faster replacement but not yet ready for production use. The kernel abstraction layer means switching is a one-line change. See [benchmarks](./benchmarks/results/latest.md) for performance comparisons.
|
|
56
|
-
|
|
57
56
|
## Install
|
|
58
57
|
|
|
59
58
|
```bash
|
|
@@ -106,6 +105,20 @@ Layer 0 kernel/, utils/ WASM bindings
|
|
|
106
105
|
|
|
107
106
|
Imports flow downward only. Boundaries are enforced in CI.
|
|
108
107
|
|
|
108
|
+
## Scope
|
|
109
|
+
|
|
110
|
+
To set expectations, this project deliberately does not:
|
|
111
|
+
|
|
112
|
+
- **Render or display geometry**: brepjs produces shape data; pass mesh output to Three.js, Babylon.js, or raw WebGL for rendering.
|
|
113
|
+
- **Support organic or sculpting workflows**: brepjs models exact mechanical solids — parts and assemblies; freeform/organic sculpting and dense lattices are out of scope (that's field-based implicit/voxel territory).
|
|
114
|
+
- **Output SVG or 2D files**: 2D drawing primitives exist solely as an intermediate step toward extruded 3D solids, not as a standalone 2D output format.
|
|
115
|
+
- **Run server-side (SSR)**: WASM requires a browser or Node.js environment with WASM support; server-side rendering frameworks (Next.js, Nuxt, Remix) need a client-only import.
|
|
116
|
+
- **Provide a GUI**: brepjs is a pure programmatic API; there is no visual editor, viewport, or file picker.
|
|
117
|
+
|
|
118
|
+
## Status
|
|
119
|
+
|
|
120
|
+
[occt-wasm](https://github.com/andymai/occt-wasm) (OpenCascade compiled to WebAssembly) is the default kernel. [brepkit](https://github.com/andymai/brepkit), a Rust-based kernel, is in active development as a faster replacement but not yet ready for production use. The kernel abstraction layer means switching is a one-line change. See [benchmarks](./benchmarks/results/latest.md) for performance comparisons.
|
|
121
|
+
|
|
109
122
|
## Authoring CAD with AI (brepjs-cad)
|
|
110
123
|
|
|
111
124
|
[`brepjs-cad`](https://www.npmjs.com/package/brepjs-cad) helps an AI agent (or you) author CAD in brepjs and **prove it is correct** before handing it off. An LLM can't see geometry, so it writes a `.brep.ts` part, runs it on a real kernel, and reads a deterministic report instead of guessing from how the code reads. It ships as two cooperating pieces: a **Claude Code skill** (the authoring loop) and a **verification CLI** (validity + measured dimensions + multi-view snapshots + STEP export).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vec2, Vec3 } from '../core/types.js';
|
|
2
2
|
import { AnyShape, Dimension, Edge, Face, Wire, Shape3D } from '../core/shapeTypes.js';
|
|
3
|
-
import { ShapeFinder } from '../query/finderFns.js';
|
|
3
|
+
import { EdgeFinderFn, FaceFinderFn, ShapeFinder } from '../query/finderFns.js';
|
|
4
4
|
/**
|
|
5
5
|
* Structural type matching a Drawing's wire-producing interface.
|
|
6
6
|
* Used in place of importing the actual Drawing class to avoid
|
|
@@ -11,8 +11,9 @@ export interface DrawingLike {
|
|
|
11
11
|
wire: Wire;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
type FinderFor<T extends AnyShape<Dimension>> = T extends Edge ? EdgeFinderFn : T extends Face ? FaceFinderFn : ShapeFinder<T>;
|
|
14
15
|
/** Callback that configures a shape finder for inline use in modifiers. */
|
|
15
|
-
export type FinderFn<T extends AnyShape<Dimension>> = (finder:
|
|
16
|
+
export type FinderFn<T extends AnyShape<Dimension>> = (finder: FinderFor<T>) => ShapeFinder<T>;
|
|
16
17
|
/**
|
|
17
18
|
* Fillet radius specification.
|
|
18
19
|
*
|
|
@@ -126,3 +127,4 @@ export type Shapeable<T extends AnyShape<Dimension>> = T | WrappedMarker<T>;
|
|
|
126
127
|
export declare function resolve<T extends AnyShape<Dimension>>(s: Shapeable<T>): T;
|
|
127
128
|
/** Extract the raw branded 3D shape from a Shapeable<Shape3D>. */
|
|
128
129
|
export declare function resolve3D(s: Shapeable<Shape3D>): Shape3D;
|
|
130
|
+
export {};
|
package/dist/topology.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
5
|
* ```typescript
|
|
6
|
-
* import { box,
|
|
6
|
+
* import { box, fuseAll, variableFillet } from 'brepjs/topology';
|
|
7
7
|
* ```
|
|
8
8
|
*/
|
|
9
9
|
export { getHashCode, isSameShape, isEqualShape, getEdges, getFaces, getWires, getVertices, iterEdges, iterFaces, iterWires, iterVertices, getBounds, vertexPosition, invalidateShapeCache, type Bounds3D, type ShapeDescription, } from './topology/shapeFns.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brepjs",
|
|
3
|
-
"version": "20.12.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "20.12.1",
|
|
4
|
+
"description": "Exact B-Rep CAD in TypeScript on OpenCascade WebAssembly, with a pluggable geometry kernel",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cad",
|
|
7
7
|
"geometry-kernel",
|