brepjs 18.69.0 → 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-CwILDYiQ.cjs → importFns-4mi5Ih46.cjs} +32 -13
- package/dist/{importFns-1SHLSNtG.js → importFns-DRPQExAD.js} +32 -13
- package/dist/index.d.ts +1 -1
- package/dist/io/gltfExportFns.d.ts +25 -0
- package/dist/io.cjs +2 -2
- package/dist/io.d.ts +1 -1
- 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) {
|
|
@@ -61,6 +61,24 @@ var FLOAT = 5126;
|
|
|
61
61
|
var UNSIGNED_INT = 5125;
|
|
62
62
|
var ARRAY_BUFFER = 34962;
|
|
63
63
|
var ELEMENT_ARRAY_BUFFER = 34963;
|
|
64
|
+
var Y_UP_QUAT = [
|
|
65
|
+
-Math.SQRT1_2,
|
|
66
|
+
0,
|
|
67
|
+
0,
|
|
68
|
+
Math.SQRT1_2
|
|
69
|
+
];
|
|
70
|
+
/**
|
|
71
|
+
* Scene-graph nodes for the single mesh. For Y-up (default) the mesh node is
|
|
72
|
+
* parented under a rotation node so the Z-up vertices display upright in glTF
|
|
73
|
+
* viewers; for Z-up the mesh node is the root with no transform.
|
|
74
|
+
*/
|
|
75
|
+
function sceneNodes(upAxis) {
|
|
76
|
+
return upAxis === "Z" ? [{ mesh: 0 }] : [{
|
|
77
|
+
name: "Z_up_to_Y_up",
|
|
78
|
+
rotation: Y_UP_QUAT,
|
|
79
|
+
children: [1]
|
|
80
|
+
}, { mesh: 0 }];
|
|
81
|
+
}
|
|
64
82
|
function computeMinMax(data) {
|
|
65
83
|
const min = [
|
|
66
84
|
Infinity,
|
|
@@ -209,7 +227,7 @@ function buildSingleBufferViews(indicesByteLength, verticesByteLength, normalsBy
|
|
|
209
227
|
function buildGltfDocument(mesh, mode, options) {
|
|
210
228
|
const { vertices, normals, triangles } = mesh;
|
|
211
229
|
const materialMap = options?.materials;
|
|
212
|
-
if (materialMap && materialMap.size > 0 && mesh.faceGroups.length > 0) return buildGltfDocumentWithMaterials(mesh, mode, materialMap);
|
|
230
|
+
if (materialMap && materialMap.size > 0 && mesh.faceGroups.length > 0) return buildGltfDocumentWithMaterials(mesh, mode, materialMap, options.upAxis ?? "Y");
|
|
213
231
|
const indicesByteLength = triangles.byteLength;
|
|
214
232
|
const verticesByteLength = vertices.byteLength;
|
|
215
233
|
const normalsByteLength = normals.byteLength;
|
|
@@ -222,7 +240,7 @@ function buildGltfDocument(mesh, mode, options) {
|
|
|
222
240
|
},
|
|
223
241
|
scene: 0,
|
|
224
242
|
scenes: [{ nodes: [0] }],
|
|
225
|
-
nodes:
|
|
243
|
+
nodes: sceneNodes(options?.upAxis ?? "Y"),
|
|
226
244
|
meshes: [{ primitives: [{
|
|
227
245
|
attributes: {
|
|
228
246
|
POSITION: 1,
|
|
@@ -250,14 +268,14 @@ function buildGltfDocument(mesh, mode, options) {
|
|
|
250
268
|
function buildGlbData(mesh, options) {
|
|
251
269
|
const materialMap = options?.materials;
|
|
252
270
|
if (materialMap && materialMap.size > 0 && mesh.faceGroups.length > 0) {
|
|
253
|
-
const { doc, binBuffer } = buildGltfDocumentAndBufferWithMaterials(mesh, materialMap);
|
|
271
|
+
const { doc, binBuffer } = buildGltfDocumentAndBufferWithMaterials(mesh, materialMap, options.upAxis ?? "Y");
|
|
254
272
|
return {
|
|
255
273
|
doc,
|
|
256
274
|
binBuffer
|
|
257
275
|
};
|
|
258
276
|
}
|
|
259
277
|
return {
|
|
260
|
-
doc: buildGltfDocument(mesh, "glb"),
|
|
278
|
+
doc: buildGltfDocument(mesh, "glb", options),
|
|
261
279
|
binBuffer: buildBinaryBuffer(mesh)
|
|
262
280
|
};
|
|
263
281
|
}
|
|
@@ -413,11 +431,12 @@ function appendIndexPrimitives(primitiveData, indexBufferInfos, verticesAccIdx,
|
|
|
413
431
|
/**
|
|
414
432
|
* Build a glTF document from material layout.
|
|
415
433
|
*/
|
|
416
|
-
function buildGltfDocFromLayout(mesh, layout) {
|
|
434
|
+
function buildGltfDocFromLayout(mesh, layout, upAxis = "Y") {
|
|
417
435
|
const { primitiveData, indexBufferInfos, verticesOffset, totalByteLength, uniqueMaterials } = layout;
|
|
418
436
|
const accessors = [];
|
|
419
437
|
const bufferViews = [];
|
|
420
438
|
const { verticesAccIdx, normalsAccIdx } = appendVertexNormalSections(mesh, verticesOffset, accessors, bufferViews);
|
|
439
|
+
const primitives = appendIndexPrimitives(primitiveData, indexBufferInfos, verticesAccIdx, normalsAccIdx, accessors, bufferViews);
|
|
421
440
|
return {
|
|
422
441
|
asset: {
|
|
423
442
|
version: "2.0",
|
|
@@ -425,8 +444,8 @@ function buildGltfDocFromLayout(mesh, layout) {
|
|
|
425
444
|
},
|
|
426
445
|
scene: 0,
|
|
427
446
|
scenes: [{ nodes: [0] }],
|
|
428
|
-
nodes:
|
|
429
|
-
meshes: [{ primitives
|
|
447
|
+
nodes: sceneNodes(upAxis),
|
|
448
|
+
meshes: [{ primitives }],
|
|
430
449
|
accessors,
|
|
431
450
|
bufferViews,
|
|
432
451
|
buffers: [{ byteLength: totalByteLength }],
|
|
@@ -453,9 +472,9 @@ function buildBinaryBufferFromLayout(mesh, layout) {
|
|
|
453
472
|
/**
|
|
454
473
|
* Build a glTF document with per-material primitives (base64 mode).
|
|
455
474
|
*/
|
|
456
|
-
function buildGltfDocumentWithMaterials(mesh, _mode, materialMap) {
|
|
475
|
+
function buildGltfDocumentWithMaterials(mesh, _mode, materialMap, upAxis = "Y") {
|
|
457
476
|
const layout = computeMaterialLayout(mesh, materialMap);
|
|
458
|
-
const doc = buildGltfDocFromLayout(mesh, layout);
|
|
477
|
+
const doc = buildGltfDocFromLayout(mesh, layout, upAxis);
|
|
459
478
|
if (_mode === "base64") {
|
|
460
479
|
const buffer = buildBinaryBufferFromLayout(mesh, layout);
|
|
461
480
|
doc.buffers[0] = {
|
|
@@ -468,10 +487,10 @@ function buildGltfDocumentWithMaterials(mesh, _mode, materialMap) {
|
|
|
468
487
|
/**
|
|
469
488
|
* Build both glTF document and binary buffer for GLB with materials.
|
|
470
489
|
*/
|
|
471
|
-
function buildGltfDocumentAndBufferWithMaterials(mesh, materialMap) {
|
|
490
|
+
function buildGltfDocumentAndBufferWithMaterials(mesh, materialMap, upAxis = "Y") {
|
|
472
491
|
const layout = computeMaterialLayout(mesh, materialMap);
|
|
473
492
|
return {
|
|
474
|
-
doc: buildGltfDocFromLayout(mesh, layout),
|
|
493
|
+
doc: buildGltfDocFromLayout(mesh, layout, upAxis),
|
|
475
494
|
binBuffer: buildBinaryBufferFromLayout(mesh, layout)
|
|
476
495
|
};
|
|
477
496
|
}
|
|
@@ -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) {
|
|
@@ -61,6 +61,24 @@ var FLOAT = 5126;
|
|
|
61
61
|
var UNSIGNED_INT = 5125;
|
|
62
62
|
var ARRAY_BUFFER = 34962;
|
|
63
63
|
var ELEMENT_ARRAY_BUFFER = 34963;
|
|
64
|
+
var Y_UP_QUAT = [
|
|
65
|
+
-Math.SQRT1_2,
|
|
66
|
+
0,
|
|
67
|
+
0,
|
|
68
|
+
Math.SQRT1_2
|
|
69
|
+
];
|
|
70
|
+
/**
|
|
71
|
+
* Scene-graph nodes for the single mesh. For Y-up (default) the mesh node is
|
|
72
|
+
* parented under a rotation node so the Z-up vertices display upright in glTF
|
|
73
|
+
* viewers; for Z-up the mesh node is the root with no transform.
|
|
74
|
+
*/
|
|
75
|
+
function sceneNodes(upAxis) {
|
|
76
|
+
return upAxis === "Z" ? [{ mesh: 0 }] : [{
|
|
77
|
+
name: "Z_up_to_Y_up",
|
|
78
|
+
rotation: Y_UP_QUAT,
|
|
79
|
+
children: [1]
|
|
80
|
+
}, { mesh: 0 }];
|
|
81
|
+
}
|
|
64
82
|
function computeMinMax(data) {
|
|
65
83
|
const min = [
|
|
66
84
|
Infinity,
|
|
@@ -209,7 +227,7 @@ function buildSingleBufferViews(indicesByteLength, verticesByteLength, normalsBy
|
|
|
209
227
|
function buildGltfDocument(mesh, mode, options) {
|
|
210
228
|
const { vertices, normals, triangles } = mesh;
|
|
211
229
|
const materialMap = options?.materials;
|
|
212
|
-
if (materialMap && materialMap.size > 0 && mesh.faceGroups.length > 0) return buildGltfDocumentWithMaterials(mesh, mode, materialMap);
|
|
230
|
+
if (materialMap && materialMap.size > 0 && mesh.faceGroups.length > 0) return buildGltfDocumentWithMaterials(mesh, mode, materialMap, options.upAxis ?? "Y");
|
|
213
231
|
const indicesByteLength = triangles.byteLength;
|
|
214
232
|
const verticesByteLength = vertices.byteLength;
|
|
215
233
|
const normalsByteLength = normals.byteLength;
|
|
@@ -222,7 +240,7 @@ function buildGltfDocument(mesh, mode, options) {
|
|
|
222
240
|
},
|
|
223
241
|
scene: 0,
|
|
224
242
|
scenes: [{ nodes: [0] }],
|
|
225
|
-
nodes:
|
|
243
|
+
nodes: sceneNodes(options?.upAxis ?? "Y"),
|
|
226
244
|
meshes: [{ primitives: [{
|
|
227
245
|
attributes: {
|
|
228
246
|
POSITION: 1,
|
|
@@ -250,14 +268,14 @@ function buildGltfDocument(mesh, mode, options) {
|
|
|
250
268
|
function buildGlbData(mesh, options) {
|
|
251
269
|
const materialMap = options?.materials;
|
|
252
270
|
if (materialMap && materialMap.size > 0 && mesh.faceGroups.length > 0) {
|
|
253
|
-
const { doc, binBuffer } = buildGltfDocumentAndBufferWithMaterials(mesh, materialMap);
|
|
271
|
+
const { doc, binBuffer } = buildGltfDocumentAndBufferWithMaterials(mesh, materialMap, options.upAxis ?? "Y");
|
|
254
272
|
return {
|
|
255
273
|
doc,
|
|
256
274
|
binBuffer
|
|
257
275
|
};
|
|
258
276
|
}
|
|
259
277
|
return {
|
|
260
|
-
doc: buildGltfDocument(mesh, "glb"),
|
|
278
|
+
doc: buildGltfDocument(mesh, "glb", options),
|
|
261
279
|
binBuffer: buildBinaryBuffer(mesh)
|
|
262
280
|
};
|
|
263
281
|
}
|
|
@@ -413,11 +431,12 @@ function appendIndexPrimitives(primitiveData, indexBufferInfos, verticesAccIdx,
|
|
|
413
431
|
/**
|
|
414
432
|
* Build a glTF document from material layout.
|
|
415
433
|
*/
|
|
416
|
-
function buildGltfDocFromLayout(mesh, layout) {
|
|
434
|
+
function buildGltfDocFromLayout(mesh, layout, upAxis = "Y") {
|
|
417
435
|
const { primitiveData, indexBufferInfos, verticesOffset, totalByteLength, uniqueMaterials } = layout;
|
|
418
436
|
const accessors = [];
|
|
419
437
|
const bufferViews = [];
|
|
420
438
|
const { verticesAccIdx, normalsAccIdx } = appendVertexNormalSections(mesh, verticesOffset, accessors, bufferViews);
|
|
439
|
+
const primitives = appendIndexPrimitives(primitiveData, indexBufferInfos, verticesAccIdx, normalsAccIdx, accessors, bufferViews);
|
|
421
440
|
return {
|
|
422
441
|
asset: {
|
|
423
442
|
version: "2.0",
|
|
@@ -425,8 +444,8 @@ function buildGltfDocFromLayout(mesh, layout) {
|
|
|
425
444
|
},
|
|
426
445
|
scene: 0,
|
|
427
446
|
scenes: [{ nodes: [0] }],
|
|
428
|
-
nodes:
|
|
429
|
-
meshes: [{ primitives
|
|
447
|
+
nodes: sceneNodes(upAxis),
|
|
448
|
+
meshes: [{ primitives }],
|
|
430
449
|
accessors,
|
|
431
450
|
bufferViews,
|
|
432
451
|
buffers: [{ byteLength: totalByteLength }],
|
|
@@ -453,9 +472,9 @@ function buildBinaryBufferFromLayout(mesh, layout) {
|
|
|
453
472
|
/**
|
|
454
473
|
* Build a glTF document with per-material primitives (base64 mode).
|
|
455
474
|
*/
|
|
456
|
-
function buildGltfDocumentWithMaterials(mesh, _mode, materialMap) {
|
|
475
|
+
function buildGltfDocumentWithMaterials(mesh, _mode, materialMap, upAxis = "Y") {
|
|
457
476
|
const layout = computeMaterialLayout(mesh, materialMap);
|
|
458
|
-
const doc = buildGltfDocFromLayout(mesh, layout);
|
|
477
|
+
const doc = buildGltfDocFromLayout(mesh, layout, upAxis);
|
|
459
478
|
if (_mode === "base64") {
|
|
460
479
|
const buffer = buildBinaryBufferFromLayout(mesh, layout);
|
|
461
480
|
doc.buffers[0] = {
|
|
@@ -468,10 +487,10 @@ function buildGltfDocumentWithMaterials(mesh, _mode, materialMap) {
|
|
|
468
487
|
/**
|
|
469
488
|
* Build both glTF document and binary buffer for GLB with materials.
|
|
470
489
|
*/
|
|
471
|
-
function buildGltfDocumentAndBufferWithMaterials(mesh, materialMap) {
|
|
490
|
+
function buildGltfDocumentAndBufferWithMaterials(mesh, materialMap, upAxis = "Y") {
|
|
472
491
|
const layout = computeMaterialLayout(mesh, materialMap);
|
|
473
492
|
return {
|
|
474
|
-
doc: buildGltfDocFromLayout(mesh, layout),
|
|
493
|
+
doc: buildGltfDocFromLayout(mesh, layout, upAxis),
|
|
475
494
|
binBuffer: buildBinaryBufferFromLayout(mesh, layout)
|
|
476
495
|
};
|
|
477
496
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { reverseCurve, curve2dBoundingBox, curve2dFirstPoint, curve2dLastPoint,
|
|
|
33
33
|
export { createBlueprint, createCompoundBlueprint, getBounds2D, getOrientation2D, isInside2D, toSVGPathD, translate2D, rotate2D, scale2D, mirror2D, stretch2D, sketchOnPlane2D, sketchOnFace2D, } from './2d/blueprints/blueprintFns.js';
|
|
34
34
|
export { getSingleFace, type SingleFace } from './query/helpers.js';
|
|
35
35
|
export { exportOBJ } from './io/objExportFns.js';
|
|
36
|
-
export { exportGltf, exportGlb, type GltfMaterial, type GltfExportOptions, } from './io/gltfExportFns.js';
|
|
36
|
+
export { exportGltf, exportGlb, type GltfMaterial, type GltfExportOptions, type GltfFace, type MaterialFn, } from './io/gltfExportFns.js';
|
|
37
37
|
export { exportDXF, blueprintToDXF, type DXFEntity, type DXFExportOptions, } from './io/dxfExportFns.js';
|
|
38
38
|
export { exportThreeMF, type ThreeMFExportOptions, type ThreeMFMaterial, } from './io/threemfExportFns.js';
|
|
39
39
|
export { importSVGPathD, importSVG, type SVGImportOptions } from './io/svgImportFns.js';
|
|
@@ -14,6 +14,23 @@ export interface GltfMaterial {
|
|
|
14
14
|
/** Roughness factor 0–1. Default: 0.5 */
|
|
15
15
|
roughness?: number;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A meshed face as presented to a {@link MaterialFn} — its stable id and the
|
|
19
|
+
* centroid of its triangles in part coordinates (Z-up, mm).
|
|
20
|
+
*/
|
|
21
|
+
export interface GltfFace {
|
|
22
|
+
/** Stable face identifier — matches ShapeMesh.faceGroups[].faceId. */
|
|
23
|
+
faceId: number;
|
|
24
|
+
/** Centroid of the face's vertices, in part (Z-up, mm) coordinates. */
|
|
25
|
+
center: [number, number, number];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Per-face material selector. Called once per face group; return a material to
|
|
29
|
+
* paint that face, or `undefined` to leave it at the glTF default. Consumed by
|
|
30
|
+
* tooling (e.g. brepjs-verify's `export const materials`) that has the mesh and
|
|
31
|
+
* builds the faceId→material map passed to {@link GltfExportOptions.materials}.
|
|
32
|
+
*/
|
|
33
|
+
export type MaterialFn = (face: GltfFace) => GltfMaterial | undefined;
|
|
17
34
|
/**
|
|
18
35
|
* Options for glTF/GLB export.
|
|
19
36
|
*
|
|
@@ -23,6 +40,14 @@ export interface GltfMaterial {
|
|
|
23
40
|
export interface GltfExportOptions {
|
|
24
41
|
/** Map of faceId → material. FaceIds come from ShapeMesh.faceGroups[].faceId. */
|
|
25
42
|
materials?: Map<number, GltfMaterial>;
|
|
43
|
+
/**
|
|
44
|
+
* Up-axis of the emitted document. brepjs geometry is Z-up (CAD convention),
|
|
45
|
+
* but glTF 2.0 mandates Y-up. With `'Y'` (the default) a root node carrying a
|
|
46
|
+
* −90° rotation about X is emitted so the part stands upright in standard glTF
|
|
47
|
+
* viewers (three.js, model-viewer, Blender); vertex data stays Z-up, matching
|
|
48
|
+
* the STEP/STL exports. Use `'Z'` to emit raw Z-up coordinates with no root node.
|
|
49
|
+
*/
|
|
50
|
+
upAxis?: 'Y' | 'Z';
|
|
26
51
|
}
|
|
27
52
|
/**
|
|
28
53
|
* Export a ShapeMesh to a glTF 2.0 JSON string with an embedded base64 buffer.
|
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.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export { importSTEP, importSTL, importIGES } from './io/importFns.js';
|
|
10
10
|
export { exportSTEP, exportSTL, exportIGES } from './topology/meshFns.js';
|
|
11
11
|
export { exportOBJ } from './io/objExportFns.js';
|
|
12
|
-
export { exportGltf, exportGlb, type GltfMaterial, type GltfExportOptions, } from './io/gltfExportFns.js';
|
|
12
|
+
export { exportGltf, exportGlb, type GltfMaterial, type GltfExportOptions, type GltfFace, type MaterialFn, } from './io/gltfExportFns.js';
|
|
13
13
|
export { exportDXF, blueprintToDXF, type DXFEntity, type DXFExportOptions, } from './io/dxfExportFns.js';
|
|
14
14
|
export { exportThreeMF, type ThreeMFExportOptions, type ThreeMFMaterial, } from './io/threemfExportFns.js';
|
|
15
15
|
export { importSVGPathD, importSVG, type SVGImportOptions } from './io/svgImportFns.js';
|
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).
|