brepjs 13.2.0 → 14.1.2
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/dist/2d/curve2dGeometryFns.d.ts +107 -0
- package/dist/2d/curve2dGeometryFns.d.ts.map +1 -0
- package/dist/2d.cjs +230 -3
- package/dist/2d.d.ts +2 -0
- package/dist/2d.d.ts.map +1 -1
- package/dist/2d.js +207 -4
- package/dist/arrayAccess-CmulMesb.cjs +40 -0
- package/dist/arrayAccess-xxcB3YNq.js +23 -0
- package/dist/{blueprint-DYCdRlW5.js → blueprint-B3A5x7P9.js} +10 -10
- package/dist/{blueprint-PLJan-W5.cjs → blueprint-D0XChcek.cjs} +14 -14
- package/dist/{blueprintFns-eWh7NpZx.js → blueprintFns-BwAMXY3t.js} +3 -3
- package/dist/{blueprintFns-Bsx25BG7.cjs → blueprintFns-COrEYX29.cjs} +3 -3
- package/dist/{boolean2D-CtB21ajK.cjs → boolean2D-BPsyKImE.cjs} +20 -19
- package/dist/{boolean2D-52qVCooY.js → boolean2D-D_Te-6N6.js} +13 -12
- package/dist/{booleanFns-BrptUFkP.cjs → booleanFns-B6M6Lm0V.cjs} +24 -22
- package/dist/{booleanFns-iM6UPb8e.js → booleanFns-CgsaJFBf.js} +8 -6
- package/dist/brepjs.cjs +304 -211
- package/dist/brepjs.js +188 -145
- package/dist/constants-B9u763C3.js +9 -0
- package/dist/constants-unWN8k4c.cjs +26 -0
- package/dist/core/curve2dHandle.d.ts +27 -0
- package/dist/core/curve2dHandle.d.ts.map +1 -0
- package/dist/core/errors.d.ts +11 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +2 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -1
- package/dist/core.cjs +9 -8
- package/dist/core.js +6 -5
- package/dist/{cornerFinder-C7aDyYLJ.js → cornerFinder-AEFnAxt4.js} +3 -3
- package/dist/{cornerFinder-SF-xmMO1.cjs → cornerFinder-DTt_SvtC.cjs} +4 -4
- package/dist/{curveFns-C-jU1_Y_.js → curveFns-CcInoOEA.js} +2 -2
- package/dist/{curveFns-ywh7Ctyk.cjs → curveFns-DCEcwcpd.cjs} +2 -2
- package/dist/{drawFns-DknEB-Qs.cjs → drawFns-BOwBIzPa.cjs} +35 -18
- package/dist/{drawFns-D-0p86Lf.js → drawFns-n9qif7QN.js} +17 -15
- package/dist/{errors-DupKEMqI.cjs → errors-9zQcQK1H.cjs} +34 -0
- package/dist/{errors-B_T0aMQF.js → errors-C-cgQA3w.js} +29 -1
- package/dist/{extrudeFns-LsH1rDMa.js → extrudeFns-DrDr9-nU.js} +3 -3
- package/dist/{extrudeFns-CGCIbydL.cjs → extrudeFns-Rcut7h8S.cjs} +3 -3
- package/dist/{faceFns-EnGcKFAr.js → faceFns-TSH54pPQ.js} +94 -4
- package/dist/{faceFns-8dGb8q3J.cjs → faceFns-cE2WxY6I.cjs} +111 -3
- package/dist/{helpers-pQpV9Mwh.cjs → helpers-DZje6XWE.cjs} +18 -17
- package/dist/{helpers-Rf0vhX6I.js → helpers-XrXlKm8D.js} +8 -7
- package/dist/{historyFns-XkjLAQyu.js → historyFns-2hCWrX_X.js} +10 -10
- package/dist/{historyFns-lNalnOdR.cjs → historyFns-BiQ9dmzp.cjs} +10 -10
- package/dist/{importFns-BSH9cGIp.cjs → importFns-DGE5nCSW.cjs} +4 -4
- package/dist/{importFns-Bgs-FYAP.js → importFns-m0xyj0Zt.js} +4 -4
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/brepkitAdapter.d.ts +150 -241
- package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkit/evolutionOps.d.ts +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -1
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/curveOps.d.ts +3 -1
- package/dist/kernel/interfaces/curveOps.d.ts.map +1 -1
- package/dist/kernel/interfaces/surfaceOps.d.ts +3 -1
- package/dist/kernel/interfaces/surfaceOps.d.ts.map +1 -1
- package/dist/kernel/occt/defaultAdapter.d.ts +3 -1
- package/dist/kernel/occt/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/occt/nurbsQueryOps.d.ts +12 -0
- package/dist/kernel/occt/nurbsQueryOps.d.ts.map +1 -0
- package/dist/kernel/types.d.ts +26 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{measureFns-D7J6qUY_.js → measureFns-DHByqdmn.js} +9 -16
- package/dist/{measureFns-CFdHa_fj.cjs → measureFns-D_QKZ5yg.cjs} +9 -16
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-2XnDXgIh.cjs → meshFns-CVe3Kc77.cjs} +4 -4
- package/dist/{meshFns-B7uklc4M.js → meshFns-DL4Djz3w.js} +3 -3
- package/dist/ns/booleans.d.ts +10 -0
- package/dist/ns/booleans.d.ts.map +1 -0
- package/dist/ns/construction.d.ts +10 -0
- package/dist/ns/construction.d.ts.map +1 -0
- package/dist/ns/ioNs.d.ts +18 -0
- package/dist/ns/ioNs.d.ts.map +1 -0
- package/dist/ns/measurement.d.ts +6 -0
- package/dist/ns/measurement.d.ts.map +1 -0
- package/dist/ns/modifiers.d.ts +6 -0
- package/dist/ns/modifiers.d.ts.map +1 -0
- package/dist/ns/patterns.d.ts +5 -0
- package/dist/ns/patterns.d.ts.map +1 -0
- package/dist/ns/primitives.d.ts +7 -0
- package/dist/ns/primitives.d.ts.map +1 -0
- package/dist/ns/query.d.ts +6 -0
- package/dist/ns/query.d.ts.map +1 -0
- package/dist/ns/transforms.d.ts +5 -0
- package/dist/ns/transforms.d.ts.map +1 -0
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{planeOps-cTxDywpG.cjs → planeOps-6Wu7dMDN.cjs} +5 -4
- package/dist/{planeOps-BuBXTLBr.js → planeOps-gTOEarV2.js} +4 -3
- package/dist/{primitiveFns-DKtvEA0i.cjs → primitiveFns-CRPGjIFg.cjs} +101 -69
- package/dist/{primitiveFns-CASk8g16.js → primitiveFns-CeKiYSSW.js} +28 -8
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{arrayAccess-Dps31ERU.js → shapeFns-DCi9O27X.js} +8 -30
- package/dist/{arrayAccess-peFKE9Ob.cjs → shapeFns-aEeSHNqX.cjs} +24 -64
- package/dist/shapeRef.cjs +8 -0
- package/dist/shapeRef.d.ts +5 -0
- package/dist/shapeRef.d.ts.map +1 -0
- package/dist/shapeRef.js +2 -0
- package/dist/shapeRefFns-B1TODUMl.js +194 -0
- package/dist/shapeRefFns-CVdS6jWS.cjs +229 -0
- package/dist/{shapeTypes-CYb8Byqj.js → shapeTypes-BO1aiDhi.js} +3937 -3697
- package/dist/{shapeTypes-CElaawp7.cjs → shapeTypes-BqWQlrYE.cjs} +3937 -3697
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-Cs4XyL58.cjs → solidBuilders-0iVdiZUw.cjs} +3 -3
- package/dist/{solidBuilders-ClJxiUa3.js → solidBuilders-jk7HfWs8.js} +3 -3
- package/dist/{surfaceBuilders-ZUTb3z6i.cjs → surfaceBuilders-C_8rs79F.cjs} +3 -3
- package/dist/{surfaceBuilders-DnGdDW8i.js → surfaceBuilders-DE5e6bp8.js} +3 -3
- package/dist/topology/api.d.ts +3 -3
- package/dist/topology/api.d.ts.map +1 -1
- package/dist/topology/nurbsFns.d.ts +13 -0
- package/dist/topology/nurbsFns.d.ts.map +1 -0
- package/dist/topology/shapeFns.d.ts +4 -3
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeRef/index.d.ts +7 -0
- package/dist/topology/shapeRef/index.d.ts.map +1 -0
- package/dist/topology/shapeRef/scoring.d.ts +16 -0
- package/dist/topology/shapeRef/scoring.d.ts.map +1 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts +47 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts.map +1 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts +40 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +1 -0
- package/dist/topology.cjs +22 -20
- package/dist/topology.d.ts +1 -0
- package/dist/topology.d.ts.map +1 -1
- package/dist/topology.js +7 -7
- package/dist/{vecOps-4iBMiet9.cjs → vecOps-BXvBYIor.cjs} +0 -26
- package/dist/{vecOps-B9-MTeC8.js → vecOps-D9etjPgV.js} +1 -9
- package/dist/vectors.cjs +6 -5
- package/dist/vectors.js +4 -3
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +14 -4
- /package/dist/{types-Bb4KK_iG.js → types-BWBlwp6w.js} +0 -0
- /package/dist/{types-BD-VVaWB.cjs → types-BjDcsS7l.cjs} +0 -0
- /package/dist/{workerHandler-nLkvSOKX.cjs → workerHandler-C-7OUJsa.cjs} +0 -0
- /package/dist/{workerHandler-BrOTzYRI.js → workerHandler-o2xzAfFk.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/ns/transforms.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
package/dist/operations.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_historyFns = require("./historyFns-
|
|
3
|
-
const require_extrudeFns = require("./extrudeFns-
|
|
2
|
+
const require_historyFns = require("./historyFns-BiQ9dmzp.cjs");
|
|
3
|
+
const require_extrudeFns = require("./extrudeFns-Rcut7h8S.cjs");
|
|
4
4
|
exports.addChild = require_historyFns.addChild;
|
|
5
5
|
exports.addStep = require_historyFns.addStep;
|
|
6
6
|
exports.circularPattern = require_historyFns.circularPattern;
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as walkAssembly, D as exportAssemblySTEP, E as linearPattern, O as createAssembly, S as updateNode, T as gridPattern, _ as collectShapes, a as findStep, b as findNode, c as registerOperation, d as replayHistory, g as addChild, h as undoLast, l as registerShape, m as stepsFrom, n as createHistory, o as getShape, p as stepCount, r as createRegistry, s as modifyStep, t as addStep, u as replayFrom, v as countNodes, w as circularPattern, x as removeChild, y as createAssemblyNode } from "./historyFns-
|
|
2
|
-
import { c as twistExtrude, o as supportExtrude, r as complexExtrude, s as sweep } from "./extrudeFns-
|
|
1
|
+
import { C as walkAssembly, D as exportAssemblySTEP, E as linearPattern, O as createAssembly, S as updateNode, T as gridPattern, _ as collectShapes, a as findStep, b as findNode, c as registerOperation, d as replayHistory, g as addChild, h as undoLast, l as registerShape, m as stepsFrom, n as createHistory, o as getShape, p as stepCount, r as createRegistry, s as modifyStep, t as addStep, u as replayFrom, v as countNodes, w as circularPattern, x as removeChild, y as createAssemblyNode } from "./historyFns-2hCWrX_X.js";
|
|
2
|
+
import { c as twistExtrude, o as supportExtrude, r as complexExtrude, s as sweep } from "./extrudeFns-DrDr9-nU.js";
|
|
3
3
|
export { addChild, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, exportAssemblySTEP, findNode, findStep, getShape as getHistoryShape, gridPattern, linearPattern, modifyStep, registerOperation, registerShape, removeChild, replayFrom, replayHistory, stepCount, stepsFrom, supportExtrude, sweep, twistExtrude, undoLast, updateNode, walkAssembly };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const require_errors = require("./errors-
|
|
2
|
-
const
|
|
3
|
-
const require_types = require("./types-
|
|
1
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
2
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
3
|
+
const require_types = require("./types-BjDcsS7l.cjs");
|
|
4
|
+
const require_vecOps = require("./vecOps-BXvBYIor.cjs");
|
|
4
5
|
//#region src/core/planeOps.ts
|
|
5
6
|
/**
|
|
6
7
|
* Create a {@link Plane} from an origin, optional X direction, and a normal.
|
|
@@ -262,7 +263,7 @@ function pivotPlane(plane, angleDeg, axis = [
|
|
|
262
263
|
0,
|
|
263
264
|
0
|
|
264
265
|
]) {
|
|
265
|
-
const angleRad = angleDeg *
|
|
266
|
+
const angleRad = angleDeg * require_constants.DEG2RAD;
|
|
266
267
|
const newZDir = require_vecOps.vecRotate(plane.zDir, axis, angleRad);
|
|
267
268
|
const newXDir = require_vecOps.vecRotate(plane.xDir, axis, angleRad);
|
|
268
269
|
const newYDir = require_vecOps.vecNormalize(require_vecOps.vecCross(newZDir, newXDir));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as toVec3 } from "./types-
|
|
1
|
+
import { A as ok, R as unwrap, b as err, d as validationError } from "./errors-C-cgQA3w.js";
|
|
2
|
+
import { t as DEG2RAD } from "./constants-B9u763C3.js";
|
|
3
|
+
import { r as toVec3 } from "./types-BWBlwp6w.js";
|
|
4
|
+
import { d as vecNormalize, h as vecScale, m as vecRotate, r as vecCross, s as vecIsZero, t as vecAdd } from "./vecOps-D9etjPgV.js";
|
|
4
5
|
//#region src/core/planeOps.ts
|
|
5
6
|
/**
|
|
6
7
|
* Create a {@link Plane} from an origin, optional X direction, and a normal.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
7
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
|
+
const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
|
|
4
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
5
|
+
const require_shapeFns = require("./shapeFns-aEeSHNqX.cjs");
|
|
6
|
+
const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
|
|
7
|
+
const require_solidBuilders = require("./solidBuilders-0iVdiZUw.cjs");
|
|
8
8
|
//#region src/topology/threeHelpers.ts
|
|
9
9
|
/**
|
|
10
10
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -135,7 +135,7 @@ function deduplicatedSubShapes(parentKernel, type) {
|
|
|
135
135
|
const results = [];
|
|
136
136
|
const seen = /* @__PURE__ */ new Map();
|
|
137
137
|
for (const item of items) {
|
|
138
|
-
const hash = kernel.hashCode(item,
|
|
138
|
+
const hash = kernel.hashCode(item, require_constants.HASH_CODE_MAX);
|
|
139
139
|
const bucket = seen.get(hash);
|
|
140
140
|
if (!bucket) {
|
|
141
141
|
seen.set(hash, [item]);
|
|
@@ -153,7 +153,7 @@ function deduplicatedSubShapes(parentKernel, type) {
|
|
|
153
153
|
* face so facesOfEdge can verify via isSame without re-extracting face edges.
|
|
154
154
|
*/
|
|
155
155
|
function getEdgeToFacesMap(parent) {
|
|
156
|
-
const cache =
|
|
156
|
+
const cache = require_shapeFns.getOrCreateCache(parent);
|
|
157
157
|
if (cache.edgeToFaces) return cache.edgeToFaces;
|
|
158
158
|
const kernel = require_shapeTypes.getKernel();
|
|
159
159
|
const edgeToFaces = /* @__PURE__ */ new Map();
|
|
@@ -161,7 +161,7 @@ function getEdgeToFacesMap(parent) {
|
|
|
161
161
|
for (const f of allFaces) {
|
|
162
162
|
const edges = kernel.iterShapes(f, "edge");
|
|
163
163
|
for (const e of edges) {
|
|
164
|
-
const hash = kernel.hashCode(e,
|
|
164
|
+
const hash = kernel.hashCode(e, require_constants.HASH_CODE_MAX);
|
|
165
165
|
let bucket = edgeToFaces.get(hash);
|
|
166
166
|
if (!bucket) {
|
|
167
167
|
bucket = [];
|
|
@@ -189,13 +189,13 @@ function getEdgeToFacesMap(parent) {
|
|
|
189
189
|
function facesOfEdge(parent, edge) {
|
|
190
190
|
const kernel = require_shapeTypes.getKernel();
|
|
191
191
|
const edgeToFaces = getEdgeToFacesMap(parent);
|
|
192
|
-
const hash = kernel.hashCode(edge.wrapped,
|
|
192
|
+
const hash = kernel.hashCode(edge.wrapped, require_constants.HASH_CODE_MAX);
|
|
193
193
|
const bucket = edgeToFaces.get(hash) ?? [];
|
|
194
194
|
const results = [];
|
|
195
195
|
const seen = /* @__PURE__ */ new Map();
|
|
196
196
|
for (const entry of bucket) {
|
|
197
197
|
if (!kernel.isSame(entry.edge, edge.wrapped)) continue;
|
|
198
|
-
const fHash = kernel.hashCode(entry.face,
|
|
198
|
+
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
199
199
|
const fBucket = seen.get(fHash);
|
|
200
200
|
if (!fBucket) {
|
|
201
201
|
seen.set(fHash, [entry.face]);
|
|
@@ -251,11 +251,11 @@ function adjacentFaces(parent, face) {
|
|
|
251
251
|
const neighborRaw = [];
|
|
252
252
|
const seen = /* @__PURE__ */ new Map();
|
|
253
253
|
for (const edgeHandle of faceEdgeHandles) {
|
|
254
|
-
const hash = kernel.hashCode(edgeHandle.wrapped,
|
|
254
|
+
const hash = kernel.hashCode(edgeHandle.wrapped, require_constants.HASH_CODE_MAX);
|
|
255
255
|
const entries = edgeToFaces.get(hash) ?? [];
|
|
256
256
|
for (const entry of entries) {
|
|
257
257
|
if (kernel.isSame(entry.face, face.wrapped)) continue;
|
|
258
|
-
const fHash = kernel.hashCode(entry.face,
|
|
258
|
+
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
259
259
|
const bucket = seen.get(fHash);
|
|
260
260
|
if (!bucket) {
|
|
261
261
|
seen.set(fHash, [entry.face]);
|
|
@@ -281,7 +281,7 @@ function sharedEdges(face1, face2) {
|
|
|
281
281
|
const edges2 = kernel.iterShapes(face2.wrapped, "edge");
|
|
282
282
|
const edge2Map = /* @__PURE__ */ new Map();
|
|
283
283
|
for (const e2 of edges2) {
|
|
284
|
-
const hash = kernel.hashCode(e2,
|
|
284
|
+
const hash = kernel.hashCode(e2, require_constants.HASH_CODE_MAX);
|
|
285
285
|
let bucket = edge2Map.get(hash);
|
|
286
286
|
if (!bucket) {
|
|
287
287
|
bucket = [];
|
|
@@ -294,6 +294,26 @@ function sharedEdges(face1, face2) {
|
|
|
294
294
|
return wrapAll(shared, "edge");
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
|
+
//#region src/topology/nurbsFns.ts
|
|
298
|
+
/**
|
|
299
|
+
* Extract NURBS data from a BSpline or Bezier edge.
|
|
300
|
+
* Returns null if the edge is not a NURBS curve (e.g., line, circle).
|
|
301
|
+
*/
|
|
302
|
+
function getNurbsCurveData(edge) {
|
|
303
|
+
const kernel = require_shapeTypes.getKernel();
|
|
304
|
+
if (!kernel.getNurbsCurveData) return null;
|
|
305
|
+
return kernel.getNurbsCurveData(edge.wrapped);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Extract NURBS data from a BSpline face.
|
|
309
|
+
* Returns null if the face is not a BSpline surface (e.g., plane, cylinder).
|
|
310
|
+
*/
|
|
311
|
+
function getNurbsSurfaceData(face) {
|
|
312
|
+
const kernel = require_shapeTypes.getKernel();
|
|
313
|
+
if (!kernel.getNurbsSurfaceData) return null;
|
|
314
|
+
return kernel.getNurbsSurfaceData(face.wrapped);
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
297
317
|
//#region src/topology/booleanDiagnosticFns.ts
|
|
298
318
|
/**
|
|
299
319
|
* Boolean pre-validation diagnostics.
|
|
@@ -360,7 +380,7 @@ function resolveEdgeCallback$1(selectedEdges, callbackFn) {
|
|
|
360
380
|
if (typeof val === "number" && val <= 0) continue;
|
|
361
381
|
if (Array.isArray(val) && (val[0] <= 0 || val[1] <= 0)) continue;
|
|
362
382
|
filteredEdges.push(edge);
|
|
363
|
-
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped,
|
|
383
|
+
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped, require_constants.HASH_CODE_MAX), val);
|
|
364
384
|
}
|
|
365
385
|
if (filteredEdges.length === 0) return null;
|
|
366
386
|
const kernelParam = (ocEdge) => {
|
|
@@ -377,15 +397,15 @@ function fuseWithEvolution(a, b, { optimisation = "none", simplify = false, sign
|
|
|
377
397
|
if (require_errors.isErr(checkA)) return checkA;
|
|
378
398
|
const checkB = validateShape3D(b, "fuseWithEvolution: second operand");
|
|
379
399
|
if (require_errors.isErr(checkB)) return checkB;
|
|
380
|
-
const inputFaceHashes =
|
|
381
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
400
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
401
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
382
402
|
optimisation,
|
|
383
403
|
simplify,
|
|
384
404
|
fuzzyValue
|
|
385
405
|
});
|
|
386
406
|
const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape", "Common causes: overlapping coplanar faces, zero-thickness geometry, or non-manifold input. Try autoHeal() on inputs first.");
|
|
387
407
|
if (fuseResult.ok) {
|
|
388
|
-
|
|
408
|
+
require_shapeFns.propagateAllMetadata(evolution, [a, b], fuseResult.value);
|
|
389
409
|
return require_errors.ok({
|
|
390
410
|
shape: fuseResult.value,
|
|
391
411
|
evolution
|
|
@@ -399,15 +419,15 @@ function cutWithEvolution(base, tool, { optimisation = "none", simplify = false,
|
|
|
399
419
|
if (require_errors.isErr(checkBase)) return checkBase;
|
|
400
420
|
const checkTool = validateShape3D(tool, "cutWithEvolution: tool");
|
|
401
421
|
if (require_errors.isErr(checkTool)) return checkTool;
|
|
402
|
-
const inputFaceHashes =
|
|
403
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes,
|
|
422
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([base, tool]);
|
|
423
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
404
424
|
optimisation,
|
|
405
425
|
simplify,
|
|
406
426
|
fuzzyValue
|
|
407
427
|
});
|
|
408
428
|
const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape", "Common causes: tool does not fully intersect the base, or produces a zero-thickness sliver. Ensure the tool extends through the shape.");
|
|
409
429
|
if (cutResult.ok) {
|
|
410
|
-
|
|
430
|
+
require_shapeFns.propagateAllMetadata(evolution, [base, tool], cutResult.value);
|
|
411
431
|
return require_errors.ok({
|
|
412
432
|
shape: cutResult.value,
|
|
413
433
|
evolution
|
|
@@ -421,14 +441,14 @@ function intersectWithEvolution(a, b, { simplify = false, signal, fuzzyValue } =
|
|
|
421
441
|
if (require_errors.isErr(checkA)) return checkA;
|
|
422
442
|
const checkB = validateShape3D(b, "intersectWithEvolution: second operand");
|
|
423
443
|
if (require_errors.isErr(checkB)) return checkB;
|
|
424
|
-
const inputFaceHashes =
|
|
425
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
444
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
445
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
426
446
|
simplify,
|
|
427
447
|
fuzzyValue
|
|
428
448
|
});
|
|
429
449
|
const intResult = castToShape3D(resultShape, "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape", "Shapes may not overlap. Verify they share a common volume before intersecting.");
|
|
430
450
|
if (intResult.ok) {
|
|
431
|
-
|
|
451
|
+
require_shapeFns.propagateAllMetadata(evolution, [a, b], intResult.value);
|
|
432
452
|
return require_errors.ok({
|
|
433
453
|
shape: intResult.value,
|
|
434
454
|
evolution
|
|
@@ -449,7 +469,7 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
449
469
|
if (require_errors.isErr(check)) return check;
|
|
450
470
|
if (typeof radius === "number" && radius <= 0) return require_errors.err(require_errors.validationError("INVALID_FILLET_RADIUS", "Fillet radius must be positive", void 0, void 0, "Provide a positive radius value greater than 0"));
|
|
451
471
|
if (Array.isArray(radius) && (radius[0] <= 0 || radius[1] <= 0)) return require_errors.err(require_errors.validationError("INVALID_FILLET_RADIUS", "Fillet radii must both be positive", void 0, void 0, "Both radius values must be greater than 0"));
|
|
452
|
-
const selectedEdges = edges ??
|
|
472
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
453
473
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FILLET_NO_EDGES, "No edges found for fillet", void 0, void 0, "Check that the shape has edges, or adjust your edge finder criteria"));
|
|
454
474
|
try {
|
|
455
475
|
let filteredEdges;
|
|
@@ -463,11 +483,11 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
463
483
|
filteredEdges = [...selectedEdges];
|
|
464
484
|
kernelRadius = radius;
|
|
465
485
|
}
|
|
466
|
-
const inputFaceHashes =
|
|
467
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes,
|
|
486
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
487
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
468
488
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
469
489
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
470
|
-
|
|
490
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
471
491
|
return require_errors.ok({
|
|
472
492
|
shape: cast,
|
|
473
493
|
evolution
|
|
@@ -493,7 +513,7 @@ function chamferWithEvolution(shape, edges, distance) {
|
|
|
493
513
|
if (require_errors.isErr(check)) return check;
|
|
494
514
|
if (typeof distance === "number" && distance <= 0) return require_errors.err(require_errors.validationError("INVALID_CHAMFER_DISTANCE", "Chamfer distance must be positive", void 0, void 0, "Provide a positive distance value greater than 0"));
|
|
495
515
|
if (Array.isArray(distance) && (distance[0] <= 0 || distance[1] <= 0)) return require_errors.err(require_errors.validationError("INVALID_CHAMFER_DISTANCE", "Chamfer distances must both be positive", void 0, void 0, "Both distance values must be greater than 0"));
|
|
496
|
-
const selectedEdges = edges ??
|
|
516
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
497
517
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
498
518
|
try {
|
|
499
519
|
let filteredEdges;
|
|
@@ -507,11 +527,11 @@ function chamferWithEvolution(shape, edges, distance) {
|
|
|
507
527
|
filteredEdges = [...selectedEdges];
|
|
508
528
|
kernelDistance = distance;
|
|
509
529
|
}
|
|
510
|
-
const inputFaceHashes =
|
|
511
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes,
|
|
530
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
531
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
512
532
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
513
533
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
514
|
-
|
|
534
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
515
535
|
return require_errors.ok({
|
|
516
536
|
shape: cast,
|
|
517
537
|
evolution
|
|
@@ -539,11 +559,11 @@ function shellWithEvolution(shape, faces, thickness, tolerance = .001) {
|
|
|
539
559
|
if (thickness <= 0) return require_errors.err(require_errors.validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
540
560
|
if (faces.length === 0) return require_errors.err(require_errors.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
541
561
|
try {
|
|
542
|
-
const inputFaceHashes =
|
|
543
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes,
|
|
562
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
563
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
544
564
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
545
565
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
546
|
-
|
|
566
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
547
567
|
return require_errors.ok({
|
|
548
568
|
shape: cast,
|
|
549
569
|
evolution
|
|
@@ -616,7 +636,7 @@ function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
|
616
636
|
if (typeof val === "number" && val <= 0) continue;
|
|
617
637
|
if (Array.isArray(val) && (val[0] <= 0 || val[1] <= 0)) continue;
|
|
618
638
|
filteredEdges.push(edge);
|
|
619
|
-
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped,
|
|
639
|
+
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped, require_constants.HASH_CODE_MAX), val);
|
|
620
640
|
}
|
|
621
641
|
if (filteredEdges.length === 0) return null;
|
|
622
642
|
const kernelParam = (ocEdge) => {
|
|
@@ -634,7 +654,7 @@ function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
|
634
654
|
function finalizeShape3D(evolution, resultShape, inputs, not3dCode, not3dMessage) {
|
|
635
655
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
636
656
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(not3dCode, not3dMessage));
|
|
637
|
-
|
|
657
|
+
require_shapeFns.propagateAllMetadata(evolution, inputs, cast);
|
|
638
658
|
return require_errors.ok(cast);
|
|
639
659
|
}
|
|
640
660
|
/**
|
|
@@ -652,10 +672,10 @@ function resolveDraftCallback(faces, angle) {
|
|
|
652
672
|
const a = angle(face);
|
|
653
673
|
if (a === null || a === 0 || Math.abs(a) >= 90) continue;
|
|
654
674
|
filteredFaces.push(face);
|
|
655
|
-
hashToAngle.set(require_shapeTypes.getKernel().hashCode(face.wrapped,
|
|
675
|
+
hashToAngle.set(require_shapeTypes.getKernel().hashCode(face.wrapped, require_constants.HASH_CODE_MAX), a);
|
|
656
676
|
}
|
|
657
677
|
const kernelAngle = (ocFace) => {
|
|
658
|
-
const a = hashToAngle.get(ocFace.HashCode(
|
|
678
|
+
const a = hashToAngle.get(ocFace.HashCode(require_constants.HASH_CODE_MAX));
|
|
659
679
|
if (a === void 0) throw new Error("draft: face hash not found — possible hash collision");
|
|
660
680
|
return a;
|
|
661
681
|
};
|
|
@@ -675,10 +695,10 @@ function thicken(shape, thickness) {
|
|
|
675
695
|
const check = validateNotNull(shape, "thicken: shape");
|
|
676
696
|
if (require_errors.isErr(check)) return check;
|
|
677
697
|
try {
|
|
678
|
-
const inputFaceHashes =
|
|
679
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes,
|
|
698
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
699
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
680
700
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
681
|
-
|
|
701
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
682
702
|
return require_errors.ok(cast);
|
|
683
703
|
} catch (e) {
|
|
684
704
|
return require_errors.err(require_errors.kernelError("THICKEN_FAILED", `Thicken operation failed: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
@@ -702,7 +722,7 @@ function fillet(shape, edges, radius) {
|
|
|
702
722
|
pairHint: "Both radius values must be greater than 0"
|
|
703
723
|
});
|
|
704
724
|
if (paramErr) return paramErr;
|
|
705
|
-
const selectedEdges = edges ??
|
|
725
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
706
726
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FILLET_NO_EDGES, "No edges found for fillet", void 0, void 0, "Check that the shape has edges, or adjust your edge finder criteria"));
|
|
707
727
|
try {
|
|
708
728
|
let filteredEdges;
|
|
@@ -716,8 +736,8 @@ function fillet(shape, edges, radius) {
|
|
|
716
736
|
filteredEdges = [...selectedEdges];
|
|
717
737
|
kernelRadius = radius;
|
|
718
738
|
}
|
|
719
|
-
const inputFaceHashes =
|
|
720
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes,
|
|
739
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
740
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
721
741
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
|
|
722
742
|
} catch (e) {
|
|
723
743
|
return require_errors.err(require_errors.kernelError("FILLET_FAILED", `Fillet operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
@@ -745,7 +765,7 @@ function chamfer(shape, edges, distance) {
|
|
|
745
765
|
pairHint: "Both distance values must be greater than 0"
|
|
746
766
|
});
|
|
747
767
|
if (paramErr) return paramErr;
|
|
748
|
-
const selectedEdges = edges ??
|
|
768
|
+
const selectedEdges = edges ?? require_shapeFns.getEdges(shape);
|
|
749
769
|
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
750
770
|
try {
|
|
751
771
|
let filteredEdges;
|
|
@@ -759,8 +779,8 @@ function chamfer(shape, edges, distance) {
|
|
|
759
779
|
filteredEdges = [...selectedEdges];
|
|
760
780
|
kernelDistance = distance;
|
|
761
781
|
}
|
|
762
|
-
const inputFaceHashes =
|
|
763
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes,
|
|
782
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
783
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
764
784
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape");
|
|
765
785
|
} catch (e) {
|
|
766
786
|
return require_errors.err(require_errors.kernelError("CHAMFER_FAILED", `Chamfer operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
@@ -784,11 +804,11 @@ function shell(shape, faces, thickness, tolerance = .001) {
|
|
|
784
804
|
if (thickness <= 0) return require_errors.err(require_errors.validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
785
805
|
if (faces.length === 0) return require_errors.err(require_errors.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
786
806
|
try {
|
|
787
|
-
const inputFaceHashes =
|
|
788
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes,
|
|
807
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
808
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
789
809
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
790
810
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
791
|
-
|
|
811
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
792
812
|
return require_errors.ok(cast);
|
|
793
813
|
} catch (e) {
|
|
794
814
|
return require_errors.err(require_errors.kernelError("SHELL_FAILED", `Shell operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
@@ -810,11 +830,11 @@ function offset(shape, distance, tolerance = 1e-6) {
|
|
|
810
830
|
if (require_errors.isErr(check)) return check;
|
|
811
831
|
if (distance === 0) return require_errors.err(require_errors.validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
812
832
|
try {
|
|
813
|
-
const inputFaceHashes =
|
|
814
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes,
|
|
833
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
834
|
+
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
815
835
|
const cast = require_shapeTypes.castShape(resultShape);
|
|
816
836
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
817
|
-
|
|
837
|
+
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
818
838
|
return require_errors.ok(cast);
|
|
819
839
|
} catch (e) {
|
|
820
840
|
return require_errors.err(require_errors.kernelError("OFFSET_FAILED", `Offset operation failed: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
@@ -844,7 +864,7 @@ function draft(shape, faces, pullDirection, neutralPlane, angle) {
|
|
|
844
864
|
try {
|
|
845
865
|
const { filteredFaces, kernelAngle } = resolveDraftCallback(faces, angle);
|
|
846
866
|
if (filteredFaces.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.DRAFT_NO_FACES, "No faces with valid draft angle", void 0, void 0, "Check that the angle callback returns non-zero values between -90 and 90 degrees"));
|
|
847
|
-
const inputFaceHashes =
|
|
867
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
848
868
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().draftWithHistory(shape.wrapped, filteredFaces.map((f) => f.wrapped), [
|
|
849
869
|
pullDirection[0],
|
|
850
870
|
pullDirection[1],
|
|
@@ -853,7 +873,7 @@ function draft(shape, faces, pullDirection, neutralPlane, angle) {
|
|
|
853
873
|
neutralPlane[0],
|
|
854
874
|
neutralPlane[1],
|
|
855
875
|
neutralPlane[2]
|
|
856
|
-
], kernelAngle, inputFaceHashes,
|
|
876
|
+
], kernelAngle, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
857
877
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.DRAFT_NOT_3D, "Draft result is not a 3D shape");
|
|
858
878
|
} catch (e) {
|
|
859
879
|
const raw = e instanceof Error ? e.message : String(e);
|
|
@@ -879,7 +899,7 @@ function variableFillet(shape, edge, radii) {
|
|
|
879
899
|
const kernel = require_shapeTypes.getKernel();
|
|
880
900
|
try {
|
|
881
901
|
const spec = JSON.stringify({
|
|
882
|
-
edge: kernel.hashCode(edge.wrapped,
|
|
902
|
+
edge: kernel.hashCode(edge.wrapped, require_constants.HASH_CODE_MAX),
|
|
883
903
|
radii: radii.map((r) => ({
|
|
884
904
|
param: r.param,
|
|
885
905
|
radius: r.radius
|
|
@@ -1010,8 +1030,8 @@ function autoHeal(shape, options) {
|
|
|
1010
1030
|
}
|
|
1011
1031
|
});
|
|
1012
1032
|
steps.push("Shape invalid — applying shape-level healing");
|
|
1013
|
-
const wiresBefore =
|
|
1014
|
-
const facesBefore =
|
|
1033
|
+
const wiresBefore = require_shapeFns.getWires(shape).length;
|
|
1034
|
+
const facesBefore = require_shapeFns.getFaces(shape).length;
|
|
1015
1035
|
let current = shape;
|
|
1016
1036
|
let solidHealed = false;
|
|
1017
1037
|
if (sewTolerance !== void 0) try {
|
|
@@ -1034,7 +1054,7 @@ function autoHeal(shape, options) {
|
|
|
1034
1054
|
});
|
|
1035
1055
|
}
|
|
1036
1056
|
if (fixSelfIntersection && fixWires) {
|
|
1037
|
-
const wires =
|
|
1057
|
+
const wires = require_shapeFns.getWires(current);
|
|
1038
1058
|
let fixCount = 0;
|
|
1039
1059
|
for (const wire of wires) try {
|
|
1040
1060
|
require_shapeTypes.getKernel().fixSelfIntersection(wire.wrapped);
|
|
@@ -1089,8 +1109,8 @@ function autoHeal(shape, options) {
|
|
|
1089
1109
|
succeeded: false,
|
|
1090
1110
|
detail: "skipped by options"
|
|
1091
1111
|
});
|
|
1092
|
-
const wiresAfter =
|
|
1093
|
-
const facesAfter =
|
|
1112
|
+
const wiresAfter = require_shapeFns.getWires(current).length;
|
|
1113
|
+
const facesAfter = require_shapeFns.getFaces(current).length;
|
|
1094
1114
|
const wiresHealed = Math.abs(wiresAfter - wiresBefore);
|
|
1095
1115
|
const facesHealed = Math.abs(facesAfter - facesBefore);
|
|
1096
1116
|
if (wiresHealed > 0) steps.push(`Wire count changed by ${wiresHealed}`);
|
|
@@ -1171,7 +1191,7 @@ function box(width, depth, height, options) {
|
|
|
1171
1191
|
0,
|
|
1172
1192
|
0
|
|
1173
1193
|
] : void 0);
|
|
1174
|
-
if (center) return
|
|
1194
|
+
if (center) return require_shapeFns.translate(solid, [
|
|
1175
1195
|
center[0] - width / 2,
|
|
1176
1196
|
center[1] - depth / 2,
|
|
1177
1197
|
center[2] - height / 2
|
|
@@ -1199,7 +1219,7 @@ function cylinder(radius, height, options) {
|
|
|
1199
1219
|
-axis[1] * height * .5,
|
|
1200
1220
|
-axis[2] * height * .5
|
|
1201
1221
|
];
|
|
1202
|
-
solid =
|
|
1222
|
+
solid = require_shapeFns.translate(solid, halfShift);
|
|
1203
1223
|
}
|
|
1204
1224
|
return solid;
|
|
1205
1225
|
}
|
|
@@ -1208,7 +1228,7 @@ function cylinder(radius, height, options) {
|
|
|
1208
1228
|
*/
|
|
1209
1229
|
function sphere(radius, options) {
|
|
1210
1230
|
let solid = require_solidBuilders.makeSphere(radius);
|
|
1211
|
-
if (options?.at) solid =
|
|
1231
|
+
if (options?.at) solid = require_shapeFns.translate(solid, options.at);
|
|
1212
1232
|
return solid;
|
|
1213
1233
|
}
|
|
1214
1234
|
/**
|
|
@@ -1236,7 +1256,7 @@ function cone(bottomRadius, topRadius, height, options) {
|
|
|
1236
1256
|
-axis[1] * height * .5,
|
|
1237
1257
|
-axis[2] * height * .5
|
|
1238
1258
|
];
|
|
1239
|
-
solid =
|
|
1259
|
+
solid = require_shapeFns.translate(solid, halfShift);
|
|
1240
1260
|
}
|
|
1241
1261
|
return solid;
|
|
1242
1262
|
}
|
|
@@ -1263,7 +1283,7 @@ function torus(majorRadius, minorRadius, options) {
|
|
|
1263
1283
|
*/
|
|
1264
1284
|
function ellipsoid(rx, ry, rz, options) {
|
|
1265
1285
|
let solid = require_solidBuilders.makeEllipsoid(rx, ry, rz);
|
|
1266
|
-
if (options?.at) solid =
|
|
1286
|
+
if (options?.at) solid = require_shapeFns.translate(solid, options.at);
|
|
1267
1287
|
return solid;
|
|
1268
1288
|
}
|
|
1269
1289
|
/** Create a straight edge between two 3D points. */
|
|
@@ -1336,7 +1356,7 @@ function ellipseArc(majorRadius, minorRadius, startAngle, endAngle, options) {
|
|
|
1336
1356
|
0,
|
|
1337
1357
|
1
|
|
1338
1358
|
];
|
|
1339
|
-
return require_surfaceBuilders.makeEllipseArc(majorRadius, minorRadius, startAngle *
|
|
1359
|
+
return require_surfaceBuilders.makeEllipseArc(majorRadius, minorRadius, startAngle * require_constants.DEG2RAD, endAngle * require_constants.DEG2RAD, options?.at ?? [
|
|
1340
1360
|
0,
|
|
1341
1361
|
0,
|
|
1342
1362
|
0
|
|
@@ -1617,6 +1637,18 @@ Object.defineProperty(exports, "fuseWithEvolution", {
|
|
|
1617
1637
|
return fuseWithEvolution;
|
|
1618
1638
|
}
|
|
1619
1639
|
});
|
|
1640
|
+
Object.defineProperty(exports, "getNurbsCurveData", {
|
|
1641
|
+
enumerable: true,
|
|
1642
|
+
get: function() {
|
|
1643
|
+
return getNurbsCurveData;
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
Object.defineProperty(exports, "getNurbsSurfaceData", {
|
|
1647
|
+
enumerable: true,
|
|
1648
|
+
get: function() {
|
|
1649
|
+
return getNurbsSurfaceData;
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1620
1652
|
Object.defineProperty(exports, "heal", {
|
|
1621
1653
|
enumerable: true,
|
|
1622
1654
|
get: function() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Y as getKernel, _ as isSolid, c as createSolid, h as isShape3D, p as isFace, r as castShapeWithKnownType, t as castShape, x as isClosedWire, y as isWire } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeEllipse, f as makeEllipseArc, g as makeThreePointArc, h as makeTangentArc, i as makeNewFaceWithinFace, l as makeBezierCurve, m as makeLine, o as makePolygon, p as makeHelix, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeCircle } from "./surfaceBuilders-
|
|
7
|
-
import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-
|
|
1
|
+
import { Y as getKernel, _ as isSolid, c as createSolid, h as isShape3D, p as isFace, r as castShapeWithKnownType, t as castShape, x as isClosedWire, y as isWire } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, T as isOk, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, v as andThen, w as isErr } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { _ as downcast } from "./faceFns-TSH54pPQ.js";
|
|
4
|
+
import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-B9u763C3.js";
|
|
5
|
+
import { I as getWires, M as getEdges, N as getFaces, P as getOrCreateCache, _ as propagateAllMetadata, g as collectInputFaceHashes, h as translate } from "./shapeFns-DCi9O27X.js";
|
|
6
|
+
import { a as makeNonPlanarFace, c as makeBSplineApproximation, d as makeEllipse, f as makeEllipseArc, g as makeThreePointArc, h as makeTangentArc, i as makeNewFaceWithinFace, l as makeBezierCurve, m as makeLine, o as makePolygon, p as makeHelix, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeCircle } from "./surfaceBuilders-DE5e6bp8.js";
|
|
7
|
+
import { a as makeOffset, c as makeTorus, i as makeEllipsoid, l as makeVertex, n as makeCone, o as makeSolid, r as makeCylinder, s as makeSphere, t as makeCompound, u as weldShellsAndFaces } from "./solidBuilders-jk7HfWs8.js";
|
|
8
8
|
//#region src/topology/threeHelpers.ts
|
|
9
9
|
/**
|
|
10
10
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -294,6 +294,26 @@ function sharedEdges(face1, face2) {
|
|
|
294
294
|
return wrapAll(shared, "edge");
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
|
+
//#region src/topology/nurbsFns.ts
|
|
298
|
+
/**
|
|
299
|
+
* Extract NURBS data from a BSpline or Bezier edge.
|
|
300
|
+
* Returns null if the edge is not a NURBS curve (e.g., line, circle).
|
|
301
|
+
*/
|
|
302
|
+
function getNurbsCurveData(edge) {
|
|
303
|
+
const kernel = getKernel();
|
|
304
|
+
if (!kernel.getNurbsCurveData) return null;
|
|
305
|
+
return kernel.getNurbsCurveData(edge.wrapped);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Extract NURBS data from a BSpline face.
|
|
309
|
+
* Returns null if the face is not a BSpline surface (e.g., plane, cylinder).
|
|
310
|
+
*/
|
|
311
|
+
function getNurbsSurfaceData(face) {
|
|
312
|
+
const kernel = getKernel();
|
|
313
|
+
if (!kernel.getNurbsSurfaceData) return null;
|
|
314
|
+
return kernel.getNurbsSurfaceData(face.wrapped);
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
297
317
|
//#region src/topology/booleanDiagnosticFns.ts
|
|
298
318
|
/**
|
|
299
319
|
* Boolean pre-validation diagnostics.
|
|
@@ -1449,4 +1469,4 @@ function addHoles(f, holes) {
|
|
|
1449
1469
|
return addHolesInFace(f, holes);
|
|
1450
1470
|
}
|
|
1451
1471
|
//#endregion
|
|
1452
|
-
export {
|
|
1472
|
+
export { getNurbsSurfaceData as $, fixShape as A, offset as B, threePointArc as C, wireLoop as D, wire as E, isValid as F, chamferWithEvolution as G, thicken as H, solidFromShell as I, fuseWithEvolution as J, cutWithEvolution as K, chamfer as L, healFace as M, healSolid as N, autoHeal as O, healWire as P, getNurbsCurveData as Q, draft as R, tangentArc as S, vertex as T, variableFillet as U, shell as V, positionOnCurve as W, shellWithEvolution as X, intersectWithEvolution as Y, checkBoolean as Z, polygon as _, circle as a, wiresOfFace as at, sphere as b, cylinder as c, toGroupedBufferGeometryData as ct, ellipsoid as d, adjacentFaces as et, face as f, offsetFace as g, line as h, bsplineApprox as i, verticesOfEdge as it, heal as j, fixSelfIntersection as k, ellipse as l, toLineGeometryData as lt, helix as m, bezier as n, facesOfEdge as nt, compound as o, chamferDistAngle as ot, filledFace as p, filletWithEvolution as q, box as r, sharedEdges as rt, cone as s, toBufferGeometryData as st, addHoles as t, edgesOfFace as tt, ellipseArc as u, sewShells as v, torus as w, subFace as x, solid as y, fillet as z };
|
package/dist/query.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_helpers = require("./helpers-
|
|
3
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
2
|
+
const require_helpers = require("./helpers-DZje6XWE.cjs");
|
|
3
|
+
const require_cornerFinder = require("./cornerFinder-DTt_SvtC.cjs");
|
|
4
4
|
exports.cornerFinder = require_cornerFinder.cornerFinder;
|
|
5
5
|
exports.edgeFinder = require_helpers.edgeFinder;
|
|
6
6
|
exports.faceFinder = require_helpers.faceFinder;
|
package/dist/query.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-
|
|
2
|
-
import { t as cornerFinder } from "./cornerFinder-
|
|
1
|
+
import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-XrXlKm8D.js";
|
|
2
|
+
import { t as cornerFinder } from "./cornerFinder-AEFnAxt4.js";
|
|
3
3
|
export { cornerFinder, edgeFinder, faceFinder, getSingleFace };
|
package/dist/result.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("./errors-
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
3
|
exports.BrepBugError = require_errors.BrepBugError;
|
|
4
4
|
exports.BrepErrorCode = require_errors.BrepErrorCode;
|
|
5
5
|
exports.OK = require_errors.OK;
|
package/dist/result.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as ok, B as unwrapOr, E as map, I as tryCatch, L as tryCatchAsync, N as pipeline, O as mapErr, R as unwrap, T as isOk, V as unwrapOrElse, a as moduleInitError, b as err, c as sketcherStateError, d as validationError, g as OK, h as bug, i as kernelError, k as match, l as typeCastError, m as BrepBugError, n as computationError, o as queryError, r as ioError, t as BrepErrorCode, v as andThen, w as isErr, x as flatMap, y as collect, z as unwrapErr } from "./errors-C-cgQA3w.js";
|
|
2
2
|
export { BrepBugError, BrepErrorCode, OK, andThen, bug, collect, computationError, err, flatMap, ioError, isErr, isOk, kernelError, map, mapErr, match, moduleInitError, ok, pipeline, queryError, sketcherStateError, tryCatch, tryCatchAsync, typeCastError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, validationError };
|