brepjs 8.8.2 → 8.8.4
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/curves.d.ts.map +1 -1
- package/dist/2d/lib/Curve2D.d.ts.map +1 -1
- package/dist/2d/lib/approximations.d.ts.map +1 -1
- package/dist/2d/lib/makeCurves.d.ts.map +1 -1
- package/dist/2d/lib/ocWrapper.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/Blueprint-C4Rx89oe.js +1440 -0
- package/dist/Blueprint-D1Dik12C.cjs +1439 -0
- package/dist/{boolean2D-q5FOdOQW.cjs → boolean2D-BZnkU_aH.cjs} +215 -130
- package/dist/{boolean2D-Dgnuy63w.js → boolean2D-D4j89vF_.js} +215 -130
- package/dist/{booleanFns-CFit7JYt.cjs → booleanFns-Cf_0aWNe.cjs} +214 -133
- package/dist/{booleanFns--Orezl-b.js → booleanFns-D6SeHoCv.js} +214 -133
- package/dist/brepjs.cjs +478 -314
- package/dist/brepjs.js +574 -410
- package/dist/core/disposal.d.ts +44 -3
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/errors.d.ts +2 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/geometryHelpers.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts +20 -0
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.d.ts.map +1 -1
- package/dist/core.cjs +7 -4
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +14 -11
- package/dist/{cornerFinder-KNTFoGrm.js → cornerFinder-CypY3T_w.js} +1 -1
- package/dist/{cornerFinder-v4un1Fr9.cjs → cornerFinder-DbRL42YI.cjs} +1 -1
- package/dist/{curveFns-6ovDM_sR.cjs → curveFns-KDpL9iyo.cjs} +139 -38
- package/dist/curveFns-VDZEhY97.js +281 -0
- package/dist/{drawFns-WgXeXHH1.cjs → drawFns-B52K-9DJ.cjs} +184 -104
- package/dist/{drawFns-XwroLxdb.js → drawFns-CVPwl2No.js} +184 -104
- package/dist/{errors-NNmTtM5u.cjs → errors-BYb4tL5h.cjs} +3 -0
- package/dist/{errors-DJ92ermb.js → errors-CHfaHQSt.js} +3 -0
- package/dist/faceFns-B8xnZw-f.cjs +358 -0
- package/dist/faceFns-DG4bu-QB.js +359 -0
- package/dist/{helpers-CRfqaW0Y.cjs → helpers-Cfibxk7U.cjs} +15 -12
- package/dist/{helpers-CtBCzEqs.js → helpers-zsENdJlc.js} +15 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/io/importFns.d.ts.map +1 -1
- package/dist/io.cjs +133 -65
- package/dist/io.js +133 -65
- package/dist/kernel/booleanOps.d.ts.map +1 -1
- package/dist/loft-Bhnw5Rfr.cjs +530 -0
- package/dist/loft-fSnlFn-j.js +531 -0
- package/dist/measurement-C4Ofuy_y.cjs +200 -0
- package/dist/measurement-DzRb6oYN.js +201 -0
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CPNNlpbw.cjs → meshFns-C-6Cq3V-.cjs} +3 -3
- package/dist/{meshFns-DAmWVyEp.js → meshFns-Cw3IFJjg.js} +3 -3
- package/dist/{occtBoundary-Cqfsau2c.cjs → occtBoundary-CN_uQJtA.cjs} +4 -3
- package/dist/{occtBoundary-DvBywHyU.js → occtBoundary-Ct0tN8cs.js} +4 -3
- package/dist/operations/exporterFns.d.ts.map +1 -1
- package/dist/operations/exporterUtils.d.ts +3 -3
- package/dist/operations/exporterUtils.d.ts.map +1 -1
- package/dist/operations/exporters.d.ts.map +1 -1
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/loft.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/{operations-BQ25CPI8.cjs → operations-DvwWDqIp.cjs} +263 -168
- package/dist/{operations-vN0tcoaU.js → operations-PYuj8GLd.js} +263 -168
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query/shapeDistanceFilter.d.ts.map +1 -1
- package/dist/query.cjs +67 -15
- package/dist/query.js +68 -16
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{shapeFns-C785aeVn.cjs → shapeFns-ByLUl6KE.cjs} +63 -9
- package/dist/{shapeFns-ClpALED4.js → shapeFns-QL3zx6uW.js} +63 -9
- package/dist/{shapeTypes-DnwCo942.js → shapeTypes-D34s68Xi.js} +51 -20
- package/dist/{shapeTypes-CIijJxCz.cjs → shapeTypes-sXITvFkF.cjs} +33 -2
- package/dist/sketching/CompoundSketch.d.ts.map +1 -1
- package/dist/sketching/Sketch.d.ts.map +1 -1
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketcher2d.d.ts.map +1 -1
- package/dist/sketching/cannedSketches.d.ts.map +1 -1
- package/dist/sketching/draw.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/surfaceBuilders-DYX6h68y.js +436 -0
- package/dist/surfaceBuilders-hupjYn0W.cjs +435 -0
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/compoundOpsFns.d.ts.map +1 -1
- package/dist/topology/curveBuilders.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/solidBuilders.d.ts.map +1 -1
- package/dist/topology/surfaceBuilders.d.ts.map +1 -1
- package/dist/{topology-zG8maSDK.cjs → topology-DWe9SYAy.cjs} +8 -8
- package/dist/{topology-CqyxpmEh.js → topology-psR8Hqiz.js} +8 -8
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/dist/{vectors-CGLqemPY.cjs → vectors-9rrStq8t.cjs} +2 -2
- package/dist/{vectors-2lOjaa8N.js → vectors-Dp5Iu1KH.js} +2 -2
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +4 -1
- package/dist/Blueprint-BmbNUnGI.cjs +0 -1185
- package/dist/Blueprint-C-JJkkwL.js +0 -1186
- package/dist/curveFns-BhQECv8e.js +0 -180
- package/dist/faceFns-3PDjBeW7.js +0 -272
- package/dist/faceFns-CxaLWOjc.cjs +0 -271
- package/dist/loft-CVb-IjEI.cjs +0 -372
- package/dist/loft-DMFjK6lk.js +0 -373
- package/dist/measurement-CecYIt3s.cjs +0 -134
- package/dist/measurement-DHDLAH7-.js +0 -135
- package/dist/surfaceBuilders-CC0ZQGix.cjs +0 -289
- package/dist/surfaceBuilders-CrJtFu2a.js +0 -290
package/dist/brepjs.js
CHANGED
|
@@ -1,42 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __using = (stack, value, async) => {
|
|
6
|
+
if (value != null) {
|
|
7
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
8
|
+
var dispose, inner;
|
|
9
|
+
if (async) dispose = value[__knownSymbol("asyncDispose")];
|
|
10
|
+
if (dispose === void 0) {
|
|
11
|
+
dispose = value[__knownSymbol("dispose")];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
15
|
+
if (inner) dispose = function() {
|
|
16
|
+
try {
|
|
17
|
+
inner.call(this);
|
|
18
|
+
} catch (e8) {
|
|
19
|
+
return Promise.reject(e8);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
stack.push([async, dispose, value]);
|
|
23
|
+
} else if (async) {
|
|
24
|
+
stack.push([async]);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
var __callDispose = (stack, error, hasError) => {
|
|
29
|
+
var E3 = typeof SuppressedError === "function" ? SuppressedError : function(e8, s6, m9, _2) {
|
|
30
|
+
return _2 = Error(m9), _2.name = "SuppressedError", _2.error = e8, _2.suppressed = s6, _2;
|
|
31
|
+
};
|
|
32
|
+
var fail = (e8) => error = hasError ? new E3(e8, error, "An error was suppressed during disposal") : (hasError = true, e8);
|
|
33
|
+
var next = (it) => {
|
|
34
|
+
while (it = stack.pop()) {
|
|
35
|
+
try {
|
|
36
|
+
var result = it[1] && it[1].call(it[2]);
|
|
37
|
+
if (it[0]) return Promise.resolve(result).then(next, (e8) => (fail(e8), next()));
|
|
38
|
+
} catch (e8) {
|
|
39
|
+
fail(e8);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (hasError) throw error;
|
|
43
|
+
};
|
|
44
|
+
return next();
|
|
45
|
+
};
|
|
46
|
+
import { g as getKernel, f as makeTriFace, d as toOcPnt, a as toVec3 } from "./occtBoundary-Ct0tN8cs.js";
|
|
47
|
+
import { h, i, j, k, r, b, t, w, l, n } from "./occtBoundary-Ct0tN8cs.js";
|
|
48
|
+
import { l as ok, y as translateOcctError, e as err, q as queryError, x as validationError, B as BrepErrorCode, o as occtError, i as ioError, d as isErr, p as typeCastError, u as unwrap } from "./errors-CHfaHQSt.js";
|
|
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
|
+
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
|
+
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";
|
|
7
52
|
import { c as vecDistance, D as DEG2RAD, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
|
|
8
|
-
import { H, R, v as v2, a as a3, b as b4, d, e, g as g3, h as
|
|
9
|
-
import { B, d as d2, C, r as r4, t as t4 } from "./Blueprint-
|
|
10
|
-
import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-
|
|
11
|
-
import { j as j3, k as k4, l as
|
|
12
|
-
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-
|
|
13
|
-
import { b as b6, g as g5, r as r5 } from "./loft-
|
|
14
|
-
import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-
|
|
15
|
-
import { a as a4, b as b7, d as d3, f as f4, g as g6, h as
|
|
16
|
-
import { B as
|
|
53
|
+
import { H, 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-C4Rx89oe.js";
|
|
55
|
+
import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-VDZEhY97.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-VDZEhY97.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-fSnlFn-j.js";
|
|
58
|
+
import { b as b6, g as g5, r as r5 } from "./loft-fSnlFn-j.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-PYuj8GLd.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-PYuj8GLd.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-D4j89vF_.js";
|
|
17
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";
|
|
18
|
-
import { l as createTypedFinder, m as faceFinder } from "./helpers-
|
|
19
|
-
import { g as g8 } from "./helpers-
|
|
63
|
+
import { l as createTypedFinder, m as faceFinder } from "./helpers-zsENdJlc.js";
|
|
64
|
+
import { g as g8 } from "./helpers-zsENdJlc.js";
|
|
20
65
|
import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
|
|
21
|
-
import { C as
|
|
22
|
-
import { c as c3, a as a7, p as p5, r as r8, t as t7 } from "./vectors-
|
|
23
|
-
import { v as vertexPosition, a as getFaces, f as getVertices, d as getEdges, t as translate$1, p as propagateOrigins, h as applyMatrix$1, j as clone$1, k as describe$1, l as isEmpty$1, m as mirror$1, r as rotate$1, s as scale$1, n as simplify$1, o as toBREP$1, q as transformCopy$1, u as getBounds, c as getWires } from "./shapeFns-
|
|
24
|
-
import { w as w5, g as g10, e as e4, x as x3, i as i6, y as
|
|
25
|
-
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
|
|
26
|
-
import { j as j6, k as k8, l as
|
|
27
|
-
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-
|
|
28
|
-
import { a as a8, b as b9, e as e5, f as f7, d as d5, g as g11, j as j7, s as s4, t as t9, k as k9, l as
|
|
29
|
-
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-
|
|
30
|
-
import { l as
|
|
31
|
-
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-
|
|
32
|
-
import { c as c5, b as b10, e as e6, d as d7, f as f9 } from "./meshFns-
|
|
33
|
-
import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-
|
|
34
|
-
import { d as d8, e as e7, f as f10, g as g12, h as
|
|
35
|
-
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-
|
|
36
|
-
import { p as p7 } from "./surfaceBuilders-
|
|
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 as H2, 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-CVPwl2No.js";
|
|
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, f as getVertices, d as getEdges, t as translate$1, p as propagateOrigins, h as applyMatrix$1, j as clone$1, k as describe$1, l as isEmpty$1, m as mirror$1, r as rotate$1, s as scale$1, n as simplify$1, o as toBREP$1, q as transformCopy$1, u as getBounds, c as getWires } from "./shapeFns-QL3zx6uW.js";
|
|
69
|
+
import { w as w5, g as g10, e as e4, x as x3, i as i6, y as y3, z as z5, A as A4, B as B6, C as C6, D as D3 } from "./shapeFns-QL3zx6uW.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-D6SeHoCv.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-D6SeHoCv.js";
|
|
72
|
+
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-psR8Hqiz.js";
|
|
73
|
+
import { a as a8, b as b9, e as e5, f as f7, 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 w6 } from "./topology-psR8Hqiz.js";
|
|
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 f8, q as q5, r as r10, s as s5, p as p6, t as t10, v as v6, u as u5, h as h7 } from "./faceFns-DG4bu-QB.js";
|
|
76
|
+
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-Cw3IFJjg.js";
|
|
77
|
+
import { c as c5, b as b10, e as e6, d as d7, f as f9 } from "./meshFns-Cw3IFJjg.js";
|
|
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 e7, f as f10, g as g12, h as h8, i as i7 } 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-DYX6h68y.js";
|
|
81
|
+
import { p as p7 } from "./surfaceBuilders-DYX6h68y.js";
|
|
37
82
|
import { edgeFinder } from "./query.js";
|
|
38
83
|
import { BrepBugError, bug } from "./result.js";
|
|
39
|
-
import { c as c6 } from "./cornerFinder-
|
|
84
|
+
import { c as c6 } from "./cornerFinder-CypY3T_w.js";
|
|
40
85
|
import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
|
|
41
86
|
const errorFactories = {
|
|
42
87
|
OCCT_OPERATION: (code, message, cause) => ({ kind: "OCCT_OPERATION", code, message, cause }),
|
|
@@ -66,6 +111,17 @@ function kernelCallRaw(fn, code, message, kind = "OCCT_OPERATION") {
|
|
|
66
111
|
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e8));
|
|
67
112
|
}
|
|
68
113
|
}
|
|
114
|
+
function kernelCallScoped(fn, code, message, kind = "OCCT_OPERATION") {
|
|
115
|
+
var _stack = [];
|
|
116
|
+
try {
|
|
117
|
+
const scope = __using(_stack, new DisposalScope());
|
|
118
|
+
return kernelCall(() => fn(scope), code, message, kind);
|
|
119
|
+
} catch (_2) {
|
|
120
|
+
var _error = _2, _hasError = true;
|
|
121
|
+
} finally {
|
|
122
|
+
__callDispose(_stack, _error, _hasError);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
69
125
|
function isNumber(r11) {
|
|
70
126
|
return typeof r11 === "number";
|
|
71
127
|
}
|
|
@@ -320,13 +376,13 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
320
376
|
);
|
|
321
377
|
}
|
|
322
378
|
const w7 = bitmap.width;
|
|
323
|
-
const
|
|
324
|
-
if (w7 < 2 ||
|
|
379
|
+
const h9 = bitmap.height;
|
|
380
|
+
if (w7 < 2 || h9 < 2) {
|
|
325
381
|
bitmap.close();
|
|
326
382
|
return err(
|
|
327
383
|
validationError(
|
|
328
384
|
BrepErrorCode.SURFACE_GRID_TOO_SMALL,
|
|
329
|
-
`surfaceFromImage: image too small (${w7}x${
|
|
385
|
+
`surfaceFromImage: image too small (${w7}x${h9}), need at least 2x2`
|
|
330
386
|
)
|
|
331
387
|
);
|
|
332
388
|
}
|
|
@@ -339,7 +395,7 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
339
395
|
)
|
|
340
396
|
);
|
|
341
397
|
}
|
|
342
|
-
const canvas = new OffscreenCanvas(w7,
|
|
398
|
+
const canvas = new OffscreenCanvas(w7, h9);
|
|
343
399
|
const ctx = canvas.getContext("2d");
|
|
344
400
|
if (!ctx) {
|
|
345
401
|
bitmap.close();
|
|
@@ -349,13 +405,13 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
349
405
|
}
|
|
350
406
|
ctx.drawImage(bitmap, 0, 0);
|
|
351
407
|
bitmap.close();
|
|
352
|
-
const imageData = ctx.getImageData(0, 0, w7,
|
|
408
|
+
const imageData = ctx.getImageData(0, 0, w7, h9);
|
|
353
409
|
const data = imageData.data;
|
|
354
410
|
const rows = [];
|
|
355
|
-
for (let
|
|
411
|
+
for (let y4 = 0; y4 < h9; y4 += downsample) {
|
|
356
412
|
const row = [];
|
|
357
413
|
for (let x4 = 0; x4 < w7; x4 += downsample) {
|
|
358
|
-
const idx = (
|
|
414
|
+
const idx = (y4 * w7 + x4) * 4;
|
|
359
415
|
const r11 = data[idx] ?? 0;
|
|
360
416
|
const g13 = data[idx + 1] ?? 0;
|
|
361
417
|
const b11 = data[idx + 2] ?? 0;
|
|
@@ -427,56 +483,70 @@ function hull(shapes, options = {}) {
|
|
|
427
483
|
}
|
|
428
484
|
}
|
|
429
485
|
function detectSphere(shape2) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
486
|
+
var _stack = [];
|
|
487
|
+
try {
|
|
488
|
+
const oc = getKernel().oc;
|
|
489
|
+
const faces = getFaces(shape2);
|
|
490
|
+
if (faces.length !== 1) return null;
|
|
491
|
+
const face2 = faces[0];
|
|
492
|
+
const scope = __using(_stack, new DisposalScope());
|
|
493
|
+
const adaptor = scope.register(new oc.BRepAdaptor_Surface_2(face2.wrapped, true));
|
|
494
|
+
const surfType = adaptor.GetType();
|
|
495
|
+
if (surfType !== oc.GeomAbs_SurfaceType.GeomAbs_Sphere) return null;
|
|
496
|
+
const ocSphere = adaptor.Sphere();
|
|
497
|
+
const radius = ocSphere.Radius();
|
|
498
|
+
ocSphere.delete();
|
|
499
|
+
return radius;
|
|
500
|
+
} catch (_2) {
|
|
501
|
+
var _error = _2, _hasError = true;
|
|
502
|
+
} finally {
|
|
503
|
+
__callDispose(_stack, _error, _hasError);
|
|
504
|
+
}
|
|
442
505
|
}
|
|
443
506
|
function minkowskiSphere(shape2, radius, tolerance) {
|
|
444
|
-
|
|
445
|
-
const r11 = gcWithScope();
|
|
507
|
+
var _stack = [];
|
|
446
508
|
try {
|
|
447
|
-
const
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
509
|
+
const oc = getKernel().oc;
|
|
510
|
+
const scope = __using(_stack, new DisposalScope());
|
|
511
|
+
try {
|
|
512
|
+
const offsetMaker = scope.register(new oc.BRepOffsetAPI_MakeOffsetShape());
|
|
513
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
514
|
+
offsetMaker.PerformByJoin(
|
|
515
|
+
shape2.wrapped,
|
|
516
|
+
radius,
|
|
517
|
+
tolerance,
|
|
518
|
+
oc.BRepOffset_Mode.BRepOffset_Skin,
|
|
519
|
+
false,
|
|
520
|
+
false,
|
|
521
|
+
oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
522
|
+
false,
|
|
523
|
+
progress
|
|
524
|
+
);
|
|
525
|
+
const resultShape = offsetMaker.Shape();
|
|
526
|
+
const wrapped = castShape(resultShape);
|
|
527
|
+
if (!isShape3D(wrapped)) {
|
|
528
|
+
wrapped[Symbol.dispose]();
|
|
529
|
+
return err(
|
|
530
|
+
typeCastError(
|
|
531
|
+
BrepErrorCode.MINKOWSKI_NOT_3D,
|
|
532
|
+
"Minkowski sphere offset did not produce a 3D shape"
|
|
533
|
+
)
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return ok(wrapped);
|
|
537
|
+
} catch (e8) {
|
|
538
|
+
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
464
539
|
return err(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
"
|
|
468
|
-
)
|
|
540
|
+
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski sphere offset failed: ${raw}`, e8, {
|
|
541
|
+
operation: "minkowski",
|
|
542
|
+
fastPath: "sphere"
|
|
543
|
+
})
|
|
469
544
|
);
|
|
470
545
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski sphere offset failed: ${raw}`, e8, {
|
|
476
|
-
operation: "minkowski",
|
|
477
|
-
fastPath: "sphere"
|
|
478
|
-
})
|
|
479
|
-
);
|
|
546
|
+
} catch (_2) {
|
|
547
|
+
var _error = _2, _hasError = true;
|
|
548
|
+
} finally {
|
|
549
|
+
__callDispose(_stack, _error, _hasError);
|
|
480
550
|
}
|
|
481
551
|
}
|
|
482
552
|
function minkowskiGeneral(shape2, tool, tolerance) {
|
|
@@ -498,14 +568,28 @@ function minkowskiGeneral(shape2, tool, tolerance) {
|
|
|
498
568
|
}
|
|
499
569
|
const sumPoints = [];
|
|
500
570
|
for (const sv of shapeVerts) {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
const
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
571
|
+
var _stack2 = [];
|
|
572
|
+
try {
|
|
573
|
+
const scope1 = __using(_stack2, new DisposalScope());
|
|
574
|
+
const pa = scope1.register(oc.BRep_Tool.Pnt(sv.wrapped));
|
|
575
|
+
const ax = pa.X(), ay = pa.Y(), az = pa.Z();
|
|
576
|
+
for (const tv of toolVerts) {
|
|
577
|
+
var _stack = [];
|
|
578
|
+
try {
|
|
579
|
+
const scope2 = __using(_stack, new DisposalScope());
|
|
580
|
+
const pb = scope2.register(oc.BRep_Tool.Pnt(tv.wrapped));
|
|
581
|
+
const bx = pb.X(), by = pb.Y(), bz = pb.Z();
|
|
582
|
+
sumPoints.push({ x: ax + bx, y: ay + by, z: az + bz });
|
|
583
|
+
} catch (_2) {
|
|
584
|
+
var _error = _2, _hasError = true;
|
|
585
|
+
} finally {
|
|
586
|
+
__callDispose(_stack, _error, _hasError);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
} catch (_3) {
|
|
590
|
+
var _error2 = _3, _hasError2 = true;
|
|
591
|
+
} finally {
|
|
592
|
+
__callDispose(_stack2, _error2, _hasError2);
|
|
509
593
|
}
|
|
510
594
|
}
|
|
511
595
|
const kernel = getKernel();
|
|
@@ -586,7 +670,7 @@ function polyhedron(points, faces, options = {}) {
|
|
|
586
670
|
}
|
|
587
671
|
try {
|
|
588
672
|
const kernel = getKernel();
|
|
589
|
-
const ptObjs = points.map(([x4,
|
|
673
|
+
const ptObjs = points.map(([x4, y4, z6]) => ({ x: x4, y: y4, z: z6 }));
|
|
590
674
|
const resultOc = kernel.buildSolidFromFaces(ptObjs, triangles, tolerance);
|
|
591
675
|
const cast = castShape(resultOc);
|
|
592
676
|
if (!isSolid(cast)) {
|
|
@@ -610,48 +694,57 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
610
694
|
}
|
|
611
695
|
const { solid: solid2 = true, ruled = false, tolerance = 1e-6 } = options ?? {};
|
|
612
696
|
try {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
697
|
+
var _stack = [];
|
|
698
|
+
try {
|
|
699
|
+
const oc = getKernel().oc;
|
|
700
|
+
const scope = __using(_stack, new DisposalScope());
|
|
701
|
+
const adaptor = scope.register(new oc.BRepAdaptor_CompCurve_2(spine.wrapped, false));
|
|
702
|
+
const uFirst = Number(adaptor.FirstParameter());
|
|
703
|
+
const uLast = Number(adaptor.LastParameter());
|
|
704
|
+
const uRange = uLast - uFirst;
|
|
705
|
+
const params = sections.map((s6, i8) => {
|
|
706
|
+
if (s6.location !== void 0) {
|
|
707
|
+
return uFirst + s6.location * uRange;
|
|
708
|
+
}
|
|
709
|
+
return uFirst + i8 / (sections.length - 1) * uRange;
|
|
710
|
+
});
|
|
711
|
+
const builder = scope.register(new oc.BRepOffsetAPI_ThruSections(solid2, ruled, tolerance));
|
|
712
|
+
for (let i8 = 0; i8 < sections.length; i8++) {
|
|
713
|
+
const param = params[i8];
|
|
714
|
+
const section2 = sections[i8];
|
|
715
|
+
if (param === void 0 || section2 === void 0) continue;
|
|
716
|
+
const pnt = scope.register(new oc.gp_Pnt_1());
|
|
717
|
+
const tangent = scope.register(new oc.gp_Vec_1());
|
|
718
|
+
adaptor.D1(param, pnt, tangent);
|
|
719
|
+
const tangentDir = scope.register(new oc.gp_Dir_2(tangent));
|
|
720
|
+
const toAx3 = scope.register(new oc.gp_Ax3_4(pnt, tangentDir));
|
|
721
|
+
const trsf = scope.register(new oc.gp_Trsf_1());
|
|
722
|
+
trsf.SetTransformation_2(toAx3);
|
|
723
|
+
trsf.Invert();
|
|
724
|
+
const transformer = scope.register(
|
|
725
|
+
new oc.BRepBuilderAPI_Transform_2(section2.wire.wrapped, trsf, true)
|
|
726
|
+
);
|
|
727
|
+
const transformedShape = transformer.Shape();
|
|
728
|
+
const transformedWire = oc.TopoDS.Wire_1(transformedShape);
|
|
729
|
+
builder.AddWire(transformedWire);
|
|
622
730
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
const transformedShape = transformer.Shape();
|
|
640
|
-
const transformedWire = oc.TopoDS.Wire_1(transformedShape);
|
|
641
|
-
builder.AddWire(transformedWire);
|
|
642
|
-
}
|
|
643
|
-
const progress = r11(new oc.Message_ProgressRange_1());
|
|
644
|
-
builder.Build(progress);
|
|
645
|
-
if (!builder.IsDone()) {
|
|
646
|
-
return err(occtError(BrepErrorCode.MULTI_SWEEP_FAILED, "Multi-section sweep build failed"));
|
|
647
|
-
}
|
|
648
|
-
const result = castShape(builder.Shape());
|
|
649
|
-
if (!isShape3D(result)) {
|
|
650
|
-
return err(
|
|
651
|
-
typeCastError("MULTI_SWEEP_NOT_3D", "Multi-section sweep did not produce a 3D shape")
|
|
652
|
-
);
|
|
731
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
732
|
+
builder.Build(progress);
|
|
733
|
+
if (!builder.IsDone()) {
|
|
734
|
+
return err(occtError(BrepErrorCode.MULTI_SWEEP_FAILED, "Multi-section sweep build failed"));
|
|
735
|
+
}
|
|
736
|
+
const result = castShape(builder.Shape());
|
|
737
|
+
if (!isShape3D(result)) {
|
|
738
|
+
return err(
|
|
739
|
+
typeCastError("MULTI_SWEEP_NOT_3D", "Multi-section sweep did not produce a 3D shape")
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
return ok(result);
|
|
743
|
+
} catch (_2) {
|
|
744
|
+
var _error = _2, _hasError = true;
|
|
745
|
+
} finally {
|
|
746
|
+
__callDispose(_stack, _error, _hasError);
|
|
653
747
|
}
|
|
654
|
-
return ok(result);
|
|
655
748
|
} catch (e8) {
|
|
656
749
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
657
750
|
return err(
|
|
@@ -662,36 +755,43 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
662
755
|
function guidedSweep(profile, spine, guides, options = {}) {
|
|
663
756
|
const { transition = "transformed", solid: solid2 = true, tolerance } = options;
|
|
664
757
|
try {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
builder.
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
758
|
+
var _stack = [];
|
|
759
|
+
try {
|
|
760
|
+
const oc = getKernel().oc;
|
|
761
|
+
const scope = __using(_stack, new DisposalScope());
|
|
762
|
+
const builder = scope.register(new oc.BRepOffsetAPI_MakePipeShell(spine.wrapped));
|
|
763
|
+
const modeMap = {
|
|
764
|
+
transformed: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_Transformed,
|
|
765
|
+
round: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_RoundCorner,
|
|
766
|
+
right: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_RightCorner
|
|
767
|
+
};
|
|
768
|
+
builder.SetTransitionMode(modeMap[transition]);
|
|
769
|
+
if (tolerance !== void 0) {
|
|
770
|
+
builder.SetTolerance(tolerance, tolerance, 1e-7);
|
|
771
|
+
}
|
|
772
|
+
if (guides.length > 0) {
|
|
773
|
+
const firstGuide = guides[0];
|
|
774
|
+
builder.SetMode_5(firstGuide.wrapped, false, oc.BRepFill_TypeOfContact.BRepFill_NoContact);
|
|
775
|
+
}
|
|
776
|
+
builder.Add_1(profile.wrapped, false, false);
|
|
777
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
778
|
+
builder.Build(progress);
|
|
779
|
+
if (!builder.IsDone()) {
|
|
780
|
+
return err(occtError(BrepErrorCode.GUIDED_SWEEP_FAILED, "Guided sweep build failed"));
|
|
781
|
+
}
|
|
782
|
+
if (solid2) {
|
|
783
|
+
builder.MakeSolid();
|
|
784
|
+
}
|
|
785
|
+
const result = castShape(builder.Shape());
|
|
786
|
+
if (!isShape3D(result)) {
|
|
787
|
+
return err(typeCastError("GUIDED_SWEEP_NOT_3D", "Guided sweep did not produce a 3D shape"));
|
|
788
|
+
}
|
|
789
|
+
return ok(result);
|
|
790
|
+
} catch (_2) {
|
|
791
|
+
var _error = _2, _hasError = true;
|
|
792
|
+
} finally {
|
|
793
|
+
__callDispose(_stack, _error, _hasError);
|
|
693
794
|
}
|
|
694
|
-
return ok(result);
|
|
695
795
|
} catch (e8) {
|
|
696
796
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
697
797
|
return err(occtError(BrepErrorCode.GUIDED_SWEEP_FAILED, `Guided sweep failed: ${raw}`, e8));
|
|
@@ -704,8 +804,8 @@ function cross2(ax, ay, bx, by) {
|
|
|
704
804
|
function dot2(ax, ay, bx, by) {
|
|
705
805
|
return ax * bx + ay * by;
|
|
706
806
|
}
|
|
707
|
-
function len2(x4,
|
|
708
|
-
return Math.sqrt(x4 * x4 +
|
|
807
|
+
function len2(x4, y4) {
|
|
808
|
+
return Math.sqrt(x4 * x4 + y4 * y4);
|
|
709
809
|
}
|
|
710
810
|
function polyAt(poly, i8) {
|
|
711
811
|
const p8 = poly[(i8 % poly.length + poly.length) % poly.length];
|
|
@@ -845,8 +945,8 @@ function computeEvents(lavNodes) {
|
|
|
845
945
|
const t11 = bisectorIntersectTime(node, node.next);
|
|
846
946
|
if (t11 !== null && t11 > EPS) {
|
|
847
947
|
const x4 = node.x + t11 * node.bx;
|
|
848
|
-
const
|
|
849
|
-
events.push({ time: t11, x: x4, y:
|
|
948
|
+
const y4 = node.y + t11 * node.by;
|
|
949
|
+
events.push({ time: t11, x: x4, y: y4, nodeA: node, nodeB: node.next, type: "edge" });
|
|
850
950
|
}
|
|
851
951
|
if (isLavNodeReflex(node)) {
|
|
852
952
|
let cur = node.next.next;
|
|
@@ -855,8 +955,8 @@ function computeEvents(lavNodes) {
|
|
|
855
955
|
const st = raySplitTime(node, cur, cur.next);
|
|
856
956
|
if (st !== null && st > EPS) {
|
|
857
957
|
const x4 = node.x + st * node.bx;
|
|
858
|
-
const
|
|
859
|
-
events.push({ time: st, x: x4, y:
|
|
958
|
+
const y4 = node.y + st * node.by;
|
|
959
|
+
events.push({ time: st, x: x4, y: y4, nodeA: node, nodeB: cur, type: "split" });
|
|
860
960
|
}
|
|
861
961
|
cur = cur.next;
|
|
862
962
|
count++;
|
|
@@ -1524,10 +1624,10 @@ async function importOBJ(blob) {
|
|
|
1524
1624
|
if (line2.startsWith("v ")) {
|
|
1525
1625
|
const parts = line2.split(/\s+/);
|
|
1526
1626
|
const x4 = parseFloat(parts[1] ?? "");
|
|
1527
|
-
const
|
|
1627
|
+
const y4 = parseFloat(parts[2] ?? "");
|
|
1528
1628
|
const z6 = parseFloat(parts[3] ?? "");
|
|
1529
|
-
if (isNaN(x4) || isNaN(
|
|
1530
|
-
vertices.push([x4,
|
|
1629
|
+
if (isNaN(x4) || isNaN(y4) || isNaN(z6)) continue;
|
|
1630
|
+
vertices.push([x4, y4, z6]);
|
|
1531
1631
|
} else if (line2.startsWith("f ")) {
|
|
1532
1632
|
const parts = line2.split(/\s+/).slice(1);
|
|
1533
1633
|
const indices = [];
|
|
@@ -1766,15 +1866,22 @@ function resolve3D(s6) {
|
|
|
1766
1866
|
return resolve(s6);
|
|
1767
1867
|
}
|
|
1768
1868
|
function box(width, depth, height, options) {
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1869
|
+
var _stack = [];
|
|
1870
|
+
try {
|
|
1871
|
+
const oc = getKernel().oc;
|
|
1872
|
+
const scope = __using(_stack, new DisposalScope());
|
|
1873
|
+
const maker = scope.register(new oc.BRepPrimAPI_MakeBox_2(width, depth, height));
|
|
1874
|
+
const solid2 = createSolid(maker.Solid());
|
|
1875
|
+
const center = options?.at ?? (options?.centered ? [0, 0, 0] : void 0);
|
|
1876
|
+
if (center) {
|
|
1877
|
+
return translate$1(solid2, [center[0] - width / 2, center[1] - depth / 2, center[2] - height / 2]);
|
|
1878
|
+
}
|
|
1879
|
+
return solid2;
|
|
1880
|
+
} catch (_2) {
|
|
1881
|
+
var _error = _2, _hasError = true;
|
|
1882
|
+
} finally {
|
|
1883
|
+
__callDispose(_stack, _error, _hasError);
|
|
1776
1884
|
}
|
|
1777
|
-
return solid2;
|
|
1778
1885
|
}
|
|
1779
1886
|
function cylinder(radius, height, options) {
|
|
1780
1887
|
const at = options?.at ?? [0, 0, 0];
|
|
@@ -1909,18 +2016,25 @@ function thicken$1(shape2, thickness) {
|
|
|
1909
2016
|
const check = validateNotNull(shape2, "thicken: shape");
|
|
1910
2017
|
if (isErr(check)) return check;
|
|
1911
2018
|
try {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2019
|
+
var _stack = [];
|
|
2020
|
+
try {
|
|
2021
|
+
const oc = getKernel().oc;
|
|
2022
|
+
const scope = __using(_stack, new DisposalScope());
|
|
2023
|
+
const builder = scope.register(new oc.BRepOffsetAPI_MakeThickSolid());
|
|
2024
|
+
builder.MakeThickSolidBySimple(shape2.wrapped, thickness);
|
|
2025
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
2026
|
+
builder.Build(progress);
|
|
2027
|
+
const resultOc = builder.Shape();
|
|
2028
|
+
const cast = castShape(resultOc);
|
|
2029
|
+
propagateOrigins(builder, [shape2], cast);
|
|
2030
|
+
propagateFaceTags(builder, [shape2], cast);
|
|
2031
|
+
propagateColors(builder, [shape2], cast);
|
|
2032
|
+
return ok(cast);
|
|
2033
|
+
} catch (_2) {
|
|
2034
|
+
var _error = _2, _hasError = true;
|
|
2035
|
+
} finally {
|
|
2036
|
+
__callDispose(_stack, _error, _hasError);
|
|
2037
|
+
}
|
|
1924
2038
|
} catch (e8) {
|
|
1925
2039
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
1926
2040
|
return err(occtError("THICKEN_FAILED", `Thicken operation failed: ${raw}`, e8));
|
|
@@ -1964,29 +2078,36 @@ function fillet$1(shape2, edges, radius) {
|
|
|
1964
2078
|
);
|
|
1965
2079
|
}
|
|
1966
2080
|
try {
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
2081
|
+
var _stack = [];
|
|
2082
|
+
try {
|
|
2083
|
+
const oc = getKernel().oc;
|
|
2084
|
+
const scope = __using(_stack, new DisposalScope());
|
|
2085
|
+
const builder = scope.register(
|
|
2086
|
+
new oc.BRepFilletAPI_MakeFillet(shape2.wrapped, oc.ChFi3d_FilletShape.ChFi3d_Rational)
|
|
2087
|
+
);
|
|
2088
|
+
for (const edge of selectedEdges) {
|
|
2089
|
+
const rad = typeof radius === "function" ? radius(edge) ?? 0 : radius;
|
|
2090
|
+
if (typeof rad === "number") {
|
|
2091
|
+
if (rad > 0) builder.Add_2(rad, edge.wrapped);
|
|
2092
|
+
} else {
|
|
2093
|
+
const [r1, r22] = rad;
|
|
2094
|
+
if (r1 > 0 && r22 > 0) builder.Add_3(r1, r22, edge.wrapped);
|
|
2095
|
+
}
|
|
1979
2096
|
}
|
|
2097
|
+
const resultOc = builder.Shape();
|
|
2098
|
+
const cast = castShape(resultOc);
|
|
2099
|
+
if (!isShape3D(cast)) {
|
|
2100
|
+
return err(occtError(BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
2101
|
+
}
|
|
2102
|
+
propagateOrigins(builder, [shape2], cast);
|
|
2103
|
+
propagateFaceTags(builder, [shape2], cast);
|
|
2104
|
+
propagateColors(builder, [shape2], cast);
|
|
2105
|
+
return ok(cast);
|
|
2106
|
+
} catch (_2) {
|
|
2107
|
+
var _error = _2, _hasError = true;
|
|
2108
|
+
} finally {
|
|
2109
|
+
__callDispose(_stack, _error, _hasError);
|
|
1980
2110
|
}
|
|
1981
|
-
const resultOc = builder.Shape();
|
|
1982
|
-
const cast = castShape(resultOc);
|
|
1983
|
-
if (!isShape3D(cast)) {
|
|
1984
|
-
return err(occtError(BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
1985
|
-
}
|
|
1986
|
-
propagateOrigins(builder, [shape2], cast);
|
|
1987
|
-
propagateFaceTags(builder, [shape2], cast);
|
|
1988
|
-
propagateColors(builder, [shape2], cast);
|
|
1989
|
-
return ok(cast);
|
|
1990
2111
|
} catch (e8) {
|
|
1991
2112
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
1992
2113
|
return err(
|
|
@@ -2028,61 +2149,68 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
2028
2149
|
return err(validationError(BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
2029
2150
|
}
|
|
2030
2151
|
try {
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
oc.
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
while (faceExp.More()) {
|
|
2040
|
-
const face2 = oc.TopoDS.Face_1(faceExp.Current());
|
|
2041
|
-
const edgeExp = new oc.TopExp_Explorer_2(
|
|
2042
|
-
face2,
|
|
2043
|
-
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
2152
|
+
var _stack = [];
|
|
2153
|
+
try {
|
|
2154
|
+
let getEdgeFaceMap = function() {
|
|
2155
|
+
if (edgeFaceMap) return edgeFaceMap;
|
|
2156
|
+
edgeFaceMap = /* @__PURE__ */ new Map();
|
|
2157
|
+
const faceExp = new oc.TopExp_Explorer_2(
|
|
2158
|
+
shape2.wrapped,
|
|
2159
|
+
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
2044
2160
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
2045
2161
|
);
|
|
2046
|
-
while (
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
|
|
2162
|
+
while (faceExp.More()) {
|
|
2163
|
+
const face2 = oc.TopoDS.Face_1(faceExp.Current());
|
|
2164
|
+
const edgeExp = new oc.TopExp_Explorer_2(
|
|
2165
|
+
face2,
|
|
2166
|
+
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
2167
|
+
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
2168
|
+
);
|
|
2169
|
+
while (edgeExp.More()) {
|
|
2170
|
+
const hash = edgeExp.Current().HashCode(2147483647);
|
|
2171
|
+
if (!edgeFaceMap.has(hash)) {
|
|
2172
|
+
edgeFaceMap.set(hash, face2);
|
|
2173
|
+
}
|
|
2174
|
+
edgeExp.Next();
|
|
2050
2175
|
}
|
|
2051
|
-
edgeExp.
|
|
2176
|
+
edgeExp.delete();
|
|
2177
|
+
faceExp.Next();
|
|
2052
2178
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
if (face2) {
|
|
2072
|
-
builder.Add_3(d1, d22, oc.TopoDS.Edge_1(edge.wrapped), face2);
|
|
2179
|
+
faceExp.delete();
|
|
2180
|
+
return edgeFaceMap;
|
|
2181
|
+
};
|
|
2182
|
+
const oc = getKernel().oc;
|
|
2183
|
+
const scope = __using(_stack, new DisposalScope());
|
|
2184
|
+
const builder = scope.register(new oc.BRepFilletAPI_MakeChamfer(shape2.wrapped));
|
|
2185
|
+
let edgeFaceMap = null;
|
|
2186
|
+
for (const edge of selectedEdges) {
|
|
2187
|
+
const d9 = typeof distance === "function" ? distance(edge) ?? 0 : distance;
|
|
2188
|
+
if (typeof d9 === "number") {
|
|
2189
|
+
if (d9 > 0) builder.Add_2(d9, edge.wrapped);
|
|
2190
|
+
} else {
|
|
2191
|
+
const [d1, d22] = d9;
|
|
2192
|
+
if (d1 > 0 && d22 > 0) {
|
|
2193
|
+
const face2 = getEdgeFaceMap().get(edge.wrapped.HashCode(2147483647));
|
|
2194
|
+
if (face2) {
|
|
2195
|
+
builder.Add_3(d1, d22, oc.TopoDS.Edge_1(edge.wrapped), face2);
|
|
2196
|
+
}
|
|
2073
2197
|
}
|
|
2074
2198
|
}
|
|
2075
2199
|
}
|
|
2200
|
+
const resultOc = builder.Shape();
|
|
2201
|
+
const cast = castShape(resultOc);
|
|
2202
|
+
if (!isShape3D(cast)) {
|
|
2203
|
+
return err(occtError(BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
2204
|
+
}
|
|
2205
|
+
propagateOrigins(builder, [shape2], cast);
|
|
2206
|
+
propagateFaceTags(builder, [shape2], cast);
|
|
2207
|
+
propagateColors(builder, [shape2], cast);
|
|
2208
|
+
return ok(cast);
|
|
2209
|
+
} catch (_2) {
|
|
2210
|
+
var _error = _2, _hasError = true;
|
|
2211
|
+
} finally {
|
|
2212
|
+
__callDispose(_stack, _error, _hasError);
|
|
2076
2213
|
}
|
|
2077
|
-
const resultOc = builder.Shape();
|
|
2078
|
-
const cast = castShape(resultOc);
|
|
2079
|
-
if (!isShape3D(cast)) {
|
|
2080
|
-
return err(occtError(BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
2081
|
-
}
|
|
2082
|
-
propagateOrigins(builder, [shape2], cast);
|
|
2083
|
-
propagateFaceTags(builder, [shape2], cast);
|
|
2084
|
-
propagateColors(builder, [shape2], cast);
|
|
2085
|
-
return ok(cast);
|
|
2086
2214
|
} catch (e8) {
|
|
2087
2215
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
2088
2216
|
return err(
|
|
@@ -2104,35 +2232,42 @@ function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
|
|
|
2104
2232
|
return err(validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
2105
2233
|
}
|
|
2106
2234
|
try {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
facesToRemove.
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2235
|
+
var _stack = [];
|
|
2236
|
+
try {
|
|
2237
|
+
const oc = getKernel().oc;
|
|
2238
|
+
const scope = __using(_stack, new DisposalScope());
|
|
2239
|
+
const facesToRemove = scope.register(new oc.TopTools_ListOfShape_1());
|
|
2240
|
+
for (const face2 of faces) {
|
|
2241
|
+
facesToRemove.Append_1(face2.wrapped);
|
|
2242
|
+
}
|
|
2243
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
2244
|
+
const builder = scope.register(new oc.BRepOffsetAPI_MakeThickSolid());
|
|
2245
|
+
builder.MakeThickSolidByJoin(
|
|
2246
|
+
shape2.wrapped,
|
|
2247
|
+
facesToRemove,
|
|
2248
|
+
-thickness,
|
|
2249
|
+
tolerance,
|
|
2250
|
+
oc.BRepOffset_Mode.BRepOffset_Skin,
|
|
2251
|
+
false,
|
|
2252
|
+
false,
|
|
2253
|
+
oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
2254
|
+
false,
|
|
2255
|
+
progress
|
|
2256
|
+
);
|
|
2257
|
+
const resultOc = builder.Shape();
|
|
2258
|
+
const cast = castShape(resultOc);
|
|
2259
|
+
if (!isShape3D(cast)) {
|
|
2260
|
+
return err(occtError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
2261
|
+
}
|
|
2262
|
+
propagateOrigins(builder, [shape2], cast);
|
|
2263
|
+
propagateFaceTags(builder, [shape2], cast);
|
|
2264
|
+
propagateColors(builder, [shape2], cast);
|
|
2265
|
+
return ok(cast);
|
|
2266
|
+
} catch (_2) {
|
|
2267
|
+
var _error = _2, _hasError = true;
|
|
2268
|
+
} finally {
|
|
2269
|
+
__callDispose(_stack, _error, _hasError);
|
|
2131
2270
|
}
|
|
2132
|
-
propagateOrigins(builder, [shape2], cast);
|
|
2133
|
-
propagateFaceTags(builder, [shape2], cast);
|
|
2134
|
-
propagateColors(builder, [shape2], cast);
|
|
2135
|
-
return ok(cast);
|
|
2136
2271
|
} catch (e8) {
|
|
2137
2272
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
2138
2273
|
return err(
|
|
@@ -2151,30 +2286,37 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
|
2151
2286
|
return err(validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
2152
2287
|
}
|
|
2153
2288
|
try {
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2289
|
+
var _stack = [];
|
|
2290
|
+
try {
|
|
2291
|
+
const oc = getKernel().oc;
|
|
2292
|
+
const scope = __using(_stack, new DisposalScope());
|
|
2293
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
2294
|
+
const builder = scope.register(new oc.BRepOffsetAPI_MakeOffsetShape());
|
|
2295
|
+
builder.PerformByJoin(
|
|
2296
|
+
shape2.wrapped,
|
|
2297
|
+
distance,
|
|
2298
|
+
tolerance,
|
|
2299
|
+
oc.BRepOffset_Mode.BRepOffset_Skin,
|
|
2300
|
+
false,
|
|
2301
|
+
false,
|
|
2302
|
+
oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
2303
|
+
false,
|
|
2304
|
+
progress
|
|
2305
|
+
);
|
|
2306
|
+
const resultOc = builder.Shape();
|
|
2307
|
+
const cast = castShape(resultOc);
|
|
2308
|
+
if (!isShape3D(cast)) {
|
|
2309
|
+
return err(occtError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
2310
|
+
}
|
|
2311
|
+
propagateOrigins(builder, [shape2], cast);
|
|
2312
|
+
propagateFaceTags(builder, [shape2], cast);
|
|
2313
|
+
propagateColors(builder, [shape2], cast);
|
|
2314
|
+
return ok(cast);
|
|
2315
|
+
} catch (_2) {
|
|
2316
|
+
var _error = _2, _hasError = true;
|
|
2317
|
+
} finally {
|
|
2318
|
+
__callDispose(_stack, _error, _hasError);
|
|
2173
2319
|
}
|
|
2174
|
-
propagateOrigins(builder, [shape2], cast);
|
|
2175
|
-
propagateFaceTags(builder, [shape2], cast);
|
|
2176
|
-
propagateColors(builder, [shape2], cast);
|
|
2177
|
-
return ok(cast);
|
|
2178
2320
|
} catch (e8) {
|
|
2179
2321
|
const raw = e8 instanceof Error ? e8.message : String(e8);
|
|
2180
2322
|
return err(occtError("OFFSET_FAILED", `Offset operation failed: ${raw}`, e8));
|
|
@@ -2333,35 +2475,42 @@ function isEmpty(shape2) {
|
|
|
2333
2475
|
return isEmpty$1(resolve(shape2));
|
|
2334
2476
|
}
|
|
2335
2477
|
function loft$1(wires, { ruled = true, startPoint, endPoint } = {}, returnShell = false) {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
const
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2478
|
+
var _stack = [];
|
|
2479
|
+
try {
|
|
2480
|
+
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
2481
|
+
return err(validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
2482
|
+
}
|
|
2483
|
+
const oc = getKernel().oc;
|
|
2484
|
+
const scope = __using(_stack, new DisposalScope());
|
|
2485
|
+
const builder = scope.register(new oc.BRepOffsetAPI_ThruSections(!returnShell, ruled, 1e-6));
|
|
2486
|
+
if (startPoint) {
|
|
2487
|
+
const pnt = scope.register(toOcPnt(toVec3(startPoint)));
|
|
2488
|
+
const vMaker = scope.register(new oc.BRepBuilderAPI_MakeVertex(pnt));
|
|
2489
|
+
builder.AddVertex(vMaker.Vertex());
|
|
2490
|
+
}
|
|
2491
|
+
for (const w7 of wires) {
|
|
2492
|
+
builder.AddWire(w7.wrapped);
|
|
2493
|
+
}
|
|
2494
|
+
if (endPoint) {
|
|
2495
|
+
const pnt = scope.register(toOcPnt(toVec3(endPoint)));
|
|
2496
|
+
const vMaker = scope.register(new oc.BRepBuilderAPI_MakeVertex(pnt));
|
|
2497
|
+
builder.AddVertex(vMaker.Vertex());
|
|
2498
|
+
}
|
|
2499
|
+
const progress = scope.register(new oc.Message_ProgressRange_1());
|
|
2500
|
+
builder.Build(progress);
|
|
2501
|
+
if (!builder.IsDone()) {
|
|
2502
|
+
return err(occtError("LOFT_FAILED", "Loft operation failed"));
|
|
2503
|
+
}
|
|
2504
|
+
const result = castShape(builder.Shape());
|
|
2505
|
+
if (!isShape3D(result)) {
|
|
2506
|
+
return err(typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
2507
|
+
}
|
|
2508
|
+
return ok(result);
|
|
2509
|
+
} catch (_2) {
|
|
2510
|
+
var _error = _2, _hasError = true;
|
|
2511
|
+
} finally {
|
|
2512
|
+
__callDispose(_stack, _error, _hasError);
|
|
2363
2513
|
}
|
|
2364
|
-
return ok(result);
|
|
2365
2514
|
}
|
|
2366
2515
|
function extrude(face2, height) {
|
|
2367
2516
|
const f11 = resolve(face2);
|
|
@@ -2385,7 +2534,9 @@ function resolveTargetFace(shape2, faceSpec) {
|
|
|
2385
2534
|
if (faceSpec === void 0) {
|
|
2386
2535
|
const faces = getFaces(shape2);
|
|
2387
2536
|
if (faces.length === 0) {
|
|
2388
|
-
|
|
2537
|
+
return err(
|
|
2538
|
+
validationError(BrepErrorCode.COMPOUND_NO_FACES, "compoundOps: shape has no faces")
|
|
2539
|
+
);
|
|
2389
2540
|
}
|
|
2390
2541
|
let best = faces[0];
|
|
2391
2542
|
let bestZ = faceCenter(best)[2];
|
|
@@ -2397,17 +2548,22 @@ function resolveTargetFace(shape2, faceSpec) {
|
|
|
2397
2548
|
bestZ = z6;
|
|
2398
2549
|
}
|
|
2399
2550
|
}
|
|
2400
|
-
return best;
|
|
2551
|
+
return ok(best);
|
|
2401
2552
|
}
|
|
2402
2553
|
if (typeof faceSpec === "function") {
|
|
2403
2554
|
const finder = faceSpec(faceFinder());
|
|
2404
2555
|
const found = finder.findAll(shape2);
|
|
2405
2556
|
if (found.length === 0) {
|
|
2406
|
-
|
|
2557
|
+
return err(
|
|
2558
|
+
queryError(
|
|
2559
|
+
BrepErrorCode.COMPOUND_FACE_NOT_FOUND,
|
|
2560
|
+
"compoundOps: face finder matched no faces"
|
|
2561
|
+
)
|
|
2562
|
+
);
|
|
2407
2563
|
}
|
|
2408
|
-
return found[0];
|
|
2564
|
+
return ok(found[0]);
|
|
2409
2565
|
}
|
|
2410
|
-
return faceSpec;
|
|
2566
|
+
return ok(faceSpec);
|
|
2411
2567
|
}
|
|
2412
2568
|
function toWire(profile) {
|
|
2413
2569
|
if ("sketchOnPlane" in profile && typeof profile.sketchOnPlane === "function") {
|
|
@@ -2446,7 +2602,9 @@ function pocket(shape2, options) {
|
|
|
2446
2602
|
if (depth <= 0) {
|
|
2447
2603
|
return err(validationError("POCKET_INVALID_DEPTH", "Pocket depth must be positive"));
|
|
2448
2604
|
}
|
|
2449
|
-
const
|
|
2605
|
+
const targetResult = resolveTargetFace(s6, options.face);
|
|
2606
|
+
if (isErr(targetResult)) return targetResult;
|
|
2607
|
+
const targetFace = targetResult.value;
|
|
2450
2608
|
const normal = normalAt(targetFace);
|
|
2451
2609
|
const w7 = toWire(profile);
|
|
2452
2610
|
const faceResult = makeFace(w7);
|
|
@@ -2462,7 +2620,9 @@ function boss(shape2, options) {
|
|
|
2462
2620
|
if (height <= 0) {
|
|
2463
2621
|
return err(validationError("BOSS_INVALID_HEIGHT", "Boss height must be positive"));
|
|
2464
2622
|
}
|
|
2465
|
-
const
|
|
2623
|
+
const targetResult = resolveTargetFace(s6, options.face);
|
|
2624
|
+
if (isErr(targetResult)) return targetResult;
|
|
2625
|
+
const targetFace = targetResult.value;
|
|
2466
2626
|
const normal = normalAt(targetFace);
|
|
2467
2627
|
const w7 = toWire(profile);
|
|
2468
2628
|
const faceResult = makeFace(w7);
|
|
@@ -2676,20 +2836,20 @@ function shape(s6) {
|
|
|
2676
2836
|
throw new Error("shape() requires a Sketch or branded shape type");
|
|
2677
2837
|
}
|
|
2678
2838
|
export {
|
|
2679
|
-
|
|
2680
|
-
|
|
2839
|
+
B4 as BaseSketcher2d,
|
|
2840
|
+
B2 as Blueprint,
|
|
2681
2841
|
a5 as BlueprintSketcher,
|
|
2682
2842
|
e2 as Blueprints,
|
|
2683
2843
|
d2 as BoundingBox2d,
|
|
2684
2844
|
BrepBugError,
|
|
2685
2845
|
BrepErrorCode,
|
|
2686
2846
|
BrepWrapperError,
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2847
|
+
C4 as CompoundBlueprint,
|
|
2848
|
+
C5 as CompoundSketch,
|
|
2849
|
+
C2 as Curve2D,
|
|
2690
2850
|
DEG2RAD,
|
|
2691
|
-
|
|
2692
|
-
|
|
2851
|
+
DisposalScope,
|
|
2852
|
+
D2 as Drawing,
|
|
2693
2853
|
a6 as DrawingPen,
|
|
2694
2854
|
F as FaceSketcher,
|
|
2695
2855
|
H as HASH_CODE_MAX,
|
|
@@ -2707,7 +2867,7 @@ export {
|
|
|
2707
2867
|
j6 as applyGlue,
|
|
2708
2868
|
applyMatrix,
|
|
2709
2869
|
j3 as approximateCurve,
|
|
2710
|
-
|
|
2870
|
+
l8 as asTopo,
|
|
2711
2871
|
b9 as autoHeal,
|
|
2712
2872
|
r4 as axis2d,
|
|
2713
2873
|
b6 as basicFaceExtrusion,
|
|
@@ -2727,13 +2887,13 @@ export {
|
|
|
2727
2887
|
checkInterference,
|
|
2728
2888
|
circle,
|
|
2729
2889
|
circularPattern,
|
|
2730
|
-
|
|
2890
|
+
m8 as classifyPointOnFace,
|
|
2731
2891
|
c5 as clearMeshCache,
|
|
2732
2892
|
clone,
|
|
2733
2893
|
c as collect,
|
|
2734
2894
|
d3 as collectShapes,
|
|
2735
2895
|
k8 as colorFaces,
|
|
2736
|
-
|
|
2896
|
+
l6 as colorShape,
|
|
2737
2897
|
f4 as complexExtrude,
|
|
2738
2898
|
w5 as composeTransforms,
|
|
2739
2899
|
compound,
|
|
@@ -2746,14 +2906,14 @@ export {
|
|
|
2746
2906
|
cone,
|
|
2747
2907
|
c6 as cornerFinder,
|
|
2748
2908
|
g6 as countNodes,
|
|
2749
|
-
|
|
2909
|
+
h5 as createAssembly,
|
|
2750
2910
|
i4 as createAssemblyNode,
|
|
2751
2911
|
createBlueprint,
|
|
2752
2912
|
Z as createCamera,
|
|
2753
|
-
|
|
2913
|
+
t3 as createCompound,
|
|
2754
2914
|
d8 as createDistanceQuery,
|
|
2755
|
-
|
|
2756
|
-
|
|
2915
|
+
r3 as createEdge,
|
|
2916
|
+
s2 as createFace,
|
|
2757
2917
|
a2 as createHandle,
|
|
2758
2918
|
j4 as createHistory,
|
|
2759
2919
|
b10 as createMeshCache,
|
|
@@ -2762,10 +2922,10 @@ export {
|
|
|
2762
2922
|
createOperationRegistry,
|
|
2763
2923
|
a7 as createPlane,
|
|
2764
2924
|
k5 as createRegistry,
|
|
2765
|
-
|
|
2925
|
+
z2 as createShell,
|
|
2766
2926
|
createSolid,
|
|
2767
2927
|
createTaskQueue,
|
|
2768
|
-
|
|
2928
|
+
u as createVertex,
|
|
2769
2929
|
createWire,
|
|
2770
2930
|
createWorkerClient,
|
|
2771
2931
|
createWorkerHandler,
|
|
@@ -2781,38 +2941,38 @@ export {
|
|
|
2781
2941
|
curveIsClosed,
|
|
2782
2942
|
k4 as curveIsPeriodic,
|
|
2783
2943
|
curveLength,
|
|
2784
|
-
|
|
2944
|
+
l3 as curvePeriod,
|
|
2785
2945
|
curvePointAt,
|
|
2786
2946
|
curveStartPoint,
|
|
2787
2947
|
curveTangentAt,
|
|
2788
2948
|
cut,
|
|
2789
2949
|
f5 as cut2D,
|
|
2790
2950
|
cutAll,
|
|
2791
|
-
|
|
2951
|
+
l4 as cutBlueprints,
|
|
2792
2952
|
cylinder,
|
|
2793
2953
|
dequeueTask,
|
|
2794
2954
|
describe,
|
|
2795
2955
|
g9 as deserializeDrawing,
|
|
2796
2956
|
fromBREP$1 as deserializeShape,
|
|
2797
2957
|
d6 as downcast,
|
|
2798
|
-
|
|
2958
|
+
h6 as draw,
|
|
2799
2959
|
i5 as drawCircle,
|
|
2800
2960
|
j5 as drawEllipse,
|
|
2801
2961
|
k7 as drawFaceOutline,
|
|
2802
|
-
|
|
2803
|
-
|
|
2962
|
+
l5 as drawParametricFunction,
|
|
2963
|
+
m6 as drawPointsInterpolation,
|
|
2804
2964
|
n6 as drawPolysides,
|
|
2805
|
-
|
|
2965
|
+
o6 as drawProjection,
|
|
2806
2966
|
p4 as drawRectangle,
|
|
2807
|
-
|
|
2967
|
+
q3 as drawRoundedRectangle,
|
|
2808
2968
|
r7 as drawSingleCircle,
|
|
2809
2969
|
s3 as drawSingleEllipse,
|
|
2810
2970
|
t6 as drawText,
|
|
2811
|
-
|
|
2971
|
+
u3 as drawingChamfer,
|
|
2812
2972
|
v4 as drawingCut,
|
|
2813
2973
|
w4 as drawingFillet,
|
|
2814
2974
|
x2 as drawingFuse,
|
|
2815
|
-
|
|
2975
|
+
y2 as drawingIntersect,
|
|
2816
2976
|
z4 as drawingToSketchOnPlane,
|
|
2817
2977
|
drill,
|
|
2818
2978
|
edgeFinder,
|
|
@@ -2822,7 +2982,7 @@ export {
|
|
|
2822
2982
|
ellipsoid,
|
|
2823
2983
|
enqueueTask,
|
|
2824
2984
|
err,
|
|
2825
|
-
|
|
2985
|
+
m5 as exportAssemblySTEP,
|
|
2826
2986
|
exportDXF,
|
|
2827
2987
|
exportGlb,
|
|
2828
2988
|
exportGltf,
|
|
@@ -2836,18 +2996,18 @@ export {
|
|
|
2836
2996
|
faceCenter,
|
|
2837
2997
|
faceFinder,
|
|
2838
2998
|
f8 as faceGeomType,
|
|
2839
|
-
|
|
2999
|
+
q5 as faceOrientation,
|
|
2840
3000
|
f7 as facesOfEdge,
|
|
2841
3001
|
p7 as fill,
|
|
2842
3002
|
filledFace,
|
|
2843
3003
|
fillet,
|
|
2844
3004
|
f3 as findCurveType,
|
|
2845
|
-
|
|
3005
|
+
m7 as findFacesByTag,
|
|
2846
3006
|
n4 as findNode,
|
|
2847
|
-
|
|
3007
|
+
o4 as findStep,
|
|
2848
3008
|
f as flatMap,
|
|
2849
3009
|
r10 as flipFaceOrientation,
|
|
2850
|
-
|
|
3010
|
+
m4 as flipOrientation,
|
|
2851
3011
|
_ as fontMetrics,
|
|
2852
3012
|
fromBREP,
|
|
2853
3013
|
h as fromOcDir,
|
|
@@ -2857,8 +3017,8 @@ export {
|
|
|
2857
3017
|
g7 as fuse2D,
|
|
2858
3018
|
fuseAll,
|
|
2859
3019
|
n5 as fuseBlueprints,
|
|
2860
|
-
|
|
2861
|
-
gcWithScope,
|
|
3020
|
+
A as gcWithObject,
|
|
3021
|
+
B as gcWithScope,
|
|
2862
3022
|
g5 as genericSweep,
|
|
2863
3023
|
getBounds,
|
|
2864
3024
|
getBounds2D,
|
|
@@ -2866,7 +3026,7 @@ export {
|
|
|
2866
3026
|
getEdges,
|
|
2867
3027
|
n7 as getFaceColor,
|
|
2868
3028
|
g10 as getFaceOrigins,
|
|
2869
|
-
|
|
3029
|
+
o7 as getFaceTags,
|
|
2870
3030
|
getFaces,
|
|
2871
3031
|
$ as getFont,
|
|
2872
3032
|
e4 as getHashCode,
|
|
@@ -2874,7 +3034,7 @@ export {
|
|
|
2874
3034
|
getKernel,
|
|
2875
3035
|
g4 as getOrientation,
|
|
2876
3036
|
getOrientation2D,
|
|
2877
|
-
|
|
3037
|
+
q4 as getShapeColor,
|
|
2878
3038
|
g2 as getShapeKind,
|
|
2879
3039
|
g8 as getSingleFace,
|
|
2880
3040
|
getSurfaceType,
|
|
@@ -2901,7 +3061,7 @@ export {
|
|
|
2901
3061
|
n3 as interpolateCurve,
|
|
2902
3062
|
intersect,
|
|
2903
3063
|
k6 as intersect2D,
|
|
2904
|
-
|
|
3064
|
+
q2 as intersectBlueprints,
|
|
2905
3065
|
ioError,
|
|
2906
3066
|
isChamferRadius,
|
|
2907
3067
|
s5 as isCompSolid,
|
|
@@ -2916,33 +3076,35 @@ export {
|
|
|
2916
3076
|
isFilletRadius,
|
|
2917
3077
|
isInitRequest,
|
|
2918
3078
|
isInside2D,
|
|
3079
|
+
f2 as isLive,
|
|
2919
3080
|
isNumber,
|
|
2920
3081
|
g as isOk,
|
|
2921
3082
|
isOperationRequest,
|
|
2922
3083
|
a0 as isProjectionPlane,
|
|
2923
3084
|
isQueueEmpty,
|
|
2924
3085
|
i6 as isSameShape,
|
|
2925
|
-
|
|
3086
|
+
h3 as isShape1D,
|
|
2926
3087
|
isShape3D,
|
|
2927
3088
|
isShell,
|
|
2928
3089
|
isSolid,
|
|
2929
3090
|
isSuccessResponse,
|
|
2930
3091
|
isValid,
|
|
2931
|
-
|
|
3092
|
+
m2 as isVertex,
|
|
2932
3093
|
isWire,
|
|
2933
|
-
|
|
3094
|
+
y3 as iterEdges,
|
|
2934
3095
|
z5 as iterFaces,
|
|
2935
3096
|
iterTopo,
|
|
2936
|
-
|
|
2937
|
-
|
|
3097
|
+
A4 as iterVertices,
|
|
3098
|
+
B6 as iterWires,
|
|
2938
3099
|
kernelCall,
|
|
2939
3100
|
kernelCallRaw,
|
|
3101
|
+
kernelCallScoped,
|
|
2940
3102
|
line,
|
|
2941
3103
|
linearPattern,
|
|
2942
3104
|
a1 as loadFont,
|
|
2943
|
-
|
|
3105
|
+
C as localGC,
|
|
2944
3106
|
loft,
|
|
2945
|
-
|
|
3107
|
+
A3 as makeBaseBox,
|
|
2946
3108
|
t4 as makePlane,
|
|
2947
3109
|
a22 as makeProjectedEdges,
|
|
2948
3110
|
m as map,
|
|
@@ -2952,7 +3114,7 @@ export {
|
|
|
2952
3114
|
e7 as measureCurvatureAt,
|
|
2953
3115
|
f10 as measureCurvatureAtMid,
|
|
2954
3116
|
g12 as measureDistance,
|
|
2955
|
-
|
|
3117
|
+
h8 as measureLength,
|
|
2956
3118
|
i7 as measureLinearProps,
|
|
2957
3119
|
measureSurfaceProps,
|
|
2958
3120
|
measureVolume,
|
|
@@ -2962,18 +3124,18 @@ export {
|
|
|
2962
3124
|
minkowski,
|
|
2963
3125
|
mirror,
|
|
2964
3126
|
mirror2D,
|
|
2965
|
-
|
|
3127
|
+
B5 as mirrorDrawing,
|
|
2966
3128
|
mirrorJoin,
|
|
2967
|
-
|
|
3129
|
+
q as modifyStep,
|
|
2968
3130
|
k2 as moduleInitError,
|
|
2969
3131
|
multiSectionSweep,
|
|
2970
3132
|
normalAt,
|
|
2971
3133
|
occtError,
|
|
2972
3134
|
offset,
|
|
2973
3135
|
offsetFace,
|
|
2974
|
-
|
|
3136
|
+
o3 as offsetWire2D,
|
|
2975
3137
|
ok,
|
|
2976
|
-
|
|
3138
|
+
o5 as organiseBlueprints,
|
|
2977
3139
|
outerWire,
|
|
2978
3140
|
pendingCount,
|
|
2979
3141
|
z as pipeline,
|
|
@@ -2990,12 +3152,12 @@ export {
|
|
|
2990
3152
|
rectangularPattern,
|
|
2991
3153
|
registerHandler,
|
|
2992
3154
|
t5 as registerOperation,
|
|
2993
|
-
|
|
3155
|
+
u2 as registerShape,
|
|
2994
3156
|
rejectAll,
|
|
2995
3157
|
v3 as removeChild,
|
|
2996
3158
|
x as replayFrom,
|
|
2997
|
-
|
|
2998
|
-
|
|
3159
|
+
y as replayHistory,
|
|
3160
|
+
C6 as resize,
|
|
2999
3161
|
resolve,
|
|
3000
3162
|
resolve3D,
|
|
3001
3163
|
r as resolveDirection,
|
|
@@ -3013,7 +3175,7 @@ export {
|
|
|
3013
3175
|
G as scaleDrawing,
|
|
3014
3176
|
section,
|
|
3015
3177
|
sectionToFace,
|
|
3016
|
-
|
|
3178
|
+
D3 as setShapeOrigin,
|
|
3017
3179
|
t8 as setTagMetadata,
|
|
3018
3180
|
sewShells,
|
|
3019
3181
|
shape,
|
|
@@ -3045,14 +3207,14 @@ export {
|
|
|
3045
3207
|
sphere,
|
|
3046
3208
|
split,
|
|
3047
3209
|
z3 as stepCount,
|
|
3048
|
-
|
|
3210
|
+
A2 as stepsFrom,
|
|
3049
3211
|
stretch2D,
|
|
3050
3212
|
subFace,
|
|
3051
|
-
|
|
3213
|
+
B3 as supportExtrude,
|
|
3052
3214
|
surfaceFromGrid,
|
|
3053
3215
|
surfaceFromImage,
|
|
3054
3216
|
sweep,
|
|
3055
|
-
|
|
3217
|
+
u4 as tagFaces,
|
|
3056
3218
|
tangentArc,
|
|
3057
3219
|
a52 as textBlueprints,
|
|
3058
3220
|
a62 as textMetrics,
|
|
@@ -3061,7 +3223,7 @@ export {
|
|
|
3061
3223
|
toBREP,
|
|
3062
3224
|
t9 as toBufferGeometryData,
|
|
3063
3225
|
k9 as toGroupedBufferGeometryData,
|
|
3064
|
-
|
|
3226
|
+
l7 as toLineGeometryData,
|
|
3065
3227
|
b as toOcVec,
|
|
3066
3228
|
toSVGPathD,
|
|
3067
3229
|
t as toVec2,
|
|
@@ -3074,16 +3236,16 @@ export {
|
|
|
3074
3236
|
t7 as translatePlane,
|
|
3075
3237
|
t2 as tryCatch,
|
|
3076
3238
|
n2 as tryCatchAsync,
|
|
3077
|
-
|
|
3239
|
+
C3 as twistExtrude,
|
|
3078
3240
|
typeCastError,
|
|
3079
|
-
|
|
3241
|
+
D as undoLast,
|
|
3080
3242
|
unwrap,
|
|
3081
3243
|
r2 as unwrapErr,
|
|
3082
3244
|
v as unwrapOr,
|
|
3083
3245
|
w2 as unwrapOrElse,
|
|
3084
3246
|
E as updateNode,
|
|
3085
|
-
|
|
3086
|
-
|
|
3247
|
+
u5 as uvBounds,
|
|
3248
|
+
h7 as uvCoordinates,
|
|
3087
3249
|
validationError,
|
|
3088
3250
|
v2 as vecAdd,
|
|
3089
3251
|
a3 as vecAngle,
|
|
@@ -3093,14 +3255,14 @@ export {
|
|
|
3093
3255
|
e as vecEquals,
|
|
3094
3256
|
vecIsZero,
|
|
3095
3257
|
g3 as vecLength,
|
|
3096
|
-
|
|
3258
|
+
h4 as vecLengthSq,
|
|
3097
3259
|
i3 as vecNegate,
|
|
3098
3260
|
vecNormalize,
|
|
3099
3261
|
k3 as vecProjectToPlane,
|
|
3100
|
-
|
|
3101
|
-
|
|
3262
|
+
l2 as vecRepr,
|
|
3263
|
+
m3 as vecRotate,
|
|
3102
3264
|
vecScale,
|
|
3103
|
-
|
|
3265
|
+
o2 as vecSub,
|
|
3104
3266
|
vertex,
|
|
3105
3267
|
vertexFinder,
|
|
3106
3268
|
vertexPosition,
|
|
@@ -3112,5 +3274,7 @@ export {
|
|
|
3112
3274
|
w as withOcDir,
|
|
3113
3275
|
l as withOcPnt,
|
|
3114
3276
|
n as withOcVec,
|
|
3115
|
-
w3 as withScope
|
|
3277
|
+
w3 as withScope,
|
|
3278
|
+
o as withScopeResult,
|
|
3279
|
+
p as withScopeResultAsync
|
|
3116
3280
|
};
|