brepjs 18.154.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 +280 -243
- package/dist/brepjs.js +279 -242
- package/dist/csg/edit.d.ts +1 -0
- package/dist/csg/serialize.d.ts +2 -1
- 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/csg/edit.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare function replaceNode(root: IRNode, pred: NodePredicate, replaceme
|
|
|
4
4
|
/** Visits each DISTINCT node once (identity-deduplicated), so a shared
|
|
5
5
|
* subtree is reported once and a self-referencing DAG walks in linear time. */
|
|
6
6
|
export declare function forEachNode(root: IRNode, fn: (node: IRNode) => void): void;
|
|
7
|
+
export declare function childrenOf(n: IRNode): readonly IRNode[];
|
|
7
8
|
export declare function nodeCount(root: IRNode): number;
|
package/dist/csg/serialize.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Result } from '../core/result.js';
|
|
2
2
|
import { IRNode } from './types.js';
|
|
3
|
-
export declare const CSG_VERSION =
|
|
3
|
+
export declare const CSG_VERSION = 8;
|
|
4
4
|
export interface CsgEnvelope {
|
|
5
5
|
readonly csgVersion: number;
|
|
6
|
+
readonly defs?: readonly unknown[];
|
|
6
7
|
readonly root: unknown;
|
|
7
8
|
}
|
|
8
9
|
export declare function toJSON(node: IRNode): CsgEnvelope;
|
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 };
|