brepjs 20.11.3 → 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/brepjs.cjs +4 -3
- package/dist/brepjs.js +4 -4
- package/dist/{drawFns-CccVnQU5.cjs → drawFns-C_YnK4Ar.cjs} +1 -1
- package/dist/{drawFns-OR6Hjs8g.js → drawFns-D6YK0JbH.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/text/fontRegistry.d.ts +12 -1
- package/dist/text.cjs +3 -2
- package/dist/text.d.ts +1 -1
- package/dist/text.js +3 -3
- package/dist/{textBlueprints-BRr35eaP.cjs → textBlueprints-C38JfUeN.cjs} +32 -8
- package/dist/{textBlueprints-BxoVq7Fr.js → textBlueprints-TLU7rjuN.js} +27 -9
- package/dist/{textMetrics-DaNriztv.js → textMetrics-CEnX8GBe.js} +1 -1
- package/dist/{textMetrics-DwMUM6GY.cjs → textMetrics-r9ldmBb5.cjs} +1 -1
- 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).
|
package/dist/brepjs.cjs
CHANGED
|
@@ -24,18 +24,18 @@ const require_threadFns = require("./threadFns-BzxB-0i5.cjs");
|
|
|
24
24
|
const require_blueprintSketcher = require("./blueprintSketcher-CG4H8A6M.cjs");
|
|
25
25
|
const require_helpers = require("./helpers-GZyqAK5c.cjs");
|
|
26
26
|
const require_blueprint = require("./blueprint-CHBjfXQO.cjs");
|
|
27
|
-
const require_drawFns = require("./drawFns-
|
|
27
|
+
const require_drawFns = require("./drawFns-C_YnK4Ar.cjs");
|
|
28
28
|
const require_measureFns = require("./measureFns-Cyjpl2Kl.cjs");
|
|
29
29
|
const require_cornerFinder = require("./cornerFinder-Bg67ivza.cjs");
|
|
30
30
|
const require_boolean2D = require("./boolean2D-DjJogOY-.cjs");
|
|
31
31
|
const require_blueprintFns = require("./blueprintFns-DOdzDcPX.cjs");
|
|
32
32
|
const require_importFns = require("./importFns-C3LbWc6X.cjs");
|
|
33
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
33
|
+
const require_textBlueprints = require("./textBlueprints-C38JfUeN.cjs");
|
|
34
34
|
const require_loftFns = require("./loftFns-BsFinbgs.cjs");
|
|
35
35
|
const require_refResolveFns = require("./refResolveFns-awGNYa3x.cjs");
|
|
36
36
|
const require_adjacencyFns = require("./adjacencyFns-Cibtcqdl.cjs");
|
|
37
37
|
const require_cameraFns = require("./cameraFns-CUX8VNKT.cjs");
|
|
38
|
-
const require_textMetrics = require("./textMetrics-
|
|
38
|
+
const require_textMetrics = require("./textMetrics-r9ldmBb5.cjs");
|
|
39
39
|
const require_principalBoxFns = require("./principalBoxFns-uZrBoGLA.cjs");
|
|
40
40
|
const require_workerPool = require("./workerPool-D5tiNXrI.cjs");
|
|
41
41
|
// src/kernel/types.ts
|
|
@@ -9831,6 +9831,7 @@ exports.sdfTorus = torus;
|
|
|
9831
9831
|
exports.section = section;
|
|
9832
9832
|
exports.sectionToFace = sectionToFace;
|
|
9833
9833
|
exports.serializeHistory = require_threadFns.serializeHistory;
|
|
9834
|
+
exports.setFallbackFont = require_textBlueprints.setFallbackFont;
|
|
9834
9835
|
exports.setJointValue = require_threadFns.setJointValue;
|
|
9835
9836
|
exports.setJointValues = require_threadFns.setJointValues;
|
|
9836
9837
|
exports.setShapeOrigin = require_originTrackingFns.setShapeOrigin;
|
package/dist/brepjs.js
CHANGED
|
@@ -22,18 +22,18 @@ import { A as setJointValue, B as walkAssembly, C as cylindricalJoint, D as plan
|
|
|
22
22
|
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CQPC4SEF.js";
|
|
23
23
|
import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-CBXclBes.js";
|
|
24
24
|
import { _ as approximateAsSvgCompatibleCurve, o as ellipseArcFlags } from "./blueprint-CN5dNZ1h.js";
|
|
25
|
-
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-
|
|
25
|
+
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-D6YK0JbH.js";
|
|
26
26
|
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-DukwjzUl.js";
|
|
27
27
|
import { t as cornerFinder } from "./cornerFinder-utEooGH7.js";
|
|
28
28
|
import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-tR_2N_Vy.js";
|
|
29
29
|
import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns--26Mr3Lm.js";
|
|
30
30
|
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-CcPhunG6.js";
|
|
31
|
-
import { a as
|
|
31
|
+
import { S as revolve$2, a as Sketches, b as extrude$2, c as compoundSketchFace, d as sketchExtrude, f as sketchFace, g as sketchWires, h as sketchSweep, i as setFallbackFont, l as compoundSketchLoft, m as sketchRevolve, n as getFont, o as Sketch, p as sketchLoft, r as loadFont, s as compoundSketchExtrude, t as textBlueprints, u as compoundSketchRevolve, x as extrudeAll, y as CompoundSketch } from "./textBlueprints-TLU7rjuN.js";
|
|
32
32
|
import { a as multiSectionSweep, c as twistExtrude, i as guidedSweep, n as loftAll, o as supportExtrude, r as complexExtrude, s as sweep$1, t as loft$2 } from "./loftFns-pMh0ET-J.js";
|
|
33
33
|
import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-BvQkLKLw.js";
|
|
34
34
|
import { a as facesOfVertex, c as verticesOfFace, i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-C0YD3Zrp.js";
|
|
35
35
|
import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-xUCRxpsa.js";
|
|
36
|
-
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-
|
|
36
|
+
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CEnX8GBe.js";
|
|
37
37
|
import { t as principalBoundingBox } from "./principalBoxFns-ClynMQMo.js";
|
|
38
38
|
import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-Bc5hmJc4.js";
|
|
39
39
|
// \0rolldown/runtime.js
|
|
@@ -9303,4 +9303,4 @@ var csg_exports = /* @__PURE__ */ __exportAll({
|
|
|
9303
9303
|
zShapeProfile: () => zShapeProfile
|
|
9304
9304
|
});
|
|
9305
9305
|
/* v8 ignore file */
|
|
9306
|
-
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, GeometryCleanupError, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToContour, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDerivedFaceRef, createDistanceQuery, createEdge, createEdgeRef, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createVertexRef, createWire, createWorkerClient, createWorkerHandler, createWorkerPool, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, facesOfVertex, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isBatchRequest, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDerivedFaceRef, isDisposeRequest, isEdge, isEdgeRef, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFaceRef, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLineageRef, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isVertexRef, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, locate, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshLODs, meshLODsProgressive, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, principalBoundingBox, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeFaces, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDerivedFaceRef, resolveDirection, resolveEdgeRef, resolveLineageRef, resolvePlane, resolveRef, resolveRefIn, resolveRefParams, resolveVertexRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLODGeometryLevels, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, verticesOfFace, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
|
9306
|
+
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, GeometryCleanupError, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToContour, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDerivedFaceRef, createDistanceQuery, createEdge, createEdgeRef, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createVertexRef, createWire, createWorkerClient, createWorkerHandler, createWorkerPool, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, facesOfVertex, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isBatchRequest, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDerivedFaceRef, isDisposeRequest, isEdge, isEdgeRef, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFaceRef, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLineageRef, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isVertexRef, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, locate, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshLODs, meshLODsProgressive, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, principalBoundingBox, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeFaces, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDerivedFaceRef, resolveDirection, resolveEdgeRef, resolveLineageRef, resolvePlane, resolveRef, resolveRefIn, resolveRefParams, resolveVertexRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setFallbackFont, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLODGeometryLevels, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, verticesOfFace, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
|
@@ -15,7 +15,7 @@ const require_helpers = require("./helpers-GZyqAK5c.cjs");
|
|
|
15
15
|
const require_blueprint = require("./blueprint-CHBjfXQO.cjs");
|
|
16
16
|
const require_cornerFinder = require("./cornerFinder-Bg67ivza.cjs");
|
|
17
17
|
const require_boolean2D = require("./boolean2D-DjJogOY-.cjs");
|
|
18
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
18
|
+
const require_textBlueprints = require("./textBlueprints-C38JfUeN.cjs");
|
|
19
19
|
const require_cameraFns = require("./cameraFns-CUX8VNKT.cjs");
|
|
20
20
|
// src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
@@ -15,7 +15,7 @@ import { b as squareDistance2d, l as add2d, s as PRECISION_OFFSET, v as samePoin
|
|
|
15
15
|
import { _ as approximateAsSvgCompatibleCurve, a as edgeToCurve, f as make2dInerpolatedBSplineCurve, i as curvesAsEdgesOnPlane, l as make2dCircle, p as make2dSegmentCurve, s as make2dArcFromCenter, t as Blueprint, u as make2dEllipse, v as Curve2D, x as BoundingBox2d, y as deserializeCurve2D } from "./blueprint-CN5dNZ1h.js";
|
|
16
16
|
import { t as cornerFinder } from "./cornerFinder-utEooGH7.js";
|
|
17
17
|
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-tR_2N_Vy.js";
|
|
18
|
-
import { _ as
|
|
18
|
+
import { _ as wrapSketchData, a as Sketches, o as Sketch, t as textBlueprints, v as wrapSketchDataArray } from "./textBlueprints-TLU7rjuN.js";
|
|
19
19
|
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-xUCRxpsa.js";
|
|
20
20
|
// src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export { drawProjection, drawFaceOutline } from './sketching/draw3d.js';
|
|
|
66
66
|
export type { DrawingInterface, SketchData } from './2d/blueprints/lib.js';
|
|
67
67
|
export { sketchExtrude, sketchRevolve, sketchLoft, sketchSweep, sketchFace, sketchWires, compoundSketchExtrude, compoundSketchRevolve, compoundSketchFace, compoundSketchLoft, } from './sketching/sketchFns.js';
|
|
68
68
|
export { drawingToSketchOnPlane, drawingFuse, drawingCut, drawingIntersect, drawingFillet, drawingChamfer, translateDrawing, rotateDrawing, scaleDrawing, mirrorDrawing, } from './sketching/drawFns.js';
|
|
69
|
-
export { loadFont, getFont } from './text/fontRegistry.js';
|
|
69
|
+
export { loadFont, getFont, setFallbackFont } from './text/fontRegistry.js';
|
|
70
70
|
export { textBlueprints } from './text/textBlueprints.js';
|
|
71
71
|
export { sketchText } from './text/sketchText.js';
|
|
72
72
|
export { textMetrics, fontMetrics, type TextMetricsResult, type FontMetricsResult, } from './text/textMetrics.js';
|
package/dist/sketching.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_blueprintSketcher = require("./blueprintSketcher-CG4H8A6M.cjs");
|
|
3
|
-
const require_drawFns = require("./drawFns-
|
|
4
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
3
|
+
const require_drawFns = require("./drawFns-C_YnK4Ar.cjs");
|
|
4
|
+
const require_textBlueprints = require("./textBlueprints-C38JfUeN.cjs");
|
|
5
5
|
// src/sketching.ts
|
|
6
6
|
/**
|
|
7
7
|
* brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
|
package/dist/sketching.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-CQPC4SEF.js";
|
|
2
|
-
import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-
|
|
3
|
-
import { a as
|
|
2
|
+
import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-D6YK0JbH.js";
|
|
3
|
+
import { a as Sketches, c as compoundSketchFace, d as sketchExtrude, f as sketchFace, g as sketchWires, h as sketchSweep, l as compoundSketchLoft, m as sketchRevolve, o as Sketch, p as sketchLoft, s as compoundSketchExtrude, u as compoundSketchRevolve, y as CompoundSketch } from "./textBlueprints-TLU7rjuN.js";
|
|
4
4
|
// src/sketching.ts
|
|
5
5
|
/**
|
|
6
6
|
* brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
|
|
@@ -13,10 +13,21 @@ import { OpenTypeFont } from '../kernel/occt/wasmTypes/externals.js';
|
|
|
13
13
|
* @returns The parsed opentype.js Font object.
|
|
14
14
|
*/
|
|
15
15
|
export declare function loadFont(fontPath: string | ArrayBuffer, fontFamily?: string, force?: boolean): Promise<Result<OpenTypeFont>>;
|
|
16
|
+
/**
|
|
17
|
+
* Register a font that text functions use when no font has been loaded.
|
|
18
|
+
*
|
|
19
|
+
* Unlike {@link loadFont}, this does not occupy the `'default'` family: once any font is
|
|
20
|
+
* loaded, it takes precedence over the fallback.
|
|
21
|
+
*
|
|
22
|
+
* @param fontData - Raw OpenType/TrueType font bytes.
|
|
23
|
+
* @returns The parsed opentype.js Font object.
|
|
24
|
+
*/
|
|
25
|
+
export declare function setFallbackFont(fontData: ArrayBuffer): Result<OpenTypeFont>;
|
|
16
26
|
/**
|
|
17
27
|
* Retrieve a previously loaded font by family name.
|
|
18
28
|
*
|
|
19
29
|
* @param fontFamily - Registry key (defaults to `'default'`).
|
|
20
|
-
* @returns The opentype.js Font object, or `undefined` if not loaded.
|
|
30
|
+
* @returns The opentype.js Font object, or `undefined` if not loaded. `'default'` resolves
|
|
31
|
+
* to the fallback font when no font has been loaded.
|
|
21
32
|
*/
|
|
22
33
|
export declare const getFont: (fontFamily?: string) => OpenTypeFont | undefined;
|
package/dist/text.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
3
|
-
const require_textMetrics = require("./textMetrics-
|
|
2
|
+
const require_textBlueprints = require("./textBlueprints-C38JfUeN.cjs");
|
|
3
|
+
const require_textMetrics = require("./textMetrics-r9ldmBb5.cjs");
|
|
4
4
|
exports.fontMetrics = require_textMetrics.fontMetrics;
|
|
5
5
|
exports.getFont = require_textBlueprints.getFont;
|
|
6
6
|
exports.loadFont = require_textBlueprints.loadFont;
|
|
7
|
+
exports.setFallbackFont = require_textBlueprints.setFallbackFont;
|
|
7
8
|
exports.sketchText = require_textMetrics.sketchText;
|
|
8
9
|
exports.textBlueprints = require_textBlueprints.textBlueprints;
|
|
9
10
|
exports.textMetrics = require_textMetrics.textMetrics;
|
package/dist/text.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* import { loadFont, sketchText } from 'brepjs/text';
|
|
7
7
|
* ```
|
|
8
8
|
*/
|
|
9
|
-
export { loadFont, getFont } from './text/fontRegistry.js';
|
|
9
|
+
export { loadFont, getFont, setFallbackFont } from './text/fontRegistry.js';
|
|
10
10
|
export { textBlueprints } from './text/textBlueprints.js';
|
|
11
11
|
export { sketchText } from './text/sketchText.js';
|
|
12
12
|
export { textMetrics, fontMetrics, type TextMetricsResult, type FontMetricsResult, } from './text/textMetrics.js';
|
package/dist/text.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-
|
|
2
|
-
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-
|
|
3
|
-
export { fontMetrics, getFont, loadFont, sketchText, textBlueprints, textMetrics };
|
|
1
|
+
import { i as setFallbackFont, n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-TLU7rjuN.js";
|
|
2
|
+
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CEnX8GBe.js";
|
|
3
|
+
export { fontMetrics, getFont, loadFont, setFallbackFont, sketchText, textBlueprints, textMetrics };
|
|
@@ -824,25 +824,43 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
824
824
|
if (!response.ok) return require_errors.err(require_errors.ioError(require_errors.BrepErrorCode.FONT_FETCH_FAILED, `Failed to fetch font from ${fontPath}: HTTP ${response.status} ${response.statusText}`));
|
|
825
825
|
fontData = await response.arrayBuffer();
|
|
826
826
|
} else fontData = fontPath;
|
|
827
|
-
|
|
827
|
+
const parsed = parseFont(fontData);
|
|
828
|
+
if (!parsed.ok) return parsed;
|
|
829
|
+
FONT_REGISTER[fontFamily] = parsed.value;
|
|
830
|
+
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = parsed.value;
|
|
831
|
+
return parsed;
|
|
832
|
+
}
|
|
833
|
+
function parseFont(fontData) {
|
|
828
834
|
try {
|
|
829
|
-
|
|
835
|
+
return require_errors.ok(opentype_js.default.parse(fontData));
|
|
830
836
|
} catch (e) {
|
|
831
837
|
return require_errors.err(require_errors.ioError(require_errors.BrepErrorCode.FONT_PARSE_FAILED, `Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
832
838
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
839
|
+
}
|
|
840
|
+
var fallbackFont;
|
|
841
|
+
/**
|
|
842
|
+
* Register a font that text functions use when no font has been loaded.
|
|
843
|
+
*
|
|
844
|
+
* Unlike {@link loadFont}, this does not occupy the `'default'` family: once any font is
|
|
845
|
+
* loaded, it takes precedence over the fallback.
|
|
846
|
+
*
|
|
847
|
+
* @param fontData - Raw OpenType/TrueType font bytes.
|
|
848
|
+
* @returns The parsed opentype.js Font object.
|
|
849
|
+
*/
|
|
850
|
+
function setFallbackFont(fontData) {
|
|
851
|
+
const parsed = parseFont(fontData);
|
|
852
|
+
if (parsed.ok) fallbackFont = parsed.value;
|
|
853
|
+
return parsed;
|
|
837
854
|
}
|
|
838
855
|
/**
|
|
839
856
|
* Retrieve a previously loaded font by family name.
|
|
840
857
|
*
|
|
841
858
|
* @param fontFamily - Registry key (defaults to `'default'`).
|
|
842
|
-
* @returns The opentype.js Font object, or `undefined` if not loaded.
|
|
859
|
+
* @returns The opentype.js Font object, or `undefined` if not loaded. `'default'` resolves
|
|
860
|
+
* to the fallback font when no font has been loaded.
|
|
843
861
|
*/
|
|
844
862
|
var getFont = (fontFamily = "default") => {
|
|
845
|
-
return FONT_REGISTER[fontFamily];
|
|
863
|
+
return FONT_REGISTER[fontFamily] ?? (fontFamily === "default" ? fallbackFont : void 0);
|
|
846
864
|
};
|
|
847
865
|
// src/text/textBlueprints.ts
|
|
848
866
|
var sketchFontCommands = function* (commands) {
|
|
@@ -960,6 +978,12 @@ Object.defineProperty(exports, "revolve", {
|
|
|
960
978
|
return revolve;
|
|
961
979
|
}
|
|
962
980
|
});
|
|
981
|
+
Object.defineProperty(exports, "setFallbackFont", {
|
|
982
|
+
enumerable: true,
|
|
983
|
+
get: function() {
|
|
984
|
+
return setFallbackFont;
|
|
985
|
+
}
|
|
986
|
+
});
|
|
963
987
|
Object.defineProperty(exports, "sketchExtrude", {
|
|
964
988
|
enumerable: true,
|
|
965
989
|
get: function() {
|
|
@@ -822,25 +822,43 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
822
822
|
if (!response.ok) return err(ioError(BrepErrorCode.FONT_FETCH_FAILED, `Failed to fetch font from ${fontPath}: HTTP ${response.status} ${response.statusText}`));
|
|
823
823
|
fontData = await response.arrayBuffer();
|
|
824
824
|
} else fontData = fontPath;
|
|
825
|
-
|
|
825
|
+
const parsed = parseFont(fontData);
|
|
826
|
+
if (!parsed.ok) return parsed;
|
|
827
|
+
FONT_REGISTER[fontFamily] = parsed.value;
|
|
828
|
+
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = parsed.value;
|
|
829
|
+
return parsed;
|
|
830
|
+
}
|
|
831
|
+
function parseFont(fontData) {
|
|
826
832
|
try {
|
|
827
|
-
|
|
833
|
+
return ok(opentype.parse(fontData));
|
|
828
834
|
} catch (e) {
|
|
829
835
|
return err(ioError(BrepErrorCode.FONT_PARSE_FAILED, `Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
830
836
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
837
|
+
}
|
|
838
|
+
var fallbackFont;
|
|
839
|
+
/**
|
|
840
|
+
* Register a font that text functions use when no font has been loaded.
|
|
841
|
+
*
|
|
842
|
+
* Unlike {@link loadFont}, this does not occupy the `'default'` family: once any font is
|
|
843
|
+
* loaded, it takes precedence over the fallback.
|
|
844
|
+
*
|
|
845
|
+
* @param fontData - Raw OpenType/TrueType font bytes.
|
|
846
|
+
* @returns The parsed opentype.js Font object.
|
|
847
|
+
*/
|
|
848
|
+
function setFallbackFont(fontData) {
|
|
849
|
+
const parsed = parseFont(fontData);
|
|
850
|
+
if (parsed.ok) fallbackFont = parsed.value;
|
|
851
|
+
return parsed;
|
|
835
852
|
}
|
|
836
853
|
/**
|
|
837
854
|
* Retrieve a previously loaded font by family name.
|
|
838
855
|
*
|
|
839
856
|
* @param fontFamily - Registry key (defaults to `'default'`).
|
|
840
|
-
* @returns The opentype.js Font object, or `undefined` if not loaded.
|
|
857
|
+
* @returns The opentype.js Font object, or `undefined` if not loaded. `'default'` resolves
|
|
858
|
+
* to the fallback font when no font has been loaded.
|
|
841
859
|
*/
|
|
842
860
|
var getFont = (fontFamily = "default") => {
|
|
843
|
-
return FONT_REGISTER[fontFamily];
|
|
861
|
+
return FONT_REGISTER[fontFamily] ?? (fontFamily === "default" ? fallbackFont : void 0);
|
|
844
862
|
};
|
|
845
863
|
// src/text/textBlueprints.ts
|
|
846
864
|
var sketchFontCommands = function* (commands) {
|
|
@@ -886,4 +904,4 @@ function textBlueprints(text, { startX = 0, startY = 0, fontSize = 16, fontFamil
|
|
|
886
904
|
const blueprints = Array.from(sketchFontCommands(writtenText.commands));
|
|
887
905
|
return organiseBlueprints(blueprints).mirror([0, 0]);
|
|
888
906
|
}
|
|
889
|
-
export {
|
|
907
|
+
export { revolve as S, wrapSketchData as _, Sketches as a, extrude as b, compoundSketchFace as c, sketchExtrude as d, sketchFace as f, sketchWires as g, sketchSweep as h, setFallbackFont as i, compoundSketchLoft as l, sketchRevolve as m, getFont as n, Sketch as o, sketchLoft as p, loadFont as r, compoundSketchExtrude as s, textBlueprints as t, compoundSketchRevolve as u, wrapSketchDataArray as v, extrudeAll as x, CompoundSketch as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as wrapSketchData, a as Sketches, n as getFont, t as textBlueprints, y as CompoundSketch } from "./textBlueprints-TLU7rjuN.js";
|
|
3
3
|
// src/text/sketchText.ts
|
|
4
4
|
/**
|
|
5
5
|
* Render text as 3D sketch outlines on a plane.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
2
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
2
|
+
const require_textBlueprints = require("./textBlueprints-C38JfUeN.cjs");
|
|
3
3
|
// src/text/sketchText.ts
|
|
4
4
|
/**
|
|
5
5
|
* Render text as 3D sketch outlines on a plane.
|
|
@@ -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.
|
|
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",
|