brepjs 12.7.3 → 12.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d/blueprints/boolean2D.d.ts.map +1 -1
- package/dist/2d/blueprints/lib.d.ts.map +1 -1
- package/dist/2d/blueprints/offset.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-CnDVffSX.cjs → Blueprint-CQ28WJhz.cjs} +29 -30
- package/dist/{Blueprint-C3lWY1Jf.js → Blueprint-DbVaf6k7.js} +7 -8
- package/dist/{boolean2D-DyQJt8Na.cjs → boolean2D-0blbVtJ8.cjs} +70 -61
- package/dist/{boolean2D-CwZAIJDS.js → boolean2D-y3E92F0u.js} +37 -28
- package/dist/{booleanFns-CcNUsgI8.js → booleanFns-BCTjYZAg.js} +4 -4
- package/dist/{booleanFns-D7HmkpYt.cjs → booleanFns-gmsX3Cv2.cjs} +59 -59
- package/dist/brepjs.cjs +319 -372
- package/dist/brepjs.js +358 -411
- package/dist/core/errors.d.ts +14 -5
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core.cjs +30 -31
- package/dist/core.js +19 -20
- package/dist/{cornerFinder-BV-l1BCw.js → cornerFinder-Ckz-mPHE.js} +1 -1
- package/dist/{cornerFinder-3zfbQvXg.cjs → cornerFinder-ZmOyOOsh.cjs} +1 -1
- package/dist/{curveFns-Ch87sD5O.cjs → curveFns-BZngcnQ1.cjs} +17 -17
- package/dist/{curveFns-CloOqAQ_.js → curveFns-mROFhiuG.js} +1 -1
- package/dist/{drawFns-5myJTgtX.js → drawFns-Bwakrq7w.js} +24 -25
- package/dist/{drawFns-CDNafQhv.cjs → drawFns-CjRc1NfQ.cjs} +51 -52
- package/dist/{faceFns-B6ebRh5I.js → faceFns-B8GnxjdY.js} +1 -1
- package/dist/{faceFns-BLTEPBKq.cjs → faceFns-DB1Fc5gy.cjs} +20 -20
- package/dist/{helpers-6kn30cSD.cjs → helpers-C8NoT0Wu.cjs} +14 -14
- package/dist/{helpers-C9KvE1RW.js → helpers-X0juxnwj.js} +4 -4
- package/dist/io.cjs +26 -26
- package/dist/io.js +3 -3
- package/dist/kernel/brepkitAdapter.d.ts +8 -8
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +6 -0
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/historyOps.d.ts +3 -3
- package/dist/kernel/historyOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +8 -8
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-BcZUCGKi.js → loft-Bhw-FMoL.js} +4 -4
- package/dist/{loft-DR1UN5uN.cjs → loft-hp3pc1M7.cjs} +43 -43
- package/dist/{measurement-DoYXRaKI.cjs → measurement-BoNTUBAp.cjs} +1 -1
- package/dist/{measurement-oWvhSVZG.js → measurement-D8EJ694A.js} +1 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-3gy0empP.cjs → meshFns-BnV0ZR8w.cjs} +17 -17
- package/dist/{meshFns-DsLRd3tA.js → meshFns-nQjK38EC.js} +2 -2
- package/dist/{operations-Dcz6YlOt.js → operations-BfbkK6DU.js} +5 -5
- package/dist/{operations-DLFzmdFX.cjs → operations-CYpmLSC4.cjs} +75 -75
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query.cjs +3 -3
- package/dist/query.js +4 -4
- package/dist/{errors-B7kgv0cd.js → result-BaSD1fqR.js} +43 -23
- package/dist/{errors-9fDehDNc.cjs → result-fAX0OZzI.cjs} +20 -0
- package/dist/result.cjs +30 -41
- package/dist/result.js +18 -29
- package/dist/{shapeFns-D-MOoqJd.cjs → shapeFns-C2SnNvdH.cjs} +39 -39
- package/dist/{shapeFns-D2PlLFE6.js → shapeFns-FDuKkrDR.js} +4 -4
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-BzfRBizW.cjs → solidBuilders-994_MQwB.cjs} +12 -12
- package/dist/{solidBuilders-BXhh5hP2.js → solidBuilders-DmwhTCCd.js} +2 -2
- package/dist/{surfaceBuilders-Be_ENWSA.cjs → surfaceBuilders-5VA34a3_.cjs} +27 -27
- package/dist/{surfaceBuilders-D6iDVPIM.js → surfaceBuilders-nQdJ56fe.js} +2 -2
- package/dist/{topology-CKtCGLmb.cjs → topology-ANwCzGL8.cjs} +54 -54
- package/dist/{topology-DxD58iQ6.js → topology-C7x98OVn.js} +8 -8
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/dist/{vectors-CESkzEm6.js → vectors-Bx8wkNui.js} +1 -1
- package/dist/{vectors-BafmMf96.cjs → vectors-D_IiZx0q.cjs} +6 -6
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +1 -1
- package/package.json +5 -8
|
@@ -34,8 +34,8 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
34
34
|
var next = (it) => {
|
|
35
35
|
while (it = stack.pop()) {
|
|
36
36
|
try {
|
|
37
|
-
var
|
|
38
|
-
if (it[0]) return Promise.resolve(
|
|
37
|
+
var result2 = it[1] && it[1].call(it[2]);
|
|
38
|
+
if (it[0]) return Promise.resolve(result2).then(next, (e) => (fail(e), next()));
|
|
39
39
|
} catch (e) {
|
|
40
40
|
fail(e);
|
|
41
41
|
}
|
|
@@ -47,18 +47,18 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
47
47
|
const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
|
|
48
48
|
const types = require("./types-CA_xrgDq.cjs");
|
|
49
49
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
50
|
-
const faceFns = require("./faceFns-
|
|
51
|
-
const
|
|
52
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
53
|
-
const solidBuilders = require("./solidBuilders-
|
|
50
|
+
const faceFns = require("./faceFns-DB1Fc5gy.cjs");
|
|
51
|
+
const result = require("./result-fAX0OZzI.cjs");
|
|
52
|
+
const surfaceBuilders = require("./surfaceBuilders-5VA34a3_.cjs");
|
|
53
|
+
const solidBuilders = require("./solidBuilders-994_MQwB.cjs");
|
|
54
54
|
function buildLawFromProfile(extrusionLength, { profile, endFactor = 1 }) {
|
|
55
55
|
if (profile !== "s-curve" && profile !== "linear") {
|
|
56
|
-
return
|
|
57
|
-
|
|
56
|
+
return result.err(
|
|
57
|
+
result.validationError("UNSUPPORTED_PROFILE", `Unsupported extrusion profile: ${String(profile)}`)
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
const law = shapeTypes.getKernel().buildExtrusionLaw(profile, extrusionLength, endFactor);
|
|
61
|
-
return
|
|
61
|
+
return result.ok(law.Trim(0, extrusionLength, 1e-6));
|
|
62
62
|
}
|
|
63
63
|
const basicFaceExtrusion = (face, extrusionVec) => {
|
|
64
64
|
const kernel = shapeTypes.getKernel();
|
|
@@ -66,7 +66,7 @@ const basicFaceExtrusion = (face, extrusionVec) => {
|
|
|
66
66
|
const len = vecOps.vecLength(vec);
|
|
67
67
|
const dir = len > 0 ? [vec[0] / len, vec[1] / len, vec[2] / len] : [0, 0, 1];
|
|
68
68
|
const shape = kernel.extrude(face.wrapped, dir, len);
|
|
69
|
-
const solid = shapeTypes.createSolid(
|
|
69
|
+
const solid = shapeTypes.createSolid(result.unwrap(faceFns.downcast(shape)));
|
|
70
70
|
return solid;
|
|
71
71
|
};
|
|
72
72
|
const revolution = (face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) => {
|
|
@@ -79,12 +79,12 @@ const revolution = (face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360
|
|
|
79
79
|
[...directionVec],
|
|
80
80
|
angle * vecOps.DEG2RAD
|
|
81
81
|
);
|
|
82
|
-
const result =
|
|
82
|
+
const result$1 = result.andThen(faceFns.cast(revolShape), (shape) => {
|
|
83
83
|
if (!faceFns.isShape3D(shape))
|
|
84
|
-
return
|
|
85
|
-
return
|
|
84
|
+
return result.err(result.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
85
|
+
return result.ok(shape);
|
|
86
86
|
});
|
|
87
|
-
return result;
|
|
87
|
+
return result$1;
|
|
88
88
|
};
|
|
89
89
|
function genericSweep(wire, spine, {
|
|
90
90
|
frenet = false,
|
|
@@ -104,16 +104,16 @@ function genericSweep(wire, spine, {
|
|
|
104
104
|
if (sweepMode === "simple" && !shellMode) {
|
|
105
105
|
const kernel2 = shapeTypes.getKernel();
|
|
106
106
|
const resultOc = kernel2.simplePipe(wire.wrapped, spine.wrapped);
|
|
107
|
-
const result2 =
|
|
107
|
+
const result2 = result.andThen(faceFns.cast(resultOc), (shape2) => {
|
|
108
108
|
if (!faceFns.isShape3D(shape2))
|
|
109
|
-
return
|
|
110
|
-
return
|
|
109
|
+
return result.err(result.typeCastError("SWEEP_NOT_3D", "Simple pipe did not produce a 3D shape"));
|
|
110
|
+
return result.ok(shape2);
|
|
111
111
|
});
|
|
112
112
|
return result2;
|
|
113
113
|
}
|
|
114
114
|
const kernel = shapeTypes.getKernel();
|
|
115
115
|
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
116
|
-
const result = kernel.sweepPipeShell(wire.wrapped, spine.wrapped, {
|
|
116
|
+
const result$1 = kernel.sweepPipeShell(wire.wrapped, spine.wrapped, {
|
|
117
117
|
transitionMode,
|
|
118
118
|
contact: !!withContact,
|
|
119
119
|
correction: withCorrection,
|
|
@@ -128,26 +128,26 @@ function genericSweep(wire, spine, {
|
|
|
128
128
|
maxDegree,
|
|
129
129
|
maxSegments
|
|
130
130
|
});
|
|
131
|
-
if (shellMode && typeof result === "object" && "firstShape" in result) {
|
|
132
|
-
const shape2 =
|
|
131
|
+
if (shellMode && typeof result$1 === "object" && "firstShape" in result$1) {
|
|
132
|
+
const shape2 = result.unwrap(faceFns.cast(result$1.shape));
|
|
133
133
|
if (!faceFns.isShape3D(shape2)) {
|
|
134
|
-
return
|
|
134
|
+
return result.err(result.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
|
|
135
135
|
}
|
|
136
|
-
const startWire =
|
|
137
|
-
const endWire =
|
|
136
|
+
const startWire = result.unwrap(faceFns.cast(result$1.firstShape));
|
|
137
|
+
const endWire = result.unwrap(faceFns.cast(result$1.lastShape));
|
|
138
138
|
if (!faceFns.isWire(startWire)) {
|
|
139
|
-
return
|
|
139
|
+
return result.err(result.typeCastError("SWEEP_START_NOT_WIRE", "Sweep did not produce a start Wire"));
|
|
140
140
|
}
|
|
141
141
|
if (!faceFns.isWire(endWire)) {
|
|
142
|
-
return
|
|
142
|
+
return result.err(result.typeCastError("SWEEP_END_NOT_WIRE", "Sweep did not produce an end Wire"));
|
|
143
143
|
}
|
|
144
|
-
return
|
|
144
|
+
return result.ok([shape2, startWire, endWire]);
|
|
145
145
|
}
|
|
146
|
-
const shape =
|
|
146
|
+
const shape = result.unwrap(faceFns.cast(result$1));
|
|
147
147
|
if (!faceFns.isShape3D(shape)) {
|
|
148
|
-
return
|
|
148
|
+
return result.err(result.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
|
|
149
149
|
}
|
|
150
|
-
return
|
|
150
|
+
return result.ok(shape);
|
|
151
151
|
}
|
|
152
152
|
function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
|
|
153
153
|
var _stack = [];
|
|
@@ -157,10 +157,10 @@ function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
|
|
|
157
157
|
const normalVec = types.toVec3(normal);
|
|
158
158
|
const endVec = vecOps.vecAdd(centerVec, normalVec);
|
|
159
159
|
const mainSpineEdge = scope.register(surfaceBuilders.makeLine(centerVec, endVec));
|
|
160
|
-
const spine = scope.register(
|
|
161
|
-
const law = profileShape ? scope.register(
|
|
162
|
-
const result = shellMode ? genericSweep(wire, spine, { law }, shellMode) : genericSweep(wire, spine, { law });
|
|
163
|
-
return result;
|
|
160
|
+
const spine = scope.register(result.unwrap(surfaceBuilders.assembleWire([mainSpineEdge])));
|
|
161
|
+
const law = profileShape ? scope.register(result.unwrap(buildLawFromProfile(vecOps.vecLength(normalVec), profileShape))) : null;
|
|
162
|
+
const result$1 = shellMode ? genericSweep(wire, spine, { law }, shellMode) : genericSweep(wire, spine, { law });
|
|
163
|
+
return result$1;
|
|
164
164
|
} catch (_) {
|
|
165
165
|
var _error = _, _hasError = true;
|
|
166
166
|
} finally {
|
|
@@ -175,16 +175,16 @@ function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMod
|
|
|
175
175
|
const normalVec = types.toVec3(normal);
|
|
176
176
|
const endVec = vecOps.vecAdd(centerVec, normalVec);
|
|
177
177
|
const mainSpineEdge = scope.register(surfaceBuilders.makeLine(centerVec, endVec));
|
|
178
|
-
const spine = scope.register(
|
|
178
|
+
const spine = scope.register(result.unwrap(surfaceBuilders.assembleWire([mainSpineEdge])));
|
|
179
179
|
const extrusionLength = vecOps.vecLength(normalVec);
|
|
180
180
|
const pitch = 360 / angleDegrees * extrusionLength;
|
|
181
181
|
const radius = 1;
|
|
182
182
|
const auxiliarySpine = scope.register(
|
|
183
183
|
surfaceBuilders.makeHelix(pitch, extrusionLength, radius, centerVec, normalVec)
|
|
184
184
|
);
|
|
185
|
-
const law = profileShape ? scope.register(
|
|
186
|
-
const result = shellMode ? genericSweep(wire, spine, { auxiliarySpine, law }, shellMode) : genericSweep(wire, spine, { auxiliarySpine, law });
|
|
187
|
-
return result;
|
|
185
|
+
const law = profileShape ? scope.register(result.unwrap(buildLawFromProfile(extrusionLength, profileShape))) : null;
|
|
186
|
+
const result$1 = shellMode ? genericSweep(wire, spine, { auxiliarySpine, law }, shellMode) : genericSweep(wire, spine, { auxiliarySpine, law });
|
|
187
|
+
return result$1;
|
|
188
188
|
} catch (_) {
|
|
189
189
|
var _error = _, _hasError = true;
|
|
190
190
|
} finally {
|
|
@@ -193,7 +193,7 @@ function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMod
|
|
|
193
193
|
}
|
|
194
194
|
const loft = (wires, { ruled = true, startPoint, endPoint } = {}, returnShell = false) => {
|
|
195
195
|
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
196
|
-
return
|
|
196
|
+
return result.err(result.validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
197
197
|
}
|
|
198
198
|
const kernel = shapeTypes.getKernel();
|
|
199
199
|
const startVertex = startPoint ? solidBuilders.makeVertex(types.toVec3(startPoint)).wrapped : void 0;
|
|
@@ -208,14 +208,14 @@ const loft = (wires, { ruled = true, startPoint, endPoint } = {}, returnShell =
|
|
|
208
208
|
...endVertex ? { endVertex } : {}
|
|
209
209
|
}
|
|
210
210
|
);
|
|
211
|
-
const result =
|
|
211
|
+
const result$1 = result.andThen(faceFns.cast(shape), (s) => {
|
|
212
212
|
if (!faceFns.isShape3D(s))
|
|
213
|
-
return
|
|
214
|
-
return
|
|
213
|
+
return result.err(result.typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
214
|
+
return result.ok(s);
|
|
215
215
|
});
|
|
216
|
-
return result;
|
|
216
|
+
return result$1;
|
|
217
217
|
} catch {
|
|
218
|
-
return
|
|
218
|
+
return result.err(result.kernelError("LOFT_FAILED", "Loft operation failed"));
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
221
|
exports.basicFaceExtrusion = basicFaceExtrusion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
|
|
3
|
-
const faceFns = require("./faceFns-
|
|
3
|
+
const faceFns = require("./faceFns-DB1Fc5gy.cjs");
|
|
4
4
|
let cache = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function getCachedMeasurement(shape, key) {
|
|
6
6
|
return cache.get(shape)?.get(key);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B as getKernel } from "./shapeTypes-CpSaBLDv.js";
|
|
2
|
-
import { u as uvBounds } from "./faceFns-
|
|
2
|
+
import { u as uvBounds } from "./faceFns-B8GnxjdY.js";
|
|
3
3
|
let cache = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
function getCachedMeasurement(shape, key) {
|
|
5
5
|
return cache.get(shape)?.get(key);
|
package/dist/measurement.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const measurement = require("./measurement-
|
|
3
|
+
const measurement = require("./measurement-BoNTUBAp.cjs");
|
|
4
4
|
exports.createDistanceQuery = measurement.createDistanceQuery;
|
|
5
5
|
exports.measureArea = measurement.measureArea;
|
|
6
6
|
exports.measureDistance = measurement.measureDistance;
|
package/dist/measurement.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
|
|
3
|
-
const
|
|
4
|
-
const shapeFns = require("./shapeFns-
|
|
3
|
+
const result = require("./result-fAX0OZzI.cjs");
|
|
4
|
+
const shapeFns = require("./shapeFns-C2SnNvdH.cjs");
|
|
5
5
|
function buildMeshCacheKey(tolerance, angularTolerance, skipNormals, includeUVs = false) {
|
|
6
6
|
return `${tolerance}:${angularTolerance}:${skipNormals}:${includeUVs}`;
|
|
7
7
|
}
|
|
@@ -86,7 +86,7 @@ function mesh(shape, {
|
|
|
86
86
|
const cached = getMeshForShape(shape.wrapped, cacheKey);
|
|
87
87
|
if (cached) return cached;
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const result2 = shapeTypes.getKernel().mesh(shape.wrapped, {
|
|
90
90
|
tolerance,
|
|
91
91
|
angularTolerance,
|
|
92
92
|
skipNormals,
|
|
@@ -95,11 +95,11 @@ function mesh(shape, {
|
|
|
95
95
|
});
|
|
96
96
|
const origins = shapeFns.getFaceOrigins(shape);
|
|
97
97
|
const mesh2 = {
|
|
98
|
-
vertices:
|
|
99
|
-
normals:
|
|
100
|
-
triangles:
|
|
101
|
-
uvs:
|
|
102
|
-
faceGroups:
|
|
98
|
+
vertices: result2.vertices,
|
|
99
|
+
normals: result2.normals,
|
|
100
|
+
triangles: result2.triangles,
|
|
101
|
+
uvs: result2.uvs,
|
|
102
|
+
faceGroups: result2.faceGroups.map((g) => ({
|
|
103
103
|
start: g.start,
|
|
104
104
|
count: g.count,
|
|
105
105
|
faceId: g.faceHash,
|
|
@@ -118,7 +118,7 @@ function meshEdges(shape, { tolerance = 1e-3, angularTolerance = 0.1, cache = tr
|
|
|
118
118
|
if (cached) return cached;
|
|
119
119
|
}
|
|
120
120
|
const kernelResult = shapeTypes.getKernel().meshEdges(shape.wrapped, tolerance, angularTolerance);
|
|
121
|
-
const
|
|
121
|
+
const result2 = {
|
|
122
122
|
lines: kernelResult.lines,
|
|
123
123
|
edgeGroups: kernelResult.edgeGroups.map((g) => ({
|
|
124
124
|
start: g.start,
|
|
@@ -127,19 +127,19 @@ function meshEdges(shape, { tolerance = 1e-3, angularTolerance = 0.1, cache = tr
|
|
|
127
127
|
}))
|
|
128
128
|
};
|
|
129
129
|
if (cache) {
|
|
130
|
-
setEdgeMeshForShape(shape.wrapped, cacheKey,
|
|
130
|
+
setEdgeMeshForShape(shape.wrapped, cacheKey, result2);
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return result2;
|
|
133
133
|
}
|
|
134
134
|
function exportSTEP(shape) {
|
|
135
135
|
try {
|
|
136
136
|
const stepString = shapeTypes.getKernel().exportSTEP([shape.wrapped]);
|
|
137
|
-
return
|
|
137
|
+
return result.ok(new Blob([stepString], { type: "application/STEP" }));
|
|
138
138
|
} catch (e) {
|
|
139
139
|
const isWriteFailure = e instanceof Error && e.message.startsWith("STEP export failed");
|
|
140
140
|
const code = isWriteFailure ? "STEP_EXPORT_FAILED" : "STEP_FILE_READ_ERROR";
|
|
141
141
|
const msg = isWriteFailure ? "Failed to write STEP file" : "Failed to read exported STEP file";
|
|
142
|
-
return
|
|
142
|
+
return result.err(result.ioError(code, msg, e));
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
function exportSTL(shape, {
|
|
@@ -152,20 +152,20 @@ function exportSTL(shape, {
|
|
|
152
152
|
shapeTypes.getKernel().meshShape(shape.wrapped, tolerance, angularTolerance);
|
|
153
153
|
}
|
|
154
154
|
const stlData = shapeTypes.getKernel().exportSTL(shape.wrapped, binary);
|
|
155
|
-
return
|
|
155
|
+
return result.ok(new Blob([stlData], { type: "application/sla" }));
|
|
156
156
|
} catch (e) {
|
|
157
157
|
const isWriteFailure = e instanceof Error && e.message.startsWith("STL export failed");
|
|
158
158
|
const code = isWriteFailure ? "STL_EXPORT_FAILED" : "STL_FILE_READ_ERROR";
|
|
159
159
|
const msg = isWriteFailure ? "Failed to write STL file" : "Failed to read exported STL file";
|
|
160
|
-
return
|
|
160
|
+
return result.err(result.ioError(code, msg, e));
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
function exportIGES(shape) {
|
|
164
164
|
try {
|
|
165
165
|
const igesString = shapeTypes.getKernel().exportIGES([shape.wrapped]);
|
|
166
|
-
return
|
|
166
|
+
return result.ok(new Blob([igesString], { type: "application/iges" }));
|
|
167
167
|
} catch (e) {
|
|
168
|
-
return
|
|
168
|
+
return result.err(result.ioError("IGES_EXPORT_FAILED", "Failed to write IGES file", e));
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
exports.clearMeshCache = clearMeshCache;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as getKernel } from "./shapeTypes-CpSaBLDv.js";
|
|
2
|
-
import { o as ok, e as err, i as ioError } from "./
|
|
3
|
-
import { g as getFaceOrigins } from "./shapeFns-
|
|
2
|
+
import { o as ok, e as err, i as ioError } from "./result-BaSD1fqR.js";
|
|
3
|
+
import { g as getFaceOrigins } from "./shapeFns-FDuKkrDR.js";
|
|
4
4
|
function buildMeshCacheKey(tolerance, angularTolerance, skipNormals, includeUVs = false) {
|
|
5
5
|
return `${tolerance}:${angularTolerance}:${skipNormals}:${includeUVs}`;
|
|
6
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { B as getKernel, d as createKernelHandle, c as castShape, p as isShape3D, u as isWire, F as createSolid } from "./shapeTypes-CpSaBLDv.js";
|
|
2
2
|
import { g as vecLength, v as vecAdd, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
|
|
3
|
-
import { e as err,
|
|
4
|
-
import { a as buildLawFromProfile } from "./loft-
|
|
5
|
-
import { j as fuseAll } from "./booleanFns-
|
|
6
|
-
import { t as toBREP } from "./shapeFns-
|
|
7
|
-
import { j as fromBREP } from "./faceFns-
|
|
3
|
+
import { e as err, z as validationError, v as unwrap, r as typeCastError, o as ok, A as BrepErrorCode, k as kernelError, i as ioError, d as computationError } from "./result-BaSD1fqR.js";
|
|
4
|
+
import { a as buildLawFromProfile } from "./loft-Bhw-FMoL.js";
|
|
5
|
+
import { j as fuseAll } from "./booleanFns-BCTjYZAg.js";
|
|
6
|
+
import { t as toBREP } from "./shapeFns-FDuKkrDR.js";
|
|
7
|
+
import { j as fromBREP } from "./faceFns-B8GnxjdY.js";
|
|
8
8
|
function uuidv() {
|
|
9
9
|
return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
|
|
10
10
|
/[018]/g,
|