brepjs 8.8.5 → 8.8.7
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.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-D4u0ExpA.js → Blueprint-BWLPU0ZC.js} +3 -3
- package/dist/{Blueprint-Bt7uPY1T.cjs → Blueprint-CIfiTx-y.cjs} +3 -3
- package/dist/{boolean2D-CsTlgpyo.js → boolean2D-BG9wtSKz.js} +5 -5
- package/dist/{boolean2D-q-P4AZ6C.cjs → boolean2D-Bs_OdV2_.cjs} +5 -5
- package/dist/{booleanFns-D7lUezkK.cjs → booleanFns-CUxOBNlC.cjs} +45 -40
- package/dist/{booleanFns-CeFzJzBI.js → booleanFns-DHEaBJwW.js} +45 -40
- package/dist/brepjs.cjs +15 -16
- package/dist/brepjs.js +210 -211
- package/dist/{cornerFinder-B-vtKJXo.cjs → cornerFinder-BijsFhpz.cjs} +1 -1
- package/dist/{cornerFinder-DPlORCdO.js → cornerFinder-DfSdXbxK.js} +1 -1
- package/dist/{curveFns-KDpL9iyo.cjs → curveFns-D0L3YcH-.cjs} +10 -4
- package/dist/{curveFns-VDZEhY97.js → curveFns-VRW_cski.js} +10 -4
- package/dist/{drawFns-dBbaIuS9.cjs → drawFns-BGGYhul8.cjs} +8 -8
- package/dist/{drawFns-D3XEel9W.js → drawFns-Df_AbW16.js} +8 -8
- package/dist/{helpers-DlHonwIc.cjs → helpers-Ces6b2wm.cjs} +1 -1
- package/dist/{helpers-Bgd8Mywb.js → helpers-D7hTCTJm.js} +1 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/{loft-B17gpWGq.js → loft-BpfrTPIR.js} +1 -1
- package/dist/{loft-DyKWV7UL.cjs → loft-GLxTzuXU.cjs} +1 -1
- package/dist/{meshFns-COlS3fd9.cjs → meshFns-BTb2esZJ.cjs} +1 -1
- package/dist/{meshFns-Cn5aF4ZG.js → meshFns-DJx5Yqiy.js} +1 -1
- package/dist/{operations-Dbq99V2Z.js → operations-CHIU-aGI.js} +2 -2
- package/dist/{operations-DmjlQKdz.cjs → operations-T5f-v2rF.cjs} +2 -2
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query/finderFns.d.ts.map +1 -1
- package/dist/query.cjs +3 -3
- package/dist/query.js +4 -4
- package/dist/{shapeFns-C0otoBvv.js → shapeFns-5HlS8wvc.js} +26 -21
- package/dist/{shapeFns-Dfix5LE1.cjs → shapeFns-CbZMmuQA.cjs} +6 -1
- package/dist/sketching/sketchLib.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{surfaceBuilders-BdGROM9K.cjs → surfaceBuilders-zWnw2I0j.cjs} +1 -1
- package/dist/{surfaceBuilders-B737jXGa.js → surfaceBuilders-zlVu1d-b.js} +1 -1
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/colorFns.d.ts.map +1 -1
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/faceTagFns.d.ts.map +1 -1
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts +13 -1
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeHelpers.d.ts.map +1 -1
- package/dist/topology/surfaceFns.d.ts.map +1 -1
- package/dist/{topology-BhzqCA8c.js → topology-CMS8QyJa.js} +4 -4
- package/dist/{topology-B8jZHHZj.cjs → topology-ZRFxrEEW.cjs} +4 -4
- package/dist/topology.cjs +5 -5
- package/dist/topology.js +22 -22
- package/package.json +1 -1
package/dist/brepjs.js
CHANGED
|
@@ -15,8 +15,8 @@ var __using = (stack, value, async) => {
|
|
|
15
15
|
if (inner) dispose = function() {
|
|
16
16
|
try {
|
|
17
17
|
inner.call(this);
|
|
18
|
-
} catch (
|
|
19
|
-
return Promise.reject(
|
|
18
|
+
} catch (e7) {
|
|
19
|
+
return Promise.reject(e7);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
stack.push([async, dispose, value]);
|
|
@@ -26,17 +26,17 @@ var __using = (stack, value, async) => {
|
|
|
26
26
|
return value;
|
|
27
27
|
};
|
|
28
28
|
var __callDispose = (stack, error, hasError) => {
|
|
29
|
-
var
|
|
30
|
-
return _2 = Error(m9), _2.name = "SuppressedError", _2.error =
|
|
29
|
+
var E4 = typeof SuppressedError === "function" ? SuppressedError : function(e7, s6, m9, _2) {
|
|
30
|
+
return _2 = Error(m9), _2.name = "SuppressedError", _2.error = e7, _2.suppressed = s6, _2;
|
|
31
31
|
};
|
|
32
|
-
var fail = (
|
|
32
|
+
var fail = (e7) => error = hasError ? new E4(e7, error, "An error was suppressed during disposal") : (hasError = true, e7);
|
|
33
33
|
var next = (it) => {
|
|
34
34
|
while (it = stack.pop()) {
|
|
35
35
|
try {
|
|
36
36
|
var result = it[1] && it[1].call(it[2]);
|
|
37
|
-
if (it[0]) return Promise.resolve(result).then(next, (
|
|
38
|
-
} catch (
|
|
39
|
-
fail(
|
|
37
|
+
if (it[0]) return Promise.resolve(result).then(next, (e7) => (fail(e7), next()));
|
|
38
|
+
} catch (e7) {
|
|
39
|
+
fail(e7);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
if (hasError) throw error;
|
|
@@ -49,39 +49,39 @@ import { l as ok, y as translateOcctError, e as err, q as queryError, x as valid
|
|
|
49
49
|
import { O, a, c, b as b2, f, g, m, h as h2, j as j2, k as k2, z, s, t as t2, n as n2, r as r2, v, w as w2 } from "./errors-CHfaHQSt.js";
|
|
50
50
|
import { c as castShape, D as DisposalScope, e as isFace, k as isShell, l as isSolid, j as isShape3D, v as createSolid, q as createWire, d as isEdge, n as isWire } from "./shapeTypes-D34s68Xi.js";
|
|
51
51
|
import { t as t3, r as r3, s as s2, a as a2, b as b3, z as z2, u, A, B, g as g2, i as i2, f as f2, h as h3, m as m2, C, w as w3, o, p } from "./shapeTypes-D34s68Xi.js";
|
|
52
|
-
import { c as vecDistance, D as DEG2RAD, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
|
|
53
|
-
import {
|
|
54
|
-
import { B as B2, d as d2, C as C2, r as r4, t as t4 } from "./Blueprint-
|
|
55
|
-
import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-
|
|
56
|
-
import { j as j3, k as k4, l as l3, f as f3, m as m4, b as b5, g as g4, n as n3, o as o3 } from "./curveFns-
|
|
57
|
-
import { m as makeCompound, d as makeCone, e as makeCylinder, f as makeEllipsoid, h as makeOffset, w as weldShellsAndFaces, a as makeSolid, i as makeSphere, j as makeTorus, k as makeVertex } from "./loft-
|
|
58
|
-
import { b as b6, g as g5, r as r5 } from "./loft-
|
|
59
|
-
import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-
|
|
60
|
-
import { a as a4, b as b7, d as d3, f as f4, g as g6, h as h5, i as i4, j as j4, k as k5, m as m5, n as n4, o as o4, p as p2, q, t as t5, u as u2, v as v3, x, y, z as z3, A as A2, B as B3, C as C3, D, E } from "./operations-
|
|
61
|
-
import { B as B4, a as a5, e as e2, C as C4, F, S, f as f5, l as l4, g as g7, n as n5, k as k6, q as q2, o as o5, p as p3, r as r6 } from "./boolean2D-
|
|
52
|
+
import { c as vecDistance, D as DEG2RAD, H as HASH_CODE_MAX, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
|
|
53
|
+
import { R, v as v2, a as a3, b as b4, d, e, g as g3, h as h4, i as i3, k as k3, l as l2, m as m3, o as o2 } from "./vecOps-ZDdZWbwT.js";
|
|
54
|
+
import { B as B2, d as d2, C as C2, r as r4, t as t4 } from "./Blueprint-BWLPU0ZC.js";
|
|
55
|
+
import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-VRW_cski.js";
|
|
56
|
+
import { j as j3, k as k4, l as l3, f as f3, m as m4, b as b5, g as g4, n as n3, o as o3 } from "./curveFns-VRW_cski.js";
|
|
57
|
+
import { m as makeCompound, d as makeCone, e as makeCylinder, f as makeEllipsoid, h as makeOffset, w as weldShellsAndFaces, a as makeSolid, i as makeSphere, j as makeTorus, k as makeVertex } from "./loft-BpfrTPIR.js";
|
|
58
|
+
import { b as b6, g as g5, r as r5 } from "./loft-BpfrTPIR.js";
|
|
59
|
+
import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-CHIU-aGI.js";
|
|
60
|
+
import { a as a4, b as b7, d as d3, f as f4, g as g6, h as h5, i as i4, j as j4, k as k5, m as m5, n as n4, o as o4, p as p2, q, t as t5, u as u2, v as v3, x, y, z as z3, A as A2, B as B3, C as C3, D, E } from "./operations-CHIU-aGI.js";
|
|
61
|
+
import { B as B4, a as a5, e as e2, C as C4, F, S, f as f5, l as l4, g as g7, n as n5, k as k6, q as q2, o as o5, p as p3, r as r6 } from "./boolean2D-BG9wtSKz.js";
|
|
62
62
|
import { createBlueprint, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, getBounds2D, getOrientation2D, isInside2D, mirror2D, reverseCurve, rotate2D, scale2D, sketch2DOnFace, sketch2DOnPlane, stretch2D, toSVGPathD, translate2D } from "./2d.js";
|
|
63
|
-
import { l as createTypedFinder, m as faceFinder } from "./helpers-
|
|
64
|
-
import { g as g8 } from "./helpers-
|
|
63
|
+
import { l as createTypedFinder, m as faceFinder } from "./helpers-D7hTCTJm.js";
|
|
64
|
+
import { g as g8 } from "./helpers-D7hTCTJm.js";
|
|
65
65
|
import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
|
|
66
|
-
import { C as C5, D as D2, a as a6, S as S2, b as b8, X, Y, c as c2, d as d4, e as e3, f as f6, Z, g as g9, h as h6, i as i5, j as j5, k as k7, l as l5, m as m6, n as n6, o as o6, p as p4, q as q3, r as r7, s as s3, t as t6, u as u3, v as v4, w as w4, x as x2, y as y2, z as z4, _, $, a0, a1, A as A3, a2 as a22, B as B5, E as E2, a3 as a32, F as F2, G, H
|
|
66
|
+
import { C as C5, D as D2, a as a6, S as S2, b as b8, X, Y, c as c2, d as d4, e as e3, f as f6, Z, g as g9, h as h6, i as i5, j as j5, k as k7, l as l5, m as m6, n as n6, o as o6, p as p4, q as q3, r as r7, s as s3, t as t6, u as u3, v as v4, w as w4, x as x2, y as y2, z as z4, _, $, a0, a1, A as A3, a2 as a22, B as B5, E as E2, a3 as a32, F as F2, G, H, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-Df_AbW16.js";
|
|
67
67
|
import { c as c3, a as a7, p as p5, r as r8, t as t7 } from "./vectors-Dp5Iu1KH.js";
|
|
68
|
-
import { v as vertexPosition, a as getFaces,
|
|
69
|
-
import {
|
|
70
|
-
import { p as propagateFaceTags, a as propagateColors, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, b as sectionToFace$1, d as slice$1, e as split$1, g as fuseAll, h as cutAll } from "./booleanFns-
|
|
71
|
-
import { j as j6, k as k8, l as l6, m as m7, n as n7, o as o7, q as q4, r as r9, t as t8, u as u4 } from "./booleanFns-
|
|
72
|
-
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-
|
|
73
|
-
import { a as a8, b as b9, e as
|
|
68
|
+
import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, t as translate$1, p as propagateOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, q as toBREP$1, u as transformCopy$1, w as getBounds, c as getWires } from "./shapeFns-5HlS8wvc.js";
|
|
69
|
+
import { x as x3, g as g10, f as f7, y as y3, h as h7, z as z5, A as A4, B as B6, C as C6, D as D3, E as E3 } from "./shapeFns-5HlS8wvc.js";
|
|
70
|
+
import { p as propagateFaceTags, a as propagateColors, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, b as sectionToFace$1, d as slice$1, e as split$1, g as fuseAll, h as cutAll } from "./booleanFns-DHEaBJwW.js";
|
|
71
|
+
import { j as j6, k as k8, l as l6, m as m7, n as n7, o as o7, q as q4, r as r9, t as t8, u as u4 } from "./booleanFns-DHEaBJwW.js";
|
|
72
|
+
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-CMS8QyJa.js";
|
|
73
|
+
import { a as a8, b as b9, e as e4, f as f8, d as d5, g as g11, j as j7, s as s4, t as t9, k as k9, l as l7, v as v5, w as w5 } from "./topology-CMS8QyJa.js";
|
|
74
74
|
import { i as iterTopo, e as faceCenter, n as normalAt, j as fromBREP$1, k as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-DG4bu-QB.js";
|
|
75
|
-
import { l as l8, c as c4, m as m8, d as d6, f as
|
|
76
|
-
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-
|
|
77
|
-
import { c as c5, b as b10, e as
|
|
75
|
+
import { l as l8, c as c4, m as m8, d as d6, f as f9, q as q5, r as r10, s as s5, p as p6, t as t10, v as v6, u as u5, h as h8 } from "./faceFns-DG4bu-QB.js";
|
|
76
|
+
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-DJx5Yqiy.js";
|
|
77
|
+
import { c as c5, b as b10, e as e5, d as d7, f as f10 } from "./meshFns-DJx5Yqiy.js";
|
|
78
78
|
import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-DzRb6oYN.js";
|
|
79
|
-
import { d as d8, e as
|
|
80
|
-
import { h as addHolesInFace, g as makeBezierCurve, k as makeBSplineApproximation, i as makeCircle, j as makeEllipse, f as makeEllipseArc, m as makeFace, n as makeNonPlanarFace, c as makeHelix, a as makeLine, o as makePolygon, l as makeNewFaceWithinFace, e as makeTangentArc, d as makeThreePointArc, b as assembleWire } from "./surfaceBuilders-
|
|
81
|
-
import { p as p7 } from "./surfaceBuilders-
|
|
79
|
+
import { d as d8, e as e6, f as f11, g as g12, h as h9, i as i6 } from "./measurement-DzRb6oYN.js";
|
|
80
|
+
import { h as addHolesInFace, g as makeBezierCurve, k as makeBSplineApproximation, i as makeCircle, j as makeEllipse, f as makeEllipseArc, m as makeFace, n as makeNonPlanarFace, c as makeHelix, a as makeLine, o as makePolygon, l as makeNewFaceWithinFace, e as makeTangentArc, d as makeThreePointArc, b as assembleWire } from "./surfaceBuilders-zlVu1d-b.js";
|
|
81
|
+
import { p as p7 } from "./surfaceBuilders-zlVu1d-b.js";
|
|
82
82
|
import { edgeFinder } from "./query.js";
|
|
83
83
|
import { BrepBugError, bug } from "./result.js";
|
|
84
|
-
import { c as c6 } from "./cornerFinder-
|
|
84
|
+
import { c as c6 } from "./cornerFinder-DfSdXbxK.js";
|
|
85
85
|
import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
|
|
86
86
|
const errorFactories = {
|
|
87
87
|
OCCT_OPERATION: (code, message, cause) => ({ kind: "OCCT_OPERATION", code, message, cause }),
|
|
@@ -96,19 +96,19 @@ const errorFactories = {
|
|
|
96
96
|
function kernelCall(fn, code, message, kind = "OCCT_OPERATION") {
|
|
97
97
|
try {
|
|
98
98
|
return ok(castShape(fn()));
|
|
99
|
-
} catch (
|
|
100
|
-
const rawMessage =
|
|
99
|
+
} catch (e7) {
|
|
100
|
+
const rawMessage = e7 instanceof Error ? e7.message : String(e7);
|
|
101
101
|
const translatedMessage = kind === "OCCT_OPERATION" ? translateOcctError(rawMessage) : rawMessage;
|
|
102
|
-
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`,
|
|
102
|
+
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e7));
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
function kernelCallRaw(fn, code, message, kind = "OCCT_OPERATION") {
|
|
106
106
|
try {
|
|
107
107
|
return ok(fn());
|
|
108
|
-
} catch (
|
|
109
|
-
const rawMessage =
|
|
108
|
+
} catch (e7) {
|
|
109
|
+
const rawMessage = e7 instanceof Error ? e7.message : String(e7);
|
|
110
110
|
const translatedMessage = kind === "OCCT_OPERATION" ? translateOcctError(rawMessage) : rawMessage;
|
|
111
|
-
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`,
|
|
111
|
+
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e7));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
function kernelCallScoped(fn, code, message, kind = "OCCT_OPERATION") {
|
|
@@ -167,11 +167,11 @@ function withNearestPostFilter(baseFinder, nearestPoint) {
|
|
|
167
167
|
if (candidates.length === 0) return [];
|
|
168
168
|
let bestIdx = 0;
|
|
169
169
|
let bestDist = vecDistance(vertexPosition(candidates[0]), nearestPoint);
|
|
170
|
-
for (let
|
|
171
|
-
const d9 = vecDistance(vertexPosition(candidates[
|
|
170
|
+
for (let i7 = 1; i7 < candidates.length; i7++) {
|
|
171
|
+
const d9 = vecDistance(vertexPosition(candidates[i7]), nearestPoint);
|
|
172
172
|
if (d9 < bestDist) {
|
|
173
173
|
bestDist = d9;
|
|
174
|
-
bestIdx =
|
|
174
|
+
bestIdx = i7;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
return [candidates[bestIdx]];
|
|
@@ -252,9 +252,9 @@ function surfaceFromGrid(heights, options = {}) {
|
|
|
252
252
|
}
|
|
253
253
|
try {
|
|
254
254
|
return buildTriangulatedSurface(heights, rows, cols, dx, dy, scaleZ);
|
|
255
|
-
} catch (
|
|
256
|
-
const raw =
|
|
257
|
-
return err(occtError(BrepErrorCode.SURFACE_FAILED, `surfaceFromGrid failed: ${raw}`,
|
|
255
|
+
} catch (e7) {
|
|
256
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
257
|
+
return err(occtError(BrepErrorCode.SURFACE_FAILED, `surfaceFromGrid failed: ${raw}`, e7));
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
@@ -329,7 +329,6 @@ function buildTriangulatedSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
if (faceCount === 0) {
|
|
332
|
-
sewing.delete();
|
|
333
332
|
return err(
|
|
334
333
|
occtError(BrepErrorCode.SURFACE_FAILED, "surfaceFromGrid: no valid triangular faces built")
|
|
335
334
|
);
|
|
@@ -367,22 +366,22 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
367
366
|
let bitmap;
|
|
368
367
|
try {
|
|
369
368
|
bitmap = await createImageBitmap(blob);
|
|
370
|
-
} catch (
|
|
369
|
+
} catch (e7) {
|
|
371
370
|
return err(
|
|
372
371
|
ioError(
|
|
373
372
|
BrepErrorCode.SURFACE_FAILED,
|
|
374
|
-
`surfaceFromImage: failed to decode image — ${
|
|
373
|
+
`surfaceFromImage: failed to decode image — ${e7 instanceof Error ? e7.message : String(e7)}`
|
|
375
374
|
)
|
|
376
375
|
);
|
|
377
376
|
}
|
|
378
|
-
const
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
377
|
+
const w6 = bitmap.width;
|
|
378
|
+
const h10 = bitmap.height;
|
|
379
|
+
if (w6 < 2 || h10 < 2) {
|
|
381
380
|
bitmap.close();
|
|
382
381
|
return err(
|
|
383
382
|
validationError(
|
|
384
383
|
BrepErrorCode.SURFACE_GRID_TOO_SMALL,
|
|
385
|
-
`surfaceFromImage: image too small (${
|
|
384
|
+
`surfaceFromImage: image too small (${w6}x${h10}), need at least 2x2`
|
|
386
385
|
)
|
|
387
386
|
);
|
|
388
387
|
}
|
|
@@ -395,7 +394,7 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
395
394
|
)
|
|
396
395
|
);
|
|
397
396
|
}
|
|
398
|
-
const canvas = new OffscreenCanvas(
|
|
397
|
+
const canvas = new OffscreenCanvas(w6, h10);
|
|
399
398
|
const ctx = canvas.getContext("2d");
|
|
400
399
|
if (!ctx) {
|
|
401
400
|
bitmap.close();
|
|
@@ -405,13 +404,13 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
405
404
|
}
|
|
406
405
|
ctx.drawImage(bitmap, 0, 0);
|
|
407
406
|
bitmap.close();
|
|
408
|
-
const imageData = ctx.getImageData(0, 0,
|
|
407
|
+
const imageData = ctx.getImageData(0, 0, w6, h10);
|
|
409
408
|
const data = imageData.data;
|
|
410
409
|
const rows = [];
|
|
411
|
-
for (let y4 = 0; y4 <
|
|
410
|
+
for (let y4 = 0; y4 < h10; y4 += downsample) {
|
|
412
411
|
const row = [];
|
|
413
|
-
for (let x4 = 0; x4 <
|
|
414
|
-
const idx = (y4 *
|
|
412
|
+
for (let x4 = 0; x4 < w6; x4 += downsample) {
|
|
413
|
+
const idx = (y4 * w6 + x4) * 4;
|
|
415
414
|
const r11 = data[idx] ?? 0;
|
|
416
415
|
const g13 = data[idx + 1] ?? 0;
|
|
417
416
|
const b11 = data[idx + 2] ?? 0;
|
|
@@ -458,8 +457,8 @@ function hull(shapes, options = {}) {
|
|
|
458
457
|
)
|
|
459
458
|
);
|
|
460
459
|
}
|
|
461
|
-
for (const [
|
|
462
|
-
const check = validateNotNull$1(shape2, `hull: shapes[${
|
|
460
|
+
for (const [i7, shape2] of shapes.entries()) {
|
|
461
|
+
const check = validateNotNull$1(shape2, `hull: shapes[${i7}]`);
|
|
463
462
|
if (isErr(check)) return check;
|
|
464
463
|
}
|
|
465
464
|
const tolerance = options.tolerance ?? 0.1;
|
|
@@ -474,12 +473,12 @@ function hull(shapes, options = {}) {
|
|
|
474
473
|
);
|
|
475
474
|
}
|
|
476
475
|
return ok(cast);
|
|
477
|
-
} catch (
|
|
478
|
-
const raw =
|
|
476
|
+
} catch (e7) {
|
|
477
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
479
478
|
if (raw.includes("coplanar") || raw.includes("fewer than") || raw.includes("degenerate")) {
|
|
480
|
-
return err(occtError(BrepErrorCode.HULL_DEGENERATE, `Hull degenerate: ${raw}`,
|
|
479
|
+
return err(occtError(BrepErrorCode.HULL_DEGENERATE, `Hull degenerate: ${raw}`, e7));
|
|
481
480
|
}
|
|
482
|
-
return err(occtError(BrepErrorCode.HULL_FAILED, `Hull operation failed: ${raw}`,
|
|
481
|
+
return err(occtError(BrepErrorCode.HULL_FAILED, `Hull operation failed: ${raw}`, e7));
|
|
483
482
|
}
|
|
484
483
|
}
|
|
485
484
|
function detectSphere(shape2) {
|
|
@@ -534,10 +533,10 @@ function minkowskiSphere(shape2, radius, tolerance) {
|
|
|
534
533
|
);
|
|
535
534
|
}
|
|
536
535
|
return ok(wrapped);
|
|
537
|
-
} catch (
|
|
538
|
-
const raw =
|
|
536
|
+
} catch (e7) {
|
|
537
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
539
538
|
return err(
|
|
540
|
-
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski sphere offset failed: ${raw}`,
|
|
539
|
+
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski sphere offset failed: ${raw}`, e7, {
|
|
541
540
|
operation: "minkowski",
|
|
542
541
|
fastPath: "sphere"
|
|
543
542
|
})
|
|
@@ -602,10 +601,10 @@ function minkowskiGeneral(shape2, tool, tolerance) {
|
|
|
602
601
|
);
|
|
603
602
|
}
|
|
604
603
|
return ok(wrapped);
|
|
605
|
-
} catch (
|
|
606
|
-
const raw =
|
|
604
|
+
} catch (e7) {
|
|
605
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
607
606
|
return err(
|
|
608
|
-
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski general path failed: ${raw}`,
|
|
607
|
+
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski general path failed: ${raw}`, e7, {
|
|
609
608
|
operation: "minkowski"
|
|
610
609
|
})
|
|
611
610
|
);
|
|
@@ -664,8 +663,8 @@ function polyhedron(points, faces, options = {}) {
|
|
|
664
663
|
}
|
|
665
664
|
if (face2.length < 3) continue;
|
|
666
665
|
const v0 = face2[0];
|
|
667
|
-
for (let
|
|
668
|
-
triangles.push([v0, face2[
|
|
666
|
+
for (let i7 = 1; i7 < face2.length - 1; i7++) {
|
|
667
|
+
triangles.push([v0, face2[i7], face2[i7 + 1]]);
|
|
669
668
|
}
|
|
670
669
|
}
|
|
671
670
|
try {
|
|
@@ -678,9 +677,9 @@ function polyhedron(points, faces, options = {}) {
|
|
|
678
677
|
return err(occtError(BrepErrorCode.POLYHEDRON_FAILED, "Polyhedron did not produce a solid"));
|
|
679
678
|
}
|
|
680
679
|
return ok(cast);
|
|
681
|
-
} catch (
|
|
682
|
-
const raw =
|
|
683
|
-
return err(occtError(BrepErrorCode.POLYHEDRON_FAILED, `Polyhedron failed: ${raw}`,
|
|
680
|
+
} catch (e7) {
|
|
681
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
682
|
+
return err(occtError(BrepErrorCode.POLYHEDRON_FAILED, `Polyhedron failed: ${raw}`, e7));
|
|
684
683
|
}
|
|
685
684
|
}
|
|
686
685
|
function multiSectionSweep(sections, spine, options) {
|
|
@@ -702,16 +701,16 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
702
701
|
const uFirst = Number(adaptor.FirstParameter());
|
|
703
702
|
const uLast = Number(adaptor.LastParameter());
|
|
704
703
|
const uRange = uLast - uFirst;
|
|
705
|
-
const params = sections.map((s6,
|
|
704
|
+
const params = sections.map((s6, i7) => {
|
|
706
705
|
if (s6.location !== void 0) {
|
|
707
706
|
return uFirst + s6.location * uRange;
|
|
708
707
|
}
|
|
709
|
-
return uFirst +
|
|
708
|
+
return uFirst + i7 / (sections.length - 1) * uRange;
|
|
710
709
|
});
|
|
711
710
|
const builder = scope.register(new oc.BRepOffsetAPI_ThruSections(solid2, ruled, tolerance));
|
|
712
|
-
for (let
|
|
713
|
-
const param = params[
|
|
714
|
-
const section2 = sections[
|
|
711
|
+
for (let i7 = 0; i7 < sections.length; i7++) {
|
|
712
|
+
const param = params[i7];
|
|
713
|
+
const section2 = sections[i7];
|
|
715
714
|
if (param === void 0 || section2 === void 0) continue;
|
|
716
715
|
const pnt = scope.register(new oc.gp_Pnt_1());
|
|
717
716
|
const tangent = scope.register(new oc.gp_Vec_1());
|
|
@@ -745,10 +744,10 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
745
744
|
} finally {
|
|
746
745
|
__callDispose(_stack, _error, _hasError);
|
|
747
746
|
}
|
|
748
|
-
} catch (
|
|
749
|
-
const raw =
|
|
747
|
+
} catch (e7) {
|
|
748
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
750
749
|
return err(
|
|
751
|
-
occtError(BrepErrorCode.MULTI_SWEEP_FAILED, `Multi-section sweep failed: ${raw}`,
|
|
750
|
+
occtError(BrepErrorCode.MULTI_SWEEP_FAILED, `Multi-section sweep failed: ${raw}`, e7)
|
|
752
751
|
);
|
|
753
752
|
}
|
|
754
753
|
}
|
|
@@ -792,9 +791,9 @@ function guidedSweep(profile, spine, guides, options = {}) {
|
|
|
792
791
|
} finally {
|
|
793
792
|
__callDispose(_stack, _error, _hasError);
|
|
794
793
|
}
|
|
795
|
-
} catch (
|
|
796
|
-
const raw =
|
|
797
|
-
return err(occtError(BrepErrorCode.GUIDED_SWEEP_FAILED, `Guided sweep failed: ${raw}`,
|
|
794
|
+
} catch (e7) {
|
|
795
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
796
|
+
return err(occtError(BrepErrorCode.GUIDED_SWEEP_FAILED, `Guided sweep failed: ${raw}`, e7));
|
|
798
797
|
}
|
|
799
798
|
}
|
|
800
799
|
const EPS = 1e-10;
|
|
@@ -807,25 +806,25 @@ function dot2(ax, ay, bx, by) {
|
|
|
807
806
|
function len2(x4, y4) {
|
|
808
807
|
return Math.sqrt(x4 * x4 + y4 * y4);
|
|
809
808
|
}
|
|
810
|
-
function polyAt(poly,
|
|
811
|
-
const p8 = poly[(
|
|
812
|
-
if (!p8) throw new Error(`Invalid polygon index ${
|
|
809
|
+
function polyAt(poly, i7) {
|
|
810
|
+
const p8 = poly[(i7 % poly.length + poly.length) % poly.length];
|
|
811
|
+
if (!p8) throw new Error(`Invalid polygon index ${i7} for length ${poly.length}`);
|
|
813
812
|
return p8;
|
|
814
813
|
}
|
|
815
814
|
function ensureCCW(poly) {
|
|
816
815
|
let area = 0;
|
|
817
|
-
for (let
|
|
818
|
-
const cur = polyAt(poly,
|
|
819
|
-
const nxt = polyAt(poly,
|
|
816
|
+
for (let i7 = 0; i7 < poly.length; i7++) {
|
|
817
|
+
const cur = polyAt(poly, i7);
|
|
818
|
+
const nxt = polyAt(poly, i7 + 1);
|
|
820
819
|
area += cur.x * nxt.y - nxt.x * cur.y;
|
|
821
820
|
}
|
|
822
821
|
if (area < 0) return [...poly].reverse();
|
|
823
822
|
return poly;
|
|
824
823
|
}
|
|
825
|
-
function bisector(poly,
|
|
826
|
-
const prev = polyAt(poly,
|
|
827
|
-
const cur = polyAt(poly,
|
|
828
|
-
const next = polyAt(poly,
|
|
824
|
+
function bisector(poly, i7) {
|
|
825
|
+
const prev = polyAt(poly, i7 - 1);
|
|
826
|
+
const cur = polyAt(poly, i7);
|
|
827
|
+
const next = polyAt(poly, i7 + 1);
|
|
829
828
|
const e1x = cur.x - prev.x;
|
|
830
829
|
const e1y = cur.y - prev.y;
|
|
831
830
|
const e1l = len2(e1x, e1y);
|
|
@@ -855,23 +854,23 @@ function isLavNodeReflex(node) {
|
|
|
855
854
|
return cross2(node.x - prev.x, node.y - prev.y, next.x - node.x, next.y - node.y) < -EPS;
|
|
856
855
|
}
|
|
857
856
|
function createLav(poly) {
|
|
858
|
-
const nodes = poly.map((p8,
|
|
859
|
-
const b11 = bisector(poly,
|
|
857
|
+
const nodes = poly.map((p8, i7) => {
|
|
858
|
+
const b11 = bisector(poly, i7);
|
|
860
859
|
return {
|
|
861
860
|
x: p8.x,
|
|
862
861
|
y: p8.y,
|
|
863
862
|
bx: b11.dx,
|
|
864
863
|
by: b11.dy,
|
|
865
|
-
origIdx:
|
|
864
|
+
origIdx: i7,
|
|
866
865
|
prev: null,
|
|
867
866
|
next: null,
|
|
868
867
|
active: true
|
|
869
868
|
};
|
|
870
869
|
});
|
|
871
|
-
for (let
|
|
872
|
-
const node = nodes[
|
|
873
|
-
const prevNode = nodes[(
|
|
874
|
-
const nextNode = nodes[(
|
|
870
|
+
for (let i7 = 0; i7 < nodes.length; i7++) {
|
|
871
|
+
const node = nodes[i7];
|
|
872
|
+
const prevNode = nodes[(i7 - 1 + nodes.length) % nodes.length];
|
|
873
|
+
const nextNode = nodes[(i7 + 1) % nodes.length];
|
|
875
874
|
if (node && prevNode && nextNode) {
|
|
876
875
|
node.prev = prevNode;
|
|
877
876
|
node.next = nextNode;
|
|
@@ -1004,7 +1003,7 @@ function computeStraightSkeleton(polygon2) {
|
|
|
1004
1003
|
c7.active = false;
|
|
1005
1004
|
} else {
|
|
1006
1005
|
let cur = activeStart;
|
|
1007
|
-
for (let
|
|
1006
|
+
for (let i7 = 0; i7 < sz; i7++) {
|
|
1008
1007
|
cur.active = false;
|
|
1009
1008
|
cur = cur.next;
|
|
1010
1009
|
}
|
|
@@ -1096,14 +1095,14 @@ function computeStraightSkeleton(polygon2) {
|
|
|
1096
1095
|
}
|
|
1097
1096
|
}
|
|
1098
1097
|
const faces = [];
|
|
1099
|
-
for (let
|
|
1100
|
-
const j8 = (
|
|
1101
|
-
const pi = polyAt(poly,
|
|
1098
|
+
for (let i7 = 0; i7 < n8; i7++) {
|
|
1099
|
+
const j8 = (i7 + 1) % n8;
|
|
1100
|
+
const pi = polyAt(poly, i7);
|
|
1102
1101
|
const pj = polyAt(poly, j8);
|
|
1103
1102
|
const faceVerts = [pi, pj];
|
|
1104
1103
|
const faceHeights = [0, 0];
|
|
1105
1104
|
const jNodes = vertexToSkelNodes[j8];
|
|
1106
|
-
const iNodes = vertexToSkelNodes[
|
|
1105
|
+
const iNodes = vertexToSkelNodes[i7];
|
|
1107
1106
|
if (jNodes) {
|
|
1108
1107
|
for (const ni of jNodes) {
|
|
1109
1108
|
const sn = skeletonNodes[ni];
|
|
@@ -1143,10 +1142,10 @@ function computeStraightSkeleton(polygon2) {
|
|
|
1143
1142
|
}
|
|
1144
1143
|
return { nodes: uniqueNodes, faces };
|
|
1145
1144
|
}
|
|
1146
|
-
function extractPolygon(
|
|
1147
|
-
const edges = getEdges(
|
|
1148
|
-
const pts = edges.map((
|
|
1149
|
-
const pt = curveStartPoint(
|
|
1145
|
+
function extractPolygon(w6) {
|
|
1146
|
+
const edges = getEdges(w6);
|
|
1147
|
+
const pts = edges.map((e7) => {
|
|
1148
|
+
const pt = curveStartPoint(e7);
|
|
1150
1149
|
return { x: pt[0], y: pt[1] };
|
|
1151
1150
|
});
|
|
1152
1151
|
const first = pts[0];
|
|
@@ -1158,16 +1157,16 @@ function extractPolygon(w7) {
|
|
|
1158
1157
|
}
|
|
1159
1158
|
function fanTriangulate(count) {
|
|
1160
1159
|
const tris = [];
|
|
1161
|
-
for (let
|
|
1162
|
-
tris.push([0,
|
|
1160
|
+
for (let i7 = 1; i7 < count - 1; i7++) {
|
|
1161
|
+
tris.push([0, i7, i7 + 1]);
|
|
1163
1162
|
}
|
|
1164
1163
|
return tris;
|
|
1165
1164
|
}
|
|
1166
|
-
function roof(
|
|
1165
|
+
function roof(w6, options) {
|
|
1167
1166
|
const angle = (options?.angle ?? 45) * (Math.PI / 180);
|
|
1168
1167
|
const tanAngle = Math.tan(angle);
|
|
1169
1168
|
try {
|
|
1170
|
-
const polygon2 = extractPolygon(
|
|
1169
|
+
const polygon2 = extractPolygon(w6);
|
|
1171
1170
|
if (polygon2.length < 3) {
|
|
1172
1171
|
return err(
|
|
1173
1172
|
occtError(BrepErrorCode.ROOF_FAILED, "Wire must have at least 3 edges for roof generation")
|
|
@@ -1185,10 +1184,10 @@ function roof(w7, options) {
|
|
|
1185
1184
|
try {
|
|
1186
1185
|
for (const skFace of skeleton.faces) {
|
|
1187
1186
|
const verts3d = skFace.vertices.map(
|
|
1188
|
-
(v7,
|
|
1187
|
+
(v7, i7) => [
|
|
1189
1188
|
v7.x,
|
|
1190
1189
|
v7.y,
|
|
1191
|
-
(skFace.heights[
|
|
1190
|
+
(skFace.heights[i7] ?? 0) * tanAngle
|
|
1192
1191
|
]
|
|
1193
1192
|
);
|
|
1194
1193
|
const tris = fanTriangulate(verts3d.length);
|
|
@@ -1217,9 +1216,9 @@ function roof(w7, options) {
|
|
|
1217
1216
|
}
|
|
1218
1217
|
const p0 = polygon2[0];
|
|
1219
1218
|
if (p0) {
|
|
1220
|
-
for (let
|
|
1221
|
-
const pi = polygon2[
|
|
1222
|
-
const pi1 = polygon2[
|
|
1219
|
+
for (let i7 = 1; i7 < polygon2.length - 1; i7++) {
|
|
1220
|
+
const pi = polygon2[i7];
|
|
1221
|
+
const pi1 = polygon2[i7 + 1];
|
|
1223
1222
|
if (!pi || !pi1) continue;
|
|
1224
1223
|
const va = [p0.x, p0.y, 0];
|
|
1225
1224
|
const vb = [pi.x, pi.y, 0];
|
|
@@ -1262,9 +1261,9 @@ function roof(w7, options) {
|
|
|
1262
1261
|
} finally {
|
|
1263
1262
|
sewing.delete();
|
|
1264
1263
|
}
|
|
1265
|
-
} catch (
|
|
1266
|
-
const msg =
|
|
1267
|
-
return err(occtError(BrepErrorCode.ROOF_FAILED, `Roof generation failed: ${msg}`,
|
|
1264
|
+
} catch (e7) {
|
|
1265
|
+
const msg = e7 instanceof Error ? e7.message : String(e7);
|
|
1266
|
+
return err(occtError(BrepErrorCode.ROOF_FAILED, `Roof generation failed: ${msg}`, e7));
|
|
1268
1267
|
}
|
|
1269
1268
|
}
|
|
1270
1269
|
function solveConstraints(nodes, constraints) {
|
|
@@ -1418,9 +1417,9 @@ function solveAssembly(assembly) {
|
|
|
1418
1417
|
dof: result.dof,
|
|
1419
1418
|
converged: result.converged
|
|
1420
1419
|
});
|
|
1421
|
-
} catch (
|
|
1422
|
-
const raw =
|
|
1423
|
-
return err(occtError(BrepErrorCode.ASSEMBLY_SOLVE_FAILED, `Assembly solve failed: ${raw}`,
|
|
1420
|
+
} catch (e7) {
|
|
1421
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
1422
|
+
return err(occtError(BrepErrorCode.ASSEMBLY_SOLVE_FAILED, `Assembly solve failed: ${raw}`, e7));
|
|
1424
1423
|
}
|
|
1425
1424
|
}
|
|
1426
1425
|
function checkInterference(shape1, shape2, tolerance = 1e-6) {
|
|
@@ -1450,11 +1449,11 @@ function checkInterference(shape1, shape2, tolerance = 1e-6) {
|
|
|
1450
1449
|
}
|
|
1451
1450
|
function checkAllInterferences(shapes, tolerance = 1e-6) {
|
|
1452
1451
|
const pairs = [];
|
|
1453
|
-
shapes.forEach((si,
|
|
1454
|
-
for (let j8 =
|
|
1452
|
+
shapes.forEach((si, i7) => {
|
|
1453
|
+
for (let j8 = i7 + 1; j8 < shapes.length; j8++) {
|
|
1455
1454
|
const result = unwrap(checkInterference(si, shapes[j8], tolerance));
|
|
1456
1455
|
if (result.hasInterference) {
|
|
1457
|
-
pairs.push({ i:
|
|
1456
|
+
pairs.push({ i: i7, j: j8, result });
|
|
1458
1457
|
}
|
|
1459
1458
|
}
|
|
1460
1459
|
});
|
|
@@ -1465,9 +1464,9 @@ function parseEntities(text) {
|
|
|
1465
1464
|
const entities = [];
|
|
1466
1465
|
let inEntities = false;
|
|
1467
1466
|
let current;
|
|
1468
|
-
for (let
|
|
1469
|
-
const codeLine = lines[
|
|
1470
|
-
const valueLine = lines[
|
|
1467
|
+
for (let i7 = 0; i7 < lines.length - 1; i7 += 2) {
|
|
1468
|
+
const codeLine = lines[i7];
|
|
1469
|
+
const valueLine = lines[i7 + 1];
|
|
1471
1470
|
if (codeLine === void 0 || valueLine === void 0) continue;
|
|
1472
1471
|
const code = parseInt(codeLine.trim(), 10);
|
|
1473
1472
|
const value = valueLine.trim();
|
|
@@ -1574,7 +1573,7 @@ async function importDXF(blob, options) {
|
|
|
1574
1573
|
return err(ioError(BrepErrorCode.DXF_IMPORT_FAILED, "Failed to read DXF blob", cause));
|
|
1575
1574
|
}
|
|
1576
1575
|
const allEntities = parseEntities(text);
|
|
1577
|
-
const entities = options?.layer !== void 0 ? allEntities.filter((
|
|
1576
|
+
const entities = options?.layer !== void 0 ? allEntities.filter((e7) => e7.layer === options.layer) : allEntities;
|
|
1578
1577
|
if (entities.length === 0) {
|
|
1579
1578
|
return ok([]);
|
|
1580
1579
|
}
|
|
@@ -1643,9 +1642,9 @@ async function importOBJ(blob) {
|
|
|
1643
1642
|
}
|
|
1644
1643
|
try {
|
|
1645
1644
|
return buildSolidFromMesh$1(vertices, faces);
|
|
1646
|
-
} catch (
|
|
1647
|
-
const msg =
|
|
1648
|
-
return err(ioError(BrepErrorCode.OBJ_IMPORT_FAILED, `OBJ import failed: ${msg}`,
|
|
1645
|
+
} catch (e7) {
|
|
1646
|
+
const msg = e7 instanceof Error ? e7.message : String(e7);
|
|
1647
|
+
return err(ioError(BrepErrorCode.OBJ_IMPORT_FAILED, `OBJ import failed: ${msg}`, e7));
|
|
1649
1648
|
}
|
|
1650
1649
|
}
|
|
1651
1650
|
function buildSolidFromMesh$1(vertices, faces) {
|
|
@@ -1654,10 +1653,10 @@ function buildSolidFromMesh$1(vertices, faces) {
|
|
|
1654
1653
|
let faceCount = 0;
|
|
1655
1654
|
try {
|
|
1656
1655
|
for (const face2 of faces) {
|
|
1657
|
-
for (let
|
|
1656
|
+
for (let i7 = 1; i7 < face2.length - 1; i7++) {
|
|
1658
1657
|
const rawA = face2[0] ?? 0;
|
|
1659
|
-
const rawB = face2[
|
|
1660
|
-
const rawC = face2[
|
|
1658
|
+
const rawB = face2[i7] ?? 0;
|
|
1659
|
+
const rawC = face2[i7 + 1] ?? 0;
|
|
1661
1660
|
const ai = rawA > 0 ? rawA - 1 : vertices.length + rawA;
|
|
1662
1661
|
const bi = rawB > 0 ? rawB - 1 : vertices.length + rawB;
|
|
1663
1662
|
const ci = rawC > 0 ? rawC - 1 : vertices.length + rawC;
|
|
@@ -1697,9 +1696,9 @@ function buildSolidFromMesh$1(vertices, faces) {
|
|
|
1697
1696
|
}
|
|
1698
1697
|
function extractFromZip(data, target) {
|
|
1699
1698
|
let eocdOffset = -1;
|
|
1700
|
-
for (let
|
|
1701
|
-
if (data[
|
|
1702
|
-
eocdOffset =
|
|
1699
|
+
for (let i7 = data.length - 22; i7 >= 0; i7--) {
|
|
1700
|
+
if (data[i7] === 80 && data[i7 + 1] === 75 && data[i7 + 2] === 5 && data[i7 + 3] === 6) {
|
|
1701
|
+
eocdOffset = i7;
|
|
1703
1702
|
break;
|
|
1704
1703
|
}
|
|
1705
1704
|
}
|
|
@@ -1851,9 +1850,9 @@ async function importThreeMF(blob) {
|
|
|
1851
1850
|
);
|
|
1852
1851
|
}
|
|
1853
1852
|
return buildSolidFromMesh(parsed);
|
|
1854
|
-
} catch (
|
|
1855
|
-
const msg =
|
|
1856
|
-
return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, `3MF import failed: ${msg}`,
|
|
1853
|
+
} catch (e7) {
|
|
1854
|
+
const msg = e7 instanceof Error ? e7.message : String(e7);
|
|
1855
|
+
return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, `3MF import failed: ${msg}`, e7));
|
|
1857
1856
|
}
|
|
1858
1857
|
}
|
|
1859
1858
|
function resolve(s6) {
|
|
@@ -1976,14 +1975,14 @@ function tangentArc(startPoint, startTgt, endPoint) {
|
|
|
1976
1975
|
function wire(listOfEdges) {
|
|
1977
1976
|
return assembleWire(listOfEdges);
|
|
1978
1977
|
}
|
|
1979
|
-
function face(
|
|
1980
|
-
return makeFace(
|
|
1978
|
+
function face(w6, holes) {
|
|
1979
|
+
return makeFace(w6, holes);
|
|
1981
1980
|
}
|
|
1982
|
-
function filledFace(
|
|
1983
|
-
return makeNonPlanarFace(
|
|
1981
|
+
function filledFace(w6) {
|
|
1982
|
+
return makeNonPlanarFace(w6);
|
|
1984
1983
|
}
|
|
1985
|
-
function subFace(originFace,
|
|
1986
|
-
return makeNewFaceWithinFace(originFace,
|
|
1984
|
+
function subFace(originFace, w6) {
|
|
1985
|
+
return makeNewFaceWithinFace(originFace, w6);
|
|
1987
1986
|
}
|
|
1988
1987
|
function polygon(points) {
|
|
1989
1988
|
return makePolygon(points);
|
|
@@ -1997,14 +1996,14 @@ function compound(shapeArray) {
|
|
|
1997
1996
|
function solid(facesOrShells) {
|
|
1998
1997
|
return makeSolid(facesOrShells);
|
|
1999
1998
|
}
|
|
2000
|
-
function offsetFace(
|
|
2001
|
-
return makeOffset(
|
|
1999
|
+
function offsetFace(f12, distance, tolerance) {
|
|
2000
|
+
return makeOffset(f12, distance, tolerance);
|
|
2002
2001
|
}
|
|
2003
2002
|
function sewShells(facesOrShells, ignoreType) {
|
|
2004
2003
|
return weldShellsAndFaces(facesOrShells, ignoreType);
|
|
2005
2004
|
}
|
|
2006
|
-
function addHoles(
|
|
2007
|
-
return addHolesInFace(
|
|
2005
|
+
function addHoles(f12, holes) {
|
|
2006
|
+
return addHolesInFace(f12, holes);
|
|
2008
2007
|
}
|
|
2009
2008
|
function validateNotNull(shape2, label) {
|
|
2010
2009
|
if (shape2.wrapped.IsNull()) {
|
|
@@ -2035,9 +2034,9 @@ function thicken$1(shape2, thickness) {
|
|
|
2035
2034
|
} finally {
|
|
2036
2035
|
__callDispose(_stack, _error, _hasError);
|
|
2037
2036
|
}
|
|
2038
|
-
} catch (
|
|
2039
|
-
const raw =
|
|
2040
|
-
return err(occtError("THICKEN_FAILED", `Thicken operation failed: ${raw}`,
|
|
2037
|
+
} catch (e7) {
|
|
2038
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
2039
|
+
return err(occtError("THICKEN_FAILED", `Thicken operation failed: ${raw}`, e7));
|
|
2041
2040
|
}
|
|
2042
2041
|
}
|
|
2043
2042
|
function fillet$1(shape2, edges, radius) {
|
|
@@ -2108,10 +2107,10 @@ function fillet$1(shape2, edges, radius) {
|
|
|
2108
2107
|
} finally {
|
|
2109
2108
|
__callDispose(_stack, _error, _hasError);
|
|
2110
2109
|
}
|
|
2111
|
-
} catch (
|
|
2112
|
-
const raw =
|
|
2110
|
+
} catch (e7) {
|
|
2111
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
2113
2112
|
return err(
|
|
2114
|
-
occtError("FILLET_FAILED", `Fillet operation failed: ${raw}`,
|
|
2113
|
+
occtError("FILLET_FAILED", `Fillet operation failed: ${raw}`, e7, {
|
|
2115
2114
|
operation: "fillet",
|
|
2116
2115
|
edgeCount: selectedEdges.length,
|
|
2117
2116
|
radius
|
|
@@ -2167,7 +2166,7 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
2167
2166
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
2168
2167
|
);
|
|
2169
2168
|
while (edgeExp.More()) {
|
|
2170
|
-
const hash = edgeExp.Current().HashCode(
|
|
2169
|
+
const hash = edgeExp.Current().HashCode(HASH_CODE_MAX);
|
|
2171
2170
|
if (!edgeFaceMap.has(hash)) {
|
|
2172
2171
|
edgeFaceMap.set(hash, face2);
|
|
2173
2172
|
}
|
|
@@ -2190,7 +2189,7 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
2190
2189
|
} else {
|
|
2191
2190
|
const [d1, d22] = d9;
|
|
2192
2191
|
if (d1 > 0 && d22 > 0) {
|
|
2193
|
-
const face2 = getEdgeFaceMap().get(edge.wrapped.HashCode(
|
|
2192
|
+
const face2 = getEdgeFaceMap().get(edge.wrapped.HashCode(HASH_CODE_MAX));
|
|
2194
2193
|
if (face2) {
|
|
2195
2194
|
builder.Add_3(d1, d22, oc.TopoDS.Edge_1(edge.wrapped), face2);
|
|
2196
2195
|
}
|
|
@@ -2211,10 +2210,10 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
2211
2210
|
} finally {
|
|
2212
2211
|
__callDispose(_stack, _error, _hasError);
|
|
2213
2212
|
}
|
|
2214
|
-
} catch (
|
|
2215
|
-
const raw =
|
|
2213
|
+
} catch (e7) {
|
|
2214
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
2216
2215
|
return err(
|
|
2217
|
-
occtError("CHAMFER_FAILED", `Chamfer operation failed: ${raw}`,
|
|
2216
|
+
occtError("CHAMFER_FAILED", `Chamfer operation failed: ${raw}`, e7, {
|
|
2218
2217
|
operation: "chamfer",
|
|
2219
2218
|
edgeCount: selectedEdges.length,
|
|
2220
2219
|
distance
|
|
@@ -2268,10 +2267,10 @@ function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
|
|
|
2268
2267
|
} finally {
|
|
2269
2268
|
__callDispose(_stack, _error, _hasError);
|
|
2270
2269
|
}
|
|
2271
|
-
} catch (
|
|
2272
|
-
const raw =
|
|
2270
|
+
} catch (e7) {
|
|
2271
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
2273
2272
|
return err(
|
|
2274
|
-
occtError("SHELL_FAILED", `Shell operation failed: ${raw}`,
|
|
2273
|
+
occtError("SHELL_FAILED", `Shell operation failed: ${raw}`, e7, {
|
|
2275
2274
|
operation: "shell",
|
|
2276
2275
|
faceCount: faces.length,
|
|
2277
2276
|
thickness
|
|
@@ -2317,9 +2316,9 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
|
2317
2316
|
} finally {
|
|
2318
2317
|
__callDispose(_stack, _error, _hasError);
|
|
2319
2318
|
}
|
|
2320
|
-
} catch (
|
|
2321
|
-
const raw =
|
|
2322
|
-
return err(occtError("OFFSET_FAILED", `Offset operation failed: ${raw}`,
|
|
2319
|
+
} catch (e7) {
|
|
2320
|
+
const raw = e7 instanceof Error ? e7.message : String(e7);
|
|
2321
|
+
return err(occtError("OFFSET_FAILED", `Offset operation failed: ${raw}`, e7));
|
|
2323
2322
|
}
|
|
2324
2323
|
}
|
|
2325
2324
|
function translate(shape2, v7) {
|
|
@@ -2488,8 +2487,8 @@ function loft$1(wires, { ruled = true, startPoint, endPoint } = {}, returnShell
|
|
|
2488
2487
|
const vMaker = scope.register(new oc.BRepBuilderAPI_MakeVertex(pnt));
|
|
2489
2488
|
builder.AddVertex(vMaker.Vertex());
|
|
2490
2489
|
}
|
|
2491
|
-
for (const
|
|
2492
|
-
builder.AddWire(
|
|
2490
|
+
for (const w6 of wires) {
|
|
2491
|
+
builder.AddWire(w6.wrapped);
|
|
2493
2492
|
}
|
|
2494
2493
|
if (endPoint) {
|
|
2495
2494
|
const pnt = scope.register(toOcPnt(toVec3(endPoint)));
|
|
@@ -2513,9 +2512,9 @@ function loft$1(wires, { ruled = true, startPoint, endPoint } = {}, returnShell
|
|
|
2513
2512
|
}
|
|
2514
2513
|
}
|
|
2515
2514
|
function extrude(face2, height) {
|
|
2516
|
-
const
|
|
2515
|
+
const f12 = resolve(face2);
|
|
2517
2516
|
const vec = typeof height === "number" ? [0, 0, height] : height;
|
|
2518
|
-
return extrude$1(
|
|
2517
|
+
return extrude$1(f12, vec);
|
|
2519
2518
|
}
|
|
2520
2519
|
function revolve(face2, options) {
|
|
2521
2520
|
const pivotPoint = options?.at ?? [0, 0, 0];
|
|
@@ -2527,7 +2526,7 @@ function revolve(face2, options) {
|
|
|
2527
2526
|
);
|
|
2528
2527
|
}
|
|
2529
2528
|
function loft(wires, options) {
|
|
2530
|
-
const resolvedWires = wires.map((
|
|
2529
|
+
const resolvedWires = wires.map((w6) => resolve(w6));
|
|
2531
2530
|
return loft$1(resolvedWires, options);
|
|
2532
2531
|
}
|
|
2533
2532
|
function resolveTargetFace(shape2, faceSpec) {
|
|
@@ -2540,11 +2539,11 @@ function resolveTargetFace(shape2, faceSpec) {
|
|
|
2540
2539
|
}
|
|
2541
2540
|
let best = faces[0];
|
|
2542
2541
|
let bestZ = faceCenter(best)[2];
|
|
2543
|
-
for (let
|
|
2544
|
-
const
|
|
2545
|
-
const z6 = faceCenter(
|
|
2542
|
+
for (let i7 = 1; i7 < faces.length; i7++) {
|
|
2543
|
+
const f12 = faces[i7];
|
|
2544
|
+
const z6 = faceCenter(f12)[2];
|
|
2546
2545
|
if (z6 > bestZ) {
|
|
2547
|
-
best =
|
|
2546
|
+
best = f12;
|
|
2548
2547
|
bestZ = z6;
|
|
2549
2548
|
}
|
|
2550
2549
|
}
|
|
@@ -2606,8 +2605,8 @@ function pocket(shape2, options) {
|
|
|
2606
2605
|
if (isErr(targetResult)) return targetResult;
|
|
2607
2606
|
const targetFace = targetResult.value;
|
|
2608
2607
|
const normal = normalAt(targetFace);
|
|
2609
|
-
const
|
|
2610
|
-
const faceResult = makeFace(
|
|
2608
|
+
const w6 = toWire(profile);
|
|
2609
|
+
const faceResult = makeFace(w6);
|
|
2611
2610
|
if (isErr(faceResult)) return faceResult;
|
|
2612
2611
|
const extDir = vecScale(vecNormalize(normal), -depth);
|
|
2613
2612
|
const toolResult = extrude$1(faceResult.value, extDir);
|
|
@@ -2624,8 +2623,8 @@ function boss(shape2, options) {
|
|
|
2624
2623
|
if (isErr(targetResult)) return targetResult;
|
|
2625
2624
|
const targetFace = targetResult.value;
|
|
2626
2625
|
const normal = normalAt(targetFace);
|
|
2627
|
-
const
|
|
2628
|
-
const faceResult = makeFace(
|
|
2626
|
+
const w6 = toWire(profile);
|
|
2627
|
+
const faceResult = makeFace(w6);
|
|
2629
2628
|
if (isErr(faceResult)) return faceResult;
|
|
2630
2629
|
const extDir = vecScale(vecNormalize(normal), height);
|
|
2631
2630
|
const toolResult = extrude$1(faceResult.value, extDir);
|
|
@@ -2793,8 +2792,8 @@ function createWrappedCurve(val) {
|
|
|
2793
2792
|
isClosed: () => curveIsClosed(val),
|
|
2794
2793
|
sweep(spine, opts) {
|
|
2795
2794
|
if (!isWire(val)) throw new Error("sweep requires a Wire");
|
|
2796
|
-
const
|
|
2797
|
-
const result = unwrapOrThrow(sweep(
|
|
2795
|
+
const w6 = val;
|
|
2796
|
+
const result = unwrapOrThrow(sweep(w6, resolve(spine), opts));
|
|
2798
2797
|
const shape3D = Array.isArray(result) ? result[0] : result;
|
|
2799
2798
|
return wrap3D(shape3D);
|
|
2800
2799
|
}
|
|
@@ -2852,7 +2851,7 @@ export {
|
|
|
2852
2851
|
D2 as Drawing,
|
|
2853
2852
|
a6 as DrawingPen,
|
|
2854
2853
|
F as FaceSketcher,
|
|
2855
|
-
|
|
2854
|
+
HASH_CODE_MAX,
|
|
2856
2855
|
O as OK,
|
|
2857
2856
|
R as RAD2DEG,
|
|
2858
2857
|
S as Sketch,
|
|
@@ -2895,7 +2894,7 @@ export {
|
|
|
2895
2894
|
k8 as colorFaces,
|
|
2896
2895
|
l6 as colorShape,
|
|
2897
2896
|
f4 as complexExtrude,
|
|
2898
|
-
|
|
2897
|
+
x3 as composeTransforms,
|
|
2899
2898
|
compound,
|
|
2900
2899
|
c2 as compoundSketchExtrude,
|
|
2901
2900
|
d4 as compoundSketchFace,
|
|
@@ -2976,7 +2975,7 @@ export {
|
|
|
2976
2975
|
z4 as drawingToSketchOnPlane,
|
|
2977
2976
|
drill,
|
|
2978
2977
|
edgeFinder,
|
|
2979
|
-
|
|
2978
|
+
e4 as edgesOfFace,
|
|
2980
2979
|
ellipse,
|
|
2981
2980
|
ellipseArc,
|
|
2982
2981
|
ellipsoid,
|
|
@@ -2986,18 +2985,18 @@ export {
|
|
|
2986
2985
|
exportDXF,
|
|
2987
2986
|
exportGlb,
|
|
2988
2987
|
exportGltf,
|
|
2989
|
-
|
|
2988
|
+
e5 as exportIGES,
|
|
2990
2989
|
exportOBJ,
|
|
2991
2990
|
d7 as exportSTEP,
|
|
2992
|
-
|
|
2991
|
+
f10 as exportSTL,
|
|
2993
2992
|
exportThreeMF,
|
|
2994
2993
|
extrude,
|
|
2995
2994
|
face,
|
|
2996
2995
|
faceCenter,
|
|
2997
2996
|
faceFinder,
|
|
2998
|
-
|
|
2997
|
+
f9 as faceGeomType,
|
|
2999
2998
|
q5 as faceOrientation,
|
|
3000
|
-
|
|
2999
|
+
f8 as facesOfEdge,
|
|
3001
3000
|
p7 as fill,
|
|
3002
3001
|
filledFace,
|
|
3003
3002
|
fillet,
|
|
@@ -3029,7 +3028,7 @@ export {
|
|
|
3029
3028
|
o7 as getFaceTags,
|
|
3030
3029
|
getFaces,
|
|
3031
3030
|
$ as getFont,
|
|
3032
|
-
|
|
3031
|
+
f7 as getHashCode,
|
|
3033
3032
|
p2 as getHistoryShape,
|
|
3034
3033
|
getKernel,
|
|
3035
3034
|
g4 as getOrientation,
|
|
@@ -3069,7 +3068,7 @@ export {
|
|
|
3069
3068
|
isDisposeRequest,
|
|
3070
3069
|
isEdge,
|
|
3071
3070
|
isEmpty,
|
|
3072
|
-
|
|
3071
|
+
y3 as isEqualShape,
|
|
3073
3072
|
isErr,
|
|
3074
3073
|
isErrorResponse,
|
|
3075
3074
|
isFace,
|
|
@@ -3082,7 +3081,7 @@ export {
|
|
|
3082
3081
|
isOperationRequest,
|
|
3083
3082
|
a0 as isProjectionPlane,
|
|
3084
3083
|
isQueueEmpty,
|
|
3085
|
-
|
|
3084
|
+
h7 as isSameShape,
|
|
3086
3085
|
h3 as isShape1D,
|
|
3087
3086
|
isShape3D,
|
|
3088
3087
|
isShell,
|
|
@@ -3091,11 +3090,11 @@ export {
|
|
|
3091
3090
|
isValid,
|
|
3092
3091
|
m2 as isVertex,
|
|
3093
3092
|
isWire,
|
|
3094
|
-
|
|
3095
|
-
|
|
3093
|
+
z5 as iterEdges,
|
|
3094
|
+
A4 as iterFaces,
|
|
3096
3095
|
iterTopo,
|
|
3097
|
-
|
|
3098
|
-
|
|
3096
|
+
B6 as iterVertices,
|
|
3097
|
+
C6 as iterWires,
|
|
3099
3098
|
kernelCall,
|
|
3100
3099
|
kernelCallRaw,
|
|
3101
3100
|
kernelCallScoped,
|
|
@@ -3111,11 +3110,11 @@ export {
|
|
|
3111
3110
|
h2 as mapErr,
|
|
3112
3111
|
j2 as match,
|
|
3113
3112
|
measureArea,
|
|
3114
|
-
|
|
3115
|
-
|
|
3113
|
+
e6 as measureCurvatureAt,
|
|
3114
|
+
f11 as measureCurvatureAtMid,
|
|
3116
3115
|
g12 as measureDistance,
|
|
3117
|
-
|
|
3118
|
-
|
|
3116
|
+
h9 as measureLength,
|
|
3117
|
+
i6 as measureLinearProps,
|
|
3119
3118
|
measureSurfaceProps,
|
|
3120
3119
|
measureVolume,
|
|
3121
3120
|
measureVolumeProps,
|
|
@@ -3157,7 +3156,7 @@ export {
|
|
|
3157
3156
|
v3 as removeChild,
|
|
3158
3157
|
x as replayFrom,
|
|
3159
3158
|
y as replayHistory,
|
|
3160
|
-
|
|
3159
|
+
D3 as resize,
|
|
3161
3160
|
resolve,
|
|
3162
3161
|
resolve3D,
|
|
3163
3162
|
r as resolveDirection,
|
|
@@ -3175,7 +3174,7 @@ export {
|
|
|
3175
3174
|
G as scaleDrawing,
|
|
3176
3175
|
section,
|
|
3177
3176
|
sectionToFace,
|
|
3178
|
-
|
|
3177
|
+
E3 as setShapeOrigin,
|
|
3179
3178
|
t8 as setTagMetadata,
|
|
3180
3179
|
sewShells,
|
|
3181
3180
|
shape,
|
|
@@ -3185,7 +3184,7 @@ export {
|
|
|
3185
3184
|
simplify,
|
|
3186
3185
|
sketch2DOnFace,
|
|
3187
3186
|
sketch2DOnPlane,
|
|
3188
|
-
|
|
3187
|
+
H as sketchCircle,
|
|
3189
3188
|
I as sketchEllipse,
|
|
3190
3189
|
J as sketchExtrude,
|
|
3191
3190
|
K as sketchFace,
|
|
@@ -3245,7 +3244,7 @@ export {
|
|
|
3245
3244
|
w2 as unwrapOrElse,
|
|
3246
3245
|
E as updateNode,
|
|
3247
3246
|
u5 as uvBounds,
|
|
3248
|
-
|
|
3247
|
+
h8 as uvCoordinates,
|
|
3249
3248
|
validationError,
|
|
3250
3249
|
v2 as vecAdd,
|
|
3251
3250
|
a3 as vecAngle,
|
|
@@ -3270,7 +3269,7 @@ export {
|
|
|
3270
3269
|
walkAssembly,
|
|
3271
3270
|
wire,
|
|
3272
3271
|
wireFinder,
|
|
3273
|
-
|
|
3272
|
+
w5 as wiresOfFace,
|
|
3274
3273
|
w as withOcDir,
|
|
3275
3274
|
l as withOcPnt,
|
|
3276
3275
|
n as withOcVec,
|