brepjs 8.4.0 → 8.7.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.cjs +2 -2
- package/dist/2d.js +13 -13
- package/dist/{Blueprint-zgFe_5Qj.cjs → Blueprint-BcbOBF-9.cjs} +11 -99
- package/dist/{Blueprint-Bp45tnh0.js → Blueprint-Cmh8lKc4.js} +29 -117
- package/dist/{boolean2D-CfEbRMPF.cjs → boolean2D-CqacqjME.cjs} +24 -25
- package/dist/{boolean2D-DN6ETTCq.js → boolean2D-D94Axs3i.js} +23 -24
- package/dist/{booleanFns-C-M6qqvB.js → booleanFns-DdjtpcM6.js} +306 -12
- package/dist/{booleanFns-5dDG0jpA.cjs → booleanFns-NtKxkiXn.cjs} +299 -5
- package/dist/brepjs.cjs +1619 -71
- package/dist/brepjs.js +1880 -333
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +4 -4
- package/dist/{cornerFinder-CC_MunIh.js → cornerFinder-BBOYfsXl.js} +1 -1
- package/dist/{cornerFinder-BQ-_VJx0.cjs → cornerFinder-Bqy8Lw2p.cjs} +1 -1
- package/dist/{curveFns-ZuQUBZvd.js → curveFns-B85Glnfo.js} +19 -17
- package/dist/{curveFns-VMxgfkqw.cjs → curveFns-BXCbASW-.cjs} +6 -4
- package/dist/{drawFns-BbhX1IUq.js → drawFns-B-gJ2WUc.js} +47 -21
- package/dist/{drawFns-CKaHgGSK.cjs → drawFns-CAmFEqd1.cjs} +63 -37
- package/dist/{errors-CSYOlCCR.js → errors-Coh_5_19.js} +26 -1
- package/dist/{errors-D13q2HCk.cjs → errors-eRQu29oc.cjs} +26 -1
- package/dist/{faceFns-CfJIbHY3.js → faceFns-CltrEfOo.js} +109 -12
- package/dist/{faceFns-es3GENII.cjs → faceFns-DcndPHWm.cjs} +103 -6
- package/dist/{helpers-C0q_FVxq.cjs → helpers-CC21GeAr.cjs} +8 -9
- package/dist/{helpers-CmVkMubc.js → helpers-SksQIreB.js} +16 -17
- package/dist/index.d.ts +18 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/io/dxfImportFns.d.ts +17 -0
- package/dist/io/dxfImportFns.d.ts.map +1 -0
- package/dist/io/objImportFns.d.ts +19 -0
- package/dist/io/objImportFns.d.ts.map +1 -0
- package/dist/io/threemfImportFns.d.ts +19 -0
- package/dist/io/threemfImportFns.d.ts.map +1 -0
- package/dist/io.cjs +5 -5
- package/dist/io.js +5 -5
- package/dist/kernel/hullOps.d.ts +1 -0
- package/dist/kernel/hullOps.d.ts.map +1 -1
- package/dist/kernel/occtAdapter.d.ts +5 -0
- package/dist/kernel/occtAdapter.d.ts.map +1 -1
- package/dist/kernel/solverAdapter.d.ts +39 -0
- package/dist/kernel/solverAdapter.d.ts.map +1 -0
- package/dist/kernel/types.d.ts +5 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-B-UCPW9P.cjs → loft-BcyyvWCj.cjs} +28 -28
- package/dist/{loft-oJq2OD3A.js → loft-CJMPx1NQ.js} +16 -16
- package/dist/{measurement-Cf_SoIiR.js → measurement-ByOztLxb.js} +3 -3
- package/dist/{measurement-CYmT-C77.cjs → measurement-DU3ry-0Q.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CqNwW0PO.js → meshFns-D2gLyLFt.js} +3 -3
- package/dist/{meshFns-DDC_2U81.cjs → meshFns-DawUwI3W.cjs} +3 -3
- package/dist/{occtBoundary-D_gjqgzo.js → occtBoundary-CWzWqBCm.js} +17 -5
- package/dist/{occtBoundary-CocN2VKx.cjs → occtBoundary-DH2VO-rq.cjs} +12 -0
- package/dist/operations/assemblyFns.d.ts +1 -0
- package/dist/operations/assemblyFns.d.ts.map +1 -1
- package/dist/operations/guidedSweepFns.d.ts +25 -0
- package/dist/operations/guidedSweepFns.d.ts.map +1 -0
- package/dist/operations/mateFns.d.ts +50 -0
- package/dist/operations/mateFns.d.ts.map +1 -0
- package/dist/operations/multiSweepFns.d.ts +32 -0
- package/dist/operations/multiSweepFns.d.ts.map +1 -0
- package/dist/operations/roofFns.d.ts +16 -0
- package/dist/operations/roofFns.d.ts.map +1 -0
- package/dist/operations/straightSkeleton.d.ts +28 -0
- package/dist/operations/straightSkeleton.d.ts.map +1 -0
- package/dist/{operations-BQeW_DSM.cjs → operations-CdELWxgv.cjs} +7 -7
- package/dist/{operations-6hdpuYmY.js → operations-DiXo_4t9.js} +15 -15
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +13 -13
- package/dist/query.cjs +5 -5
- package/dist/query.js +7 -7
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{shapeFns-B0zSdO9c.cjs → shapeFns-3RYtsUVY.cjs} +54 -21
- package/dist/{shapeFns-k1YHFwmB.js → shapeFns-4ioRrhih.js} +52 -19
- package/dist/{shapeTypes-BxVxLdiD.cjs → shapeTypes-CMjrTv36.cjs} +1 -1
- package/dist/{shapeTypes-c-_pgYCx.js → shapeTypes-D0vfRxWb.js} +13 -13
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{curveBuilders-BREwqvuc.js → surfaceBuilders-B7Jxob8g.js} +106 -13
- package/dist/{curveBuilders-BkEJ-RVn.cjs → surfaceBuilders-Xx9DRRxs.cjs} +96 -3
- package/dist/text/textBlueprints.d.ts +38 -0
- package/dist/text/textBlueprints.d.ts.map +1 -1
- package/dist/topology/api.d.ts +5 -0
- package/dist/topology/api.d.ts.map +1 -1
- package/dist/topology/booleanFns.d.ts +10 -1
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/colorFns.d.ts +38 -0
- package/dist/topology/colorFns.d.ts.map +1 -0
- package/dist/topology/curveFns.d.ts +1 -1
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/faceTagFns.d.ts +44 -0
- package/dist/topology/faceTagFns.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/polyhedronFns.d.ts +8 -0
- package/dist/topology/polyhedronFns.d.ts.map +1 -0
- package/dist/topology/shapeFns.d.ts +4 -0
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/surfaceBuilders.d.ts +7 -0
- package/dist/topology/surfaceBuilders.d.ts.map +1 -1
- package/dist/topology/surfaceFns.d.ts +38 -0
- package/dist/topology/surfaceFns.d.ts.map +1 -0
- package/dist/{topology-CycEc6Oe.cjs → topology-D-nGjCzV.cjs} +19 -20
- package/dist/{topology-tMKHJgw2.js → topology-DRP9zreU.js} +8 -9
- package/dist/topology.cjs +13 -14
- package/dist/topology.js +51 -52
- package/dist/{vectors-DE0XriuQ.js → vectors-CZV4ZrTz.js} +2 -2
- package/dist/{vectors-DVmHF4zt.cjs → vectors-DwFeX0Ja.cjs} +2 -2
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +4 -3
- package/dist/cast-CPNOTNFm.cjs +0 -102
- package/dist/cast-Cerqtxtb.js +0 -103
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
|
|
3
3
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
4
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
-
const
|
|
6
|
-
const errors = require("./errors-
|
|
7
|
-
const loft = require("./loft-
|
|
8
|
-
const booleanFns = require("./booleanFns-
|
|
4
|
+
const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
|
|
5
|
+
const faceFns = require("./faceFns-DcndPHWm.cjs");
|
|
6
|
+
const errors = require("./errors-eRQu29oc.cjs");
|
|
7
|
+
const loft = require("./loft-BcyyvWCj.cjs");
|
|
8
|
+
const booleanFns = require("./booleanFns-NtKxkiXn.cjs");
|
|
9
9
|
function uuidv() {
|
|
10
10
|
return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
|
|
11
11
|
/[018]/g,
|
|
@@ -117,7 +117,7 @@ function extrude(face, extrusionVec) {
|
|
|
117
117
|
const vec = r(occtBoundary.toOcVec(extrusionVec));
|
|
118
118
|
const builder = r(new oc.BRepPrimAPI_MakePrism_1(face.wrapped, vec, false, true));
|
|
119
119
|
const shape = builder.Shape();
|
|
120
|
-
const downcastResult =
|
|
120
|
+
const downcastResult = faceFns.downcast(shape);
|
|
121
121
|
if (errors.isErr(downcastResult)) {
|
|
122
122
|
return downcastResult;
|
|
123
123
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as getKernel,
|
|
1
|
+
import { g as getKernel, b as toOcVec, d as toOcPnt, e as makeOcAx3, u as uniqueIOFilename } from "./occtBoundary-CWzWqBCm.js";
|
|
2
2
|
import { g as vecLength, v as vecAdd, D as DEG2RAD, f as vecIsZero, j as vecNormalize, n as vecScale } from "./vecOps-ZDdZWbwT.js";
|
|
3
|
-
import { b as createOcHandle, c as castShape, h as isShape3D, m as isWire,
|
|
4
|
-
import { d as downcast } from "./
|
|
5
|
-
import { e as err, x as validationError, u as unwrap, p as typeCastError, l as ok, B as BrepErrorCode, d as isErr, o as occtError, i as ioError, b as computationError } from "./errors-
|
|
6
|
-
import { n as buildLawFromProfile } from "./loft-
|
|
7
|
-
import {
|
|
3
|
+
import { b as createOcHandle, c as castShape, h as isShape3D, m as isWire, n as gcWithScope, u as createSolid } from "./shapeTypes-D0vfRxWb.js";
|
|
4
|
+
import { d as downcast } from "./faceFns-CltrEfOo.js";
|
|
5
|
+
import { e as err, x as validationError, u as unwrap, p as typeCastError, l as ok, B as BrepErrorCode, d as isErr, o as occtError, i as ioError, b as computationError } from "./errors-Coh_5_19.js";
|
|
6
|
+
import { n as buildLawFromProfile } from "./loft-CJMPx1NQ.js";
|
|
7
|
+
import { g as fuseAll } from "./booleanFns-DdjtpcM6.js";
|
|
8
8
|
function uuidv() {
|
|
9
9
|
return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
|
|
10
10
|
/[018]/g,
|
|
@@ -580,11 +580,11 @@ function modifyStep(history, stepId, newParams, registry) {
|
|
|
580
580
|
return replayFrom(modifiedHistory, stepId, registry);
|
|
581
581
|
}
|
|
582
582
|
export {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
583
|
+
stepsFrom as A,
|
|
584
|
+
supportExtrude as B,
|
|
585
|
+
twistExtrude as C,
|
|
586
|
+
undoLast as D,
|
|
587
|
+
updateNode as E,
|
|
588
588
|
addChild as a,
|
|
589
589
|
addStep as b,
|
|
590
590
|
circularPattern as c,
|
|
@@ -607,8 +607,8 @@ export {
|
|
|
607
607
|
registerOperation as t,
|
|
608
608
|
registerShape as u,
|
|
609
609
|
removeChild as v,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
610
|
+
walkAssembly as w,
|
|
611
|
+
replayFrom as x,
|
|
612
|
+
replayHistory as y,
|
|
613
|
+
stepCount as z
|
|
614
614
|
};
|
package/dist/operations.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const operations = require("./operations-
|
|
4
|
-
const loft = require("./loft-
|
|
3
|
+
const operations = require("./operations-CdELWxgv.cjs");
|
|
4
|
+
const loft = require("./loft-BcyyvWCj.cjs");
|
|
5
5
|
exports.addChild = operations.addChild;
|
|
6
6
|
exports.addStep = operations.addStep;
|
|
7
7
|
exports.circularPattern = operations.circularPattern;
|
package/dist/operations.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a, b, c, d, f, g, h, i, j, k, m, n, o, p, l, q, t, u, v,
|
|
2
|
-
import {
|
|
1
|
+
import { a, b, c, d, f, g, h, i, j, k, m, n, o, p, l, q, t, u, v, x, y, z, A, B, s, C, D, E, w } from "./operations-DiXo_4t9.js";
|
|
2
|
+
import { b as b2, g as g2, l as l2, r } from "./loft-CJMPx1NQ.js";
|
|
3
3
|
export {
|
|
4
4
|
a as addChild,
|
|
5
5
|
b as addStep,
|
|
6
|
-
|
|
6
|
+
b2 as basicFaceExtrusion,
|
|
7
7
|
c as circularPattern,
|
|
8
8
|
d as collectShapes,
|
|
9
9
|
f as complexExtrude,
|
|
@@ -15,7 +15,7 @@ export {
|
|
|
15
15
|
m as exportAssemblySTEP,
|
|
16
16
|
n as findNode,
|
|
17
17
|
o as findStep,
|
|
18
|
-
|
|
18
|
+
g2 as genericSweep,
|
|
19
19
|
p as getHistoryShape,
|
|
20
20
|
l as linearPattern,
|
|
21
21
|
l2 as loft,
|
|
@@ -23,15 +23,15 @@ export {
|
|
|
23
23
|
t as registerOperation,
|
|
24
24
|
u as registerShape,
|
|
25
25
|
v as removeChild,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
x as replayFrom,
|
|
27
|
+
y as replayHistory,
|
|
28
28
|
r as revolution,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
z as stepCount,
|
|
30
|
+
A as stepsFrom,
|
|
31
|
+
B as supportExtrude,
|
|
32
32
|
s as sweep,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
C as twistExtrude,
|
|
34
|
+
D as undoLast,
|
|
35
|
+
E as updateNode,
|
|
36
|
+
w as walkAssembly
|
|
37
37
|
};
|
package/dist/query.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const helpers = require("./helpers-
|
|
4
|
-
const cornerFinder = require("./cornerFinder-
|
|
5
|
-
const occtBoundary = require("./occtBoundary-
|
|
6
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
+
const helpers = require("./helpers-CC21GeAr.cjs");
|
|
4
|
+
const cornerFinder = require("./cornerFinder-Bqy8Lw2p.cjs");
|
|
5
|
+
const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
|
|
6
|
+
const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
|
|
7
7
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
8
|
-
const curveFns = require("./curveFns-
|
|
8
|
+
const curveFns = require("./curveFns-BXCbASW-.cjs");
|
|
9
9
|
function edgeDirectionFilter(dir, angle) {
|
|
10
10
|
const d = vecOps.vecNormalize(helpers.resolveDir(dir));
|
|
11
11
|
return (edge) => {
|
package/dist/query.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c } from "./cornerFinder-
|
|
4
|
-
import { g as getKernel } from "./occtBoundary-
|
|
5
|
-
import {
|
|
1
|
+
import { l as createTypedFinder, o as distanceFromPointFilter, q as resolveDir } from "./helpers-SksQIreB.js";
|
|
2
|
+
import { m, g } from "./helpers-SksQIreB.js";
|
|
3
|
+
import { c } from "./cornerFinder-BBOYfsXl.js";
|
|
4
|
+
import { g as getKernel } from "./occtBoundary-CWzWqBCm.js";
|
|
5
|
+
import { n as gcWithScope } from "./shapeTypes-D0vfRxWb.js";
|
|
6
6
|
import { j as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
7
|
-
import {
|
|
7
|
+
import { b as getCurveType, i as curveLength } from "./curveFns-B85Glnfo.js";
|
|
8
8
|
function edgeDirectionFilter(dir, angle) {
|
|
9
9
|
const d = vecNormalize(resolveDir(dir));
|
|
10
10
|
return (edge) => {
|
|
@@ -40,6 +40,6 @@ function edgeFinder() {
|
|
|
40
40
|
export {
|
|
41
41
|
c as cornerFinder,
|
|
42
42
|
edgeFinder,
|
|
43
|
-
|
|
43
|
+
m as faceFinder,
|
|
44
44
|
g as getSingleFace
|
|
45
45
|
};
|
package/dist/result.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const errors = require("./errors-
|
|
3
|
+
const errors = require("./errors-eRQu29oc.cjs");
|
|
4
4
|
class BrepBugError extends Error {
|
|
5
5
|
location;
|
|
6
6
|
constructor(location, message) {
|
package/dist/result.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B, O, a, c, b, e, f, i, d, g, m, h, j, k, o, l, z, q, s, t, n, p, u, r, v, w, x } from "./errors-
|
|
1
|
+
import { B, O, a, c, b, e, f, i, d, g, m, h, j, k, o, l, z, q, s, t, n, p, u, r, v, w, x } from "./errors-Coh_5_19.js";
|
|
2
2
|
class BrepBugError extends Error {
|
|
3
3
|
location;
|
|
4
4
|
constructor(location, message) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
-
const shapeTypes = require("./shapeTypes-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
|
|
3
|
+
const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
|
-
const
|
|
6
|
-
const errors = require("./errors-
|
|
5
|
+
const faceFns = require("./faceFns-DcndPHWm.cjs");
|
|
6
|
+
const errors = require("./errors-eRQu29oc.cjs");
|
|
7
7
|
function clone(shape) {
|
|
8
|
-
return shapeTypes.castShape(errors.unwrap(
|
|
8
|
+
return shapeTypes.castShape(errors.unwrap(faceFns.downcast(shape.wrapped)));
|
|
9
9
|
}
|
|
10
10
|
function toBREP(shape) {
|
|
11
11
|
const oc = occtBoundary.getKernel().oc;
|
|
@@ -82,6 +82,38 @@ function scale(shape, factor, center = [0, 0, 0]) {
|
|
|
82
82
|
pnt.delete();
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
|
+
function resize(shape, dimensions, options) {
|
|
86
|
+
const bbox = occtBoundary.getKernel().boundingBox(shape.wrapped);
|
|
87
|
+
const size = [
|
|
88
|
+
bbox.max[0] - bbox.min[0],
|
|
89
|
+
bbox.max[1] - bbox.min[1],
|
|
90
|
+
bbox.max[2] - bbox.min[2]
|
|
91
|
+
];
|
|
92
|
+
const auto = options?.auto === true;
|
|
93
|
+
function factor(dim, sz, baseFactor) {
|
|
94
|
+
if (dim !== void 0 && sz > 1e-12) return dim / sz;
|
|
95
|
+
if (dim === void 0 && auto) return baseFactor;
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
let autoFactor = 1;
|
|
99
|
+
if (auto) {
|
|
100
|
+
if (dimensions[0] !== void 0 && size[0] > 1e-12) autoFactor = dimensions[0] / size[0];
|
|
101
|
+
else if (dimensions[1] !== void 0 && size[1] > 1e-12) autoFactor = dimensions[1] / size[1];
|
|
102
|
+
else if (dimensions[2] !== void 0 && size[2] > 1e-12) autoFactor = dimensions[2] / size[2];
|
|
103
|
+
}
|
|
104
|
+
const factors = [
|
|
105
|
+
factor(dimensions[0], size[0], autoFactor),
|
|
106
|
+
factor(dimensions[1], size[1], autoFactor),
|
|
107
|
+
factor(dimensions[2], size[2], autoFactor)
|
|
108
|
+
];
|
|
109
|
+
const isUniform = Math.abs(factors[0] - factors[1]) < 1e-6 && Math.abs(factors[1] - factors[2]) < 1e-6;
|
|
110
|
+
if (!isUniform) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
"resize: non-uniform scaling is not supported (WASM build lacks BRepBuilderAPI_GTransform). Use auto: true to scale proportionally, or set all three dimensions to achieve uniform scaling."
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return scale(shape, factors[0]);
|
|
116
|
+
}
|
|
85
117
|
function parseMatrixInput(input) {
|
|
86
118
|
if ("linear" in input) {
|
|
87
119
|
return { linear: input.linear, translation: input.translation };
|
|
@@ -204,8 +236,8 @@ function getOrCreateCache(shape) {
|
|
|
204
236
|
function getEdges(shape) {
|
|
205
237
|
const cache = getOrCreateCache(shape);
|
|
206
238
|
if (cache.edges) return cache.edges;
|
|
207
|
-
const edges = Array.from(
|
|
208
|
-
(e) => shapeTypes.castShape(errors.unwrap(
|
|
239
|
+
const edges = Array.from(faceFns.iterTopo(shape.wrapped, "edge")).map(
|
|
240
|
+
(e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
|
|
209
241
|
);
|
|
210
242
|
cache.edges = edges;
|
|
211
243
|
return edges;
|
|
@@ -213,8 +245,8 @@ function getEdges(shape) {
|
|
|
213
245
|
function getFaces(shape) {
|
|
214
246
|
const cache = getOrCreateCache(shape);
|
|
215
247
|
if (cache.faces) return cache.faces;
|
|
216
|
-
const faces = Array.from(
|
|
217
|
-
(e) => shapeTypes.castShape(errors.unwrap(
|
|
248
|
+
const faces = Array.from(faceFns.iterTopo(shape.wrapped, "face")).map(
|
|
249
|
+
(e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
|
|
218
250
|
);
|
|
219
251
|
cache.faces = faces;
|
|
220
252
|
return faces;
|
|
@@ -222,8 +254,8 @@ function getFaces(shape) {
|
|
|
222
254
|
function getWires(shape) {
|
|
223
255
|
const cache = getOrCreateCache(shape);
|
|
224
256
|
if (cache.wires) return cache.wires;
|
|
225
|
-
const wires = Array.from(
|
|
226
|
-
(e) => shapeTypes.castShape(errors.unwrap(
|
|
257
|
+
const wires = Array.from(faceFns.iterTopo(shape.wrapped, "wire")).map(
|
|
258
|
+
(e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
|
|
227
259
|
);
|
|
228
260
|
cache.wires = wires;
|
|
229
261
|
return wires;
|
|
@@ -312,28 +344,28 @@ function propagateOriginsByHash(inputs, result) {
|
|
|
312
344
|
}
|
|
313
345
|
}
|
|
314
346
|
function getVertices(shape) {
|
|
315
|
-
return Array.from(
|
|
316
|
-
(e) => shapeTypes.castShape(errors.unwrap(
|
|
347
|
+
return Array.from(faceFns.iterTopo(shape.wrapped, "vertex")).map(
|
|
348
|
+
(e) => shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)))
|
|
317
349
|
);
|
|
318
350
|
}
|
|
319
351
|
function* iterEdges(shape) {
|
|
320
|
-
for (const e of
|
|
321
|
-
yield shapeTypes.castShape(errors.unwrap(
|
|
352
|
+
for (const e of faceFns.iterTopo(shape.wrapped, "edge")) {
|
|
353
|
+
yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(e)));
|
|
322
354
|
}
|
|
323
355
|
}
|
|
324
356
|
function* iterFaces(shape) {
|
|
325
|
-
for (const f of
|
|
326
|
-
yield shapeTypes.castShape(errors.unwrap(
|
|
357
|
+
for (const f of faceFns.iterTopo(shape.wrapped, "face")) {
|
|
358
|
+
yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(f)));
|
|
327
359
|
}
|
|
328
360
|
}
|
|
329
361
|
function* iterWires(shape) {
|
|
330
|
-
for (const w of
|
|
331
|
-
yield shapeTypes.castShape(errors.unwrap(
|
|
362
|
+
for (const w of faceFns.iterTopo(shape.wrapped, "wire")) {
|
|
363
|
+
yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(w)));
|
|
332
364
|
}
|
|
333
365
|
}
|
|
334
366
|
function* iterVertices(shape) {
|
|
335
|
-
for (const v of
|
|
336
|
-
yield shapeTypes.castShape(errors.unwrap(
|
|
367
|
+
for (const v of faceFns.iterTopo(shape.wrapped, "vertex")) {
|
|
368
|
+
yield shapeTypes.castShape(errors.unwrap(faceFns.downcast(v)));
|
|
337
369
|
}
|
|
338
370
|
}
|
|
339
371
|
function getBounds(shape) {
|
|
@@ -396,6 +428,7 @@ exports.iterWires = iterWires;
|
|
|
396
428
|
exports.mirror = mirror;
|
|
397
429
|
exports.propagateOrigins = propagateOrigins;
|
|
398
430
|
exports.propagateOriginsByHash = propagateOriginsByHash;
|
|
431
|
+
exports.resize = resize;
|
|
399
432
|
exports.rotate = rotate;
|
|
400
433
|
exports.scale = scale;
|
|
401
434
|
exports.setShapeOrigin = setShapeOrigin;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { g as getKernel,
|
|
2
|
-
import { c as castShape, g as getShapeKind,
|
|
1
|
+
import { g as getKernel, b as toOcVec, m as makeOcAx1, c as makeOcAx2, d as toOcPnt } from "./occtBoundary-CWzWqBCm.js";
|
|
2
|
+
import { c as castShape, g as getShapeKind, n as gcWithScope } from "./shapeTypes-D0vfRxWb.js";
|
|
3
3
|
import { D as DEG2RAD, H as HASH_CODE_MAX } from "./vecOps-ZDdZWbwT.js";
|
|
4
|
-
import { i as iterTopo, d as downcast } from "./
|
|
5
|
-
import { u as unwrap } from "./errors-
|
|
4
|
+
import { i as iterTopo, d as downcast } from "./faceFns-CltrEfOo.js";
|
|
5
|
+
import { u as unwrap } from "./errors-Coh_5_19.js";
|
|
6
6
|
function clone(shape) {
|
|
7
7
|
return castShape(unwrap(downcast(shape.wrapped)));
|
|
8
8
|
}
|
|
@@ -81,6 +81,38 @@ function scale(shape, factor, center = [0, 0, 0]) {
|
|
|
81
81
|
pnt.delete();
|
|
82
82
|
return result;
|
|
83
83
|
}
|
|
84
|
+
function resize(shape, dimensions, options) {
|
|
85
|
+
const bbox = getKernel().boundingBox(shape.wrapped);
|
|
86
|
+
const size = [
|
|
87
|
+
bbox.max[0] - bbox.min[0],
|
|
88
|
+
bbox.max[1] - bbox.min[1],
|
|
89
|
+
bbox.max[2] - bbox.min[2]
|
|
90
|
+
];
|
|
91
|
+
const auto = options?.auto === true;
|
|
92
|
+
function factor(dim, sz, baseFactor) {
|
|
93
|
+
if (dim !== void 0 && sz > 1e-12) return dim / sz;
|
|
94
|
+
if (dim === void 0 && auto) return baseFactor;
|
|
95
|
+
return 1;
|
|
96
|
+
}
|
|
97
|
+
let autoFactor = 1;
|
|
98
|
+
if (auto) {
|
|
99
|
+
if (dimensions[0] !== void 0 && size[0] > 1e-12) autoFactor = dimensions[0] / size[0];
|
|
100
|
+
else if (dimensions[1] !== void 0 && size[1] > 1e-12) autoFactor = dimensions[1] / size[1];
|
|
101
|
+
else if (dimensions[2] !== void 0 && size[2] > 1e-12) autoFactor = dimensions[2] / size[2];
|
|
102
|
+
}
|
|
103
|
+
const factors = [
|
|
104
|
+
factor(dimensions[0], size[0], autoFactor),
|
|
105
|
+
factor(dimensions[1], size[1], autoFactor),
|
|
106
|
+
factor(dimensions[2], size[2], autoFactor)
|
|
107
|
+
];
|
|
108
|
+
const isUniform = Math.abs(factors[0] - factors[1]) < 1e-6 && Math.abs(factors[1] - factors[2]) < 1e-6;
|
|
109
|
+
if (!isUniform) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
"resize: non-uniform scaling is not supported (WASM build lacks BRepBuilderAPI_GTransform). Use auto: true to scale proportionally, or set all three dimensions to achieve uniform scaling."
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return scale(shape, factors[0]);
|
|
115
|
+
}
|
|
84
116
|
function parseMatrixInput(input) {
|
|
85
117
|
if ("linear" in input) {
|
|
86
118
|
return { linear: input.linear, translation: input.translation };
|
|
@@ -377,28 +409,29 @@ function vertexPosition(vertex) {
|
|
|
377
409
|
export {
|
|
378
410
|
iterVertices as A,
|
|
379
411
|
iterWires as B,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
getEdges as
|
|
386
|
-
|
|
412
|
+
resize as C,
|
|
413
|
+
setShapeOrigin as D,
|
|
414
|
+
getFaces as a,
|
|
415
|
+
propagateOriginsByHash as b,
|
|
416
|
+
getWires as c,
|
|
417
|
+
getEdges as d,
|
|
418
|
+
getHashCode as e,
|
|
419
|
+
getVertices as f,
|
|
387
420
|
getFaceOrigins as g,
|
|
388
|
-
|
|
421
|
+
applyMatrix as h,
|
|
389
422
|
isSameShape as i,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
423
|
+
clone as j,
|
|
424
|
+
describe as k,
|
|
425
|
+
isEmpty as l,
|
|
393
426
|
mirror as m,
|
|
394
|
-
|
|
395
|
-
|
|
427
|
+
simplify as n,
|
|
428
|
+
toBREP as o,
|
|
396
429
|
propagateOrigins as p,
|
|
397
|
-
|
|
430
|
+
transformCopy as q,
|
|
398
431
|
rotate as r,
|
|
399
432
|
scale as s,
|
|
400
433
|
translate as t,
|
|
401
|
-
|
|
434
|
+
getBounds as u,
|
|
402
435
|
vertexPosition as v,
|
|
403
436
|
composeTransforms as w,
|
|
404
437
|
isEqualShape as x,
|
|
@@ -44,7 +44,7 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
44
44
|
};
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
|
-
const occtBoundary = require("./occtBoundary-
|
|
47
|
+
const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
|
|
48
48
|
const globalWithRegistry = globalThis;
|
|
49
49
|
if (!globalWithRegistry.FinalizationRegistry) {
|
|
50
50
|
console.warn("brepjs: FinalizationRegistry unavailable — garbage collection will not work");
|
|
@@ -43,7 +43,7 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
43
43
|
};
|
|
44
44
|
return next();
|
|
45
45
|
};
|
|
46
|
-
import { g as getKernel } from "./occtBoundary-
|
|
46
|
+
import { g as getKernel } from "./occtBoundary-CWzWqBCm.js";
|
|
47
47
|
const globalWithRegistry = globalThis;
|
|
48
48
|
if (!globalWithRegistry.FinalizationRegistry) {
|
|
49
49
|
console.warn("brepjs: FinalizationRegistry unavailable — garbage collection will not work");
|
|
@@ -300,17 +300,17 @@ export {
|
|
|
300
300
|
isSolid as k,
|
|
301
301
|
isVertex as l,
|
|
302
302
|
isWire as m,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
303
|
+
gcWithScope as n,
|
|
304
|
+
createWire as o,
|
|
305
|
+
createEdge as p,
|
|
306
|
+
createFace as q,
|
|
307
|
+
localGC as r,
|
|
308
|
+
createCompound as s,
|
|
309
|
+
createVertex as t,
|
|
310
|
+
createSolid as u,
|
|
311
|
+
registerForCleanup as v,
|
|
312
312
|
withScope as w,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
unregisterFromCleanup as x,
|
|
314
|
+
createShell as y,
|
|
315
|
+
gcWithObject as z
|
|
316
316
|
};
|
package/dist/sketching.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const drawFns = require("./drawFns-
|
|
4
|
-
const boolean2D = require("./boolean2D-
|
|
3
|
+
const drawFns = require("./drawFns-CAmFEqd1.cjs");
|
|
4
|
+
const boolean2D = require("./boolean2D-CqacqjME.cjs");
|
|
5
5
|
exports.CompoundSketch = drawFns.CompoundSketch;
|
|
6
6
|
exports.Drawing = drawFns.Drawing;
|
|
7
7
|
exports.DrawingPen = drawFns.DrawingPen;
|
package/dist/sketching.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C, D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W } from "./drawFns-
|
|
2
|
-
import { B as B2, a as a2, F as F2, S as S2 } from "./boolean2D-
|
|
1
|
+
import { C, D, a, S, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W } from "./drawFns-B-gJ2WUc.js";
|
|
2
|
+
import { B as B2, a as a2, F as F2, S as S2 } from "./boolean2D-D94Axs3i.js";
|
|
3
3
|
export {
|
|
4
4
|
B2 as BaseSketcher2d,
|
|
5
5
|
a2 as BlueprintSketcher,
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { g as getKernel,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { g as getKernel, d as toOcPnt, b as toOcVec, c as makeOcAx2, e as makeOcAx3 } from "./occtBoundary-CWzWqBCm.js";
|
|
2
|
+
import { e as err, o as occtError, l as ok, x as validationError, a as andThen } from "./errors-Coh_5_19.js";
|
|
3
|
+
import { d as isEdge, m as isWire, o as createWire, p as createEdge, n as gcWithScope, q as createFace, r as localGC, e as isFace } from "./shapeTypes-D0vfRxWb.js";
|
|
4
|
+
import { d as getEdges } from "./shapeFns-4ioRrhih.js";
|
|
5
|
+
import { o as outerWire, c as cast } from "./faceFns-CltrEfOo.js";
|
|
6
|
+
function range(len) {
|
|
7
|
+
return Array.from(Array(len).keys());
|
|
8
|
+
}
|
|
9
|
+
function zip(arrays) {
|
|
10
|
+
const minLength = Math.min(...arrays.map((arr) => arr.length));
|
|
11
|
+
return range(minLength).map((i) => arrays.map((arr) => arr[i]));
|
|
12
|
+
}
|
|
4
13
|
function makeLine(v1, v2) {
|
|
5
14
|
const oc = getKernel().oc;
|
|
6
15
|
const r = gcWithScope();
|
|
@@ -183,15 +192,99 @@ function assembleWire(listOfEdges) {
|
|
|
183
192
|
}
|
|
184
193
|
return ok(createWire(wireBuilder.Wire()));
|
|
185
194
|
}
|
|
195
|
+
function makeFace(wire, holes) {
|
|
196
|
+
const oc = getKernel().oc;
|
|
197
|
+
const faceBuilder = new oc.BRepBuilderAPI_MakeFace_15(wire.wrapped, false);
|
|
198
|
+
holes?.forEach((hole) => {
|
|
199
|
+
faceBuilder.Add(hole.wrapped);
|
|
200
|
+
});
|
|
201
|
+
if (!faceBuilder.IsDone()) {
|
|
202
|
+
faceBuilder.delete();
|
|
203
|
+
return err(
|
|
204
|
+
occtError("FACE_BUILD_FAILED", "Failed to build the face. Your wire might be non planar.")
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
const face = faceBuilder.Face();
|
|
208
|
+
faceBuilder.delete();
|
|
209
|
+
return ok(createFace(face));
|
|
210
|
+
}
|
|
211
|
+
function fill(face) {
|
|
212
|
+
const outer = outerWire(face);
|
|
213
|
+
return makeFace(outer);
|
|
214
|
+
}
|
|
215
|
+
function makeNewFaceWithinFace(originFace, wire) {
|
|
216
|
+
const oc = getKernel().oc;
|
|
217
|
+
const [r, gc] = localGC();
|
|
218
|
+
const surface = r(oc.BRep_Tool.Surface_2(originFace.wrapped));
|
|
219
|
+
const faceBuilder = r(new oc.BRepBuilderAPI_MakeFace_21(surface, wire.wrapped, true));
|
|
220
|
+
const face = faceBuilder.Face();
|
|
221
|
+
gc();
|
|
222
|
+
return createFace(face);
|
|
223
|
+
}
|
|
224
|
+
function makeNonPlanarFace(wire) {
|
|
225
|
+
const oc = getKernel().oc;
|
|
226
|
+
const [r, gc] = localGC();
|
|
227
|
+
const faceBuilder = r(
|
|
228
|
+
new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
|
|
229
|
+
);
|
|
230
|
+
getEdges(wire).forEach((edge) => {
|
|
231
|
+
faceBuilder.Add_1(
|
|
232
|
+
edge.wrapped,
|
|
233
|
+
oc.GeomAbs_Shape.GeomAbs_C0,
|
|
234
|
+
true
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
const progress = r(new oc.Message_ProgressRange_1());
|
|
238
|
+
faceBuilder.Build(progress);
|
|
239
|
+
return andThen(cast(faceBuilder.Shape()), (newFace) => {
|
|
240
|
+
gc();
|
|
241
|
+
if (!isFace(newFace)) {
|
|
242
|
+
return err(occtError("FACE_BUILD_FAILED", "Failed to create a face"));
|
|
243
|
+
}
|
|
244
|
+
return ok(newFace);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function addHolesInFace(face, holes) {
|
|
248
|
+
const oc = getKernel().oc;
|
|
249
|
+
const [r, gc] = localGC();
|
|
250
|
+
const faceMaker = r(new oc.BRepBuilderAPI_MakeFace_2(face.wrapped));
|
|
251
|
+
holes.forEach((wire) => {
|
|
252
|
+
faceMaker.Add(wire.wrapped);
|
|
253
|
+
});
|
|
254
|
+
const builtFace = r(faceMaker.Face());
|
|
255
|
+
const fixer = r(new oc.ShapeFix_Face_2(builtFace));
|
|
256
|
+
fixer.FixOrientation_1();
|
|
257
|
+
const newFace = fixer.Face();
|
|
258
|
+
gc();
|
|
259
|
+
return createFace(newFace);
|
|
260
|
+
}
|
|
261
|
+
function makePolygon(points) {
|
|
262
|
+
if (points.length < 3)
|
|
263
|
+
return err(
|
|
264
|
+
validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon")
|
|
265
|
+
);
|
|
266
|
+
const edges = zip([points, [...points.slice(1), points[0]]]).map(
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- zip returns untyped pairs
|
|
268
|
+
([p1, p2]) => makeLine(p1, p2)
|
|
269
|
+
);
|
|
270
|
+
return andThen(assembleWire(edges), (wire) => makeFace(wire));
|
|
271
|
+
}
|
|
186
272
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
273
|
+
makeLine as a,
|
|
274
|
+
assembleWire as b,
|
|
275
|
+
makeHelix as c,
|
|
276
|
+
makeThreePointArc as d,
|
|
277
|
+
makeTangentArc as e,
|
|
278
|
+
makeEllipseArc as f,
|
|
279
|
+
makeBezierCurve as g,
|
|
280
|
+
addHolesInFace as h,
|
|
281
|
+
makeCircle as i,
|
|
282
|
+
makeEllipse as j,
|
|
283
|
+
makeBSplineApproximation as k,
|
|
284
|
+
makeNewFaceWithinFace as l,
|
|
285
|
+
makeFace as m,
|
|
286
|
+
makeNonPlanarFace as n,
|
|
287
|
+
makePolygon as o,
|
|
288
|
+
fill as p,
|
|
289
|
+
zip as z
|
|
197
290
|
};
|