brepjs 18.77.0 → 18.78.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{blueprint-BE93BNYE.cjs → blueprint-B59GQsSD.cjs} +5 -5
- package/dist/{blueprint-BVe9JU-L.js → blueprint-BQmmwEKa.js} +5 -5
- package/dist/{blueprintFns-B_7kKwEZ.cjs → blueprintFns-C1kKA5qn.cjs} +2 -2
- package/dist/{blueprintFns-DWinspVK.js → blueprintFns-DSK1nrwo.js} +2 -2
- package/dist/{blueprintSketcher-D75tuXkF.cjs → blueprintSketcher-BJPBKhF3.cjs} +3 -3
- package/dist/{blueprintSketcher-DL-wgnVs.js → blueprintSketcher-EYqKWQh0.js} +3 -3
- package/dist/{boolean2D-C4Txi8U1.cjs → boolean2D-B1Di3Bpn.cjs} +4 -4
- package/dist/{boolean2D-OtHT7POp.js → boolean2D-COHH5tLX.js} +4 -4
- package/dist/brepjs.cjs +152 -151
- package/dist/brepjs.js +25 -25
- package/dist/{cameraFns-DCXqzH_m.js → cameraFns-BMrhkkOV.js} +2 -2
- package/dist/{cameraFns-DfSRnD1k.cjs → cameraFns-BZ_8L3gd.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-KuLU-4pQ.cjs → cornerFinder-Ey3oibK1.cjs} +1 -1
- package/dist/{cornerFinder-DPkLU1Of.js → cornerFinder-Fi7obttG.js} +1 -1
- package/dist/{curveFns-C0oCmjV2.cjs → curveFns-Ca59CNS0.cjs} +1 -1
- package/dist/{curveFns-B4KEYU1M.js → curveFns-CoD5E2Vl.js} +1 -1
- package/dist/{drawFns-DNokXs9U.cjs → drawFns-DTpCthM5.cjs} +12 -12
- package/dist/{drawFns-BBoTkSta.js → drawFns-D_LwehLr.js} +12 -12
- package/dist/{faceFns-p0lyVuyw.cjs → faceFns-0sI6cbHe.cjs} +2 -2
- package/dist/{faceFns-BJ2hzXJp.js → faceFns-Cuxdy-7R.js} +2 -2
- package/dist/{primitiveFns-ItlGYe3M.cjs → healingFns--PtL9j2K.cjs} +9 -466
- package/dist/{primitiveFns-DWIzRvTY.js → healingFns-Bm-NdBj_.js} +8 -303
- package/dist/{helpers-DTBDjbdR.cjs → helpers-B8mE35Fm.cjs} +6 -6
- package/dist/{helpers-C78MY-s6.js → helpers-CD8EMZ5l.js} +6 -6
- package/dist/{importFns-CUAiLgt_.cjs → importFns-BHEgzDLw.cjs} +2 -2
- package/dist/{importFns-Rv22QSn6.js → importFns-vnxBqXwv.js} +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occt/geometryQueryOps.d.ts +1 -1
- package/dist/{extrudeFns-CSWqlW-n.js → loftFns-CsHOwded.js} +93 -2
- package/dist/{extrudeFns-BJSW3EaV.cjs → loftFns-DiSsI2PM.cjs} +104 -1
- package/dist/{measureFns-C8c6xRUE.js → measureFns-CdcufPNp.js} +3 -3
- package/dist/{measureFns-DnxobCbD.cjs → measureFns-nF-OXcDV.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CuYzpojl.js → meshFns-BCgtjlbs.js} +3 -3
- package/dist/{meshFns-BawS1xNA.cjs → meshFns-CnckZa6H.cjs} +3 -3
- package/dist/operations/threadFns.d.ts +39 -0
- package/dist/operations.cjs +33 -32
- package/dist/operations.d.ts +1 -0
- package/dist/operations.js +3 -3
- package/dist/{booleanFns-D7Xgt-Og.js → primitiveFns-BSKbI4Kl.js} +301 -7
- package/dist/{booleanFns-CFa3bgbG.cjs → primitiveFns-DEBQdEkG.cjs} +460 -4
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{shapeFns-DZ6poxP7.js → shapeFns-BzlBMNRO.js} +2 -2
- package/dist/{shapeFns-D5WNrq3s.cjs → shapeFns-CecvqmYJ.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-BOWP8n4j.cjs → shapeRefFns-BDACYYRr.cjs} +4 -4
- package/dist/{shapeRefFns-ClsyeZp4.js → shapeRefFns-CpRRMBKz.js} +4 -4
- package/dist/{shapeTypes-CxSqNvHA.cjs → shapeTypes-DWxL75W3.cjs} +4 -9
- package/dist/{shapeTypes-CyTY0prh.js → shapeTypes-DfQi9Kvk.js} +4 -9
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-BtEFUFQ9.js → solidBuilders-DnIrQYZd.js} +2 -2
- package/dist/{solidBuilders-diw2zyyN.cjs → solidBuilders-osLCTRG0.cjs} +2 -2
- package/dist/{surfaceBuilders-CPHOXRLE.cjs → surfaceBuilders-B8aVZamB.cjs} +2 -2
- package/dist/{surfaceBuilders-Do0rypyD.js → surfaceBuilders-hTXdNCYm.js} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-CYc0xi6l.js → textBlueprints-BpqDGwdx.js} +9 -99
- package/dist/{textBlueprints-D31dKTZS.cjs → textBlueprints-CI3k7Izc.cjs} +17 -119
- package/dist/{textMetrics-CjbXCzpg.cjs → textMetrics-C4RrG9jL.cjs} +1 -1
- package/dist/{textMetrics-DfxB-y9A.js → textMetrics-kFw-DE2w.js} +1 -1
- package/dist/{historyFns-Ck2tXVAL.js → threadFns-DGEyXFGP.js} +73 -6
- package/dist/{historyFns-4ggYGJB2.cjs → threadFns-a_C2wGGt.cjs} +79 -6
- package/dist/topology/booleanFns.d.ts +9 -1
- package/dist/topology.cjs +39 -39
- package/dist/topology.js +7 -7
- package/dist/{topologyQueryFns-BomrmBie.js → topologyQueryFns-CqjEReSt.js} +1 -1
- package/dist/{topologyQueryFns-Dzxrwn-E.cjs → topologyQueryFns-DfOxu8tG.cjs} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as getKernel, _ as isSolid, c as createSolid, g as isShell, h as isShape3D, i as createCompound, l as createVertex } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, _ as isSolid, c as createSolid, g as isShell, h as isShape3D, i as createCompound, l as createVertex } from "./shapeTypes-DfQi9Kvk.js";
|
|
2
2
|
import { A as ok, R as unwrap, b as err, l as typeCastError, v as andThen } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { _ as cast, v as downcast } from "./faceFns-
|
|
3
|
+
import { _ as cast, v as downcast } from "./faceFns-Cuxdy-7R.js";
|
|
4
4
|
//#region src/topology/shapeUtils.ts
|
|
5
5
|
/**
|
|
6
6
|
* Shape assembly utilities — welding and sewing operations.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-DWxL75W3.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_faceFns = require("./faceFns-
|
|
3
|
+
const require_faceFns = require("./faceFns-0sI6cbHe.cjs");
|
|
4
4
|
//#region src/topology/shapeUtils.ts
|
|
5
5
|
/**
|
|
6
6
|
* Shape assembly utilities — welding and sewing operations.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-DWxL75W3.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_faceFns = require("./faceFns-
|
|
3
|
+
const require_faceFns = require("./faceFns-0sI6cbHe.cjs");
|
|
4
4
|
//#region src/utils/range.ts
|
|
5
5
|
/** Generate an array of integers `[0, 1, …, len - 1]`. */
|
|
6
6
|
function range(len) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as getKernel, a as createEdge, o as createFace, p as isFace, u as createWire, w as isPlanarFace } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, a as createEdge, o as createFace, p as isFace, u as createWire, w as isPlanarFace } from "./shapeTypes-DfQi9Kvk.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, i as kernelError, v as andThen } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { _ as cast, u as outerWire } from "./faceFns-
|
|
3
|
+
import { _ as cast, u as outerWire } from "./faceFns-Cuxdy-7R.js";
|
|
4
4
|
//#region src/utils/range.ts
|
|
5
5
|
/** Generate an array of integers `[0, 1, …, len - 1]`. */
|
|
6
6
|
function range(len) {
|
package/dist/text.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
3
|
-
const require_textMetrics = require("./textMetrics-
|
|
2
|
+
const require_textBlueprints = require("./textBlueprints-CI3k7Izc.cjs");
|
|
3
|
+
const require_textMetrics = require("./textMetrics-C4RrG9jL.cjs");
|
|
4
4
|
exports.fontMetrics = require_textMetrics.fontMetrics;
|
|
5
5
|
exports.getFont = require_textBlueprints.getFont;
|
|
6
6
|
exports.loadFont = require_textBlueprints.loadFont;
|
package/dist/text.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-
|
|
2
|
-
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-
|
|
1
|
+
import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-BpqDGwdx.js";
|
|
2
|
+
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-kFw-DE2w.js";
|
|
3
3
|
export { fontMetrics, getFont, loadFont, sketchText, textBlueprints, textMetrics };
|
|
@@ -1,106 +1,16 @@
|
|
|
1
|
-
import { Z as getKernel,
|
|
2
|
-
import { A as ok, R as unwrap, T as isOk, b as err,
|
|
1
|
+
import { Z as getKernel, o as createFace, p as isFace, u as createWire } from "./shapeTypes-DfQi9Kvk.js";
|
|
2
|
+
import { A as ok, R as unwrap, T as isOk, b as err, h as bug, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
4
4
|
import { d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-SKPRvPH-.js";
|
|
5
5
|
import { n as createPlane } from "./planeOps-DSjjtrjg.js";
|
|
6
|
-
import { _ as cast, v as downcast } from "./faceFns-
|
|
7
|
-
import { l as curveStartPoint, u as curveTangentAt } from "./curveFns-
|
|
6
|
+
import { _ as cast, v as downcast } from "./faceFns-Cuxdy-7R.js";
|
|
7
|
+
import { l as curveStartPoint, u as curveTangentAt } from "./curveFns-CoD5E2Vl.js";
|
|
8
8
|
import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
9
|
-
import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-
|
|
10
|
-
import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-
|
|
11
|
-
import { o as makeSolid, t as makeCompound } from "./solidBuilders-
|
|
12
|
-
import {
|
|
9
|
+
import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-hTXdNCYm.js";
|
|
10
|
+
import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-EYqKWQh0.js";
|
|
11
|
+
import { o as makeSolid, t as makeCompound } from "./solidBuilders-DnIrQYZd.js";
|
|
12
|
+
import { a as revolve, d as twistExtrude, o as complexExtrude, r as extrude, t as loft, u as sweep } from "./loftFns-CsHOwded.js";
|
|
13
13
|
import opentype from "opentype.js";
|
|
14
|
-
//#region src/operations/loftFns.ts
|
|
15
|
-
/**
|
|
16
|
-
* Functional loft operation using branded shape types.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Loft through a set of wire profiles to create a 3D shape.
|
|
20
|
-
*
|
|
21
|
-
* Builds a `BRepOffsetAPI_ThruSections` surface through the given wires,
|
|
22
|
-
* optionally starting and/or ending at point vertices. Produces a solid
|
|
23
|
-
* by default, or a shell when `returnShell` is `true`.
|
|
24
|
-
*
|
|
25
|
-
* @param wires - Ordered wire profiles to loft through.
|
|
26
|
-
* @param config - Loft configuration (ruled interpolation, start/end points).
|
|
27
|
-
* @param returnShell - When `true`, return a shell instead of a solid.
|
|
28
|
-
* @returns `Result` containing the lofted 3D shape, or an error on failure.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* const result = loft([bottomWire, topWire], { ruled: false });
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @see {@link loft!loft | loft} for the OOP API equivalent.
|
|
36
|
-
*/
|
|
37
|
-
function loft(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
|
|
38
|
-
if (wires.length === 0 && !startPoint && !endPoint) return err(validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
39
|
-
const kernel = getKernel();
|
|
40
|
-
const startVertex = startPoint ? kernel.makeVertex(...toVec3(startPoint)) : void 0;
|
|
41
|
-
const endVertex = endPoint ? kernel.makeVertex(...toVec3(endPoint)) : void 0;
|
|
42
|
-
try {
|
|
43
|
-
const result = castShape(kernel.loftAdvanced(wires.map((w) => w.wrapped), {
|
|
44
|
-
solid: !returnShell,
|
|
45
|
-
ruled,
|
|
46
|
-
tolerance,
|
|
47
|
-
...startVertex ? { startVertex } : {},
|
|
48
|
-
...endVertex ? { endVertex } : {}
|
|
49
|
-
}));
|
|
50
|
-
if (!isShape3D(result)) return err(typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
51
|
-
return ok(result);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
return err(kernelError("LOFT_FAILED", "Loft operation failed", e, void 0, "Common causes: wire profiles with different edge counts, self-intersecting result, or profiles too far apart. Ensure profiles are compatible and ordered."));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Batch loft: build N independent lofts in a single kernel call.
|
|
58
|
-
*
|
|
59
|
-
* Uses the C++ LoftBatch extractor when available (single WASM call),
|
|
60
|
-
* falling back to N individual loft operations otherwise.
|
|
61
|
-
*
|
|
62
|
-
* @returns Array of 3D shapes, one per entry.
|
|
63
|
-
*/
|
|
64
|
-
function loftAll(entries) {
|
|
65
|
-
if (entries.length === 0) return ok([]);
|
|
66
|
-
const kernel = getKernel();
|
|
67
|
-
const verticesToDelete = [];
|
|
68
|
-
const kernelEntries = entries.map((e) => {
|
|
69
|
-
const startVertex = e.startPoint ? kernel.makeVertex(...toVec3(e.startPoint)) : void 0;
|
|
70
|
-
const endVertex = e.endPoint ? kernel.makeVertex(...toVec3(e.endPoint)) : void 0;
|
|
71
|
-
if (startVertex) verticesToDelete.push(startVertex);
|
|
72
|
-
if (endVertex) verticesToDelete.push(endVertex);
|
|
73
|
-
return {
|
|
74
|
-
wires: e.wires.map((w) => w.wrapped),
|
|
75
|
-
solid: true,
|
|
76
|
-
ruled: e.ruled ?? true,
|
|
77
|
-
tolerance: e.tolerance ?? 1e-6,
|
|
78
|
-
startVertex,
|
|
79
|
-
endVertex
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
try {
|
|
83
|
-
const shapes = kernel.loftBatch?.(kernelEntries) ?? kernelEntries.map((e) => kernel.loftAdvanced(e.wires, {
|
|
84
|
-
solid: e.solid,
|
|
85
|
-
ruled: e.ruled,
|
|
86
|
-
tolerance: e.tolerance,
|
|
87
|
-
startVertex: e.startVertex,
|
|
88
|
-
endVertex: e.endVertex
|
|
89
|
-
}));
|
|
90
|
-
const results = [];
|
|
91
|
-
for (const shape of shapes) {
|
|
92
|
-
const cast = castShape(shape);
|
|
93
|
-
if (!isShape3D(cast)) return err(typeCastError("LOFT_ALL_NOT_3D", "Batch loft entry did not produce a 3D shape"));
|
|
94
|
-
results.push(cast);
|
|
95
|
-
}
|
|
96
|
-
return ok(results);
|
|
97
|
-
} catch (e) {
|
|
98
|
-
return err(kernelError("LOFT_ALL_FAILED", "Batch loft operation failed", e));
|
|
99
|
-
} finally {
|
|
100
|
-
for (const v of verticesToDelete) kernel.dispose(v);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
14
|
//#region src/sketching/compoundSketch.ts
|
|
105
15
|
/**
|
|
106
16
|
* Represent a face with holes as a group of sketches (one outer + zero or more inner).
|
|
@@ -640,4 +550,4 @@ function textBlueprints(text, { startX = 0, startY = 0, fontSize = 16, fontFamil
|
|
|
640
550
|
return organiseBlueprints(Array.from(sketchFontCommands(writtenText.commands))).mirror([0, 0]);
|
|
641
551
|
}
|
|
642
552
|
//#endregion
|
|
643
|
-
export { wrapSketchDataArray as _, Sketch as a,
|
|
553
|
+
export { wrapSketchDataArray as _, Sketch as a, compoundSketchLoft as c, sketchFace as d, sketchLoft as f, wrapSketchData as g, sketchWires as h, Sketches as i, compoundSketchRevolve as l, sketchSweep as m, getFont as n, compoundSketchExtrude as o, sketchRevolve as p, loadFont as r, compoundSketchFace as s, textBlueprints as t, sketchExtrude as u, CompoundSketch as v };
|
|
@@ -29,110 +29,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
enumerable: true
|
|
30
30
|
}) : target, mod));
|
|
31
31
|
//#endregion
|
|
32
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
32
|
+
const require_shapeTypes = require("./shapeTypes-DWxL75W3.cjs");
|
|
33
33
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
34
34
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
35
35
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
36
36
|
const require_planeOps = require("./planeOps-BA4HfgQu.cjs");
|
|
37
|
-
const require_faceFns = require("./faceFns-
|
|
38
|
-
const require_curveFns = require("./curveFns-
|
|
37
|
+
const require_faceFns = require("./faceFns-0sI6cbHe.cjs");
|
|
38
|
+
const require_curveFns = require("./curveFns-Ca59CNS0.cjs");
|
|
39
39
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
40
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
41
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
42
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
43
|
-
const
|
|
40
|
+
const require_surfaceBuilders = require("./surfaceBuilders-B8aVZamB.cjs");
|
|
41
|
+
const require_blueprintSketcher = require("./blueprintSketcher-BJPBKhF3.cjs");
|
|
42
|
+
const require_solidBuilders = require("./solidBuilders-osLCTRG0.cjs");
|
|
43
|
+
const require_loftFns = require("./loftFns-DiSsI2PM.cjs");
|
|
44
44
|
let opentype_js = require("opentype.js");
|
|
45
45
|
opentype_js = __toESM(opentype_js, 1);
|
|
46
|
-
//#region src/operations/loftFns.ts
|
|
47
|
-
/**
|
|
48
|
-
* Functional loft operation using branded shape types.
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
* Loft through a set of wire profiles to create a 3D shape.
|
|
52
|
-
*
|
|
53
|
-
* Builds a `BRepOffsetAPI_ThruSections` surface through the given wires,
|
|
54
|
-
* optionally starting and/or ending at point vertices. Produces a solid
|
|
55
|
-
* by default, or a shell when `returnShell` is `true`.
|
|
56
|
-
*
|
|
57
|
-
* @param wires - Ordered wire profiles to loft through.
|
|
58
|
-
* @param config - Loft configuration (ruled interpolation, start/end points).
|
|
59
|
-
* @param returnShell - When `true`, return a shell instead of a solid.
|
|
60
|
-
* @returns `Result` containing the lofted 3D shape, or an error on failure.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```ts
|
|
64
|
-
* const result = loft([bottomWire, topWire], { ruled: false });
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @see {@link loft!loft | loft} for the OOP API equivalent.
|
|
68
|
-
*/
|
|
69
|
-
function loft(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
|
|
70
|
-
if (wires.length === 0 && !startPoint && !endPoint) return require_errors.err(require_errors.validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
71
|
-
const kernel = require_shapeTypes.getKernel();
|
|
72
|
-
const startVertex = startPoint ? kernel.makeVertex(...require_types.toVec3(startPoint)) : void 0;
|
|
73
|
-
const endVertex = endPoint ? kernel.makeVertex(...require_types.toVec3(endPoint)) : void 0;
|
|
74
|
-
try {
|
|
75
|
-
const result = require_shapeTypes.castShape(kernel.loftAdvanced(wires.map((w) => w.wrapped), {
|
|
76
|
-
solid: !returnShell,
|
|
77
|
-
ruled,
|
|
78
|
-
tolerance,
|
|
79
|
-
...startVertex ? { startVertex } : {},
|
|
80
|
-
...endVertex ? { endVertex } : {}
|
|
81
|
-
}));
|
|
82
|
-
if (!require_shapeTypes.isShape3D(result)) return require_errors.err(require_errors.typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
83
|
-
return require_errors.ok(result);
|
|
84
|
-
} catch (e) {
|
|
85
|
-
return require_errors.err(require_errors.kernelError("LOFT_FAILED", "Loft operation failed", e, void 0, "Common causes: wire profiles with different edge counts, self-intersecting result, or profiles too far apart. Ensure profiles are compatible and ordered."));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Batch loft: build N independent lofts in a single kernel call.
|
|
90
|
-
*
|
|
91
|
-
* Uses the C++ LoftBatch extractor when available (single WASM call),
|
|
92
|
-
* falling back to N individual loft operations otherwise.
|
|
93
|
-
*
|
|
94
|
-
* @returns Array of 3D shapes, one per entry.
|
|
95
|
-
*/
|
|
96
|
-
function loftAll(entries) {
|
|
97
|
-
if (entries.length === 0) return require_errors.ok([]);
|
|
98
|
-
const kernel = require_shapeTypes.getKernel();
|
|
99
|
-
const verticesToDelete = [];
|
|
100
|
-
const kernelEntries = entries.map((e) => {
|
|
101
|
-
const startVertex = e.startPoint ? kernel.makeVertex(...require_types.toVec3(e.startPoint)) : void 0;
|
|
102
|
-
const endVertex = e.endPoint ? kernel.makeVertex(...require_types.toVec3(e.endPoint)) : void 0;
|
|
103
|
-
if (startVertex) verticesToDelete.push(startVertex);
|
|
104
|
-
if (endVertex) verticesToDelete.push(endVertex);
|
|
105
|
-
return {
|
|
106
|
-
wires: e.wires.map((w) => w.wrapped),
|
|
107
|
-
solid: true,
|
|
108
|
-
ruled: e.ruled ?? true,
|
|
109
|
-
tolerance: e.tolerance ?? 1e-6,
|
|
110
|
-
startVertex,
|
|
111
|
-
endVertex
|
|
112
|
-
};
|
|
113
|
-
});
|
|
114
|
-
try {
|
|
115
|
-
const shapes = kernel.loftBatch?.(kernelEntries) ?? kernelEntries.map((e) => kernel.loftAdvanced(e.wires, {
|
|
116
|
-
solid: e.solid,
|
|
117
|
-
ruled: e.ruled,
|
|
118
|
-
tolerance: e.tolerance,
|
|
119
|
-
startVertex: e.startVertex,
|
|
120
|
-
endVertex: e.endVertex
|
|
121
|
-
}));
|
|
122
|
-
const results = [];
|
|
123
|
-
for (const shape of shapes) {
|
|
124
|
-
const cast = require_shapeTypes.castShape(shape);
|
|
125
|
-
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.typeCastError("LOFT_ALL_NOT_3D", "Batch loft entry did not produce a 3D shape"));
|
|
126
|
-
results.push(cast);
|
|
127
|
-
}
|
|
128
|
-
return require_errors.ok(results);
|
|
129
|
-
} catch (e) {
|
|
130
|
-
return require_errors.err(require_errors.kernelError("LOFT_ALL_FAILED", "Batch loft operation failed", e));
|
|
131
|
-
} finally {
|
|
132
|
-
for (const v of verticesToDelete) kernel.dispose(v);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
136
46
|
//#region src/sketching/compoundSketch.ts
|
|
137
47
|
/**
|
|
138
48
|
* Represent a face with holes as a group of sketches (one outer + zero or more inner).
|
|
@@ -230,7 +140,7 @@ function sketchWires(sketch) {
|
|
|
230
140
|
*/
|
|
231
141
|
function sketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
232
142
|
const face = require_errors.unwrap(require_surfaceBuilders.makeFace(sketch.wire));
|
|
233
|
-
const solid = require_errors.unwrap(
|
|
143
|
+
const solid = require_errors.unwrap(require_loftFns.revolve(face, origin ? require_types.toVec3(origin) : sketch.defaultOrigin, revolutionAxis ? require_types.toVec3(revolutionAxis) : [
|
|
234
144
|
0,
|
|
235
145
|
0,
|
|
236
146
|
1
|
|
@@ -251,16 +161,16 @@ function sketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusio
|
|
|
251
161
|
const extrusionVec = require_vecOps.vecScale(require_vecOps.vecNormalize(extrusionDirection ? require_types.toVec3(extrusionDirection) : sketch.defaultDirection), extrusionDistance);
|
|
252
162
|
const originVec = origin ? require_types.toVec3(origin) : sketch.defaultOrigin;
|
|
253
163
|
if (extrusionProfile && !twistAngle) {
|
|
254
|
-
const solid = require_errors.unwrap(
|
|
164
|
+
const solid = require_errors.unwrap(require_loftFns.complexExtrude(sketch.wire, [...originVec], [...extrusionVec], extrusionProfile));
|
|
255
165
|
sketch.delete();
|
|
256
166
|
return solid;
|
|
257
167
|
}
|
|
258
168
|
if (twistAngle) {
|
|
259
|
-
const solid = require_errors.unwrap(
|
|
169
|
+
const solid = require_errors.unwrap(require_loftFns.twistExtrude(sketch.wire, twistAngle, [...originVec], [...extrusionVec], extrusionProfile));
|
|
260
170
|
sketch.delete();
|
|
261
171
|
return solid;
|
|
262
172
|
}
|
|
263
|
-
const solid = require_errors.unwrap(
|
|
173
|
+
const solid = require_errors.unwrap(require_loftFns.extrude(require_errors.unwrap(require_surfaceBuilders.makeFace(sketch.wire)), [...extrusionVec]));
|
|
264
174
|
sketch.delete();
|
|
265
175
|
return solid;
|
|
266
176
|
}
|
|
@@ -287,7 +197,7 @@ function sketchSweep(sketch, sketchOnPlane, sweepConfig = {}) {
|
|
|
287
197
|
...sweepConfig
|
|
288
198
|
};
|
|
289
199
|
if (sketch.baseFace) config.support = sketch.baseFace.wrapped;
|
|
290
|
-
const shape = require_errors.unwrap(
|
|
200
|
+
const shape = require_errors.unwrap(require_loftFns.sweep(profile.wire, sketch.wire, config));
|
|
291
201
|
sketch.delete();
|
|
292
202
|
return shape;
|
|
293
203
|
}
|
|
@@ -298,7 +208,7 @@ function sketchSweep(sketch, sketchOnPlane, sweepConfig = {}) {
|
|
|
298
208
|
*/
|
|
299
209
|
function sketchLoft(sketch, otherSketches, loftConfig = {}, returnShell = false) {
|
|
300
210
|
const sketchArray = Array.isArray(otherSketches) ? [sketch, ...otherSketches] : [sketch, otherSketches];
|
|
301
|
-
const shape = require_errors.unwrap(loft(sketchArray.map((s) => s.wire), loftConfig, returnShell));
|
|
211
|
+
const shape = require_errors.unwrap(require_loftFns.loft(sketchArray.map((s) => s.wire), loftConfig, returnShell));
|
|
302
212
|
sketchArray.forEach((s) => {
|
|
303
213
|
s.delete();
|
|
304
214
|
});
|
|
@@ -360,9 +270,9 @@ function compoundSketchWires(sketch) {
|
|
|
360
270
|
*/
|
|
361
271
|
function compoundSketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
362
272
|
const extrusionVec = require_vecOps.vecScale(require_vecOps.vecNormalize(extrusionDirection ? require_types.toVec3(extrusionDirection) : sketch.outerSketch.defaultDirection), extrusionDistance);
|
|
363
|
-
if (extrusionProfile && !twistAngle) return solidFromShellGenerator(sketch.sketches, (s) =>
|
|
364
|
-
if (twistAngle) return solidFromShellGenerator(sketch.sketches, (s) =>
|
|
365
|
-
return require_errors.unwrap(
|
|
273
|
+
if (extrusionProfile && !twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => require_loftFns.complexExtrude(s.wire, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
|
|
274
|
+
if (twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => require_loftFns.twistExtrude(s.wire, twistAngle, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
|
|
275
|
+
return require_errors.unwrap(require_loftFns.extrude(compoundSketchFace(sketch), extrusionVec));
|
|
366
276
|
}
|
|
367
277
|
/** Revolve a compound sketch (outer + holes) around an axis. */
|
|
368
278
|
function compoundSketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
@@ -372,7 +282,7 @@ function compoundSketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
|
372
282
|
0,
|
|
373
283
|
1
|
|
374
284
|
];
|
|
375
|
-
return require_errors.unwrap(
|
|
285
|
+
return require_errors.unwrap(require_loftFns.revolve(compoundSketchFace(sketch), center, dir));
|
|
376
286
|
}
|
|
377
287
|
/** Loft between two compound sketches with matching sub-sketch counts. */
|
|
378
288
|
function compoundSketchLoft(sketch, other, loftConfig) {
|
|
@@ -732,18 +642,6 @@ Object.defineProperty(exports, "loadFont", {
|
|
|
732
642
|
return loadFont;
|
|
733
643
|
}
|
|
734
644
|
});
|
|
735
|
-
Object.defineProperty(exports, "loft", {
|
|
736
|
-
enumerable: true,
|
|
737
|
-
get: function() {
|
|
738
|
-
return loft;
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
Object.defineProperty(exports, "loftAll", {
|
|
742
|
-
enumerable: true,
|
|
743
|
-
get: function() {
|
|
744
|
-
return loftAll;
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
645
|
Object.defineProperty(exports, "sketchExtrude", {
|
|
748
646
|
enumerable: true,
|
|
749
647
|
get: function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
2
|
-
import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-
|
|
2
|
+
import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-BpqDGwdx.js";
|
|
3
3
|
//#region src/text/sketchText.ts
|
|
4
4
|
/**
|
|
5
5
|
* Render text as 3D sketch outlines on a plane.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { B as createKernelHandle, Z as getKernel, t as castShape } from "./shapeTypes-
|
|
2
|
-
import { A as ok, b as err, d as validationError, n as computationError, r as ioError } from "./errors-DNWJsfVU.js";
|
|
1
|
+
import { B as createKernelHandle, R as DisposalScope, Y as _usingCtx, Z as getKernel, t as castShape } from "./shapeTypes-DfQi9Kvk.js";
|
|
2
|
+
import { A as ok, T as isOk, b as err, d as validationError, n as computationError, r as ioError } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
|
|
4
|
-
import { y as fromBREP } from "./faceFns-
|
|
5
|
-
import { s as toBREP } from "./shapeFns-
|
|
6
|
-
import {
|
|
4
|
+
import { y as fromBREP } from "./faceFns-Cuxdy-7R.js";
|
|
5
|
+
import { s as toBREP } from "./shapeFns-BzlBMNRO.js";
|
|
6
|
+
import { E as wire, M as fuseAll, h as line } from "./primitiveFns-BSKbI4Kl.js";
|
|
7
|
+
import { t as loft } from "./loftFns-CsHOwded.js";
|
|
7
8
|
//#region src/utils/uuid.ts
|
|
8
9
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
9
10
|
function uuidv() {
|
|
@@ -455,4 +456,70 @@ function deserializeHistory(data) {
|
|
|
455
456
|
});
|
|
456
457
|
}
|
|
457
458
|
//#endregion
|
|
458
|
-
|
|
459
|
+
//#region src/operations/threadFns.ts
|
|
460
|
+
/**
|
|
461
|
+
* Build a helical screw-thread ridge by lofting rotated tooth sections.
|
|
462
|
+
*
|
|
463
|
+
* @param options - {@link ThreadOptions}.
|
|
464
|
+
* @returns `Result` with the thread-ridge solid, or an error.
|
|
465
|
+
*
|
|
466
|
+
* @example External thread (Ø12 rod, 2.5 mm pitch):
|
|
467
|
+
* ```ts
|
|
468
|
+
* const ridge = thread({ radius: 6, pitch: 2.5, height: 7.5 });
|
|
469
|
+
* const rod = fuse(cylinder(6.15, 7.5), unwrap(ridge));
|
|
470
|
+
* ```
|
|
471
|
+
* @example Internal thread (tapped Ø6 hole):
|
|
472
|
+
* ```ts
|
|
473
|
+
* const ridge = thread({ radius: 3, pitch: 1, height: 6, inward: true });
|
|
474
|
+
* const nut = cut(boredBlock, unwrap(ridge));
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
function thread(options) {
|
|
478
|
+
try {
|
|
479
|
+
var _usingCtx$1 = _usingCtx();
|
|
480
|
+
const { radius, pitch, height, depth = .6 * pitch, toothHalfWidth = .42 * pitch, sectionsPerTurn = 20, lefthand = false, inward = false } = options;
|
|
481
|
+
if (!(radius > 0)) return err(validationError("THREAD_INVALID_RADIUS", "radius must be > 0"));
|
|
482
|
+
if (!(pitch > 0)) return err(validationError("THREAD_INVALID_PITCH", "pitch must be > 0"));
|
|
483
|
+
if (!(height > 0)) return err(validationError("THREAD_INVALID_HEIGHT", "height must be > 0"));
|
|
484
|
+
if (!(depth > 0)) return err(validationError("THREAD_INVALID_DEPTH", "depth must be > 0"));
|
|
485
|
+
if (sectionsPerTurn < 3) return err(validationError("THREAD_TOO_FEW_SECTIONS", "sectionsPerTurn must be >= 3"));
|
|
486
|
+
const turns = height / pitch;
|
|
487
|
+
const nSec = Math.max(2, Math.round(turns * sectionsPerTurn));
|
|
488
|
+
const sign = lefthand ? -1 : 1;
|
|
489
|
+
const apexU = inward ? -depth : depth;
|
|
490
|
+
const baseU = inward ? .3 : -.3;
|
|
491
|
+
const a = toothHalfWidth;
|
|
492
|
+
const scope = _usingCtx$1.u(new DisposalScope());
|
|
493
|
+
const sections = [];
|
|
494
|
+
for (let i = 0; i <= nSec; i++) {
|
|
495
|
+
const th = sign * i * 2 * Math.PI / sectionsPerTurn;
|
|
496
|
+
const z = pitch * Math.abs(th) / (2 * Math.PI);
|
|
497
|
+
const cx = radius * Math.cos(th);
|
|
498
|
+
const cy = radius * Math.sin(th);
|
|
499
|
+
const rx = Math.cos(th);
|
|
500
|
+
const ry = Math.sin(th);
|
|
501
|
+
const pt = (u, v) => [
|
|
502
|
+
cx + u * rx,
|
|
503
|
+
cy + u * ry,
|
|
504
|
+
z + v
|
|
505
|
+
];
|
|
506
|
+
const p1 = pt(baseU, -a);
|
|
507
|
+
const apex = pt(apexU, 0);
|
|
508
|
+
const p3 = pt(baseU, a);
|
|
509
|
+
const w = wire([
|
|
510
|
+
scope.register(line(p1, apex)),
|
|
511
|
+
scope.register(line(apex, p3)),
|
|
512
|
+
scope.register(line(p3, p1))
|
|
513
|
+
]);
|
|
514
|
+
if (!isOk(w)) return w;
|
|
515
|
+
sections.push(scope.register(w.value));
|
|
516
|
+
}
|
|
517
|
+
return loft(sections, { ruled: true });
|
|
518
|
+
} catch (_) {
|
|
519
|
+
_usingCtx$1.e = _;
|
|
520
|
+
} finally {
|
|
521
|
+
_usingCtx$1.d();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
525
|
+
export { updateNode as C, linearPattern as D, gridPattern as E, exportAssemblySTEP as O, removeChild as S, circularPattern as T, addChild as _, deserializeHistory as a, createAssemblyNode as b, modifyStep as c, replayFrom as d, replayHistory as f, undoLast as g, stepsFrom as h, createRegistry as i, createAssembly as k, registerOperation as l, stepCount as m, addStep as n, findStep as o, serializeHistory as p, createHistory as r, getShape as s, thread as t, registerShape as u, collectShapes as v, walkAssembly as w, findNode as x, countNodes as y };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-DWxL75W3.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
5
|
-
const require_shapeFns = require("./shapeFns-
|
|
6
|
-
const
|
|
4
|
+
const require_faceFns = require("./faceFns-0sI6cbHe.cjs");
|
|
5
|
+
const require_shapeFns = require("./shapeFns-CecvqmYJ.cjs");
|
|
6
|
+
const require_primitiveFns = require("./primitiveFns-DEBQdEkG.cjs");
|
|
7
|
+
const require_loftFns = require("./loftFns-DiSsI2PM.cjs");
|
|
7
8
|
//#region src/utils/uuid.ts
|
|
8
9
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
9
10
|
function uuidv() {
|
|
@@ -127,7 +128,7 @@ function linearPattern(shape, direction, count, spacing, options) {
|
|
|
127
128
|
if (count === 1) return require_errors.ok(shape);
|
|
128
129
|
if (require_vecOps.vecIsZero(direction)) return require_errors.err(require_errors.validationError("PATTERN_ZERO_DIRECTION", "Pattern direction cannot be zero"));
|
|
129
130
|
const dir = require_vecOps.vecNormalize(direction);
|
|
130
|
-
return
|
|
131
|
+
return require_primitiveFns.fuseAll(require_shapeTypes.getKernel().linearPattern(shape.wrapped, [...dir], spacing, count).map((s) => require_shapeTypes.castShape(s)), {
|
|
131
132
|
optimisation: "sameFace",
|
|
132
133
|
...options,
|
|
133
134
|
unsafe: true
|
|
@@ -153,7 +154,7 @@ function circularPattern(shape, axis, count, fullAngle = 360, center = [
|
|
|
153
154
|
if (count === 1) return require_errors.ok(shape);
|
|
154
155
|
if (require_vecOps.vecIsZero(axis)) return require_errors.err(require_errors.validationError("PATTERN_ZERO_AXIS", "Pattern axis cannot be zero"));
|
|
155
156
|
const angleStep = fullAngle / count;
|
|
156
|
-
return
|
|
157
|
+
return require_primitiveFns.fuseAll(require_shapeTypes.getKernel().circularPattern(shape.wrapped, [...center], [...axis], angleStep, count).map((s) => require_shapeTypes.castShape(s)), {
|
|
157
158
|
optimisation: "sameFace",
|
|
158
159
|
...options,
|
|
159
160
|
unsafe: true
|
|
@@ -455,6 +456,72 @@ function deserializeHistory(data) {
|
|
|
455
456
|
});
|
|
456
457
|
}
|
|
457
458
|
//#endregion
|
|
459
|
+
//#region src/operations/threadFns.ts
|
|
460
|
+
/**
|
|
461
|
+
* Build a helical screw-thread ridge by lofting rotated tooth sections.
|
|
462
|
+
*
|
|
463
|
+
* @param options - {@link ThreadOptions}.
|
|
464
|
+
* @returns `Result` with the thread-ridge solid, or an error.
|
|
465
|
+
*
|
|
466
|
+
* @example External thread (Ø12 rod, 2.5 mm pitch):
|
|
467
|
+
* ```ts
|
|
468
|
+
* const ridge = thread({ radius: 6, pitch: 2.5, height: 7.5 });
|
|
469
|
+
* const rod = fuse(cylinder(6.15, 7.5), unwrap(ridge));
|
|
470
|
+
* ```
|
|
471
|
+
* @example Internal thread (tapped Ø6 hole):
|
|
472
|
+
* ```ts
|
|
473
|
+
* const ridge = thread({ radius: 3, pitch: 1, height: 6, inward: true });
|
|
474
|
+
* const nut = cut(boredBlock, unwrap(ridge));
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
function thread(options) {
|
|
478
|
+
try {
|
|
479
|
+
var _usingCtx$1 = require_shapeTypes._usingCtx();
|
|
480
|
+
const { radius, pitch, height, depth = .6 * pitch, toothHalfWidth = .42 * pitch, sectionsPerTurn = 20, lefthand = false, inward = false } = options;
|
|
481
|
+
if (!(radius > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_RADIUS", "radius must be > 0"));
|
|
482
|
+
if (!(pitch > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_PITCH", "pitch must be > 0"));
|
|
483
|
+
if (!(height > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_HEIGHT", "height must be > 0"));
|
|
484
|
+
if (!(depth > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_DEPTH", "depth must be > 0"));
|
|
485
|
+
if (sectionsPerTurn < 3) return require_errors.err(require_errors.validationError("THREAD_TOO_FEW_SECTIONS", "sectionsPerTurn must be >= 3"));
|
|
486
|
+
const turns = height / pitch;
|
|
487
|
+
const nSec = Math.max(2, Math.round(turns * sectionsPerTurn));
|
|
488
|
+
const sign = lefthand ? -1 : 1;
|
|
489
|
+
const apexU = inward ? -depth : depth;
|
|
490
|
+
const baseU = inward ? .3 : -.3;
|
|
491
|
+
const a = toothHalfWidth;
|
|
492
|
+
const scope = _usingCtx$1.u(new require_shapeTypes.DisposalScope());
|
|
493
|
+
const sections = [];
|
|
494
|
+
for (let i = 0; i <= nSec; i++) {
|
|
495
|
+
const th = sign * i * 2 * Math.PI / sectionsPerTurn;
|
|
496
|
+
const z = pitch * Math.abs(th) / (2 * Math.PI);
|
|
497
|
+
const cx = radius * Math.cos(th);
|
|
498
|
+
const cy = radius * Math.sin(th);
|
|
499
|
+
const rx = Math.cos(th);
|
|
500
|
+
const ry = Math.sin(th);
|
|
501
|
+
const pt = (u, v) => [
|
|
502
|
+
cx + u * rx,
|
|
503
|
+
cy + u * ry,
|
|
504
|
+
z + v
|
|
505
|
+
];
|
|
506
|
+
const p1 = pt(baseU, -a);
|
|
507
|
+
const apex = pt(apexU, 0);
|
|
508
|
+
const p3 = pt(baseU, a);
|
|
509
|
+
const w = require_primitiveFns.wire([
|
|
510
|
+
scope.register(require_primitiveFns.line(p1, apex)),
|
|
511
|
+
scope.register(require_primitiveFns.line(apex, p3)),
|
|
512
|
+
scope.register(require_primitiveFns.line(p3, p1))
|
|
513
|
+
]);
|
|
514
|
+
if (!require_errors.isOk(w)) return w;
|
|
515
|
+
sections.push(scope.register(w.value));
|
|
516
|
+
}
|
|
517
|
+
return require_loftFns.loft(sections, { ruled: true });
|
|
518
|
+
} catch (_) {
|
|
519
|
+
_usingCtx$1.e = _;
|
|
520
|
+
} finally {
|
|
521
|
+
_usingCtx$1.d();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
458
525
|
Object.defineProperty(exports, "addChild", {
|
|
459
526
|
enumerable: true,
|
|
460
527
|
get: function() {
|
|
@@ -605,6 +672,12 @@ Object.defineProperty(exports, "stepsFrom", {
|
|
|
605
672
|
return stepsFrom;
|
|
606
673
|
}
|
|
607
674
|
});
|
|
675
|
+
Object.defineProperty(exports, "thread", {
|
|
676
|
+
enumerable: true,
|
|
677
|
+
get: function() {
|
|
678
|
+
return thread;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
608
681
|
Object.defineProperty(exports, "undoLast", {
|
|
609
682
|
enumerable: true,
|
|
610
683
|
get: function() {
|
|
@@ -55,7 +55,15 @@ export declare function intersect(a: Shape3D, b: Shape3D, options: BooleanOption
|
|
|
55
55
|
* Fuse all shapes in a single boolean operation.
|
|
56
56
|
*
|
|
57
57
|
* With `strategy: 'native'` (default), uses N-way BRepAlgoAPI_BuilderAlgo.
|
|
58
|
-
* With `strategy: 'pairwise'`, uses recursive divide-and-conquer
|
|
58
|
+
* With `strategy: 'pairwise'`, uses recursive divide-and-conquer over
|
|
59
|
+
* BRepAlgoAPI_Fuse.
|
|
60
|
+
*
|
|
61
|
+
* `strategy: 'pairwise'` is the workaround for #1126: the native N-way builder
|
|
62
|
+
* can silently corrupt the topology of certain disjoint inputs (e.g. an
|
|
63
|
+
* annular-sector tread fused with a frenet-swept rail) so the result passes all
|
|
64
|
+
* in-memory checks but traps the STEP writer. The pairwise path uses a different
|
|
65
|
+
* OCCT algorithm that is not affected. Tracked upstream at
|
|
66
|
+
* andymai/opencascade.js#3.
|
|
59
67
|
*
|
|
60
68
|
* @param shapes - Array of 3D shapes to fuse (at least one required).
|
|
61
69
|
* @param options - Boolean operation options.
|