brepjs 20.5.0 → 20.7.0
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 +1 -0
- package/dist/2d.cjs +9 -11
- package/dist/2d.js +9 -11
- package/dist/{adjacencyFns-DeyXahej.js → adjacencyFns-BgJQQjdt.js} +5 -6
- package/dist/{adjacencyFns-1rxgJ6Hw.cjs → adjacencyFns-_RTYhwtD.cjs} +5 -6
- package/dist/{arrayAccess-DrUGPADn.js → arrayAccess-BpgouNir.js} +1 -2
- package/dist/{arrayAccess-e4H9cBfh.cjs → arrayAccess-DpJYARwv.cjs} +1 -2
- package/dist/{blueprint-rwJjYPzo.js → blueprint-Bth4EVaO.js} +24 -37
- package/dist/{blueprint-Yyoiz-U1.cjs → blueprint-wq2TU1XP.cjs} +24 -37
- package/dist/{blueprintFns-Q3Sq-Fse.js → blueprintFns-DQmNe1p6.js} +5 -7
- package/dist/{blueprintFns-Ce6OoPSX.cjs → blueprintFns-Dd0gm1rX.cjs} +5 -7
- package/dist/{blueprintSketcher-CzKbxeTk.cjs → blueprintSketcher-CSDqr27-.cjs} +19 -31
- package/dist/{blueprintSketcher-FywUpRiV.js → blueprintSketcher-DNp87aQZ.js} +19 -31
- package/dist/{boolean2D-D8igCYc9.js → boolean2D-BAb4SnIL.js} +13 -19
- package/dist/{boolean2D-BzZ9iBSn.cjs → boolean2D-BkgOjMRt.cjs} +13 -19
- package/dist/brepjs.cjs +113 -187
- package/dist/brepjs.js +113 -188
- package/dist/{bug-O02CsAmt.cjs → bug-CBcpIPuf.cjs} +2 -4
- package/dist/{bug-BdOHwn_e.js → bug-ClMTAJhe.js} +2 -4
- package/dist/{cameraFns-Cs6v3bWQ.js → cameraFns-9AGyuZVp.js} +8 -11
- package/dist/{cameraFns-RHCb1F1s.cjs → cameraFns-CKUN90f_.cjs} +8 -11
- package/dist/{constants-ITRzCnCp.js → constants-iraOnb2p.js} +1 -2
- package/dist/{constants-BOVyEYGH.cjs → constants-oee0S_x6.cjs} +1 -2
- package/dist/core/errors.d.ts +3 -0
- package/dist/core.cjs +8 -8
- package/dist/core.js +8 -8
- package/dist/{cornerFinder-Dlae8IX5.js → cornerFinder-Cr_04etw.js} +4 -5
- package/dist/{cornerFinder-Cji_BK-R.cjs → cornerFinder-DJWo6h1Z.cjs} +4 -5
- package/dist/{curveFns-KS1BWGhF.js → curveFns-CkA2WJP2.js} +3 -4
- package/dist/{curveFns-6-ULFrEB.cjs → curveFns-U7srQ3ZA.cjs} +3 -4
- package/dist/{drawFns-3yRVBDgI.js → drawFns-C6bmFijD.js} +32 -45
- package/dist/{drawFns-Ddlgp9gQ.cjs → drawFns-DlCxozRP.cjs} +32 -45
- package/dist/{errors-jwhfQJZK.cjs → errors-GVyCnpi0.cjs} +6 -5
- package/dist/{errors-Zb3jBa0u.js → errors-vxP5FT8B.js} +6 -5
- package/dist/{faceFns-CTlJC5IY.js → faceFns-BBk6XKJO.js} +6 -8
- package/dist/{faceFns-CZeHWke7.cjs → faceFns-DSRREV5G.cjs} +6 -8
- package/dist/{faceRoleFns-CWU1-Pm8.js → faceRoleFns-BPxzQF-n.js} +1 -2
- package/dist/{faceRoleFns-CtH_48MO.cjs → faceRoleFns-Db5bYj4Q.cjs} +1 -2
- package/dist/{healingFns-DwSpJZfg.cjs → healingFns-C9G3yjOe.cjs} +148 -51
- package/dist/{healingFns-Ct3gEMvk.js → healingFns-CEr0afli.js} +148 -51
- package/dist/{helpers-NRZVshPb.cjs → helpers-JuPoaP_b.cjs} +15 -21
- package/dist/{helpers-BN1mVMuZ.js → helpers-sDialr0f.js} +15 -21
- package/dist/{importFns-BEi-HsSw.cjs → importFns-ClqPJCFR.cjs} +12 -19
- package/dist/{importFns-0kHGg-b8.js → importFns-DSUfSQn2.js} +12 -19
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/capabilities.d.ts +8 -0
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -2
- package/dist/{loftFns-B5mq1WDh.js → loftFns-B8DSoG-F.js} +7 -10
- package/dist/{loftFns-DL9UsQhd.cjs → loftFns-mkJeOaII.cjs} +7 -10
- package/dist/{measureFns-D_GpQw5z.cjs → measureFns-BvNkzSR6.cjs} +6 -8
- package/dist/{measureFns-CyDVZomf.js → measureFns-PRM3gOjw.js} +6 -8
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-COlno8TY.js → meshFns-CgbT3uuO.js} +6 -8
- package/dist/{meshFns-CAxkaRTm.cjs → meshFns-W7ZTKqiJ.cjs} +6 -8
- package/dist/{occtWasmAdapter-CA6PmIIj.cjs → occtWasmAdapter-BSQeA69d.cjs} +49 -57
- package/dist/{occtWasmAdapter-BX10fyla.js → occtWasmAdapter-PzZJHUAd.js} +44 -58
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{originTrackingFns-DiHy5BZC.js → originTrackingFns-D8SNCDKj.js} +4 -5
- package/dist/{originTrackingFns-CWo6NWHK.cjs → originTrackingFns-DJDTRJh3.cjs} +4 -5
- package/dist/{planeOps-DJuclNxa.cjs → planeOps-C9d2Y56B.cjs} +5 -6
- package/dist/{planeOps-Cxws4Tiu.js → planeOps-Dp0YvuFE.js} +5 -6
- package/dist/{primitiveFns-ZV3aMbqG.cjs → primitiveFns-EtHyTqhw.cjs} +8 -10
- package/dist/{primitiveFns-CGJzS4MO.js → primitiveFns-W3RYNJcm.js} +8 -10
- package/dist/{principalBoxFns-BJgGEoik.js → principalBoxFns-Cbtty-2_.js} +7 -8
- package/dist/{principalBoxFns-5FSbxAj-.cjs → principalBoxFns-CmZa7qHi.cjs} +7 -8
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -2
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{refResolveFns-CpVZoeOT.js → refResolveFns-BkciKtNP.js} +14 -21
- package/dist/{refResolveFns-Ct52Uw7R.cjs → refResolveFns-D99Vqe7a.cjs} +14 -21
- package/dist/result.cjs +2 -2
- package/dist/result.js +2 -2
- package/dist/{rolldown-runtime-C0BPl7ul.cjs → rolldown-runtime-BW-eSwOZ.cjs} +1 -2
- package/dist/{shapeFns-C2j6oZ2u.cjs → shapeFns-B54CsPyk.cjs} +5 -6
- package/dist/{shapeFns--1wNlcc_.js → shapeFns-DB3l3ULC.js} +5 -6
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -2
- package/dist/{shapeTypes-CqNJoSam.js → shapeTypes-CgbUTASh.js} +82 -161
- package/dist/{shapeTypes-DH2ShBU_.cjs → shapeTypes-D_anqiRe.cjs} +82 -161
- package/dist/sketching.cjs +4 -5
- package/dist/sketching.js +4 -5
- package/dist/{solidBuilders-CgicU3le.cjs → solidBuilders-CUd-korS.cjs} +17 -23
- package/dist/{solidBuilders-IstbiWju.js → solidBuilders-DE_na4G3.js} +17 -23
- package/dist/{surfaceBuilders-vYgSvgI6.cjs → surfaceBuilders-DOn2jWkh.cjs} +8 -12
- package/dist/{surfaceBuilders-8nLk2PWk.js → surfaceBuilders-wdGNiImD.js} +8 -12
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-fa7VHJZz.cjs → textBlueprints-BQ60Rc96.cjs} +24 -32
- package/dist/{textBlueprints-C13NAA3C.js → textBlueprints-B_jwMuej.js} +23 -31
- package/dist/{textMetrics--cikHkGX.cjs → textMetrics-Bm0a4kh7.cjs} +4 -6
- package/dist/{textMetrics-Dcc63qRm.js → textMetrics-Dj3yfZNQ.js} +4 -6
- package/dist/{threadFns-BUQPg_vI.cjs → threadFns-BuRPVenB.cjs} +21 -33
- package/dist/{threadFns-3U9x4v_M.js → threadFns-DlL5VnMf.js} +21 -33
- package/dist/topology/modifierFns.d.ts +5 -0
- package/dist/topology/thickResultCheck.d.ts +18 -0
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-DnfjQgP7.js → topologyQueryFns-6M_dbT1R.js} +10 -10
- package/dist/{topologyQueryFns-q2bGyuEV.cjs → topologyQueryFns-ENxs8uu2.cjs} +15 -9
- package/dist/{types-D24Y27N0.js → types-CKXsIm9-.js} +1 -2
- package/dist/{types-KjA8tY4Y.cjs → types-CjF9Rofr.cjs} +1 -2
- package/dist/{validityTypes-r0A2YdNq.cjs → validityTypes-BPamqRZ8.cjs} +3 -4
- package/dist/{validityTypes-t7JpS0Ki.js → validityTypes-BTuI0vcR.js} +3 -4
- package/dist/{vecOps-CCnJt-yH.cjs → vecOps-CrGEPPQM.cjs} +1 -2
- package/dist/{vecOps-SKPRvPH-.js → vecOps-S-m9H_fe.js} +1 -2
- package/dist/vectors.cjs +4 -4
- package/dist/vectors.js +4 -4
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -2
- package/dist/{workerPool-XcYX2UZ0.js → workerPool-Bc5hmJc4.js} +5 -10
- package/dist/{workerPool-D30NsiIW.cjs → workerPool-D5tiNXrI.cjs} +5 -10
- package/package.json +10 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as isSolid, D as getShapeKind, T as isWire, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, x as isShape3D, y as isFace } from "./shapeTypes-
|
|
2
|
-
import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode, x as isOk } from "./errors-
|
|
3
|
-
import { c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
4
|
-
import { n as HASH_CODE_MAX } from "./constants-
|
|
5
|
-
import { y as downcast } from "./faceFns-
|
|
6
|
-
import { C as propagateAllMetadata, f as cut, h as fuseAll, m as fuse, p as cutAll, x as collectInputFaceHashes } from "./solidBuilders-
|
|
7
|
-
import { t as firstOrThrow } from "./arrayAccess-
|
|
8
|
-
|
|
1
|
+
import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, x as isShape3D, y as isFace } from "./shapeTypes-CgbUTASh.js";
|
|
2
|
+
import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode, x as isOk } from "./errors-vxP5FT8B.js";
|
|
3
|
+
import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-6M_dbT1R.js";
|
|
4
|
+
import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
|
|
5
|
+
import { y as downcast } from "./faceFns-BBk6XKJO.js";
|
|
6
|
+
import { C as propagateAllMetadata, f as cut, h as fuseAll, m as fuse, p as cutAll, x as collectInputFaceHashes } from "./solidBuilders-DE_na4G3.js";
|
|
7
|
+
import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
8
|
+
// src/topology/threeHelpers.ts
|
|
9
9
|
/**
|
|
10
10
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
11
11
|
*
|
|
@@ -106,8 +106,100 @@ function toLODGeometryLevels(lods, options) {
|
|
|
106
106
|
distance: distances?.[idx] ?? (last - idx) * step
|
|
107
107
|
}));
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
// src/topology/thickResultCheck.ts
|
|
110
|
+
var UNCHANGED_VOLUME_REL_TOL = 1e-7;
|
|
111
|
+
var WALL_DISTANCE_REL_TOL = .001;
|
|
112
|
+
function facesByHash(shape) {
|
|
113
|
+
const kernel = getKernel();
|
|
114
|
+
const byHash = /* @__PURE__ */ new Map();
|
|
115
|
+
for (const face of getFaces(shape)) byHash.set(kernel.hashCode(face.wrapped, HASH_CODE_MAX), face);
|
|
116
|
+
return byHash;
|
|
117
|
+
}
|
|
118
|
+
function volumeFailure(distance, input, result) {
|
|
119
|
+
if (Math.abs(result.volume - input.volume) <= UNCHANGED_VOLUME_REL_TOL * Math.abs(input.volume) && result.faceCount === input.faceCount) return "unchanged";
|
|
120
|
+
if (result.volume <= 0) return "volume";
|
|
121
|
+
return result.volume > input.volume === distance > 0 ? void 0 : "volume";
|
|
122
|
+
}
|
|
123
|
+
/** Distance from the middle of a generated wall's surface to its source face. */
|
|
124
|
+
function wallGap(source, generated) {
|
|
125
|
+
const kernel = getKernel();
|
|
126
|
+
const uv = kernel.uvBounds(generated.wrapped);
|
|
127
|
+
const p = kernel.pointOnSurface(generated.wrapped, (uv.uMin + uv.uMax) / 2, (uv.vMin + uv.vMax) / 2);
|
|
128
|
+
const q = kernel.projectPointOnFace(source.wrapped, p);
|
|
129
|
+
return Math.hypot(p[0] - q[0], p[1] - q[1], p[2] - q[2]);
|
|
130
|
+
}
|
|
131
|
+
function worstWallDeviation(input, result, evolution, spec) {
|
|
132
|
+
if (evolution.generated.size === 0) return 0;
|
|
133
|
+
const sources = facesByHash(input);
|
|
134
|
+
const produced = facesByHash(result);
|
|
135
|
+
const wall = Math.abs(spec.distance);
|
|
136
|
+
let worst = 0;
|
|
137
|
+
for (const [sourceHash, generatedHashes] of evolution.generated) {
|
|
138
|
+
if (spec.openedFaceHashes?.has(sourceHash)) continue;
|
|
139
|
+
const source = sources.get(sourceHash);
|
|
140
|
+
if (!source) continue;
|
|
141
|
+
for (const hash of generatedHashes) {
|
|
142
|
+
const face = produced.get(hash);
|
|
143
|
+
if (!face) continue;
|
|
144
|
+
worst = Math.max(worst, Math.abs(wallGap(source, face) - wall));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return worst;
|
|
148
|
+
}
|
|
149
|
+
function failure(spec, reason, metadata) {
|
|
150
|
+
const wall = Math.abs(spec.distance);
|
|
151
|
+
const isShell = spec.operation === "shell";
|
|
152
|
+
if (isShell && reason === "unchanged") {
|
|
153
|
+
const code = BrepErrorCode.SHELL_NO_EFFECT;
|
|
154
|
+
return err(kernelError(code, `Shell left the solid unchanged: a ${wall} wall is too thick for this body`, void 0, {
|
|
155
|
+
operation: "shell",
|
|
156
|
+
reason,
|
|
157
|
+
thickness: wall,
|
|
158
|
+
...metadata
|
|
159
|
+
}, getSuggestionForCode(code)));
|
|
160
|
+
}
|
|
161
|
+
const code = isShell ? BrepErrorCode.SHELL_INVALID_RESULT : BrepErrorCode.OFFSET_INVALID_RESULT;
|
|
162
|
+
const what = isShell ? `a ${wall} wall` : `an offset of ${spec.distance}`;
|
|
163
|
+
return err(kernelError(code, `${spec.operation} gave no usable solid (${reason}): ${what} is too large for this body`, void 0, {
|
|
164
|
+
operation: spec.operation,
|
|
165
|
+
reason,
|
|
166
|
+
distance: spec.distance,
|
|
167
|
+
...metadata
|
|
168
|
+
}, getSuggestionForCode(code)));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Verify a shell/offset result against its input. The wall-distance check
|
|
172
|
+
* needs `evolution` built from every input face hash and a kernel with native
|
|
173
|
+
* history; pass `undefined` to skip it.
|
|
174
|
+
*/
|
|
175
|
+
function checkThickResult(input, result, evolution, spec) {
|
|
176
|
+
const kernel = getKernel();
|
|
177
|
+
if (kernel.isNull(result.wrapped)) return failure(spec, "empty", {});
|
|
178
|
+
const inputVolume = kernel.volume(input.wrapped);
|
|
179
|
+
const resultVolume = kernel.volume(result.wrapped);
|
|
180
|
+
const byVolume = volumeFailure(spec.distance, {
|
|
181
|
+
volume: inputVolume,
|
|
182
|
+
faceCount: getFaces(input).length
|
|
183
|
+
}, {
|
|
184
|
+
volume: resultVolume,
|
|
185
|
+
faceCount: getFaces(result).length
|
|
186
|
+
});
|
|
187
|
+
if (byVolume) return failure(spec, byVolume, {
|
|
188
|
+
inputVolume,
|
|
189
|
+
resultVolume
|
|
190
|
+
});
|
|
191
|
+
if (!kernel.isValid(result.wrapped)) return failure(spec, "invalid", {});
|
|
192
|
+
if (evolution && getKernelCapabilities().nativeHistory === true) {
|
|
193
|
+
const deviation = worstWallDeviation(input, result, evolution, spec);
|
|
194
|
+
const allowed = Math.max(10 * spec.tolerance, WALL_DISTANCE_REL_TOL * Math.abs(spec.distance));
|
|
195
|
+
if (deviation > allowed) return failure(spec, "wall-distance", {
|
|
196
|
+
deviation,
|
|
197
|
+
allowed
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return ok(void 0);
|
|
201
|
+
}
|
|
202
|
+
// src/topology/modifierFns.ts
|
|
111
203
|
/**
|
|
112
204
|
* Functional modifier operations — fillet, chamfer, shell, thicken, offset, draft.
|
|
113
205
|
*
|
|
@@ -325,6 +417,22 @@ function chamfer(shape, edges, distance) {
|
|
|
325
417
|
}));
|
|
326
418
|
}
|
|
327
419
|
}
|
|
420
|
+
function acceptThickResult(input, cast, evolution, spec, propagateMetadata = true) {
|
|
421
|
+
let checked;
|
|
422
|
+
try {
|
|
423
|
+
if (isShape3D(cast) || getKernel().isNull(cast.wrapped)) checked = checkThickResult(input, cast, evolution, spec);
|
|
424
|
+
else checked = err(spec.operation === "shell" ? kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape") : kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
425
|
+
} catch (e) {
|
|
426
|
+
disposeResultShape(cast);
|
|
427
|
+
throw e;
|
|
428
|
+
}
|
|
429
|
+
if (isErr(checked)) {
|
|
430
|
+
disposeResultShape(cast);
|
|
431
|
+
return checked;
|
|
432
|
+
}
|
|
433
|
+
if (evolution && propagateMetadata) propagateAllMetadata(evolution, [input], cast);
|
|
434
|
+
return ok(cast);
|
|
435
|
+
}
|
|
328
436
|
/**
|
|
329
437
|
* Create a hollow shell by removing faces and offsetting remaining walls.
|
|
330
438
|
*
|
|
@@ -332,31 +440,29 @@ function chamfer(shape, edges, distance) {
|
|
|
332
440
|
* @param faces - Faces to remove.
|
|
333
441
|
* @param thickness - Wall thickness.
|
|
334
442
|
* @param tolerance - Shell operation tolerance (default 1e-3).
|
|
443
|
+
* @returns Err `SHELL_NO_EFFECT` when the wall is too thick and the kernel
|
|
444
|
+
* hands back the input, `SHELL_INVALID_RESULT` when the result is not a
|
|
445
|
+
* usable hollow body.
|
|
335
446
|
*/
|
|
336
447
|
function shell(shape, faces, thickness, tolerance = .001, { trackEvolution = true } = {}) {
|
|
337
448
|
const check = validateNotNull$1(shape, "shell: shape");
|
|
338
449
|
if (isErr(check)) return check;
|
|
339
450
|
if (thickness <= 0) return err(validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
340
451
|
if (faces.length === 0) return err(validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
452
|
+
const kernel = getKernel();
|
|
453
|
+
const spec = {
|
|
454
|
+
operation: "shell",
|
|
455
|
+
distance: -thickness,
|
|
456
|
+
tolerance,
|
|
457
|
+
openedFaceHashes: new Set(faces.map((f) => kernel.hashCode(f.wrapped, HASH_CODE_MAX)))
|
|
458
|
+
};
|
|
341
459
|
try {
|
|
342
|
-
if (!trackEvolution) {
|
|
343
|
-
const resultShape =
|
|
344
|
-
|
|
345
|
-
if (!isShape3D(cast)) {
|
|
346
|
-
disposeResultShape(cast);
|
|
347
|
-
return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
348
|
-
}
|
|
349
|
-
return ok(cast);
|
|
460
|
+
if (!trackEvolution && getKernelCapabilities().nativeHistory !== true) {
|
|
461
|
+
const resultShape = kernel.shell(shape.wrapped, faces.map((f) => f.wrapped), thickness, tolerance);
|
|
462
|
+
return acceptThickResult(shape, castResultShape(resultShape), void 0, spec);
|
|
350
463
|
}
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
const cast = castResultShape(resultShape);
|
|
354
|
-
if (!isShape3D(cast)) {
|
|
355
|
-
disposeResultShape(cast);
|
|
356
|
-
return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
357
|
-
}
|
|
358
|
-
propagateAllMetadata(evolution, [shape], cast);
|
|
359
|
-
return ok(cast);
|
|
464
|
+
const { shape: resultShape, evolution } = kernel.shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, subShapeHashes(shape, "face"), HASH_CODE_MAX, tolerance);
|
|
465
|
+
return acceptThickResult(shape, castResultShape(resultShape), evolution, spec, trackEvolution);
|
|
360
466
|
} catch (e) {
|
|
361
467
|
const raw = e instanceof Error ? e.message : String(e);
|
|
362
468
|
return err(kernelError("SHELL_FAILED", `Shell operation failed: ${raw}`, e, {
|
|
@@ -372,21 +478,20 @@ function shell(shape, faces, thickness, tolerance = .001, { trackEvolution = tru
|
|
|
372
478
|
* @param shape - The shape to offset (must be a 3D shape with faces).
|
|
373
479
|
* @param distance - Offset distance (positive = outward, negative = inward).
|
|
374
480
|
* @param tolerance - Offset tolerance (default 1e-6).
|
|
481
|
+
* @returns Err `OFFSET_INVALID_RESULT` when the offset consumes the body or
|
|
482
|
+
* gives no usable solid.
|
|
375
483
|
*/
|
|
376
484
|
function offset(shape, distance, tolerance = 1e-6) {
|
|
377
485
|
const check = validateNotNull$1(shape, "offset: shape");
|
|
378
486
|
if (isErr(check)) return check;
|
|
379
487
|
if (Math.abs(distance) < 1e-10) return err(validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
380
488
|
try {
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
propagateAllMetadata(evolution, [shape], cast);
|
|
389
|
-
return ok(cast);
|
|
489
|
+
const { shape: resultShape, evolution } = getKernel().offsetWithHistory(shape.wrapped, distance, subShapeHashes(shape, "face"), HASH_CODE_MAX, tolerance);
|
|
490
|
+
return acceptThickResult(shape, castResultShape(resultShape), evolution, {
|
|
491
|
+
operation: "offset",
|
|
492
|
+
distance,
|
|
493
|
+
tolerance
|
|
494
|
+
});
|
|
390
495
|
} catch (e) {
|
|
391
496
|
const raw = e instanceof Error ? e.message : String(e);
|
|
392
497
|
return err(kernelError("OFFSET_FAILED", `Offset operation failed: ${raw}`, e));
|
|
@@ -481,8 +586,7 @@ function variableFillet(shape, edge, radii) {
|
|
|
481
586
|
return err(kernelError(BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet failed", e));
|
|
482
587
|
}
|
|
483
588
|
}
|
|
484
|
-
|
|
485
|
-
//#region src/topology/chamferAngleFns.ts
|
|
589
|
+
// src/topology/chamferAngleFns.ts
|
|
486
590
|
/**
|
|
487
591
|
* Chamfer with distance + angle — functional API.
|
|
488
592
|
*
|
|
@@ -532,8 +636,7 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
532
636
|
}
|
|
533
637
|
return ok(wrapped);
|
|
534
638
|
}
|
|
535
|
-
|
|
536
|
-
//#region src/topology/nurbsFns.ts
|
|
639
|
+
// src/topology/nurbsFns.ts
|
|
537
640
|
/**
|
|
538
641
|
* Extract NURBS data from a BSpline or Bezier edge.
|
|
539
642
|
* Returns null if the edge is not a NURBS curve (e.g., line, circle).
|
|
@@ -552,8 +655,7 @@ function getNurbsSurfaceData(face) {
|
|
|
552
655
|
if (!kernel.getNurbsSurfaceData) return null;
|
|
553
656
|
return kernel.getNurbsSurfaceData(face.wrapped);
|
|
554
657
|
}
|
|
555
|
-
|
|
556
|
-
//#region src/topology/booleanBatchFns.ts
|
|
658
|
+
// src/topology/booleanBatchFns.ts
|
|
557
659
|
var REAL_OPS = {
|
|
558
660
|
cut,
|
|
559
661
|
cutAll,
|
|
@@ -675,8 +777,7 @@ function tryBatch(fn) {
|
|
|
675
777
|
return null;
|
|
676
778
|
}
|
|
677
779
|
}
|
|
678
|
-
|
|
679
|
-
//#region src/topology/booleanDiagnosticFns.ts
|
|
780
|
+
// src/topology/booleanDiagnosticFns.ts
|
|
680
781
|
/**
|
|
681
782
|
* Boolean pre-validation diagnostics.
|
|
682
783
|
*/
|
|
@@ -697,8 +798,7 @@ function tryBatch(fn) {
|
|
|
697
798
|
function checkBoolean(base, tool, op) {
|
|
698
799
|
return getKernel().checkBoolean(base.wrapped, tool.wrapped, op);
|
|
699
800
|
}
|
|
700
|
-
|
|
701
|
-
//#region src/topology/evolutionFns.ts
|
|
801
|
+
// src/topology/evolutionFns.ts
|
|
702
802
|
/**
|
|
703
803
|
* Evolution-tracking variants of boolean and modifier operations.
|
|
704
804
|
*
|
|
@@ -941,8 +1041,7 @@ function shellWithEvolution(shape, faces, thickness, tolerance = .001) {
|
|
|
941
1041
|
}));
|
|
942
1042
|
}
|
|
943
1043
|
}
|
|
944
|
-
|
|
945
|
-
//#region src/topology/positionFns.ts
|
|
1044
|
+
// src/topology/positionFns.ts
|
|
946
1045
|
/**
|
|
947
1046
|
* Curve-based positioning operations.
|
|
948
1047
|
*/
|
|
@@ -970,8 +1069,7 @@ function positionOnCurve(shape, spine, param) {
|
|
|
970
1069
|
return err(kernelError(BrepErrorCode.POSITION_ON_CURVE_FAILED, `Failed to position shape on curve at param ${param}`, e));
|
|
971
1070
|
}
|
|
972
1071
|
}
|
|
973
|
-
|
|
974
|
-
//#region src/topology/healingFns.ts
|
|
1072
|
+
// src/topology/healingFns.ts
|
|
975
1073
|
/**
|
|
976
1074
|
* Shape healing and validation functions.
|
|
977
1075
|
*
|
|
@@ -1258,5 +1356,4 @@ function fixSelfIntersection(wire) {
|
|
|
1258
1356
|
return err(kernelError(BrepErrorCode.FIX_SELF_INTERSECTION_FAILED, "Failed to fix wire self-intersection", e));
|
|
1259
1357
|
}
|
|
1260
1358
|
}
|
|
1261
|
-
//#endregion
|
|
1262
1359
|
export { toBufferGeometryData as A, chamfer as C, shell as D, offset as E, toLODGeometryData as M, toLODGeometryLevels as N, thicken as O, toLineGeometryData as P, chamferDistAngle as S, fillet as T, checkBoolean as _, healFace as a, getNurbsCurveData as b, isValid as c, chamferWithEvolution as d, cutWithEvolution as f, shellWithEvolution as g, intersectWithEvolution as h, heal as i, toGroupedBufferGeometryData as j, variableFillet as k, solidFromShell as l, fuseWithEvolution as m, fixSelfIntersection as n, healSolid as o, filletWithEvolution as p, fixShape as r, healWire as s, autoHeal as t, positionOnCurve as u, cutAllBisect as v, draft as w, getNurbsSurfaceData as x, fuseAllBisect as y };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_constants = require("./constants-
|
|
5
|
-
const require_vecOps = require("./vecOps-
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_shapeFns = require("./shapeFns-
|
|
8
|
-
const require_curveFns = require("./curveFns-
|
|
9
|
-
const require_measureFns = require("./measureFns-
|
|
10
|
-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D_anqiRe.cjs");
|
|
2
|
+
const require_errors = require("./errors-GVyCnpi0.cjs");
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-ENxs8uu2.cjs");
|
|
4
|
+
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
5
|
+
const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
|
|
6
|
+
const require_faceFns = require("./faceFns-DSRREV5G.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-B54CsPyk.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-U7srQ3ZA.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-BvNkzSR6.cjs");
|
|
10
|
+
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
13
13
|
/** Base precision for offset operations — scaled internally for sub-tasks. */
|
|
@@ -89,8 +89,7 @@ var polarToCartesian = (r, theta) => {
|
|
|
89
89
|
var cartesianToPolar = ([x, y]) => {
|
|
90
90
|
return [Math.sqrt(x * x + y * y), Math.atan2(y, x)];
|
|
91
91
|
};
|
|
92
|
-
|
|
93
|
-
//#region src/query/finderCore.ts
|
|
92
|
+
// src/query/finderCore.ts
|
|
94
93
|
/**
|
|
95
94
|
* Find exactly one element matching all predicates. Returns an error Result
|
|
96
95
|
* if zero or more than one element matches.
|
|
@@ -181,8 +180,7 @@ function createTypedFinder(topoKind, filters, rebuild, extend) {
|
|
|
181
180
|
...extensions
|
|
182
181
|
};
|
|
183
182
|
}
|
|
184
|
-
|
|
185
|
-
//#region src/query/directionUtils.ts
|
|
183
|
+
// src/query/directionUtils.ts
|
|
186
184
|
var DIRECTIONS = {
|
|
187
185
|
X: [
|
|
188
186
|
1,
|
|
@@ -209,8 +207,7 @@ function resolveDir(dir) {
|
|
|
209
207
|
];
|
|
210
208
|
return dir;
|
|
211
209
|
}
|
|
212
|
-
|
|
213
|
-
//#region src/query/shapeDistanceFilter.ts
|
|
210
|
+
// src/query/shapeDistanceFilter.ts
|
|
214
211
|
/**
|
|
215
212
|
* Create a predicate that checks whether a shape element's minimum distance
|
|
216
213
|
* from `point` equals `distance` (within `tolerance`).
|
|
@@ -226,8 +223,7 @@ function distanceFromPointFilter(distance, point, tolerance) {
|
|
|
226
223
|
return Math.abs(d - distance) < tolerance;
|
|
227
224
|
};
|
|
228
225
|
}
|
|
229
|
-
|
|
230
|
-
//#region src/query/shapeFinders.ts
|
|
226
|
+
// src/query/shapeFinders.ts
|
|
231
227
|
function edgeDirectionFilter(dir, angle) {
|
|
232
228
|
const d = require_vecOps.vecNormalize(resolveDir(dir));
|
|
233
229
|
return (edge) => {
|
|
@@ -299,15 +295,13 @@ function buildWireFinder(filters) {
|
|
|
299
295
|
function wireFinder() {
|
|
300
296
|
return buildWireFinder([]);
|
|
301
297
|
}
|
|
302
|
-
|
|
303
|
-
//#region src/query/helpers.ts
|
|
298
|
+
// src/query/helpers.ts
|
|
304
299
|
/** Resolve a {@link SingleFace} input to a concrete Face from the given shape. */
|
|
305
300
|
function getSingleFace(f, shape) {
|
|
306
301
|
if (typeof f === "object" && "_topoKind" in f) return f.findUnique(shape);
|
|
307
302
|
if (typeof f !== "function" && require_shapeTypes.isFace(f)) return require_errors.ok(f);
|
|
308
303
|
return f(faceFinder()).findUnique(shape);
|
|
309
304
|
}
|
|
310
|
-
//#endregion
|
|
311
305
|
Object.defineProperty(exports, "PRECISION_INTERSECTION", {
|
|
312
306
|
enumerable: true,
|
|
313
307
|
get: function() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { q as getKernel, y as isFace } from "./shapeTypes-
|
|
2
|
-
import { E as ok, g as err, o as queryError, x as isOk } from "./errors-
|
|
3
|
-
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
4
|
-
import { t as DEG2RAD } from "./constants-
|
|
5
|
-
import { a as vecDot, d as vecNormalize } from "./vecOps-
|
|
6
|
-
import { l as normalAt, s as getSurfaceType } from "./faceFns-
|
|
7
|
-
import { a as isSameShape, n as getHashCode } from "./shapeFns
|
|
8
|
-
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-
|
|
9
|
-
import { n as measureArea } from "./measureFns-
|
|
10
|
-
|
|
1
|
+
import { q as getKernel, y as isFace } from "./shapeTypes-CgbUTASh.js";
|
|
2
|
+
import { E as ok, g as err, o as queryError, x as isOk } from "./errors-vxP5FT8B.js";
|
|
3
|
+
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-6M_dbT1R.js";
|
|
4
|
+
import { t as DEG2RAD } from "./constants-iraOnb2p.js";
|
|
5
|
+
import { a as vecDot, d as vecNormalize } from "./vecOps-S-m9H_fe.js";
|
|
6
|
+
import { l as normalAt, s as getSurfaceType } from "./faceFns-BBk6XKJO.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-DB3l3ULC.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-CkA2WJP2.js";
|
|
9
|
+
import { n as measureArea } from "./measureFns-PRM3gOjw.js";
|
|
10
|
+
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
13
13
|
/** Base precision for offset operations — scaled internally for sub-tasks. */
|
|
@@ -89,8 +89,7 @@ var polarToCartesian = (r, theta) => {
|
|
|
89
89
|
var cartesianToPolar = ([x, y]) => {
|
|
90
90
|
return [Math.sqrt(x * x + y * y), Math.atan2(y, x)];
|
|
91
91
|
};
|
|
92
|
-
|
|
93
|
-
//#region src/query/finderCore.ts
|
|
92
|
+
// src/query/finderCore.ts
|
|
94
93
|
/**
|
|
95
94
|
* Find exactly one element matching all predicates. Returns an error Result
|
|
96
95
|
* if zero or more than one element matches.
|
|
@@ -181,8 +180,7 @@ function createTypedFinder(topoKind, filters, rebuild, extend) {
|
|
|
181
180
|
...extensions
|
|
182
181
|
};
|
|
183
182
|
}
|
|
184
|
-
|
|
185
|
-
//#region src/query/directionUtils.ts
|
|
183
|
+
// src/query/directionUtils.ts
|
|
186
184
|
var DIRECTIONS = {
|
|
187
185
|
X: [
|
|
188
186
|
1,
|
|
@@ -209,8 +207,7 @@ function resolveDir(dir) {
|
|
|
209
207
|
];
|
|
210
208
|
return dir;
|
|
211
209
|
}
|
|
212
|
-
|
|
213
|
-
//#region src/query/shapeDistanceFilter.ts
|
|
210
|
+
// src/query/shapeDistanceFilter.ts
|
|
214
211
|
/**
|
|
215
212
|
* Create a predicate that checks whether a shape element's minimum distance
|
|
216
213
|
* from `point` equals `distance` (within `tolerance`).
|
|
@@ -226,8 +223,7 @@ function distanceFromPointFilter(distance, point, tolerance) {
|
|
|
226
223
|
return Math.abs(d - distance) < tolerance;
|
|
227
224
|
};
|
|
228
225
|
}
|
|
229
|
-
|
|
230
|
-
//#region src/query/shapeFinders.ts
|
|
226
|
+
// src/query/shapeFinders.ts
|
|
231
227
|
function edgeDirectionFilter(dir, angle) {
|
|
232
228
|
const d = vecNormalize(resolveDir(dir));
|
|
233
229
|
return (edge) => {
|
|
@@ -299,13 +295,11 @@ function buildWireFinder(filters) {
|
|
|
299
295
|
function wireFinder() {
|
|
300
296
|
return buildWireFinder([]);
|
|
301
297
|
}
|
|
302
|
-
|
|
303
|
-
//#region src/query/helpers.ts
|
|
298
|
+
// src/query/helpers.ts
|
|
304
299
|
/** Resolve a {@link SingleFace} input to a concrete Face from the given shape. */
|
|
305
300
|
function getSingleFace(f, shape) {
|
|
306
301
|
if (typeof f === "object" && "_topoKind" in f) return f.findUnique(shape);
|
|
307
302
|
if (typeof f !== "function" && isFace(f)) return ok(f);
|
|
308
303
|
return f(faceFinder()).findUnique(shape);
|
|
309
304
|
}
|
|
310
|
-
//#endregion
|
|
311
305
|
export { rotate2d as _, createTypedFinder as a, squareDistance2d as b, PRECISION_POINT as c, cartesianToPolar as d, crossProduct2d as f, polarToCartesian as g, polarAngle2d as h, wireFinder as i, add2d as l, normalize2d as m, edgeFinder as n, PRECISION_INTERSECTION as o, distance2d as p, faceFinder as r, PRECISION_OFFSET as s, getSingleFace as t, angle2d as u, samePoint as v, subtract2d as x, scalarMultiply2d as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_bug = require("./bug-
|
|
3
|
-
const require_errors = require("./errors-
|
|
4
|
-
const require_arrayAccess = require("./arrayAccess-
|
|
5
|
-
const require_blueprint = require("./blueprint-
|
|
6
|
-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D_anqiRe.cjs");
|
|
2
|
+
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
3
|
+
const require_errors = require("./errors-GVyCnpi0.cjs");
|
|
4
|
+
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
5
|
+
const require_blueprint = require("./blueprint-wq2TU1XP.cjs");
|
|
6
|
+
// src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
9
9
|
return require_bug.vec3At(arr, i * 3);
|
|
@@ -55,8 +55,7 @@ function exportOBJ(mesh) {
|
|
|
55
55
|
}
|
|
56
56
|
return lines.join("\n") + "\n";
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
//#region src/io/gltfExportFns.ts
|
|
58
|
+
// src/io/gltfExportFns.ts
|
|
60
59
|
var FLOAT = 5126;
|
|
61
60
|
var UNSIGNED_INT = 5125;
|
|
62
61
|
var ARRAY_BUFFER = 34962;
|
|
@@ -507,8 +506,7 @@ function buildBinaryBuffer(mesh) {
|
|
|
507
506
|
output.set(new Uint8Array(normals.buffer, normals.byteOffset, normalsByteLength), align4(indicesByteLength) + verticesByteLength);
|
|
508
507
|
return buffer;
|
|
509
508
|
}
|
|
510
|
-
|
|
511
|
-
//#region src/io/dxfExportFns.ts
|
|
509
|
+
// src/io/dxfExportFns.ts
|
|
512
510
|
/**
|
|
513
511
|
* Export DXF entities to a DXF R12 ASCII string.
|
|
514
512
|
*
|
|
@@ -609,8 +607,7 @@ function approximateCurveAsPolyline(curve, segments) {
|
|
|
609
607
|
points
|
|
610
608
|
};
|
|
611
609
|
}
|
|
612
|
-
|
|
613
|
-
//#region src/io/threemfExportFns.ts
|
|
610
|
+
// src/io/threemfExportFns.ts
|
|
614
611
|
var crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
615
612
|
for (let i = 0; i < 256; i++) {
|
|
616
613
|
let c = i;
|
|
@@ -911,8 +908,7 @@ function exportThreeMF(mesh, options = {}) {
|
|
|
911
908
|
entry("3D/3dmodel.model", model)
|
|
912
909
|
]);
|
|
913
910
|
}
|
|
914
|
-
|
|
915
|
-
//#region src/io/svgImportFns.ts
|
|
911
|
+
// src/io/svgImportFns.ts
|
|
916
912
|
function tokenizeSVGPath(d) {
|
|
917
913
|
const tokens = [];
|
|
918
914
|
const re = /([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g;
|
|
@@ -1238,8 +1234,7 @@ function importSVG(svgString) {
|
|
|
1238
1234
|
return require_errors.err(require_errors.ioError("SVG_IMPORT_FAILED", `Failed to import SVG: ${e instanceof Error ? e.message : String(e)}`));
|
|
1239
1235
|
}
|
|
1240
1236
|
}
|
|
1241
|
-
|
|
1242
|
-
//#region src/io/stepConfigFns.ts
|
|
1237
|
+
// src/io/stepConfigFns.ts
|
|
1243
1238
|
/**
|
|
1244
1239
|
* Configured STEP export with full control over units, schema, and assembly mode.
|
|
1245
1240
|
*/
|
|
@@ -1265,8 +1260,7 @@ function exportSTEPConfigured(parts, options) {
|
|
|
1265
1260
|
return require_errors.err(require_errors.ioError(require_errors.BrepErrorCode.STEP_EXPORT_CONFIGURED_FAILED, "Configured STEP export failed", e));
|
|
1266
1261
|
}
|
|
1267
1262
|
}
|
|
1268
|
-
|
|
1269
|
-
//#region src/io/importFns.ts
|
|
1263
|
+
// src/io/importFns.ts
|
|
1270
1264
|
/**
|
|
1271
1265
|
* Functional file import operations using branded shape types.
|
|
1272
1266
|
* Supports STEP, STL, and IGES formats.
|
|
@@ -1355,7 +1349,6 @@ async function importIGES(blob) {
|
|
|
1355
1349
|
return require_errors.err(require_errors.ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
|
|
1356
1350
|
}
|
|
1357
1351
|
}
|
|
1358
|
-
//#endregion
|
|
1359
1352
|
Object.defineProperty(exports, "blueprintToDXF", {
|
|
1360
1353
|
enumerable: true,
|
|
1361
1354
|
get: function() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as castResultShape, q as getKernel } from "./shapeTypes-
|
|
2
|
-
import { i as wasmIndex, r as vec3At$1 } from "./bug-
|
|
3
|
-
import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-
|
|
4
|
-
import { n as getAtOrThrow } from "./arrayAccess-
|
|
5
|
-
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-
|
|
6
|
-
|
|
1
|
+
import { n as castResultShape, q as getKernel } from "./shapeTypes-CgbUTASh.js";
|
|
2
|
+
import { i as wasmIndex, r as vec3At$1 } from "./bug-ClMTAJhe.js";
|
|
3
|
+
import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-vxP5FT8B.js";
|
|
4
|
+
import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
5
|
+
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-Bth4EVaO.js";
|
|
6
|
+
// src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
9
9
|
return vec3At$1(arr, i * 3);
|
|
@@ -55,8 +55,7 @@ function exportOBJ(mesh) {
|
|
|
55
55
|
}
|
|
56
56
|
return lines.join("\n") + "\n";
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
//#region src/io/gltfExportFns.ts
|
|
58
|
+
// src/io/gltfExportFns.ts
|
|
60
59
|
var FLOAT = 5126;
|
|
61
60
|
var UNSIGNED_INT = 5125;
|
|
62
61
|
var ARRAY_BUFFER = 34962;
|
|
@@ -507,8 +506,7 @@ function buildBinaryBuffer(mesh) {
|
|
|
507
506
|
output.set(new Uint8Array(normals.buffer, normals.byteOffset, normalsByteLength), align4(indicesByteLength) + verticesByteLength);
|
|
508
507
|
return buffer;
|
|
509
508
|
}
|
|
510
|
-
|
|
511
|
-
//#region src/io/dxfExportFns.ts
|
|
509
|
+
// src/io/dxfExportFns.ts
|
|
512
510
|
/**
|
|
513
511
|
* Export DXF entities to a DXF R12 ASCII string.
|
|
514
512
|
*
|
|
@@ -609,8 +607,7 @@ function approximateCurveAsPolyline(curve, segments) {
|
|
|
609
607
|
points
|
|
610
608
|
};
|
|
611
609
|
}
|
|
612
|
-
|
|
613
|
-
//#region src/io/threemfExportFns.ts
|
|
610
|
+
// src/io/threemfExportFns.ts
|
|
614
611
|
var crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
615
612
|
for (let i = 0; i < 256; i++) {
|
|
616
613
|
let c = i;
|
|
@@ -911,8 +908,7 @@ function exportThreeMF(mesh, options = {}) {
|
|
|
911
908
|
entry("3D/3dmodel.model", model)
|
|
912
909
|
]);
|
|
913
910
|
}
|
|
914
|
-
|
|
915
|
-
//#region src/io/svgImportFns.ts
|
|
911
|
+
// src/io/svgImportFns.ts
|
|
916
912
|
function tokenizeSVGPath(d) {
|
|
917
913
|
const tokens = [];
|
|
918
914
|
const re = /([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g;
|
|
@@ -1238,8 +1234,7 @@ function importSVG(svgString) {
|
|
|
1238
1234
|
return err(ioError("SVG_IMPORT_FAILED", `Failed to import SVG: ${e instanceof Error ? e.message : String(e)}`));
|
|
1239
1235
|
}
|
|
1240
1236
|
}
|
|
1241
|
-
|
|
1242
|
-
//#region src/io/stepConfigFns.ts
|
|
1237
|
+
// src/io/stepConfigFns.ts
|
|
1243
1238
|
/**
|
|
1244
1239
|
* Configured STEP export with full control over units, schema, and assembly mode.
|
|
1245
1240
|
*/
|
|
@@ -1265,8 +1260,7 @@ function exportSTEPConfigured(parts, options) {
|
|
|
1265
1260
|
return err(ioError(BrepErrorCode.STEP_EXPORT_CONFIGURED_FAILED, "Configured STEP export failed", e));
|
|
1266
1261
|
}
|
|
1267
1262
|
}
|
|
1268
|
-
|
|
1269
|
-
//#region src/io/importFns.ts
|
|
1263
|
+
// src/io/importFns.ts
|
|
1270
1264
|
/**
|
|
1271
1265
|
* Functional file import operations using branded shape types.
|
|
1272
1266
|
* Supports STEP, STL, and IGES formats.
|
|
@@ -1355,5 +1349,4 @@ async function importIGES(blob) {
|
|
|
1355
1349
|
return err(ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
|
|
1356
1350
|
}
|
|
1357
1351
|
}
|
|
1358
|
-
//#endregion
|
|
1359
1352
|
export { importSVG as a, blueprintToDXF as c, exportGltf as d, exportOBJ as f, exportSTEPConfigured as i, exportDXF as l, importSTEP as n, importSVGPathD as o, importSTL as r, exportThreeMF as s, importIGES as t, exportGlb as u };
|
package/dist/io.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_meshFns = require("./meshFns-
|
|
3
|
-
const require_importFns = require("./importFns-
|
|
2
|
+
const require_meshFns = require("./meshFns-W7ZTKqiJ.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-ClqPJCFR.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
|
6
6
|
exports.exportGlb = require_importFns.exportGlb;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-
|
|
2
|
-
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-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-CgbT3uuO.js";
|
|
2
|
+
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-DSUfSQn2.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -24,9 +24,17 @@ export interface KernelCapabilities {
|
|
|
24
24
|
readonly exactMeasurement: boolean;
|
|
25
25
|
/** How tessellation resolution is controlled — see module docs. */
|
|
26
26
|
readonly tessellationModel: TessellationModel;
|
|
27
|
+
/**
|
|
28
|
+
* `*WithHistory` maps come from the kernel's own operation history, so a
|
|
29
|
+
* face listed as generated from a source face is that face's offset, sweep,
|
|
30
|
+
* or fillet. Kernels that rebuild the maps by geometric matching leave it unset.
|
|
31
|
+
*/
|
|
32
|
+
readonly nativeHistory?: boolean | undefined;
|
|
27
33
|
}
|
|
28
34
|
/** Default for an exact B-rep kernel (OCCT family, brepkit). */
|
|
29
35
|
export declare const EXACT_BREP_CAPABILITIES: KernelCapabilities;
|
|
36
|
+
/** OCCT-family kernels: exact B-rep with OCCT's own shape history. */
|
|
37
|
+
export declare const OCCT_CAPABILITIES: KernelCapabilities;
|
|
30
38
|
/**
|
|
31
39
|
* Conservative fallback for a kernel that doesn't declare capabilities: assume
|
|
32
40
|
* exact B-rep so export/measurement aren't wrongly blocked, but claim no
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_occtWasmAdapter = require("../../occtWasmAdapter-
|
|
2
|
+
const require_occtWasmAdapter = require("../../occtWasmAdapter-BSQeA69d.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|