brepjs 18.69.1 → 18.69.2
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-a7QLhV4U.cjs → blueprint-DIQeD9xj.cjs} +5 -5
- package/dist/{blueprint-Z5mhI2QD.js → blueprint-Dgl9IkCV.js} +5 -5
- package/dist/{blueprintFns-DULa6FpG.cjs → blueprintFns-BO44cqFY.cjs} +2 -2
- package/dist/{blueprintFns-BNhsXv6q.js → blueprintFns-sKzHcJ4U.js} +2 -2
- package/dist/{blueprintSketcher-4zOPSOnK.cjs → blueprintSketcher-BpOknLmX.cjs} +3 -3
- package/dist/{blueprintSketcher-0DeTMXwj.js → blueprintSketcher-DbINWerx.js} +3 -3
- package/dist/{boolean2D-BNWuFXK_.js → boolean2D-CreNaKXt.js} +4 -4
- package/dist/{boolean2D-xDBZQH_n.cjs → boolean2D-DZcOTOSA.cjs} +4 -4
- package/dist/{booleanFns-CaKngiuu.js → booleanFns-0jDBFjAv.js} +4 -4
- package/dist/{booleanFns-aeG4pQmM.cjs → booleanFns-DvXg6a2Y.cjs} +4 -4
- package/dist/brepjs.cjs +25 -25
- package/dist/brepjs.js +25 -25
- package/dist/{cameraFns-k787od3u.js → cameraFns-Bwxq0IDz.js} +2 -2
- package/dist/{cameraFns-Bk8frXwa.cjs → cameraFns-CsGSVYgb.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-tTS3ny7e.cjs → cornerFinder-ChltJ_ur.cjs} +1 -1
- package/dist/{cornerFinder-B8GvvW0U.js → cornerFinder-fMf9-El_.js} +1 -1
- package/dist/{curveFns-DvNBwUdJ.js → curveFns-BhTtS18d.js} +1 -1
- package/dist/{curveFns-CYP8UOgX.cjs → curveFns-CXytEfTr.cjs} +1 -1
- package/dist/{drawFns-Chpdmj4G.cjs → drawFns-Bn4vzbUr.cjs} +12 -12
- package/dist/{drawFns-DmAPsfmx.js → drawFns-Bzr38vZx.js} +12 -12
- package/dist/{extrudeFns-IvYW5-8y.cjs → extrudeFns-C0FsOXev.cjs} +1 -1
- package/dist/{extrudeFns-CMr1tf7I.js → extrudeFns-rnUgev_g.js} +1 -1
- package/dist/{faceFns-CZp3Y8vi.js → faceFns-Dreo5ksY.js} +2 -2
- package/dist/{faceFns-Byt7Vd3F.cjs → faceFns-FAZgMVCx.cjs} +2 -2
- package/dist/{helpers-BX-0e71G.js → helpers--BMa_zB7.js} +6 -6
- package/dist/{helpers-wFts3ttt.cjs → helpers-D8ycrNeD.cjs} +6 -6
- package/dist/{historyFns-CZ9oNL7j.js → historyFns-CR0RejKJ.js} +4 -4
- package/dist/{historyFns-BzPsKySX.cjs → historyFns-mnmeZ0kB.cjs} +4 -4
- package/dist/{importFns-8zgPWa83.cjs → importFns-4mi5Ih46.cjs} +2 -2
- package/dist/{importFns-BAJm4qfD.js → importFns-DRPQExAD.js} +2 -2
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/ioOps.d.ts +2 -2
- package/dist/kernel/occtWasm/ioOps.d.ts +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/stlBuilder.d.ts +20 -0
- package/dist/{measureFns-CvvenWkS.js → measureFns-BLEx4ZU3.js} +3 -3
- package/dist/{measureFns-CrSEblGG.cjs → measureFns-CT0XaSOt.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-0RHalM3t.js → meshFns-B3MjIqk1.js} +3 -3
- package/dist/{meshFns-DwHAYqRN.cjs → meshFns-lwgHYQ79.cjs} +3 -3
- package/dist/{occtWasmAdapter-BPu07Zxg.cjs → occtWasmAdapter-BH7r2nTq.cjs} +137 -51
- package/dist/{occtWasmAdapter-Ctfykwr2.js → occtWasmAdapter-C7FDeTaw.js} +114 -52
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-CKCALTVe.cjs → primitiveFns-DZmgvzvk.cjs} +7 -7
- package/dist/{primitiveFns-ecKWNC5k.js → primitiveFns-DcZDTQ_R.js} +7 -7
- 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-D63FuB8f.js → shapeFns-BnkizFjV.js} +2 -2
- package/dist/{shapeFns-B5JrP5aD.cjs → shapeFns-w1YoIn_p.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-H_O8zyAx.cjs → shapeRefFns-B3myHs0D.cjs} +4 -4
- package/dist/{shapeRefFns-DjGKujf0.js → shapeRefFns-OVWdFOAC.js} +4 -4
- package/dist/{shapeTypes-kAKwccy_.cjs → shapeTypes-BIlZar9m.cjs} +174 -172
- package/dist/{shapeTypes-RYLpXWzG.js → shapeTypes-yCQ8z5Hc.js} +174 -172
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-0SgkQ386.js → solidBuilders-CPOTKI5i.js} +2 -2
- package/dist/{solidBuilders-B2IX6Pm8.cjs → solidBuilders-dNhToZgl.cjs} +2 -2
- package/dist/{surfaceBuilders-jx81G_YJ.js → surfaceBuilders-CS1QccDv.js} +2 -2
- package/dist/{surfaceBuilders-BkvJS8pw.cjs → surfaceBuilders-CzHPZtd3.cjs} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-BXGrW7Ak.js → textBlueprints-B57ej88L.js} +7 -7
- package/dist/{textBlueprints-Q2gxuZd1.cjs → textBlueprints-TG6AH06v.cjs} +7 -7
- package/dist/{textMetrics-V7TXOETY.js → textMetrics-BxtB3sjj.js} +1 -1
- package/dist/{textMetrics-CnCjqf59.cjs → textMetrics-Dag-YREs.cjs} +1 -1
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +7 -7
- package/dist/{topologyQueryFns-Ck5trXrW.cjs → topologyQueryFns-BuWZAQ_o.cjs} +1 -1
- package/dist/{topologyQueryFns-BtWPlP5v.js → topologyQueryFns-Bxdnl5Vt.js} +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as createKernelHandle, Z as getKernel, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { B as createKernelHandle, Z as getKernel, t as castShape } from "./shapeTypes-yCQ8z5Hc.js";
|
|
2
2
|
import { A as ok, 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 { v as fromBREP } from "./faceFns-
|
|
5
|
-
import { s as toBREP } from "./shapeFns-
|
|
6
|
-
import { a as fuseAll } from "./booleanFns-
|
|
4
|
+
import { v as fromBREP } from "./faceFns-Dreo5ksY.js";
|
|
5
|
+
import { s as toBREP } from "./shapeFns-BnkizFjV.js";
|
|
6
|
+
import { a as fuseAll } from "./booleanFns-0jDBFjAv.js";
|
|
7
7
|
//#region src/utils/uuid.ts
|
|
8
8
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
9
9
|
function uuidv() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BIlZar9m.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 require_booleanFns = require("./booleanFns-
|
|
4
|
+
const require_faceFns = require("./faceFns-FAZgMVCx.cjs");
|
|
5
|
+
const require_shapeFns = require("./shapeFns-w1YoIn_p.cjs");
|
|
6
|
+
const require_booleanFns = require("./booleanFns-DvXg6a2Y.cjs");
|
|
7
7
|
//#region src/utils/uuid.ts
|
|
8
8
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
9
9
|
function uuidv() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BIlZar9m.cjs");
|
|
2
2
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
3
3
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
4
4
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
5
|
-
const require_blueprint = require("./blueprint-
|
|
5
|
+
const require_blueprint = require("./blueprint-DIQeD9xj.cjs");
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Z as getKernel, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, t as castShape } from "./shapeTypes-yCQ8z5Hc.js";
|
|
2
2
|
import { n as wasmIndex, t as vec3At$1 } from "./vec3-Dpha8d5k.js";
|
|
3
3
|
import { A as ok, b as err, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
4
4
|
import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
5
|
-
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-
|
|
5
|
+
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-Dgl9IkCV.js";
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
package/dist/io.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_meshFns = require("./meshFns-
|
|
3
|
-
const require_importFns = require("./importFns-
|
|
2
|
+
const require_meshFns = require("./meshFns-lwgHYQ79.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-4mi5Ih46.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
|
6
6
|
exports.exportGlb = require_importFns.exportGlb;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-
|
|
2
|
-
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-B3MjIqk1.js";
|
|
2
|
+
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-DRPQExAD.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BrepkitKernel } from './brepkitWasmTypes.js';
|
|
2
2
|
import { KernelShape, KernelType, StepAssemblyPart } from '../types.js';
|
|
3
3
|
export declare function exportSTEP(bk: BrepkitKernel, shapes: KernelShape[]): string;
|
|
4
|
-
export declare function exportSTL(bk: BrepkitKernel, shape: KernelShape, binary?: boolean): string | ArrayBuffer;
|
|
4
|
+
export declare function exportSTL(bk: BrepkitKernel, shape: KernelShape, binary?: boolean, tolerance?: number, angularTolerance?: number): string | ArrayBuffer;
|
|
5
5
|
export declare function importSTEP(bk: BrepkitKernel, data: string | ArrayBuffer): KernelShape[];
|
|
6
6
|
export declare function importSTL(bk: BrepkitKernel, data: string | ArrayBuffer): KernelShape;
|
|
7
7
|
export declare function exportIGES(bk: BrepkitKernel, shapes: KernelShape[]): string;
|
|
@@ -39,7 +39,7 @@ export declare function exportSTEPConfigured(bk: BrepkitKernel, shapes: Array<{
|
|
|
39
39
|
/** Co-located factory: returns the file-I/O slice of {@link KernelAdapter} bound to `bk`. */
|
|
40
40
|
export declare function makeIoOps(bk: BrepkitKernel): {
|
|
41
41
|
exportSTEP: (shapes: any[]) => string;
|
|
42
|
-
exportSTL: (shape: any, binary: boolean | undefined) => string | ArrayBuffer;
|
|
42
|
+
exportSTL: (shape: any, binary: boolean | undefined, tolerance: number | undefined, angularTolerance: number | undefined) => string | ArrayBuffer;
|
|
43
43
|
importSTEP: (data: string | ArrayBuffer) => any[];
|
|
44
44
|
importSTL: (data: string | ArrayBuffer) => any;
|
|
45
45
|
exportIGES: (shapes: any[]) => string;
|
|
@@ -18,7 +18,7 @@ type MeshFn = (shape: KernelShape, options: {
|
|
|
18
18
|
}>;
|
|
19
19
|
};
|
|
20
20
|
export declare function exportSTEP(k: OcctKernelWasm, makeCompound: CompoundFn, shapes: KernelShape[]): string;
|
|
21
|
-
export declare function exportSTL(
|
|
21
|
+
export declare function exportSTL(mesh: MeshFn, shape: KernelShape, binary?: boolean, tolerance?: number, angularTolerance?: number): string | ArrayBuffer;
|
|
22
22
|
export declare function importSTEP(k: OcctKernelWasm, data: string | ArrayBuffer): KernelShape[];
|
|
23
23
|
export declare function importSTL(k: OcctKernelWasm, Module: OcctWasmModule, data: string | ArrayBuffer): KernelShape;
|
|
24
24
|
export declare function exportIGES(k: OcctKernelWasm, makeCompound: CompoundFn, shapes: KernelShape[]): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_occtWasmAdapter = require("../../occtWasmAdapter-
|
|
2
|
+
const require_occtWasmAdapter = require("../../occtWasmAdapter-BH7r2nTq.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as OcctWasmAdapter } from "../../occtWasmAdapter-
|
|
1
|
+
import { t as OcctWasmAdapter } from "../../occtWasmAdapter-C7FDeTaw.js";
|
|
2
2
|
export { OcctWasmAdapter };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kernel-agnostic STL serializers.
|
|
3
|
+
*
|
|
4
|
+
* Both writers take a triangle soup (positions + indices) and emit STL. Facet
|
|
5
|
+
* normals are derived from triangle winding (right-hand rule) rather than the
|
|
6
|
+
* mesh's per-vertex normals, matching the per-facet STL format.
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default tessellation tolerances for STL export, shared by every kernel
|
|
11
|
+
* adapter so per-adapter defaults can't drift. Callers normally pass explicit
|
|
12
|
+
* values (the public `exportSTL` derives them from the active quality level);
|
|
13
|
+
* these apply only to direct kernel-level calls made without arguments.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_STL_TOLERANCE = 0.001;
|
|
16
|
+
export declare const DEFAULT_STL_ANGULAR_TOLERANCE = 0.1;
|
|
17
|
+
/** Serialize a triangle soup as a binary STL (80-byte header + uint32 count + 50B/tri). */
|
|
18
|
+
export declare function buildBinarySTL(vertices: ArrayLike<number>, triangles: ArrayLike<number>): ArrayBuffer;
|
|
19
|
+
/** Serialize a triangle soup as an ASCII STL. */
|
|
20
|
+
export declare function buildAsciiSTL(vertices: ArrayLike<number>, triangles: ArrayLike<number>): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Z as getKernel } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel } from "./shapeTypes-yCQ8z5Hc.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { w as kernelCallRaw } from "./topologyQueryFns-
|
|
4
|
-
import { p as uvBounds } from "./faceFns-
|
|
3
|
+
import { w as kernelCallRaw } from "./topologyQueryFns-Bxdnl5Vt.js";
|
|
4
|
+
import { p as uvBounds } from "./faceFns-Dreo5ksY.js";
|
|
5
5
|
//#region src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BIlZar9m.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BuWZAQ_o.cjs");
|
|
4
|
+
const require_faceFns = require("./faceFns-FAZgMVCx.cjs");
|
|
5
5
|
//#region src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
package/dist/measurement.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_measureFns = require("./measureFns-
|
|
2
|
+
const require_measureFns = require("./measureFns-CT0XaSOt.cjs");
|
|
3
3
|
exports.createDistanceQuery = require_measureFns.createDistanceQuery;
|
|
4
4
|
exports.measureArea = require_measureFns.measureArea;
|
|
5
5
|
exports.measureDistance = require_measureFns.measureDistance;
|
package/dist/measurement.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-
|
|
1
|
+
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-BLEx4ZU3.js";
|
|
2
2
|
export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Z as getKernel, gt as qualityDeflection } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, gt as qualityDeflection } from "./shapeTypes-yCQ8z5Hc.js";
|
|
2
2
|
import { A as ok, b as err, r as ioError } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { d as getSolids, n as getBounds } from "./topologyQueryFns-
|
|
4
|
-
import { O as getFaceOrigins } from "./shapeFns-
|
|
3
|
+
import { d as getSolids, n as getBounds } from "./topologyQueryFns-Bxdnl5Vt.js";
|
|
4
|
+
import { O as getFaceOrigins } from "./shapeFns-BnkizFjV.js";
|
|
5
5
|
//#region src/topology/meshCache.ts
|
|
6
6
|
/**
|
|
7
7
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BIlZar9m.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_shapeFns = require("./shapeFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BuWZAQ_o.cjs");
|
|
4
|
+
const require_shapeFns = require("./shapeFns-w1YoIn_p.cjs");
|
|
5
5
|
//#region src/topology/meshCache.ts
|
|
6
6
|
/**
|
|
7
7
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -1004,6 +1004,111 @@ function evaluateBSpline2d(c, t) {
|
|
|
1004
1004
|
return d[p];
|
|
1005
1005
|
}
|
|
1006
1006
|
//#endregion
|
|
1007
|
+
//#region src/kernel/stlBuilder.ts
|
|
1008
|
+
/**
|
|
1009
|
+
* Kernel-agnostic STL serializers.
|
|
1010
|
+
*
|
|
1011
|
+
* Both writers take a triangle soup (positions + indices) and emit STL. Facet
|
|
1012
|
+
* normals are derived from triangle winding (right-hand rule) rather than the
|
|
1013
|
+
* mesh's per-vertex normals, matching the per-facet STL format.
|
|
1014
|
+
* @module
|
|
1015
|
+
*/
|
|
1016
|
+
/**
|
|
1017
|
+
* Default tessellation tolerances for STL export, shared by every kernel
|
|
1018
|
+
* adapter so per-adapter defaults can't drift. Callers normally pass explicit
|
|
1019
|
+
* values (the public `exportSTL` derives them from the active quality level);
|
|
1020
|
+
* these apply only to direct kernel-level calls made without arguments.
|
|
1021
|
+
*/
|
|
1022
|
+
var DEFAULT_STL_TOLERANCE = .001;
|
|
1023
|
+
var DEFAULT_STL_ANGULAR_TOLERANCE = .1;
|
|
1024
|
+
var scratch = {
|
|
1025
|
+
nx: 0,
|
|
1026
|
+
ny: 0,
|
|
1027
|
+
nz: 0,
|
|
1028
|
+
ax: 0,
|
|
1029
|
+
ay: 0,
|
|
1030
|
+
az: 0,
|
|
1031
|
+
bx: 0,
|
|
1032
|
+
by: 0,
|
|
1033
|
+
bz: 0,
|
|
1034
|
+
cx: 0,
|
|
1035
|
+
cy: 0,
|
|
1036
|
+
cz: 0
|
|
1037
|
+
};
|
|
1038
|
+
function facetAt(vertices, triangles, i) {
|
|
1039
|
+
const ia = (triangles[i * 3] ?? 0) * 3;
|
|
1040
|
+
const ib = (triangles[i * 3 + 1] ?? 0) * 3;
|
|
1041
|
+
const ic = (triangles[i * 3 + 2] ?? 0) * 3;
|
|
1042
|
+
const ax = vertices[ia] ?? 0, ay = vertices[ia + 1] ?? 0, az = vertices[ia + 2] ?? 0;
|
|
1043
|
+
const bx = vertices[ib] ?? 0, by = vertices[ib + 1] ?? 0, bz = vertices[ib + 2] ?? 0;
|
|
1044
|
+
const cx = vertices[ic] ?? 0, cy = vertices[ic + 1] ?? 0, cz = vertices[ic + 2] ?? 0;
|
|
1045
|
+
const ux = bx - ax, uy = by - ay, uz = bz - az;
|
|
1046
|
+
const vx = cx - ax, vy = cy - ay, vz = cz - az;
|
|
1047
|
+
let nx = uy * vz - uz * vy;
|
|
1048
|
+
let ny = uz * vx - ux * vz;
|
|
1049
|
+
let nz = ux * vy - uy * vx;
|
|
1050
|
+
const len = Math.hypot(nx, ny, nz) || 1;
|
|
1051
|
+
nx /= len;
|
|
1052
|
+
ny /= len;
|
|
1053
|
+
nz /= len;
|
|
1054
|
+
scratch.nx = nx;
|
|
1055
|
+
scratch.ny = ny;
|
|
1056
|
+
scratch.nz = nz;
|
|
1057
|
+
scratch.ax = ax;
|
|
1058
|
+
scratch.ay = ay;
|
|
1059
|
+
scratch.az = az;
|
|
1060
|
+
scratch.bx = bx;
|
|
1061
|
+
scratch.by = by;
|
|
1062
|
+
scratch.bz = bz;
|
|
1063
|
+
scratch.cx = cx;
|
|
1064
|
+
scratch.cy = cy;
|
|
1065
|
+
scratch.cz = cz;
|
|
1066
|
+
return scratch;
|
|
1067
|
+
}
|
|
1068
|
+
/** Serialize a triangle soup as a binary STL (80-byte header + uint32 count + 50B/tri). */
|
|
1069
|
+
function buildBinarySTL(vertices, triangles) {
|
|
1070
|
+
const triCount = Math.floor(triangles.length / 3);
|
|
1071
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(84 + triCount * 50);
|
|
1072
|
+
const view = new DataView(buffer);
|
|
1073
|
+
view.setUint32(80, triCount, true);
|
|
1074
|
+
let offset = 84;
|
|
1075
|
+
for (let i = 0; i < triCount; i++) {
|
|
1076
|
+
const f = facetAt(vertices, triangles, i);
|
|
1077
|
+
view.setFloat32(offset, f.nx, true);
|
|
1078
|
+
view.setFloat32(offset + 4, f.ny, true);
|
|
1079
|
+
view.setFloat32(offset + 8, f.nz, true);
|
|
1080
|
+
view.setFloat32(offset + 12, f.ax, true);
|
|
1081
|
+
view.setFloat32(offset + 16, f.ay, true);
|
|
1082
|
+
view.setFloat32(offset + 20, f.az, true);
|
|
1083
|
+
view.setFloat32(offset + 24, f.bx, true);
|
|
1084
|
+
view.setFloat32(offset + 28, f.by, true);
|
|
1085
|
+
view.setFloat32(offset + 32, f.bz, true);
|
|
1086
|
+
view.setFloat32(offset + 36, f.cx, true);
|
|
1087
|
+
view.setFloat32(offset + 40, f.cy, true);
|
|
1088
|
+
view.setFloat32(offset + 44, f.cz, true);
|
|
1089
|
+
view.setUint16(offset + 48, 0, true);
|
|
1090
|
+
offset += 50;
|
|
1091
|
+
}
|
|
1092
|
+
return buffer;
|
|
1093
|
+
}
|
|
1094
|
+
/** Serialize a triangle soup as an ASCII STL. */
|
|
1095
|
+
function buildAsciiSTL(vertices, triangles) {
|
|
1096
|
+
const triCount = Math.floor(triangles.length / 3);
|
|
1097
|
+
const lines = ["solid brepjs"];
|
|
1098
|
+
for (let i = 0; i < triCount; i++) {
|
|
1099
|
+
const f = facetAt(vertices, triangles, i);
|
|
1100
|
+
lines.push(`facet normal ${f.nx} ${f.ny} ${f.nz}`);
|
|
1101
|
+
lines.push("outer loop");
|
|
1102
|
+
lines.push(`vertex ${f.ax} ${f.ay} ${f.az}`);
|
|
1103
|
+
lines.push(`vertex ${f.bx} ${f.by} ${f.bz}`);
|
|
1104
|
+
lines.push(`vertex ${f.cx} ${f.cy} ${f.cz}`);
|
|
1105
|
+
lines.push("endloop");
|
|
1106
|
+
lines.push("endfacet");
|
|
1107
|
+
}
|
|
1108
|
+
lines.push("endsolid brepjs");
|
|
1109
|
+
return lines.join("\n") + "\n";
|
|
1110
|
+
}
|
|
1111
|
+
//#endregion
|
|
1007
1112
|
//#region src/kernel/occtWasm/helpers.ts
|
|
1008
1113
|
var noop = () => {};
|
|
1009
1114
|
/** Build an opaque kernel handle for an arena-allocated WASM shape. */
|
|
@@ -2671,56 +2776,13 @@ function exportSTEP(k, makeCompound, shapes) {
|
|
|
2671
2776
|
const compound = makeCompound(shapes);
|
|
2672
2777
|
return k.exportStep(unwrap(compound));
|
|
2673
2778
|
}
|
|
2674
|
-
function exportSTL(
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
return buildBinarySTL(vertices, triangles);
|
|
2682
|
-
}
|
|
2683
|
-
return k.exportStl(unwrap(shape), tolerance, true);
|
|
2684
|
-
}
|
|
2685
|
-
/** Serialize a triangle soup as a binary STL (80-byte header + uint32 count + 50B/tri). */
|
|
2686
|
-
function buildBinarySTL(vertices, triangles) {
|
|
2687
|
-
const triCount = Math.floor(triangles.length / 3);
|
|
2688
|
-
const buffer = /* @__PURE__ */ new ArrayBuffer(84 + triCount * 50);
|
|
2689
|
-
const view = new DataView(buffer);
|
|
2690
|
-
view.setUint32(80, triCount, true);
|
|
2691
|
-
let offset = 84;
|
|
2692
|
-
for (let i = 0; i < triCount; i++) {
|
|
2693
|
-
const ia = (triangles[i * 3] ?? 0) * 3;
|
|
2694
|
-
const ib = (triangles[i * 3 + 1] ?? 0) * 3;
|
|
2695
|
-
const ic = (triangles[i * 3 + 2] ?? 0) * 3;
|
|
2696
|
-
const ax = vertices[ia] ?? 0, ay = vertices[ia + 1] ?? 0, az = vertices[ia + 2] ?? 0;
|
|
2697
|
-
const bx = vertices[ib] ?? 0, by = vertices[ib + 1] ?? 0, bz = vertices[ib + 2] ?? 0;
|
|
2698
|
-
const cx = vertices[ic] ?? 0, cy = vertices[ic + 1] ?? 0, cz = vertices[ic + 2] ?? 0;
|
|
2699
|
-
const ux = bx - ax, uy = by - ay, uz = bz - az;
|
|
2700
|
-
const vx = cx - ax, vy = cy - ay, vz = cz - az;
|
|
2701
|
-
let nx = uy * vz - uz * vy;
|
|
2702
|
-
let ny = uz * vx - ux * vz;
|
|
2703
|
-
let nz = ux * vy - uy * vx;
|
|
2704
|
-
const len = Math.hypot(nx, ny, nz) || 1;
|
|
2705
|
-
nx /= len;
|
|
2706
|
-
ny /= len;
|
|
2707
|
-
nz /= len;
|
|
2708
|
-
view.setFloat32(offset, nx, true);
|
|
2709
|
-
view.setFloat32(offset + 4, ny, true);
|
|
2710
|
-
view.setFloat32(offset + 8, nz, true);
|
|
2711
|
-
view.setFloat32(offset + 12, ax, true);
|
|
2712
|
-
view.setFloat32(offset + 16, ay, true);
|
|
2713
|
-
view.setFloat32(offset + 20, az, true);
|
|
2714
|
-
view.setFloat32(offset + 24, bx, true);
|
|
2715
|
-
view.setFloat32(offset + 28, by, true);
|
|
2716
|
-
view.setFloat32(offset + 32, bz, true);
|
|
2717
|
-
view.setFloat32(offset + 36, cx, true);
|
|
2718
|
-
view.setFloat32(offset + 40, cy, true);
|
|
2719
|
-
view.setFloat32(offset + 44, cz, true);
|
|
2720
|
-
view.setUint16(offset + 48, 0, true);
|
|
2721
|
-
offset += 50;
|
|
2722
|
-
}
|
|
2723
|
-
return buffer;
|
|
2779
|
+
function exportSTL(mesh, shape, binary, tolerance = DEFAULT_STL_TOLERANCE, angularTolerance = DEFAULT_STL_ANGULAR_TOLERANCE) {
|
|
2780
|
+
const { vertices, triangles } = mesh(shape, {
|
|
2781
|
+
tolerance,
|
|
2782
|
+
angularTolerance,
|
|
2783
|
+
skipNormals: true
|
|
2784
|
+
});
|
|
2785
|
+
return binary ? buildBinarySTL(vertices, triangles) : buildAsciiSTL(vertices, triangles);
|
|
2724
2786
|
}
|
|
2725
2787
|
function importSTEP(k, data) {
|
|
2726
2788
|
const str = typeof data === "string" ? data : new TextDecoder().decode(data);
|
|
@@ -4503,7 +4565,7 @@ var OcctWasmAdapter = class OcctWasmAdapter {
|
|
|
4503
4565
|
return exportSTEP(this.k, this.makeCompound.bind(this), shapes);
|
|
4504
4566
|
}
|
|
4505
4567
|
exportSTL(shape, binary, tolerance, angularTolerance) {
|
|
4506
|
-
return exportSTL(this.
|
|
4568
|
+
return exportSTL(this.mesh.bind(this), shape, binary, tolerance, angularTolerance);
|
|
4507
4569
|
}
|
|
4508
4570
|
importSTEP(data) {
|
|
4509
4571
|
return importSTEP(this.k, data);
|
|
@@ -4952,6 +5014,18 @@ Object.defineProperty(exports, "DEFAULT_CAPABILITIES", {
|
|
|
4952
5014
|
return DEFAULT_CAPABILITIES;
|
|
4953
5015
|
}
|
|
4954
5016
|
});
|
|
5017
|
+
Object.defineProperty(exports, "DEFAULT_STL_ANGULAR_TOLERANCE", {
|
|
5018
|
+
enumerable: true,
|
|
5019
|
+
get: function() {
|
|
5020
|
+
return DEFAULT_STL_ANGULAR_TOLERANCE;
|
|
5021
|
+
}
|
|
5022
|
+
});
|
|
5023
|
+
Object.defineProperty(exports, "DEFAULT_STL_TOLERANCE", {
|
|
5024
|
+
enumerable: true,
|
|
5025
|
+
get: function() {
|
|
5026
|
+
return DEFAULT_STL_TOLERANCE;
|
|
5027
|
+
}
|
|
5028
|
+
});
|
|
4955
5029
|
Object.defineProperty(exports, "EXACT_BREP_CAPABILITIES", {
|
|
4956
5030
|
enumerable: true,
|
|
4957
5031
|
get: function() {
|
|
@@ -4970,6 +5044,18 @@ Object.defineProperty(exports, "addCurveToBBox", {
|
|
|
4970
5044
|
return addCurveToBBox;
|
|
4971
5045
|
}
|
|
4972
5046
|
});
|
|
5047
|
+
Object.defineProperty(exports, "buildAsciiSTL", {
|
|
5048
|
+
enumerable: true,
|
|
5049
|
+
get: function() {
|
|
5050
|
+
return buildAsciiSTL;
|
|
5051
|
+
}
|
|
5052
|
+
});
|
|
5053
|
+
Object.defineProperty(exports, "buildBinarySTL", {
|
|
5054
|
+
enumerable: true,
|
|
5055
|
+
get: function() {
|
|
5056
|
+
return buildBinarySTL;
|
|
5057
|
+
}
|
|
5058
|
+
});
|
|
4973
5059
|
Object.defineProperty(exports, "createBBox2d", {
|
|
4974
5060
|
enumerable: true,
|
|
4975
5061
|
get: function() {
|
|
@@ -1004,6 +1004,111 @@ function evaluateBSpline2d(c, t) {
|
|
|
1004
1004
|
return d[p];
|
|
1005
1005
|
}
|
|
1006
1006
|
//#endregion
|
|
1007
|
+
//#region src/kernel/stlBuilder.ts
|
|
1008
|
+
/**
|
|
1009
|
+
* Kernel-agnostic STL serializers.
|
|
1010
|
+
*
|
|
1011
|
+
* Both writers take a triangle soup (positions + indices) and emit STL. Facet
|
|
1012
|
+
* normals are derived from triangle winding (right-hand rule) rather than the
|
|
1013
|
+
* mesh's per-vertex normals, matching the per-facet STL format.
|
|
1014
|
+
* @module
|
|
1015
|
+
*/
|
|
1016
|
+
/**
|
|
1017
|
+
* Default tessellation tolerances for STL export, shared by every kernel
|
|
1018
|
+
* adapter so per-adapter defaults can't drift. Callers normally pass explicit
|
|
1019
|
+
* values (the public `exportSTL` derives them from the active quality level);
|
|
1020
|
+
* these apply only to direct kernel-level calls made without arguments.
|
|
1021
|
+
*/
|
|
1022
|
+
var DEFAULT_STL_TOLERANCE = .001;
|
|
1023
|
+
var DEFAULT_STL_ANGULAR_TOLERANCE = .1;
|
|
1024
|
+
var scratch = {
|
|
1025
|
+
nx: 0,
|
|
1026
|
+
ny: 0,
|
|
1027
|
+
nz: 0,
|
|
1028
|
+
ax: 0,
|
|
1029
|
+
ay: 0,
|
|
1030
|
+
az: 0,
|
|
1031
|
+
bx: 0,
|
|
1032
|
+
by: 0,
|
|
1033
|
+
bz: 0,
|
|
1034
|
+
cx: 0,
|
|
1035
|
+
cy: 0,
|
|
1036
|
+
cz: 0
|
|
1037
|
+
};
|
|
1038
|
+
function facetAt(vertices, triangles, i) {
|
|
1039
|
+
const ia = (triangles[i * 3] ?? 0) * 3;
|
|
1040
|
+
const ib = (triangles[i * 3 + 1] ?? 0) * 3;
|
|
1041
|
+
const ic = (triangles[i * 3 + 2] ?? 0) * 3;
|
|
1042
|
+
const ax = vertices[ia] ?? 0, ay = vertices[ia + 1] ?? 0, az = vertices[ia + 2] ?? 0;
|
|
1043
|
+
const bx = vertices[ib] ?? 0, by = vertices[ib + 1] ?? 0, bz = vertices[ib + 2] ?? 0;
|
|
1044
|
+
const cx = vertices[ic] ?? 0, cy = vertices[ic + 1] ?? 0, cz = vertices[ic + 2] ?? 0;
|
|
1045
|
+
const ux = bx - ax, uy = by - ay, uz = bz - az;
|
|
1046
|
+
const vx = cx - ax, vy = cy - ay, vz = cz - az;
|
|
1047
|
+
let nx = uy * vz - uz * vy;
|
|
1048
|
+
let ny = uz * vx - ux * vz;
|
|
1049
|
+
let nz = ux * vy - uy * vx;
|
|
1050
|
+
const len = Math.hypot(nx, ny, nz) || 1;
|
|
1051
|
+
nx /= len;
|
|
1052
|
+
ny /= len;
|
|
1053
|
+
nz /= len;
|
|
1054
|
+
scratch.nx = nx;
|
|
1055
|
+
scratch.ny = ny;
|
|
1056
|
+
scratch.nz = nz;
|
|
1057
|
+
scratch.ax = ax;
|
|
1058
|
+
scratch.ay = ay;
|
|
1059
|
+
scratch.az = az;
|
|
1060
|
+
scratch.bx = bx;
|
|
1061
|
+
scratch.by = by;
|
|
1062
|
+
scratch.bz = bz;
|
|
1063
|
+
scratch.cx = cx;
|
|
1064
|
+
scratch.cy = cy;
|
|
1065
|
+
scratch.cz = cz;
|
|
1066
|
+
return scratch;
|
|
1067
|
+
}
|
|
1068
|
+
/** Serialize a triangle soup as a binary STL (80-byte header + uint32 count + 50B/tri). */
|
|
1069
|
+
function buildBinarySTL(vertices, triangles) {
|
|
1070
|
+
const triCount = Math.floor(triangles.length / 3);
|
|
1071
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(84 + triCount * 50);
|
|
1072
|
+
const view = new DataView(buffer);
|
|
1073
|
+
view.setUint32(80, triCount, true);
|
|
1074
|
+
let offset = 84;
|
|
1075
|
+
for (let i = 0; i < triCount; i++) {
|
|
1076
|
+
const f = facetAt(vertices, triangles, i);
|
|
1077
|
+
view.setFloat32(offset, f.nx, true);
|
|
1078
|
+
view.setFloat32(offset + 4, f.ny, true);
|
|
1079
|
+
view.setFloat32(offset + 8, f.nz, true);
|
|
1080
|
+
view.setFloat32(offset + 12, f.ax, true);
|
|
1081
|
+
view.setFloat32(offset + 16, f.ay, true);
|
|
1082
|
+
view.setFloat32(offset + 20, f.az, true);
|
|
1083
|
+
view.setFloat32(offset + 24, f.bx, true);
|
|
1084
|
+
view.setFloat32(offset + 28, f.by, true);
|
|
1085
|
+
view.setFloat32(offset + 32, f.bz, true);
|
|
1086
|
+
view.setFloat32(offset + 36, f.cx, true);
|
|
1087
|
+
view.setFloat32(offset + 40, f.cy, true);
|
|
1088
|
+
view.setFloat32(offset + 44, f.cz, true);
|
|
1089
|
+
view.setUint16(offset + 48, 0, true);
|
|
1090
|
+
offset += 50;
|
|
1091
|
+
}
|
|
1092
|
+
return buffer;
|
|
1093
|
+
}
|
|
1094
|
+
/** Serialize a triangle soup as an ASCII STL. */
|
|
1095
|
+
function buildAsciiSTL(vertices, triangles) {
|
|
1096
|
+
const triCount = Math.floor(triangles.length / 3);
|
|
1097
|
+
const lines = ["solid brepjs"];
|
|
1098
|
+
for (let i = 0; i < triCount; i++) {
|
|
1099
|
+
const f = facetAt(vertices, triangles, i);
|
|
1100
|
+
lines.push(`facet normal ${f.nx} ${f.ny} ${f.nz}`);
|
|
1101
|
+
lines.push("outer loop");
|
|
1102
|
+
lines.push(`vertex ${f.ax} ${f.ay} ${f.az}`);
|
|
1103
|
+
lines.push(`vertex ${f.bx} ${f.by} ${f.bz}`);
|
|
1104
|
+
lines.push(`vertex ${f.cx} ${f.cy} ${f.cz}`);
|
|
1105
|
+
lines.push("endloop");
|
|
1106
|
+
lines.push("endfacet");
|
|
1107
|
+
}
|
|
1108
|
+
lines.push("endsolid brepjs");
|
|
1109
|
+
return lines.join("\n") + "\n";
|
|
1110
|
+
}
|
|
1111
|
+
//#endregion
|
|
1007
1112
|
//#region src/kernel/occtWasm/helpers.ts
|
|
1008
1113
|
var noop = () => {};
|
|
1009
1114
|
/** Build an opaque kernel handle for an arena-allocated WASM shape. */
|
|
@@ -2671,56 +2776,13 @@ function exportSTEP(k, makeCompound, shapes) {
|
|
|
2671
2776
|
const compound = makeCompound(shapes);
|
|
2672
2777
|
return k.exportStep(unwrap(compound));
|
|
2673
2778
|
}
|
|
2674
|
-
function exportSTL(
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
return buildBinarySTL(vertices, triangles);
|
|
2682
|
-
}
|
|
2683
|
-
return k.exportStl(unwrap(shape), tolerance, true);
|
|
2684
|
-
}
|
|
2685
|
-
/** Serialize a triangle soup as a binary STL (80-byte header + uint32 count + 50B/tri). */
|
|
2686
|
-
function buildBinarySTL(vertices, triangles) {
|
|
2687
|
-
const triCount = Math.floor(triangles.length / 3);
|
|
2688
|
-
const buffer = /* @__PURE__ */ new ArrayBuffer(84 + triCount * 50);
|
|
2689
|
-
const view = new DataView(buffer);
|
|
2690
|
-
view.setUint32(80, triCount, true);
|
|
2691
|
-
let offset = 84;
|
|
2692
|
-
for (let i = 0; i < triCount; i++) {
|
|
2693
|
-
const ia = (triangles[i * 3] ?? 0) * 3;
|
|
2694
|
-
const ib = (triangles[i * 3 + 1] ?? 0) * 3;
|
|
2695
|
-
const ic = (triangles[i * 3 + 2] ?? 0) * 3;
|
|
2696
|
-
const ax = vertices[ia] ?? 0, ay = vertices[ia + 1] ?? 0, az = vertices[ia + 2] ?? 0;
|
|
2697
|
-
const bx = vertices[ib] ?? 0, by = vertices[ib + 1] ?? 0, bz = vertices[ib + 2] ?? 0;
|
|
2698
|
-
const cx = vertices[ic] ?? 0, cy = vertices[ic + 1] ?? 0, cz = vertices[ic + 2] ?? 0;
|
|
2699
|
-
const ux = bx - ax, uy = by - ay, uz = bz - az;
|
|
2700
|
-
const vx = cx - ax, vy = cy - ay, vz = cz - az;
|
|
2701
|
-
let nx = uy * vz - uz * vy;
|
|
2702
|
-
let ny = uz * vx - ux * vz;
|
|
2703
|
-
let nz = ux * vy - uy * vx;
|
|
2704
|
-
const len = Math.hypot(nx, ny, nz) || 1;
|
|
2705
|
-
nx /= len;
|
|
2706
|
-
ny /= len;
|
|
2707
|
-
nz /= len;
|
|
2708
|
-
view.setFloat32(offset, nx, true);
|
|
2709
|
-
view.setFloat32(offset + 4, ny, true);
|
|
2710
|
-
view.setFloat32(offset + 8, nz, true);
|
|
2711
|
-
view.setFloat32(offset + 12, ax, true);
|
|
2712
|
-
view.setFloat32(offset + 16, ay, true);
|
|
2713
|
-
view.setFloat32(offset + 20, az, true);
|
|
2714
|
-
view.setFloat32(offset + 24, bx, true);
|
|
2715
|
-
view.setFloat32(offset + 28, by, true);
|
|
2716
|
-
view.setFloat32(offset + 32, bz, true);
|
|
2717
|
-
view.setFloat32(offset + 36, cx, true);
|
|
2718
|
-
view.setFloat32(offset + 40, cy, true);
|
|
2719
|
-
view.setFloat32(offset + 44, cz, true);
|
|
2720
|
-
view.setUint16(offset + 48, 0, true);
|
|
2721
|
-
offset += 50;
|
|
2722
|
-
}
|
|
2723
|
-
return buffer;
|
|
2779
|
+
function exportSTL(mesh, shape, binary, tolerance = DEFAULT_STL_TOLERANCE, angularTolerance = DEFAULT_STL_ANGULAR_TOLERANCE) {
|
|
2780
|
+
const { vertices, triangles } = mesh(shape, {
|
|
2781
|
+
tolerance,
|
|
2782
|
+
angularTolerance,
|
|
2783
|
+
skipNormals: true
|
|
2784
|
+
});
|
|
2785
|
+
return binary ? buildBinarySTL(vertices, triangles) : buildAsciiSTL(vertices, triangles);
|
|
2724
2786
|
}
|
|
2725
2787
|
function importSTEP(k, data) {
|
|
2726
2788
|
const str = typeof data === "string" ? data : new TextDecoder().decode(data);
|
|
@@ -4503,7 +4565,7 @@ var OcctWasmAdapter = class OcctWasmAdapter {
|
|
|
4503
4565
|
return exportSTEP(this.k, this.makeCompound.bind(this), shapes);
|
|
4504
4566
|
}
|
|
4505
4567
|
exportSTL(shape, binary, tolerance, angularTolerance) {
|
|
4506
|
-
return exportSTL(this.
|
|
4568
|
+
return exportSTL(this.mesh.bind(this), shape, binary, tolerance, angularTolerance);
|
|
4507
4569
|
}
|
|
4508
4570
|
importSTEP(data) {
|
|
4509
4571
|
return importSTEP(this.k, data);
|
|
@@ -4946,4 +5008,4 @@ var OcctWasmAdapter = class OcctWasmAdapter {
|
|
|
4946
5008
|
}
|
|
4947
5009
|
};
|
|
4948
5010
|
//#endregion
|
|
4949
|
-
export { EXACT_BREP_CAPABILITIES as S,
|
|
5011
|
+
export { translateCurve2d$1 as C, EXACT_BREP_CAPABILITIES as E, tangentCurve2d as S, DEFAULT_CAPABILITIES as T, mirrorAcrossAxis as _, buildBinarySTL as a, scaleCurve2d$1 as b, curveBounds as c, evaluateCurve2d$1 as d, intersectCurves2dFn as f, makeLine2d$1 as g, makeEllipse2d$1 as h, buildAsciiSTL as i, curveTypeName as l, makeCircle2d$1 as m, DEFAULT_STL_ANGULAR_TOLERANCE as n, addCurveToBBox as o, makeBezier2d$1 as p, DEFAULT_STL_TOLERANCE as r, createBBox2d as s, OcctWasmAdapter as t, deserializeCurve2d$1 as u, mirrorAtPoint as v, quickHull as w, serializeCurve2d$1 as x, rotateCurve2d$1 as y };
|
package/dist/operations.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_historyFns = require("./historyFns-
|
|
3
|
-
const require_extrudeFns = require("./extrudeFns-
|
|
2
|
+
const require_historyFns = require("./historyFns-mnmeZ0kB.cjs");
|
|
3
|
+
const require_extrudeFns = require("./extrudeFns-C0FsOXev.cjs");
|
|
4
4
|
exports.addChild = require_historyFns.addChild;
|
|
5
5
|
exports.addStep = require_historyFns.addStep;
|
|
6
6
|
exports.circularPattern = require_historyFns.circularPattern;
|
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as walkAssembly, D as exportAssemblySTEP, E as linearPattern, O as createAssembly, S as updateNode, T as gridPattern, _ as collectShapes, a as findStep, b as findNode, c as registerOperation, d as replayHistory, g as addChild, h as undoLast, l as registerShape, m as stepsFrom, n as createHistory, o as getShape, p as stepCount, r as createRegistry, s as modifyStep, t as addStep, u as replayFrom, v as countNodes, w as circularPattern, x as removeChild, y as createAssemblyNode } from "./historyFns-
|
|
2
|
-
import { c as sweep, i as complexExtrude, l as twistExtrude, s as supportExtrude } from "./extrudeFns-
|
|
1
|
+
import { C as walkAssembly, D as exportAssemblySTEP, E as linearPattern, O as createAssembly, S as updateNode, T as gridPattern, _ as collectShapes, a as findStep, b as findNode, c as registerOperation, d as replayHistory, g as addChild, h as undoLast, l as registerShape, m as stepsFrom, n as createHistory, o as getShape, p as stepCount, r as createRegistry, s as modifyStep, t as addStep, u as replayFrom, v as countNodes, w as circularPattern, x as removeChild, y as createAssemblyNode } from "./historyFns-CR0RejKJ.js";
|
|
2
|
+
import { c as sweep, i as complexExtrude, l as twistExtrude, s as supportExtrude } from "./extrudeFns-rnUgev_g.js";
|
|
3
3
|
export { addChild, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, exportAssemblySTEP, findNode, findStep, getShape as getHistoryShape, gridPattern, linearPattern, modifyStep, registerOperation, registerShape, removeChild, replayFrom, replayHistory, stepCount, stepsFrom, supportExtrude, sweep, twistExtrude, undoLast, updateNode, walkAssembly };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BIlZar9m.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BuWZAQ_o.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
|
-
const require_faceFns = require("./faceFns-
|
|
6
|
-
const require_shapeFns = require("./shapeFns-
|
|
5
|
+
const require_faceFns = require("./faceFns-FAZgMVCx.cjs");
|
|
6
|
+
const require_shapeFns = require("./shapeFns-w1YoIn_p.cjs");
|
|
7
7
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
8
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
9
|
-
const require_booleanFns = require("./booleanFns-
|
|
10
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
8
|
+
const require_surfaceBuilders = require("./surfaceBuilders-CzHPZtd3.cjs");
|
|
9
|
+
const require_booleanFns = require("./booleanFns-DvXg6a2Y.cjs");
|
|
10
|
+
const require_solidBuilders = require("./solidBuilders-dNhToZgl.cjs");
|
|
11
11
|
//#region src/topology/threeHelpers.ts
|
|
12
12
|
/**
|
|
13
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|