brepjs 7.4.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -17
- package/dist/2d/blueprints/blueprintFns.d.ts +0 -22
- package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
- package/dist/2d/blueprints/boolean2D.d.ts +3 -3
- package/dist/2d.cjs +2 -58
- package/dist/2d.d.ts +1 -2
- package/dist/2d.d.ts.map +1 -1
- package/dist/2d.js +7 -64
- package/dist/{Blueprint-3Dyu0OL6.cjs → Blueprint-CVctc41Z.cjs} +4 -4
- package/dist/{Blueprint-DSHD89bZ.js → Blueprint-D3JfGJTz.js} +4 -4
- package/dist/{boolean2D-BwOpOv6L.cjs → boolean2D-BdZATaHs.cjs} +9 -9
- package/dist/{boolean2D-CtyE2hK5.js → boolean2D-hOw5Qay5.js} +9 -9
- package/dist/{booleanFns-5KSbtLBU.cjs → booleanFns-BBSVKhL2.cjs} +27 -31
- package/dist/{booleanFns-DcxqLQSG.js → booleanFns-CqehfzcK.js} +27 -31
- package/dist/brepjs.cjs +95 -106
- package/dist/brepjs.js +129 -140
- package/dist/{cast-D1s7Im9E.js → cast-DQaUibmm.js} +3 -3
- package/dist/{cast-DsxJk_F0.cjs → cast-DkB0GKmQ.cjs} +2 -2
- package/dist/{drawFns-CSbH7uoI.js → drawFns-921SkhDL.js} +9 -9
- package/dist/{drawFns-C6KQjmQj.cjs → drawFns-CUyx50gi.cjs} +9 -9
- package/dist/{faceFns-B9if-FPW.cjs → faceFns-BwK7FP7N.cjs} +1 -1
- package/dist/{faceFns-Bl6HHbqO.js → faceFns-DHu-2JpA.js} +1 -1
- package/dist/index.d.ts +9 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/{loft-Cc5E5pAf.cjs → loft-BzWFokmC.cjs} +2 -2
- package/dist/{loft-BlNndTOR.js → loft-CtG5nMq5.js} +2 -2
- package/dist/{measurement-D75pyJi1.js → measurement-C5JGCuUP.js} +1 -1
- package/dist/{measurement-BVdZ9cG3.cjs → measurement-fxm_pW7x.cjs} +1 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-p_kv--PW.js → meshFns-AqAjTTVl.js} +11 -11
- package/dist/{meshFns-mVlogI3J.cjs → meshFns-BhrZGi6w.cjs} +11 -11
- package/dist/operations/api.d.ts +4 -6
- package/dist/operations/api.d.ts.map +1 -1
- package/dist/operations/exporterFns.d.ts +0 -2
- package/dist/operations/exporterFns.d.ts.map +1 -1
- package/dist/operations/extrude.d.ts +2 -4
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts +4 -4
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/extrudeUtils.d.ts +0 -2
- package/dist/operations/extrudeUtils.d.ts.map +1 -1
- package/dist/operations/loft.d.ts +1 -1
- package/dist/operations/loftFns.d.ts +2 -4
- package/dist/operations/loftFns.d.ts.map +1 -1
- package/dist/{operations-SRN-mfTx.cjs → operations-BP1wVDw0.cjs} +14 -20
- package/dist/{operations-CEV-gqkX.js → operations-C1rWoba2.js} +14 -20
- package/dist/operations.cjs +2 -2
- package/dist/operations.d.ts +3 -3
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +2 -2
- package/dist/{query-D7XclvBZ.js → query-V6nV-VfL.js} +4 -4
- package/dist/{query-DkcMfh6j.cjs → query-hMSmOWJP.cjs} +4 -4
- package/dist/query.cjs +1 -1
- package/dist/query.js +1 -1
- package/dist/{shapeFns-BpCPVHFT.js → shapeFns-BrF97sKt.js} +19 -19
- package/dist/{shapeFns-DjsWo98C.cjs → shapeFns-BvOndshS.cjs} +19 -19
- package/dist/{shapeHelpers-BBSVHPGk.cjs → shapeHelpers-B2SXz1p4.cjs} +2 -2
- package/dist/{shapeHelpers-C4QIp7u5.js → shapeHelpers-BcoZf2N9.js} +2 -2
- package/dist/sketching/sketcherlib.d.ts +2 -4
- package/dist/sketching/sketcherlib.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.d.ts +2 -2
- package/dist/sketching.d.ts.map +1 -1
- package/dist/sketching.js +2 -2
- package/dist/topology/api.d.ts +11 -15
- package/dist/topology/api.d.ts.map +1 -1
- package/dist/topology/apiTypes.d.ts +0 -2
- package/dist/topology/apiTypes.d.ts.map +1 -1
- package/dist/topology/booleanFns.d.ts +9 -9
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/cast.d.ts +2 -2
- package/dist/topology/cast.d.ts.map +1 -1
- package/dist/topology/chamferAngleFns.d.ts +1 -1
- package/dist/topology/chamferAngleFns.d.ts.map +1 -1
- package/dist/topology/healingFns.d.ts +2 -2
- package/dist/topology/healingFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +2 -2
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/meshCache.d.ts +2 -4
- package/dist/topology/meshCache.d.ts.map +1 -1
- package/dist/topology/meshFns.d.ts +2 -2
- package/dist/topology/meshFns.d.ts.map +1 -1
- package/dist/topology/modifierFns.d.ts +5 -5
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/primitiveFns.d.ts +4 -8
- package/dist/topology/primitiveFns.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts +9 -9
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeModifiers.d.ts +0 -2
- package/dist/topology/shapeModifiers.d.ts.map +1 -1
- package/dist/topology/wrapperFns.d.ts +3 -3
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-Bb1W3SyF.cjs → topology-CIooytHH.cjs} +18 -18
- package/dist/{topology-BEMrS4WZ.js → topology-tFzqSrGH.js} +18 -18
- package/dist/topology.cjs +8 -8
- package/dist/topology.d.ts +1 -1
- package/dist/topology.d.ts.map +1 -1
- package/dist/topology.js +8 -8
- package/package.json +3 -3
- package/dist/2d/blueprints/boolean2dFns.d.ts +0 -46
- package/dist/2d/blueprints/boolean2dFns.d.ts.map +0 -1
- package/dist/core/geometry.d.ts +0 -26
- package/dist/core/geometry.d.ts.map +0 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -4,24 +4,24 @@ const occtBoundary = require("./occtBoundary-du8_ex-p.cjs");
|
|
|
4
4
|
const errors = require("./errors-DK1VAdP4.cjs");
|
|
5
5
|
const shapeTypes = require("./shapeTypes-DKhwEnUM.cjs");
|
|
6
6
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
7
|
-
const Blueprint = require("./Blueprint-
|
|
7
|
+
const Blueprint = require("./Blueprint-CVctc41Z.cjs");
|
|
8
8
|
const curveFns = require("./curveFns-BilyYL_s.cjs");
|
|
9
|
-
const loft$
|
|
10
|
-
const operations = require("./operations-
|
|
11
|
-
const boolean2D = require("./boolean2D-
|
|
9
|
+
const loft$2 = require("./loft-BzWFokmC.cjs");
|
|
10
|
+
const operations = require("./operations-BP1wVDw0.cjs");
|
|
11
|
+
const boolean2D = require("./boolean2D-BdZATaHs.cjs");
|
|
12
12
|
const _2d = require("./2d.cjs");
|
|
13
|
-
const query = require("./query-
|
|
13
|
+
const query = require("./query-hMSmOWJP.cjs");
|
|
14
14
|
const io = require("./io.cjs");
|
|
15
|
-
const drawFns = require("./drawFns-
|
|
15
|
+
const drawFns = require("./drawFns-CUyx50gi.cjs");
|
|
16
16
|
const vectors = require("./vectors-ChWEZPwy.cjs");
|
|
17
|
-
const shapeFns = require("./shapeFns-
|
|
18
|
-
const topology = require("./topology-
|
|
19
|
-
const faceFns = require("./faceFns-
|
|
20
|
-
const meshFns = require("./meshFns-
|
|
21
|
-
const booleanFns = require("./booleanFns-
|
|
22
|
-
const measurement = require("./measurement-
|
|
23
|
-
const shapeHelpers = require("./shapeHelpers-
|
|
24
|
-
const cast = require("./cast-
|
|
17
|
+
const shapeFns = require("./shapeFns-BvOndshS.cjs");
|
|
18
|
+
const topology = require("./topology-CIooytHH.cjs");
|
|
19
|
+
const faceFns = require("./faceFns-BwK7FP7N.cjs");
|
|
20
|
+
const meshFns = require("./meshFns-BhrZGi6w.cjs");
|
|
21
|
+
const booleanFns = require("./booleanFns-BBSVKhL2.cjs");
|
|
22
|
+
const measurement = require("./measurement-fxm_pW7x.cjs");
|
|
23
|
+
const shapeHelpers = require("./shapeHelpers-B2SXz1p4.cjs");
|
|
24
|
+
const cast = require("./cast-DkB0GKmQ.cjs");
|
|
25
25
|
const result = require("./result.cjs");
|
|
26
26
|
const worker = require("./worker.cjs");
|
|
27
27
|
const errorFactories = {
|
|
@@ -52,11 +52,6 @@ function kernelCallRaw(fn, code, message, kind = "OCCT_OPERATION") {
|
|
|
52
52
|
return errors.err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function isPoint(p) {
|
|
56
|
-
if (Array.isArray(p)) return p.length === 3 || p.length === 2;
|
|
57
|
-
else if (p && typeof p?.XYZ === "function") return true;
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
55
|
function isNumber(r) {
|
|
61
56
|
return typeof r === "number";
|
|
62
57
|
}
|
|
@@ -127,9 +122,13 @@ function box(width, depth, height, options) {
|
|
|
127
122
|
const maker = r(new oc.BRepPrimAPI_MakeBox_2(width, depth, height));
|
|
128
123
|
let solid2 = shapeTypes.createSolid(maker.Solid());
|
|
129
124
|
gc();
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
solid2 = shapeFns.
|
|
125
|
+
const center = options?.at ?? (options?.centered ? [0, 0, 0] : void 0);
|
|
126
|
+
if (center) {
|
|
127
|
+
solid2 = shapeFns.translate(solid2, [
|
|
128
|
+
center[0] - width / 2,
|
|
129
|
+
center[1] - depth / 2,
|
|
130
|
+
center[2] - height / 2
|
|
131
|
+
]);
|
|
133
132
|
}
|
|
134
133
|
return solid2;
|
|
135
134
|
}
|
|
@@ -143,14 +142,14 @@ function cylinder(radius, height, options) {
|
|
|
143
142
|
-axis[1] * height * 0.5,
|
|
144
143
|
-axis[2] * height * 0.5
|
|
145
144
|
];
|
|
146
|
-
solid2 = shapeFns.
|
|
145
|
+
solid2 = shapeFns.translate(solid2, halfShift);
|
|
147
146
|
}
|
|
148
147
|
return solid2;
|
|
149
148
|
}
|
|
150
149
|
function sphere(radius, options) {
|
|
151
150
|
let solid2 = shapeHelpers.makeSphere(radius);
|
|
152
151
|
if (options?.at) {
|
|
153
|
-
solid2 = shapeFns.
|
|
152
|
+
solid2 = shapeFns.translate(solid2, options.at);
|
|
154
153
|
}
|
|
155
154
|
return solid2;
|
|
156
155
|
}
|
|
@@ -164,7 +163,7 @@ function cone(bottomRadius, topRadius, height, options) {
|
|
|
164
163
|
-axis[1] * height * 0.5,
|
|
165
164
|
-axis[2] * height * 0.5
|
|
166
165
|
];
|
|
167
|
-
solid2 = shapeFns.
|
|
166
|
+
solid2 = shapeFns.translate(solid2, halfShift);
|
|
168
167
|
}
|
|
169
168
|
return solid2;
|
|
170
169
|
}
|
|
@@ -174,7 +173,7 @@ function torus(majorRadius, minorRadius, options) {
|
|
|
174
173
|
function ellipsoid(rx, ry, rz, options) {
|
|
175
174
|
let solid2 = shapeHelpers.makeEllipsoid(rx, ry, rz);
|
|
176
175
|
if (options?.at) {
|
|
177
|
-
solid2 = shapeFns.
|
|
176
|
+
solid2 = shapeFns.translate(solid2, options.at);
|
|
178
177
|
}
|
|
179
178
|
return solid2;
|
|
180
179
|
}
|
|
@@ -182,11 +181,11 @@ function line(from, to) {
|
|
|
182
181
|
return shapeHelpers.makeLine(from, to);
|
|
183
182
|
}
|
|
184
183
|
function circle(radius, options) {
|
|
185
|
-
const axisDir = options?.axis ??
|
|
184
|
+
const axisDir = options?.axis ?? [0, 0, 1];
|
|
186
185
|
return shapeHelpers.makeCircle(radius, options?.at ?? [0, 0, 0], axisDir);
|
|
187
186
|
}
|
|
188
187
|
function ellipse(majorRadius, minorRadius, options) {
|
|
189
|
-
const axisDir = options?.axis ??
|
|
188
|
+
const axisDir = options?.axis ?? [0, 0, 1];
|
|
190
189
|
return shapeHelpers.makeEllipse(majorRadius, minorRadius, options?.at ?? [0, 0, 0], axisDir, options?.xDir);
|
|
191
190
|
}
|
|
192
191
|
function helix(pitch, height, radius, options) {
|
|
@@ -203,7 +202,7 @@ function threePointArc(p1, p2, p3) {
|
|
|
203
202
|
return shapeHelpers.makeThreePointArc(p1, p2, p3);
|
|
204
203
|
}
|
|
205
204
|
function ellipseArc(majorRadius, minorRadius, startAngle, endAngle, options) {
|
|
206
|
-
const axisDir = options?.axis ??
|
|
205
|
+
const axisDir = options?.axis ?? [0, 0, 1];
|
|
207
206
|
return shapeHelpers.makeEllipseArc(
|
|
208
207
|
majorRadius,
|
|
209
208
|
minorRadius,
|
|
@@ -262,8 +261,8 @@ function validateNotNull(shape2, label) {
|
|
|
262
261
|
}
|
|
263
262
|
return errors.ok(void 0);
|
|
264
263
|
}
|
|
265
|
-
function
|
|
266
|
-
const check = validateNotNull(shape2, "
|
|
264
|
+
function thicken$1(shape2, thickness) {
|
|
265
|
+
const check = validateNotNull(shape2, "thicken: shape");
|
|
267
266
|
if (errors.isErr(check)) return check;
|
|
268
267
|
return kernelCall(
|
|
269
268
|
() => occtBoundary.getKernel().thicken(shape2.wrapped, thickness),
|
|
@@ -271,8 +270,8 @@ function thickenSurface(shape2, thickness) {
|
|
|
271
270
|
"Thicken operation failed"
|
|
272
271
|
);
|
|
273
272
|
}
|
|
274
|
-
function
|
|
275
|
-
const check = validateNotNull(shape2, "
|
|
273
|
+
function fillet$1(shape2, edges, radius) {
|
|
274
|
+
const check = validateNotNull(shape2, "fillet: shape");
|
|
276
275
|
if (errors.isErr(check)) return check;
|
|
277
276
|
if (typeof radius === "number" && radius <= 0) {
|
|
278
277
|
return errors.err(
|
|
@@ -331,15 +330,15 @@ function filletShape(shape2, edges, radius) {
|
|
|
331
330
|
const raw = e instanceof Error ? e.message : String(e);
|
|
332
331
|
return errors.err(
|
|
333
332
|
errors.occtError("FILLET_FAILED", `Fillet operation failed: ${raw}`, e, {
|
|
334
|
-
operation: "
|
|
333
|
+
operation: "fillet",
|
|
335
334
|
edgeCount: selectedEdges.length,
|
|
336
335
|
radius
|
|
337
336
|
})
|
|
338
337
|
);
|
|
339
338
|
}
|
|
340
339
|
}
|
|
341
|
-
function
|
|
342
|
-
const check = validateNotNull(shape2, "
|
|
340
|
+
function chamfer$1(shape2, edges, distance) {
|
|
341
|
+
const check = validateNotNull(shape2, "chamfer: shape");
|
|
343
342
|
if (errors.isErr(check)) return check;
|
|
344
343
|
if (typeof distance === "number" && distance <= 0) {
|
|
345
344
|
return errors.err(
|
|
@@ -390,15 +389,15 @@ function chamferShape(shape2, edges, distance) {
|
|
|
390
389
|
const raw = e instanceof Error ? e.message : String(e);
|
|
391
390
|
return errors.err(
|
|
392
391
|
errors.occtError("CHAMFER_FAILED", `Chamfer operation failed: ${raw}`, e, {
|
|
393
|
-
operation: "
|
|
392
|
+
operation: "chamfer",
|
|
394
393
|
edgeCount: selectedEdges.length,
|
|
395
394
|
distance
|
|
396
395
|
})
|
|
397
396
|
);
|
|
398
397
|
}
|
|
399
398
|
}
|
|
400
|
-
function
|
|
401
|
-
const check = validateNotNull(shape2, "
|
|
399
|
+
function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
|
|
400
|
+
const check = validateNotNull(shape2, "shell: shape");
|
|
402
401
|
if (errors.isErr(check)) return check;
|
|
403
402
|
if (thickness <= 0) {
|
|
404
403
|
return errors.err(errors.validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
@@ -422,15 +421,15 @@ function shellShape(shape2, faces, thickness, tolerance = 1e-3) {
|
|
|
422
421
|
const raw = e instanceof Error ? e.message : String(e);
|
|
423
422
|
return errors.err(
|
|
424
423
|
errors.occtError("SHELL_FAILED", `Shell operation failed: ${raw}`, e, {
|
|
425
|
-
operation: "
|
|
424
|
+
operation: "shell",
|
|
426
425
|
faceCount: faces.length,
|
|
427
426
|
thickness
|
|
428
427
|
})
|
|
429
428
|
);
|
|
430
429
|
}
|
|
431
430
|
}
|
|
432
|
-
function
|
|
433
|
-
const check = validateNotNull(shape2, "
|
|
431
|
+
function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
432
|
+
const check = validateNotNull(shape2, "offset: shape");
|
|
434
433
|
if (errors.isErr(check)) return check;
|
|
435
434
|
if (distance === 0) {
|
|
436
435
|
return errors.err(errors.validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
@@ -442,39 +441,39 @@ function offsetShape(shape2, distance, tolerance = 1e-6) {
|
|
|
442
441
|
);
|
|
443
442
|
}
|
|
444
443
|
function translate(shape2, v) {
|
|
445
|
-
return shapeFns.
|
|
444
|
+
return shapeFns.translate(resolve(shape2), v);
|
|
446
445
|
}
|
|
447
446
|
function rotate(shape2, angle, options) {
|
|
448
|
-
const pivotPoint = options?.at
|
|
449
|
-
return shapeFns.
|
|
447
|
+
const pivotPoint = options?.at;
|
|
448
|
+
return shapeFns.rotate(resolve(shape2), angle, pivotPoint, options?.axis);
|
|
450
449
|
}
|
|
451
450
|
function mirror(shape2, options) {
|
|
452
|
-
const planeOrigin = options?.at
|
|
453
|
-
return shapeFns.
|
|
451
|
+
const planeOrigin = options?.at;
|
|
452
|
+
return shapeFns.mirror(resolve(shape2), options?.normal ?? [1, 0, 0], planeOrigin);
|
|
454
453
|
}
|
|
455
454
|
function scale(shape2, factor, options) {
|
|
456
|
-
return shapeFns.
|
|
455
|
+
return shapeFns.scale(resolve(shape2), factor, options?.center);
|
|
457
456
|
}
|
|
458
457
|
function clone(shape2) {
|
|
459
|
-
return shapeFns.
|
|
458
|
+
return shapeFns.clone(resolve(shape2));
|
|
460
459
|
}
|
|
461
460
|
function fuse(a, b, options) {
|
|
462
|
-
return booleanFns.
|
|
461
|
+
return booleanFns.fuse(resolve(a), resolve(b), options);
|
|
463
462
|
}
|
|
464
463
|
function cut(base, tool, options) {
|
|
465
|
-
return booleanFns.
|
|
464
|
+
return booleanFns.cut(resolve(base), resolve(tool), options);
|
|
466
465
|
}
|
|
467
466
|
function intersect(a, b, options) {
|
|
468
|
-
return booleanFns.
|
|
467
|
+
return booleanFns.intersect(resolve(a), resolve(b), options);
|
|
469
468
|
}
|
|
470
469
|
function section(shape2, plane, options) {
|
|
471
|
-
return booleanFns.
|
|
470
|
+
return booleanFns.section(resolve(shape2), plane, options);
|
|
472
471
|
}
|
|
473
472
|
function split(shape2, tools) {
|
|
474
|
-
return booleanFns.
|
|
473
|
+
return booleanFns.split(resolve(shape2), tools);
|
|
475
474
|
}
|
|
476
475
|
function slice(shape2, planes, options) {
|
|
477
|
-
return booleanFns.
|
|
476
|
+
return booleanFns.slice(resolve(shape2), planes, options);
|
|
478
477
|
}
|
|
479
478
|
function resolveEdges(edgesOrFn, shape2) {
|
|
480
479
|
if (edgesOrFn === void 0) return void 0;
|
|
@@ -524,7 +523,7 @@ function fillet(shape2, edgesOrRadius, maybeRadius) {
|
|
|
524
523
|
edges = void 0;
|
|
525
524
|
radius = edgesOrRadius;
|
|
526
525
|
}
|
|
527
|
-
return
|
|
526
|
+
return fillet$1(s, edges, normalizeFilletRadius(radius));
|
|
528
527
|
}
|
|
529
528
|
function chamfer(shape2, edgesOrDistance, maybeDistance) {
|
|
530
529
|
const s = resolve(shape2);
|
|
@@ -540,54 +539,54 @@ function chamfer(shape2, edgesOrDistance, maybeDistance) {
|
|
|
540
539
|
const normalized = normalizeChamferDistance(distance);
|
|
541
540
|
if (normalized.mode === "distAngle") {
|
|
542
541
|
const selectedEdges = edges ?? shapeFns.getEdges(s);
|
|
543
|
-
return topology.
|
|
542
|
+
return topology.chamferDistAngle(
|
|
544
543
|
s,
|
|
545
544
|
[...selectedEdges],
|
|
546
545
|
normalized.distance,
|
|
547
546
|
normalized.angle
|
|
548
547
|
);
|
|
549
548
|
}
|
|
550
|
-
return
|
|
549
|
+
return chamfer$1(s, edges, normalized.distance);
|
|
551
550
|
}
|
|
552
551
|
function shell(shape2, faces, thickness, options) {
|
|
553
552
|
const s = resolve(shape2);
|
|
554
553
|
const resolvedFaces = resolveFaces(faces, s);
|
|
555
|
-
return
|
|
554
|
+
return shell$1(s, resolvedFaces, thickness, options?.tolerance);
|
|
556
555
|
}
|
|
557
556
|
function offset(shape2, distance, options) {
|
|
558
|
-
return
|
|
557
|
+
return offset$1(resolve(shape2), distance, options?.tolerance);
|
|
559
558
|
}
|
|
560
559
|
function thicken(shape2, thickness) {
|
|
561
|
-
return
|
|
560
|
+
return thicken$1(resolve(shape2), thickness);
|
|
562
561
|
}
|
|
563
562
|
function heal(shape2) {
|
|
564
|
-
return topology.
|
|
563
|
+
return topology.heal(resolve(shape2));
|
|
565
564
|
}
|
|
566
565
|
function simplify(shape2) {
|
|
567
|
-
return shapeFns.
|
|
566
|
+
return shapeFns.simplify(resolve(shape2));
|
|
568
567
|
}
|
|
569
568
|
function mesh(shape2, options) {
|
|
570
|
-
return meshFns.
|
|
569
|
+
return meshFns.mesh(resolve(shape2), options);
|
|
571
570
|
}
|
|
572
571
|
function meshEdges(shape2, options) {
|
|
573
|
-
return meshFns.
|
|
572
|
+
return meshFns.meshEdges(resolve(shape2), options);
|
|
574
573
|
}
|
|
575
574
|
function describe(shape2) {
|
|
576
|
-
return shapeFns.
|
|
575
|
+
return shapeFns.describe(resolve(shape2));
|
|
577
576
|
}
|
|
578
577
|
function toBREP(shape2) {
|
|
579
|
-
return shapeFns.
|
|
578
|
+
return shapeFns.toBREP(resolve(shape2));
|
|
580
579
|
}
|
|
581
580
|
function fromBREP(data) {
|
|
582
|
-
return cast.
|
|
581
|
+
return cast.fromBREP(data);
|
|
583
582
|
}
|
|
584
583
|
function isValid(shape2) {
|
|
585
|
-
return topology.
|
|
584
|
+
return topology.isValid(resolve(shape2));
|
|
586
585
|
}
|
|
587
586
|
function isEmpty(shape2) {
|
|
588
|
-
return shapeFns.
|
|
587
|
+
return shapeFns.isEmpty(resolve(shape2));
|
|
589
588
|
}
|
|
590
|
-
function
|
|
589
|
+
function loft$1(wires, { ruled = true, startPoint, endPoint } = {}, returnShell = false) {
|
|
591
590
|
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
592
591
|
return errors.err(errors.validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
593
592
|
}
|
|
@@ -621,15 +620,20 @@ function loftWires(wires, { ruled = true, startPoint, endPoint } = {}, returnShe
|
|
|
621
620
|
function extrude(face2, height) {
|
|
622
621
|
const f = resolve(face2);
|
|
623
622
|
const vec = typeof height === "number" ? [0, 0, height] : height;
|
|
624
|
-
return operations.
|
|
623
|
+
return operations.extrude(f, vec);
|
|
625
624
|
}
|
|
626
625
|
function revolve(face2, options) {
|
|
627
|
-
const pivotPoint = options?.at ??
|
|
628
|
-
return operations.
|
|
626
|
+
const pivotPoint = options?.at ?? [0, 0, 0];
|
|
627
|
+
return operations.revolve(
|
|
628
|
+
resolve(face2),
|
|
629
|
+
pivotPoint,
|
|
630
|
+
options?.axis ?? [0, 0, 1],
|
|
631
|
+
options?.angle ?? 360
|
|
632
|
+
);
|
|
629
633
|
}
|
|
630
634
|
function loft(wires, options) {
|
|
631
635
|
const resolvedWires = wires.map((w) => resolve(w));
|
|
632
|
-
return
|
|
636
|
+
return loft$1(resolvedWires, options);
|
|
633
637
|
}
|
|
634
638
|
function resolveTargetFace(shape2, faceSpec) {
|
|
635
639
|
if (faceSpec === void 0) {
|
|
@@ -687,8 +691,8 @@ function drill(shape2, options) {
|
|
|
687
691
|
}
|
|
688
692
|
const cyl = shapeHelpers.makeCylinder(radius, depth, pos, dir);
|
|
689
693
|
const startOffset = options.depth === void 0 ? vecOps.vecScale(dir, -depth / 2) : [0, 0, 0];
|
|
690
|
-
const tool = startOffset[0] !== 0 || startOffset[1] !== 0 || startOffset[2] !== 0 ? shapeFns.
|
|
691
|
-
return booleanFns.
|
|
694
|
+
const tool = startOffset[0] !== 0 || startOffset[1] !== 0 || startOffset[2] !== 0 ? shapeFns.translate(cyl, startOffset) : cyl;
|
|
695
|
+
return booleanFns.cut(s, tool);
|
|
692
696
|
}
|
|
693
697
|
function pocket(shape2, options) {
|
|
694
698
|
const s = resolve(shape2);
|
|
@@ -702,9 +706,9 @@ function pocket(shape2, options) {
|
|
|
702
706
|
const faceResult = shapeHelpers.makeFace(w);
|
|
703
707
|
if (errors.isErr(faceResult)) return faceResult;
|
|
704
708
|
const extDir = vecOps.vecScale(vecOps.vecNormalize(normal), -depth);
|
|
705
|
-
const toolResult = operations.
|
|
709
|
+
const toolResult = operations.extrude(faceResult.value, extDir);
|
|
706
710
|
if (errors.isErr(toolResult)) return toolResult;
|
|
707
|
-
return booleanFns.
|
|
711
|
+
return booleanFns.cut(s, toolResult.value);
|
|
708
712
|
}
|
|
709
713
|
function boss(shape2, options) {
|
|
710
714
|
const s = resolve(shape2);
|
|
@@ -718,16 +722,16 @@ function boss(shape2, options) {
|
|
|
718
722
|
const faceResult = shapeHelpers.makeFace(w);
|
|
719
723
|
if (errors.isErr(faceResult)) return faceResult;
|
|
720
724
|
const extDir = vecOps.vecScale(vecOps.vecNormalize(normal), height);
|
|
721
|
-
const toolResult = operations.
|
|
725
|
+
const toolResult = operations.extrude(faceResult.value, extDir);
|
|
722
726
|
if (errors.isErr(toolResult)) return toolResult;
|
|
723
|
-
return booleanFns.
|
|
727
|
+
return booleanFns.fuse(s, toolResult.value);
|
|
724
728
|
}
|
|
725
729
|
function mirrorJoin(shape2, options) {
|
|
726
730
|
const s = resolve(shape2);
|
|
727
731
|
const normal = options?.normal ?? [1, 0, 0];
|
|
728
|
-
const planeOrigin = options?.at
|
|
729
|
-
const mirrored = shapeFns.
|
|
730
|
-
return booleanFns.
|
|
732
|
+
const planeOrigin = options?.at;
|
|
733
|
+
const mirrored = shapeFns.mirror(s, normal, planeOrigin);
|
|
734
|
+
return booleanFns.fuse(s, mirrored);
|
|
731
735
|
}
|
|
732
736
|
function rectangularPattern(shape2, options) {
|
|
733
737
|
const s = resolve(shape2);
|
|
@@ -753,8 +757,8 @@ function rectangularPattern(shape2, options) {
|
|
|
753
757
|
xNorm[1] * xSpacing * xi + yNorm[1] * ySpacing * yi,
|
|
754
758
|
xNorm[2] * xSpacing * xi + yNorm[2] * ySpacing * yi
|
|
755
759
|
];
|
|
756
|
-
const copy = shapeFns.
|
|
757
|
-
const fuseResult = booleanFns.
|
|
760
|
+
const copy = shapeFns.translate(s, offset2);
|
|
761
|
+
const fuseResult = booleanFns.fuse(result2, copy);
|
|
758
762
|
if (errors.isErr(fuseResult)) return fuseResult;
|
|
759
763
|
result2 = fuseResult.value;
|
|
760
764
|
}
|
|
@@ -1029,9 +1033,9 @@ exports.getCurveType = curveFns.getCurveType;
|
|
|
1029
1033
|
exports.getOrientation = curveFns.getOrientation;
|
|
1030
1034
|
exports.interpolateCurve = curveFns.interpolateCurve;
|
|
1031
1035
|
exports.offsetWire2D = curveFns.offsetWire2D;
|
|
1032
|
-
exports.basicFaceExtrusion = loft$
|
|
1033
|
-
exports.genericSweep = loft$
|
|
1034
|
-
exports.revolution = loft$
|
|
1036
|
+
exports.basicFaceExtrusion = loft$2.basicFaceExtrusion;
|
|
1037
|
+
exports.genericSweep = loft$2.genericSweep;
|
|
1038
|
+
exports.revolution = loft$2.revolution;
|
|
1035
1039
|
exports.addChild = operations.addChild;
|
|
1036
1040
|
exports.addStep = operations.addStep;
|
|
1037
1041
|
exports.circularPattern = operations.circularPattern;
|
|
@@ -1076,10 +1080,6 @@ exports.intersectBlueprints = boolean2D.intersectBlueprints;
|
|
|
1076
1080
|
exports.organiseBlueprints = boolean2D.organiseBlueprints;
|
|
1077
1081
|
exports.polysidesBlueprint = boolean2D.polysidesBlueprint;
|
|
1078
1082
|
exports.roundedRectangleBlueprint = boolean2D.roundedRectangleBlueprint;
|
|
1079
|
-
exports.blueprintBoundingBox = _2d.blueprintBoundingBox;
|
|
1080
|
-
exports.blueprintIsInside = _2d.blueprintIsInside;
|
|
1081
|
-
exports.blueprintOrientation = _2d.blueprintOrientation;
|
|
1082
|
-
exports.blueprintToSVGPathD = _2d.blueprintToSVGPathD;
|
|
1083
1083
|
exports.createBlueprint = _2d.createBlueprint;
|
|
1084
1084
|
exports.curve2dBoundingBox = _2d.curve2dBoundingBox;
|
|
1085
1085
|
exports.curve2dDistanceFrom = _2d.curve2dDistanceFrom;
|
|
@@ -1089,28 +1089,18 @@ exports.curve2dLastPoint = _2d.curve2dLastPoint;
|
|
|
1089
1089
|
exports.curve2dParameter = _2d.curve2dParameter;
|
|
1090
1090
|
exports.curve2dSplitAt = _2d.curve2dSplitAt;
|
|
1091
1091
|
exports.curve2dTangentAt = _2d.curve2dTangentAt;
|
|
1092
|
-
exports.cutBlueprint2D = _2d.cutBlueprint2D;
|
|
1093
|
-
exports.fuseBlueprint2D = _2d.fuseBlueprint2D;
|
|
1094
1092
|
exports.getBounds2D = _2d.getBounds2D;
|
|
1095
1093
|
exports.getOrientation2D = _2d.getOrientation2D;
|
|
1096
|
-
exports.intersectBlueprint2D = _2d.intersectBlueprint2D;
|
|
1097
1094
|
exports.isInside2D = _2d.isInside2D;
|
|
1098
1095
|
exports.mirror2D = _2d.mirror2D;
|
|
1099
|
-
exports.mirrorBlueprint = _2d.mirrorBlueprint;
|
|
1100
1096
|
exports.reverseCurve = _2d.reverseCurve;
|
|
1101
1097
|
exports.rotate2D = _2d.rotate2D;
|
|
1102
|
-
exports.rotateBlueprint = _2d.rotateBlueprint;
|
|
1103
1098
|
exports.scale2D = _2d.scale2D;
|
|
1104
|
-
exports.scaleBlueprint = _2d.scaleBlueprint;
|
|
1105
1099
|
exports.sketch2DOnFace = _2d.sketch2DOnFace;
|
|
1106
1100
|
exports.sketch2DOnPlane = _2d.sketch2DOnPlane;
|
|
1107
|
-
exports.sketchBlueprintOnFace = _2d.sketchBlueprintOnFace;
|
|
1108
|
-
exports.sketchBlueprintOnPlane = _2d.sketchBlueprintOnPlane;
|
|
1109
1101
|
exports.stretch2D = _2d.stretch2D;
|
|
1110
|
-
exports.stretchBlueprint = _2d.stretchBlueprint;
|
|
1111
1102
|
exports.toSVGPathD = _2d.toSVGPathD;
|
|
1112
1103
|
exports.translate2D = _2d.translate2D;
|
|
1113
|
-
exports.translateBlueprint = _2d.translateBlueprint;
|
|
1114
1104
|
exports.cornerFinder = query.cornerFinder;
|
|
1115
1105
|
exports.edgeFinder = query.edgeFinder;
|
|
1116
1106
|
exports.faceFinder = query.faceFinder;
|
|
@@ -1207,7 +1197,7 @@ exports.iterWires = shapeFns.iterWires;
|
|
|
1207
1197
|
exports.vertexPosition = shapeFns.vertexPosition;
|
|
1208
1198
|
exports.adjacentFaces = topology.adjacentFaces;
|
|
1209
1199
|
exports.autoHeal = topology.autoHeal;
|
|
1210
|
-
exports.chamferDistAngleShape = topology.
|
|
1200
|
+
exports.chamferDistAngleShape = topology.chamferDistAngle;
|
|
1211
1201
|
exports.edgesOfFace = topology.edgesOfFace;
|
|
1212
1202
|
exports.facesOfEdge = topology.facesOfEdge;
|
|
1213
1203
|
exports.healFace = topology.healFace;
|
|
@@ -1252,7 +1242,7 @@ exports.measureVolume = measurement.measureVolume;
|
|
|
1252
1242
|
exports.measureVolumeProps = measurement.measureVolumeProps;
|
|
1253
1243
|
exports.asTopo = cast.asTopo;
|
|
1254
1244
|
exports.cast = cast.cast;
|
|
1255
|
-
exports.deserializeShape = cast.
|
|
1245
|
+
exports.deserializeShape = cast.fromBREP;
|
|
1256
1246
|
exports.downcast = cast.downcast;
|
|
1257
1247
|
exports.isCompSolid = cast.isCompSolid;
|
|
1258
1248
|
exports.iterTopo = cast.iterTopo;
|
|
@@ -1307,7 +1297,6 @@ exports.isChamferRadius = isChamferRadius;
|
|
|
1307
1297
|
exports.isEmpty = isEmpty;
|
|
1308
1298
|
exports.isFilletRadius = isFilletRadius;
|
|
1309
1299
|
exports.isNumber = isNumber;
|
|
1310
|
-
exports.isPoint = isPoint;
|
|
1311
1300
|
exports.isValid = isValid;
|
|
1312
1301
|
exports.kernelCall = kernelCall;
|
|
1313
1302
|
exports.kernelCallRaw = kernelCallRaw;
|