brepjs 20.12.4 → 20.12.6
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/lib/offset.d.ts +1 -1
- package/dist/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{adjacencyFns-54UTqtan.js → adjacencyFns--KmBIKYJ.js} +3 -3
- package/dist/{adjacencyFns-C_Vb1AeW.cjs → adjacencyFns-BFJfaUwX.cjs} +3 -3
- package/dist/{blueprint-DFpjcrlm.js → blueprint-BhIk9Pvm.js} +7 -8
- package/dist/{blueprint-D0VEeTzJ.cjs → blueprint-D83DDDPb.cjs} +7 -8
- package/dist/{blueprintFns-Douf5ZdX.cjs → blueprintFns-C4TQn-x_.cjs} +2 -2
- package/dist/{blueprintFns-Dye1jezD.js → blueprintFns-eULVgkq9.js} +2 -2
- package/dist/{blueprintSketcher-Cr0Lr1Dq.js → blueprintSketcher-D_Faf0GO.js} +32 -14
- package/dist/{blueprintSketcher-W9yON-UC.cjs → blueprintSketcher-Di376t-0.cjs} +32 -14
- package/dist/{boolean2D-C9VghXHG.cjs → boolean2D-CNZFI_y8.cjs} +4 -4
- package/dist/{boolean2D-CCV3R6lN.js → boolean2D-DqpCF72W.js} +4 -4
- package/dist/brepjs.cjs +128 -100
- package/dist/brepjs.js +128 -100
- package/dist/{cameraFns-DZOI_ewG.js → cameraFns-CrClIkmV.js} +3 -3
- package/dist/{cameraFns-x3L6dtA8.cjs → cameraFns-RqraCXIc.cjs} +3 -3
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-BY10jciz.js → cornerFinder-BZuQkRp2.js} +1 -1
- package/dist/{cornerFinder-B8PqO4um.cjs → cornerFinder-CdOe1Wrb.cjs} +1 -1
- package/dist/{curveFns-B4308HNM.js → curveFns-BP3srCfK.js} +1 -1
- package/dist/{curveFns-8lUhNquZ.cjs → curveFns-CyIvQNYT.cjs} +1 -1
- package/dist/{drawFns-C7zAvera.cjs → drawFns-71cOhWD-.cjs} +29 -16
- package/dist/{drawFns-DjnU3fEd.js → drawFns-DxDwJ5zZ.js} +29 -16
- package/dist/{faceFns-BjmlYcc9.cjs → faceFns-B7MiDYj1.cjs} +2 -2
- package/dist/{faceFns-7eHqNM0P.js → faceFns-iVPbTxki.js} +2 -2
- package/dist/{healingFns-BW7mZ_SW.js → healingFns-BhP8zfp1.js} +5 -5
- package/dist/{healingFns-CYLIcIWv.cjs → healingFns-DWljGTNR.cjs} +5 -5
- package/dist/{helpers-BQ6XMFcm.js → helpers-D2hANLRu.js} +14 -10
- package/dist/{helpers-De0Z_6iV.cjs → helpers-DKEVm6Hu.cjs} +14 -10
- package/dist/{importFns-BCL4-H8e.js → importFns-DUzIkns7.js} +2 -2
- package/dist/{importFns-3IMBHQrQ.cjs → importFns-KEPAgbjj.cjs} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/bspline2dFit.d.ts +42 -0
- package/dist/kernel/geometry2d.d.ts +45 -0
- package/dist/kernel/occt/kernel2dOps.d.ts +1 -1
- package/dist/kernel/occtWasm/constructionOps.d.ts +1 -1
- package/dist/kernel/occtWasm/kernel2dOps.d.ts +7 -4
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +3 -3
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/occtWasm/occtWasmTypes.d.ts +7 -0
- package/dist/{loftFns-DlG5oR0X.cjs → loftFns-D5AvfCGG.cjs} +17 -2
- package/dist/{loftFns-H4ZOpRAk.js → loftFns-D5NJpHLZ.js} +17 -2
- package/dist/{measureFns-Ce01LVwq.cjs → measureFns-CZHNWkiA.cjs} +102 -35
- package/dist/{measureFns-1IfNe629.js → measureFns-mxBdPiWa.js} +102 -35
- package/dist/measurement/measureFns.d.ts +3 -2
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-nEvfwNRF.cjs → meshFns-Czlt-GBJ.cjs} +3 -3
- package/dist/{meshFns-DaRZxa7B.js → meshFns-DmjMzNbH.js} +3 -3
- package/dist/{occtWasmAdapter-ipKUdNLN.js → occtWasmAdapter-B9d0Q0Vl.js} +1160 -261
- package/dist/{occtWasmAdapter-CRd9RFEu.cjs → occtWasmAdapter-DVxLkjlJ.cjs} +1171 -260
- package/dist/operations/patternFns.d.ts +6 -1
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{originTrackingFns-zrksCJTa.js → originTrackingFns-CBnyKLm7.js} +2 -2
- package/dist/{originTrackingFns-9gyCMFFQ.cjs → originTrackingFns-CHymOLLm.cjs} +2 -2
- package/dist/{primitiveFns-BRXZ7jnP.cjs → primitiveFns-BVeBEaa4.cjs} +7 -14
- package/dist/{primitiveFns-ClQP6zMQ.js → primitiveFns-DeNl60Rw.js} +7 -14
- package/dist/{principalBoxFns-DsfWOoXg.js → principalBoxFns-3mW_hA6z.js} +3 -3
- package/dist/{principalBoxFns-tIv-crMB.cjs → principalBoxFns-CG6kG7vT.cjs} +3 -3
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query/finderCore.d.ts +7 -7
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{refResolveFns-BZdUlv9f.cjs → refResolveFns-BAs4p9z7.cjs} +6 -6
- package/dist/{refResolveFns-BG3JGs--.js → refResolveFns-DHx1Y3GG.js} +6 -6
- package/dist/{shapeFns-BbXqiNqY.cjs → shapeFns-C0w8vvfb.cjs} +2 -2
- package/dist/{shapeFns-BCgegapL.js → shapeFns-CgqKICF_.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-DJT3SnGK.cjs → shapeTypes-Dc7j-MYg.cjs} +10 -16
- package/dist/{shapeTypes-DAz6aAnJ.js → shapeTypes-DwvQUp9M.js} +10 -16
- package/dist/sketching/sketches.d.ts +2 -0
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-8xytLt8-.js → solidBuilders-DT1gpVWM.js} +5 -5
- package/dist/{solidBuilders-BWbqhbyv.cjs → solidBuilders-iS5DDwg8.cjs} +5 -5
- package/dist/{surfaceBuilders-CwG_RPdZ.cjs → surfaceBuilders-BvwSgD3C.cjs} +3 -3
- package/dist/{surfaceBuilders-BO96DMCH.js → surfaceBuilders-CPLe0bbk.js} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-Dhe8_Uvc.js → textBlueprints-BU0Rhk54.js} +19 -11
- package/dist/{textBlueprints-DHfYmLtP.cjs → textBlueprints-CNPCPJix.cjs} +19 -11
- package/dist/{textMetrics-CwYDH9js.cjs → textMetrics-C71g4TmO.cjs} +1 -1
- package/dist/{textMetrics-Bbf-Dllw.js → textMetrics-Df9aLYK2.js} +1 -1
- package/dist/{threadFns-B23RqugN.cjs → threadFns-CzXEnnmo.cjs} +37 -29
- package/dist/{threadFns-Cn7_bmux.js → threadFns-DESH7lcs.js} +36 -28
- package/dist/topology/apiTypes.d.ts +13 -7
- package/dist/topology.cjs +9 -9
- package/dist/topology.d.ts +1 -1
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-xh11vEQw.cjs → topologyQueryFns-5Frx8Y-0.cjs} +1 -1
- package/dist/{topologyQueryFns-BfYdGOJc.js → topologyQueryFns-LXV1nTaS.js} +1 -1
- package/dist/{validityTypes-CXkecqMw.cjs → validityTypes-C6rROGTP.cjs} +1 -1
- package/dist/{validityTypes-BfOuvfyp.js → validityTypes-DM-Iwe8N.js} +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel } from "./shapeTypes-DwvQUp9M.js";
|
|
2
2
|
import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { E as kernelCallRaw } from "./topologyQueryFns-
|
|
4
|
-
import { m as uvBounds } from "./faceFns-
|
|
3
|
+
import { E as kernelCallRaw } from "./topologyQueryFns-LXV1nTaS.js";
|
|
4
|
+
import { m as uvBounds } from "./faceFns-iVPbTxki.js";
|
|
5
5
|
// src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
|
@@ -27,6 +27,66 @@ function nullShapeErr(fn) {
|
|
|
27
27
|
return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `${fn}: shape is a null shape`));
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
+
* Run `fn` on fresh handles to the distinct sub-shapes of `type`, releasing them
|
|
31
|
+
* afterwards. Unlike getFaces and friends this leaves the shape's topology cache
|
|
32
|
+
* alone, so a measurement allocates nothing that outlives it.
|
|
33
|
+
*/
|
|
34
|
+
function withSubShapes(shape, type, fn) {
|
|
35
|
+
const kernel = getKernel();
|
|
36
|
+
const items = kernel.iterShapes(shape.wrapped, type);
|
|
37
|
+
try {
|
|
38
|
+
return fn(items);
|
|
39
|
+
} finally {
|
|
40
|
+
for (const item of items) kernel.dispose(item);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Run `fn` on a throwaway compound of `parts`, releasing the compound afterwards. */
|
|
44
|
+
function withCompoundOf(parts, fn) {
|
|
45
|
+
const kernel = getKernel();
|
|
46
|
+
const c = kernel.makeCompound(parts);
|
|
47
|
+
try {
|
|
48
|
+
return fn(c);
|
|
49
|
+
} finally {
|
|
50
|
+
kernel.dispose(c);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function volumeOf(target) {
|
|
54
|
+
const kernel = getKernel();
|
|
55
|
+
const m = kernel.volume(target);
|
|
56
|
+
const comResult = kernelCallRaw(() => kernel.centerOfMass(target), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
57
|
+
if (!comResult.ok) return comResult;
|
|
58
|
+
return ok({
|
|
59
|
+
mass: m,
|
|
60
|
+
volume: m,
|
|
61
|
+
centerOfMass: comResult.value
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Area-weighted centroid of `faces`, from each face's own surface center of mass. */
|
|
65
|
+
function surfaceCentroid(faces) {
|
|
66
|
+
const kernel = getKernel();
|
|
67
|
+
let total = 0;
|
|
68
|
+
let x = 0;
|
|
69
|
+
let y = 0;
|
|
70
|
+
let z = 0;
|
|
71
|
+
for (const f of faces) {
|
|
72
|
+
const a = kernel.area(f);
|
|
73
|
+
const [cx, cy, cz] = kernel.surfaceCenterOfMass(f);
|
|
74
|
+
total += a;
|
|
75
|
+
x += a * cx;
|
|
76
|
+
y += a * cy;
|
|
77
|
+
z += a * cz;
|
|
78
|
+
}
|
|
79
|
+
return total > 0 ? [
|
|
80
|
+
x / total,
|
|
81
|
+
y / total,
|
|
82
|
+
z / total
|
|
83
|
+
] : [
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
0
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
30
90
|
* Measure volume properties of a 3D shape.
|
|
31
91
|
*
|
|
32
92
|
* @param shape - A solid or compound shape.
|
|
@@ -37,31 +97,23 @@ function measureVolumeProps(shape) {
|
|
|
37
97
|
const cached = getCachedMeasurement(shape.wrapped, "volume");
|
|
38
98
|
if (cached) return ok(cached);
|
|
39
99
|
if (shapeIsNull(shape)) return nullShapeErr("measureVolumeProps");
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
0
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
setCachedMeasurement(shape.wrapped, "volume", zero);
|
|
53
|
-
return ok(zero);
|
|
54
|
-
}
|
|
55
|
-
const m = kernel.volume(shape.wrapped);
|
|
56
|
-
const comResult = kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
57
|
-
if (!comResult.ok) return comResult;
|
|
58
|
-
const result = {
|
|
59
|
-
mass: m,
|
|
60
|
-
volume: m,
|
|
61
|
-
centerOfMass: comResult.value
|
|
100
|
+
const type = getKernel().shapeType(shape.wrapped);
|
|
101
|
+
const zero = {
|
|
102
|
+
mass: 0,
|
|
103
|
+
volume: 0,
|
|
104
|
+
centerOfMass: [
|
|
105
|
+
0,
|
|
106
|
+
0,
|
|
107
|
+
0
|
|
108
|
+
]
|
|
62
109
|
};
|
|
63
|
-
|
|
64
|
-
|
|
110
|
+
let result;
|
|
111
|
+
if (type === "solid" || type === "compsolid") result = volumeOf(shape.wrapped);
|
|
112
|
+
else if (type === "compound") result = withSubShapes(shape, "solid", (solids) => solids.length === 0 ? ok(zero) : withCompoundOf(solids, volumeOf));
|
|
113
|
+
else result = ok(zero);
|
|
114
|
+
if (!result.ok) return result;
|
|
115
|
+
setCachedMeasurement(shape.wrapped, "volume", result.value);
|
|
116
|
+
return result;
|
|
65
117
|
}
|
|
66
118
|
/**
|
|
67
119
|
* Measure surface properties of a face or 3D shape.
|
|
@@ -76,7 +128,7 @@ function measureSurfaceProps(shape) {
|
|
|
76
128
|
if (shapeIsNull(shape)) return nullShapeErr("measureSurfaceProps");
|
|
77
129
|
const kernel = getKernel();
|
|
78
130
|
const m = kernel.area(shape.wrapped);
|
|
79
|
-
const comResult = kernelCallRaw(() => kernel.
|
|
131
|
+
const comResult = kernelCallRaw(() => kernel.shapeType(shape.wrapped) === "face" ? kernel.surfaceCenterOfMass(shape.wrapped) : withSubShapes(shape, "face", surfaceCentroid), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
80
132
|
if (!comResult.ok) return comResult;
|
|
81
133
|
const result = {
|
|
82
134
|
mass: m,
|
|
@@ -89,8 +141,9 @@ function measureSurfaceProps(shape) {
|
|
|
89
141
|
/**
|
|
90
142
|
* Measure linear properties of any shape.
|
|
91
143
|
*
|
|
92
|
-
* For edges this is the arc length; for wires
|
|
93
|
-
*
|
|
144
|
+
* For edges this is the arc length; for wires and faces it is the total length
|
|
145
|
+
* of their edges; for shells, solids, and compounds it is the total length of
|
|
146
|
+
* their distinct edges, each counted once.
|
|
94
147
|
*
|
|
95
148
|
* @param shape - Any shape whose linear extent is to be measured.
|
|
96
149
|
* @returns `Result` containing length, center of mass, and raw mass property.
|
|
@@ -101,12 +154,26 @@ function measureLinearProps(shape) {
|
|
|
101
154
|
if (cached) return ok(cached);
|
|
102
155
|
if (shapeIsNull(shape)) return nullShapeErr("measureLinearProps");
|
|
103
156
|
const kernel = getKernel();
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
157
|
+
const type = kernel.shapeType(shape.wrapped);
|
|
158
|
+
const linearOf = (target) => {
|
|
159
|
+
const m = kernel.length(target);
|
|
160
|
+
return {
|
|
161
|
+
mass: m,
|
|
162
|
+
length: m,
|
|
163
|
+
centerOfMass: kernel.linearCenterOfMass(target)
|
|
164
|
+
};
|
|
109
165
|
};
|
|
166
|
+
let result;
|
|
167
|
+
if (type === "vertex" || type === "edge" || type === "wire" || type === "face") result = linearOf(shape.wrapped);
|
|
168
|
+
else result = withSubShapes(shape, "edge", (edges) => edges.length === 0 ? {
|
|
169
|
+
mass: 0,
|
|
170
|
+
length: 0,
|
|
171
|
+
centerOfMass: [
|
|
172
|
+
0,
|
|
173
|
+
0,
|
|
174
|
+
0
|
|
175
|
+
]
|
|
176
|
+
} : withCompoundOf(edges, linearOf));
|
|
110
177
|
setCachedMeasurement(shape.wrapped, "linear", result);
|
|
111
178
|
return ok(result);
|
|
112
179
|
}
|
|
@@ -22,8 +22,9 @@ export declare function measureSurfaceProps(shape: Face<Dimension> | Shape3D): R
|
|
|
22
22
|
/**
|
|
23
23
|
* Measure linear properties of any shape.
|
|
24
24
|
*
|
|
25
|
-
* For edges this is the arc length; for wires
|
|
26
|
-
*
|
|
25
|
+
* For edges this is the arc length; for wires and faces it is the total length
|
|
26
|
+
* of their edges; for shells, solids, and compounds it is the total length of
|
|
27
|
+
* their distinct edges, each counted once.
|
|
27
28
|
*
|
|
28
29
|
* @param shape - Any shape whose linear extent is to be measured.
|
|
29
30
|
* @returns `Result` containing length, center of mass, and raw mass property.
|
package/dist/measurement.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_measureFns = require("./measureFns-
|
|
3
|
-
const require_principalBoxFns = require("./principalBoxFns-
|
|
2
|
+
const require_measureFns = require("./measureFns-CZHNWkiA.cjs");
|
|
3
|
+
const require_principalBoxFns = require("./principalBoxFns-CG6kG7vT.cjs");
|
|
4
4
|
exports.createDistanceQuery = require_measureFns.createDistanceQuery;
|
|
5
5
|
exports.measureArea = require_measureFns.measureArea;
|
|
6
6
|
exports.measureDistance = require_measureFns.measureDistance;
|
package/dist/measurement.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
2
|
-
import { t as principalBoundingBox } from "./principalBoxFns-
|
|
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-mxBdPiWa.js";
|
|
2
|
+
import { t as principalBoundingBox } from "./principalBoxFns-3mW_hA6z.js";
|
|
3
3
|
export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, principalBoundingBox };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-Dc7j-MYg.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_originTrackingFns = require("./originTrackingFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-5Frx8Y-0.cjs");
|
|
4
|
+
const require_originTrackingFns = require("./originTrackingFns-CHymOLLm.cjs");
|
|
5
5
|
// 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
|
-
import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-DwvQUp9M.js";
|
|
2
2
|
import { E as ok, g as err, r as ioError } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { d as getSolids, n as getBounds } from "./topologyQueryFns-
|
|
4
|
-
import { t as getFaceOrigins } from "./originTrackingFns-
|
|
3
|
+
import { d as getSolids, n as getBounds } from "./topologyQueryFns-LXV1nTaS.js";
|
|
4
|
+
import { t as getFaceOrigins } from "./originTrackingFns-CBnyKLm7.js";
|
|
5
5
|
// src/topology/meshCache.ts
|
|
6
6
|
/**
|
|
7
7
|
* Build a parameter key for the inner cache map (excludes shape identity).
|