brepjs 18.155.0 → 18.156.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs.cjs +2 -16
- package/dist/brepjs.js +1 -15
- package/dist/io.cjs +1 -1
- package/dist/io.js +1 -1
- package/dist/{meshFns-FSW58GBR.js → meshFns-BTE7WFpU.js} +18 -4
- package/dist/{meshFns-cMtop3IN.cjs → meshFns-BZNqLhDE.cjs} +23 -3
- package/dist/topology/meshFns.d.ts +4 -1
- package/dist/topology.cjs +1 -1
- package/dist/topology.js +1 -1
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -16,7 +16,7 @@ const require_solidBuilders = require("./solidBuilders-BKSCyfzL.cjs");
|
|
|
16
16
|
const require_primitiveFns = require("./primitiveFns-BjwF7CHF.cjs");
|
|
17
17
|
const require_shapeFns = require("./shapeFns-C3AFMiyv.cjs");
|
|
18
18
|
const require_curveFns = require("./curveFns-DTbY4aYG.cjs");
|
|
19
|
-
const require_meshFns = require("./meshFns-
|
|
19
|
+
const require_meshFns = require("./meshFns-BZNqLhDE.cjs");
|
|
20
20
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
21
21
|
const require_surfaceBuilders = require("./surfaceBuilders-aSFtcDr6.cjs");
|
|
22
22
|
const require_healingFns = require("./healingFns-CnRyuMWf.cjs");
|
|
@@ -3355,20 +3355,6 @@ function relocateFaceGroups(faceGroups, innerHashes, placedHashes) {
|
|
|
3355
3355
|
faceId: remap.get(g.faceId) ?? g.faceId
|
|
3356
3356
|
}));
|
|
3357
3357
|
}
|
|
3358
|
-
var SCALE_INVARIANT_DIAGONAL = 10;
|
|
3359
|
-
function scaleDefaultTolerance(base, shape) {
|
|
3360
|
-
let diagonal;
|
|
3361
|
-
try {
|
|
3362
|
-
const b = require_topologyQueryFns.getBounds(shape);
|
|
3363
|
-
const dx = b.xMax - b.xMin;
|
|
3364
|
-
const dy = b.yMax - b.yMin;
|
|
3365
|
-
const dz = b.zMax - b.zMin;
|
|
3366
|
-
diagonal = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
3367
|
-
} catch {
|
|
3368
|
-
return base;
|
|
3369
|
-
}
|
|
3370
|
-
return base * Math.max(1, diagonal / SCALE_INVARIANT_DIAGONAL);
|
|
3371
|
-
}
|
|
3372
3358
|
var Evaluator = class {
|
|
3373
3359
|
cache = /* @__PURE__ */ new Map();
|
|
3374
3360
|
refCounts = /* @__PURE__ */ new Map();
|
|
@@ -3499,7 +3485,7 @@ var Evaluator = class {
|
|
|
3499
3485
|
const { inner } = peelRigid(node, env);
|
|
3500
3486
|
const source = this.evaluate(inner, env);
|
|
3501
3487
|
if (!source.ok) return base;
|
|
3502
|
-
return scaleDefaultTolerance(base, source.value);
|
|
3488
|
+
return require_meshFns.scaleDefaultTolerance(base, source.value);
|
|
3503
3489
|
}
|
|
3504
3490
|
evaluateInner(node, env) {
|
|
3505
3491
|
const key = cacheKey(node, env, this.kernelId, this.defaultTolerance);
|
package/dist/brepjs.js
CHANGED
|
@@ -14,7 +14,7 @@ import { A as parseColor, D as colorShape, E as colorFaces, F as tagFaces, M as
|
|
|
14
14
|
import { A as locate$1, C as threePointArc, D as wireLoop, E as wire, F as transformCopy$1, I as translate$2, M as resize, N as rotate$2, O as applyMatrix$1, P as scale$3, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, j as mirror$2, k as composeTransforms, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-B0iLpCEN.js";
|
|
15
15
|
import { a as isSameShape, i as isEqualShape, n as getHashCode, o as simplify$1, r as isEmpty$2, s as toBREP$1, t as clone$1 } from "./shapeFns-D0hK1y4m.js";
|
|
16
16
|
import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-U6vegvin.js";
|
|
17
|
-
import { a as meshEdges$1, c as meshMultiLOD, d as createMeshCache, i as mesh$1, l as
|
|
17
|
+
import { a as meshEdges$1, c as meshMultiLOD, d as clearMeshCache, f as createMeshCache, i as mesh$1, l as scaleDefaultTolerance, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as buildMeshCacheKey } from "./meshFns-BTE7WFpU.js";
|
|
18
18
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
19
19
|
import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, p as makeEllipseArc, r as makeFace, s as assembleWire, u as makeBezierCurve } from "./surfaceBuilders-C_oBS19q.js";
|
|
20
20
|
import { A as toBufferGeometryData, C as chamfer$2, D as shell$2, E as offset$1, M as toLODGeometryData, N as toLODGeometryLevels, O as thicken$1, P as toLineGeometryData, S as chamferDistAngle, T as fillet$2, _ as checkBoolean, a as healFace, b as getNurbsCurveData, c as isValid$1, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, i as heal$1, j as toGroupedBufferGeometryData, k as variableFillet, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, w as draft$1, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-CN9ra8Kh.js";
|
|
@@ -3365,20 +3365,6 @@ function relocateFaceGroups(faceGroups, innerHashes, placedHashes) {
|
|
|
3365
3365
|
faceId: remap.get(g.faceId) ?? g.faceId
|
|
3366
3366
|
}));
|
|
3367
3367
|
}
|
|
3368
|
-
var SCALE_INVARIANT_DIAGONAL = 10;
|
|
3369
|
-
function scaleDefaultTolerance(base, shape) {
|
|
3370
|
-
let diagonal;
|
|
3371
|
-
try {
|
|
3372
|
-
const b = getBounds(shape);
|
|
3373
|
-
const dx = b.xMax - b.xMin;
|
|
3374
|
-
const dy = b.yMax - b.yMin;
|
|
3375
|
-
const dz = b.zMax - b.zMin;
|
|
3376
|
-
diagonal = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
3377
|
-
} catch {
|
|
3378
|
-
return base;
|
|
3379
|
-
}
|
|
3380
|
-
return base * Math.max(1, diagonal / SCALE_INVARIANT_DIAGONAL);
|
|
3381
|
-
}
|
|
3382
3368
|
var Evaluator = class {
|
|
3383
3369
|
cache = /* @__PURE__ */ new Map();
|
|
3384
3370
|
refCounts = /* @__PURE__ */ new Map();
|
package/dist/io.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_meshFns = require("./meshFns-
|
|
2
|
+
const require_meshFns = require("./meshFns-BZNqLhDE.cjs");
|
|
3
3
|
const require_importFns = require("./importFns-cs7Y4qFg.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-BTE7WFpU.js";
|
|
2
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-DjS57JAv.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -112,6 +112,20 @@ function createMeshCache() {
|
|
|
112
112
|
/**
|
|
113
113
|
* Meshing and export functions — functional replacements for Shape mesh/export methods.
|
|
114
114
|
*/
|
|
115
|
+
var SCALE_INVARIANT_DIAGONAL = 10;
|
|
116
|
+
function scaleDefaultTolerance(base, shape) {
|
|
117
|
+
let diagonal;
|
|
118
|
+
try {
|
|
119
|
+
const b = getBounds(shape);
|
|
120
|
+
const dx = b.xMax - b.xMin;
|
|
121
|
+
const dy = b.yMax - b.yMin;
|
|
122
|
+
const dz = b.zMax - b.zMin;
|
|
123
|
+
diagonal = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
124
|
+
} catch {
|
|
125
|
+
return base;
|
|
126
|
+
}
|
|
127
|
+
return base * Math.max(1, diagonal / SCALE_INVARIANT_DIAGONAL);
|
|
128
|
+
}
|
|
115
129
|
/**
|
|
116
130
|
* Mesh a shape as a set of triangles for rendering.
|
|
117
131
|
*
|
|
@@ -123,7 +137,7 @@ function createMeshCache() {
|
|
|
123
137
|
*/
|
|
124
138
|
function mesh(shape, opts = {}) {
|
|
125
139
|
const quality = qualityDeflection();
|
|
126
|
-
const { tolerance = quality.tolerance, angularTolerance = quality.angularTolerance, skipNormals = false, includeUVs = false, cache = true, signal } = opts;
|
|
140
|
+
const { tolerance = scaleDefaultTolerance(quality.tolerance, shape), angularTolerance = quality.angularTolerance, skipNormals = false, includeUVs = false, cache = true, signal } = opts;
|
|
127
141
|
signal?.throwIfAborted();
|
|
128
142
|
const cacheKey = buildMeshCacheKey(tolerance, angularTolerance, skipNormals, includeUVs);
|
|
129
143
|
if (cache) {
|
|
@@ -163,7 +177,7 @@ function mesh(shape, opts = {}) {
|
|
|
163
177
|
*/
|
|
164
178
|
function meshEdges(shape, opts = {}) {
|
|
165
179
|
const quality = qualityDeflection();
|
|
166
|
-
const { tolerance = quality.tolerance, angularTolerance = quality.angularTolerance, cache = true } = opts;
|
|
180
|
+
const { tolerance = scaleDefaultTolerance(quality.tolerance, shape), angularTolerance = quality.angularTolerance, cache = true } = opts;
|
|
167
181
|
const cacheKey = buildEdgeMeshCacheKey(tolerance, angularTolerance);
|
|
168
182
|
if (cache) {
|
|
169
183
|
const cached = getEdgeMeshForShape(shape.wrapped, cacheKey);
|
|
@@ -269,7 +283,7 @@ function exportSTEP(shape) {
|
|
|
269
283
|
*/
|
|
270
284
|
function exportSTL(shape, opts = {}) {
|
|
271
285
|
const quality = qualityDeflection();
|
|
272
|
-
const { tolerance = quality.tolerance, angularTolerance = quality.angularTolerance, binary = false } = opts;
|
|
286
|
+
const { tolerance = scaleDefaultTolerance(quality.tolerance, shape), angularTolerance = quality.angularTolerance, binary = false } = opts;
|
|
273
287
|
const unserializable = probeSerializable(shape, "STL");
|
|
274
288
|
if (unserializable) return err(unserializable);
|
|
275
289
|
try {
|
|
@@ -424,4 +438,4 @@ async function meshLODsProgressive(shape, options = {}) {
|
|
|
424
438
|
return results;
|
|
425
439
|
}
|
|
426
440
|
//#endregion
|
|
427
|
-
export { meshEdges as a, meshMultiLOD as c,
|
|
441
|
+
export { meshEdges as a, meshMultiLOD as c, clearMeshCache as d, createMeshCache as f, mesh as i, scaleDefaultTolerance as l, exportSTEP as n, meshLODs as o, exportSTL as r, meshLODsProgressive as s, exportIGES as t, buildMeshCacheKey as u };
|
|
@@ -112,6 +112,20 @@ function createMeshCache() {
|
|
|
112
112
|
/**
|
|
113
113
|
* Meshing and export functions — functional replacements for Shape mesh/export methods.
|
|
114
114
|
*/
|
|
115
|
+
var SCALE_INVARIANT_DIAGONAL = 10;
|
|
116
|
+
function scaleDefaultTolerance(base, shape) {
|
|
117
|
+
let diagonal;
|
|
118
|
+
try {
|
|
119
|
+
const b = require_topologyQueryFns.getBounds(shape);
|
|
120
|
+
const dx = b.xMax - b.xMin;
|
|
121
|
+
const dy = b.yMax - b.yMin;
|
|
122
|
+
const dz = b.zMax - b.zMin;
|
|
123
|
+
diagonal = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
124
|
+
} catch {
|
|
125
|
+
return base;
|
|
126
|
+
}
|
|
127
|
+
return base * Math.max(1, diagonal / SCALE_INVARIANT_DIAGONAL);
|
|
128
|
+
}
|
|
115
129
|
/**
|
|
116
130
|
* Mesh a shape as a set of triangles for rendering.
|
|
117
131
|
*
|
|
@@ -123,7 +137,7 @@ function createMeshCache() {
|
|
|
123
137
|
*/
|
|
124
138
|
function mesh(shape, opts = {}) {
|
|
125
139
|
const quality = require_shapeTypes.qualityDeflection();
|
|
126
|
-
const { tolerance = quality.tolerance, angularTolerance = quality.angularTolerance, skipNormals = false, includeUVs = false, cache = true, signal } = opts;
|
|
140
|
+
const { tolerance = scaleDefaultTolerance(quality.tolerance, shape), angularTolerance = quality.angularTolerance, skipNormals = false, includeUVs = false, cache = true, signal } = opts;
|
|
127
141
|
signal?.throwIfAborted();
|
|
128
142
|
const cacheKey = buildMeshCacheKey(tolerance, angularTolerance, skipNormals, includeUVs);
|
|
129
143
|
if (cache) {
|
|
@@ -163,7 +177,7 @@ function mesh(shape, opts = {}) {
|
|
|
163
177
|
*/
|
|
164
178
|
function meshEdges(shape, opts = {}) {
|
|
165
179
|
const quality = require_shapeTypes.qualityDeflection();
|
|
166
|
-
const { tolerance = quality.tolerance, angularTolerance = quality.angularTolerance, cache = true } = opts;
|
|
180
|
+
const { tolerance = scaleDefaultTolerance(quality.tolerance, shape), angularTolerance = quality.angularTolerance, cache = true } = opts;
|
|
167
181
|
const cacheKey = buildEdgeMeshCacheKey(tolerance, angularTolerance);
|
|
168
182
|
if (cache) {
|
|
169
183
|
const cached = getEdgeMeshForShape(shape.wrapped, cacheKey);
|
|
@@ -269,7 +283,7 @@ function exportSTEP(shape) {
|
|
|
269
283
|
*/
|
|
270
284
|
function exportSTL(shape, opts = {}) {
|
|
271
285
|
const quality = require_shapeTypes.qualityDeflection();
|
|
272
|
-
const { tolerance = quality.tolerance, angularTolerance = quality.angularTolerance, binary = false } = opts;
|
|
286
|
+
const { tolerance = scaleDefaultTolerance(quality.tolerance, shape), angularTolerance = quality.angularTolerance, binary = false } = opts;
|
|
273
287
|
const unserializable = probeSerializable(shape, "STL");
|
|
274
288
|
if (unserializable) return require_errors.err(unserializable);
|
|
275
289
|
try {
|
|
@@ -490,3 +504,9 @@ Object.defineProperty(exports, "meshMultiLOD", {
|
|
|
490
504
|
return meshMultiLOD;
|
|
491
505
|
}
|
|
492
506
|
});
|
|
507
|
+
Object.defineProperty(exports, "scaleDefaultTolerance", {
|
|
508
|
+
enumerable: true,
|
|
509
|
+
get: function() {
|
|
510
|
+
return scaleDefaultTolerance;
|
|
511
|
+
}
|
|
512
|
+
});
|
|
@@ -31,13 +31,16 @@ export interface EdgeMesh {
|
|
|
31
31
|
}
|
|
32
32
|
/** Shared options for meshing operations. */
|
|
33
33
|
export interface MeshOptions {
|
|
34
|
-
/** Linear deflection tolerance. Smaller = finer mesh. Defaults to the active
|
|
34
|
+
/** Linear deflection tolerance. Smaller = finer mesh. Defaults to the active
|
|
35
|
+
* quality level, scaled with the shape's bounding-box diagonal beyond 10
|
|
36
|
+
* model units so default meshes stay scale-invariant. */
|
|
35
37
|
tolerance?: number;
|
|
36
38
|
/** Angular deflection tolerance in radians. Smaller = finer mesh on curved surfaces. Defaults to the active quality level. */
|
|
37
39
|
angularTolerance?: number;
|
|
38
40
|
/** Abort signal to cancel mesh generation between face iterations. */
|
|
39
41
|
signal?: AbortSignal;
|
|
40
42
|
}
|
|
43
|
+
export declare function scaleDefaultTolerance(base: number, shape: AnyShape<Dimension>): number;
|
|
41
44
|
/**
|
|
42
45
|
* Mesh a shape as a set of triangles for rendering.
|
|
43
46
|
*
|
package/dist/topology.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const require_solidBuilders = require("./solidBuilders-BKSCyfzL.cjs");
|
|
|
5
5
|
const require_primitiveFns = require("./primitiveFns-BjwF7CHF.cjs");
|
|
6
6
|
const require_shapeFns = require("./shapeFns-C3AFMiyv.cjs");
|
|
7
7
|
const require_curveFns = require("./curveFns-DTbY4aYG.cjs");
|
|
8
|
-
const require_meshFns = require("./meshFns-
|
|
8
|
+
const require_meshFns = require("./meshFns-BZNqLhDE.cjs");
|
|
9
9
|
const require_healingFns = require("./healingFns-CnRyuMWf.cjs");
|
|
10
10
|
const require_adjacencyFns = require("./adjacencyFns-DmzCVsNA.cjs");
|
|
11
11
|
exports.addHoles = require_primitiveFns.addHoles;
|
package/dist/topology.js
CHANGED
|
@@ -4,7 +4,7 @@ import { h as fuseAll, p as cutAll } from "./solidBuilders-BiRBDuvG.js";
|
|
|
4
4
|
import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-B0iLpCEN.js";
|
|
5
5
|
import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-D0hK1y4m.js";
|
|
6
6
|
import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-U6vegvin.js";
|
|
7
|
-
import { d as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES
|
|
7
|
+
import { d as clearMeshCache, f as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-BTE7WFpU.js";
|
|
8
8
|
import { A as toBufferGeometryData, P as toLineGeometryData, S as chamferDistAngle, _ as checkBoolean, a as healFace, b as getNurbsCurveData, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, j as toGroupedBufferGeometryData, k as variableFillet, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-CN9ra8Kh.js";
|
|
9
9
|
import { i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-oMRMitRE.js";
|
|
10
10
|
export { addHoles, adjacentFaces, approximateCurve, asTopo, autoHeal, bezier, box, bsplineApprox, cast, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkBoolean, circle, classifyPointOnFace, clearMeshCache, compound, cone, createMeshCache, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cutAll, cutAllBisect, cutWithEvolution, cylinder, fromBREP as deserializeShape, downcast, edgesOfFace, ellipse, ellipseArc, ellipsoid, exportIGES, exportSTEP, exportSTL, face, faceAxis, faceCenter, faceGeomType, faceOrientation, facesOfEdge, filledFace, filletWithEvolution, fixSelfIntersection, fixShape, flipFaceOrientation, flipOrientation, fuseAll, fuseAllBisect, fuseWithEvolution, getBounds, getCurveType, getEdges, getFaces, getHashCode, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getSurfaceType, getVertices, getWires, healFace, healSolid, healWire, helix, innerWires, interpolateCurve, intersectWithEvolution, invalidateShapeCache, isCompSolid, isEqualShape, isSameShape, iterEdges, iterFaces, iterTopo, iterVertices, iterWires, line, normalAt, offsetFace, offsetWire2D, outerWire, pointOnSurface, polygon, positionOnCurve, projectPointOnFace, sewShells, shapeType, sharedEdges, shellWithEvolution, solid, solidFromShell, sphere, subFace, tangentArc, threePointArc, toBufferGeometryData, toGroupedBufferGeometryData, toLineGeometryData, torus, uvBounds, uvCoordinates, variableFillet, vertex, vertexPosition, verticesOfEdge, wire, wireLoop, wiresOfFace };
|