brepjs 20.13.0 → 20.13.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/{adjacencyFns-BXzEHSC5.cjs → adjacencyFns-BBugwmvl.cjs} +3 -3
- package/dist/{adjacencyFns-BYjzMejn.js → adjacencyFns-V29Gvfs9.js} +3 -3
- package/dist/{blueprint-464KGkzc.cjs → blueprint-BO8zuqoy.cjs} +5 -5
- package/dist/{blueprint-D-4-uTkr.js → blueprint-CDmOJybf.js} +5 -5
- package/dist/{blueprintFns-CE5RdX-E.js → blueprintFns-CEKZsu4N.js} +2 -2
- package/dist/{blueprintFns-BdyFiuiC.cjs → blueprintFns-Cki-iwEl.cjs} +2 -2
- package/dist/{blueprintSketcher-C4XHzqTw.cjs → blueprintSketcher-Bxkp-vjK.cjs} +3 -3
- package/dist/{blueprintSketcher-CQ9LxcIl.js → blueprintSketcher-DG_2zJg7.js} +3 -3
- package/dist/{boolean2D-CKE32vHV.cjs → boolean2D-C_sEMz0u.cjs} +4 -4
- package/dist/{boolean2D-DwJvQ4p_.js → boolean2D-DqCcYA2X.js} +4 -4
- package/dist/{booleanFns-MkzdfjDv.cjs → booleanFns-CA9tvtqr.cjs} +5 -5
- package/dist/{booleanFns-CsTz48A3.js → booleanFns-CopMFBLS.js} +5 -5
- package/dist/brepjs.cjs +33 -31
- package/dist/brepjs.js +33 -31
- package/dist/{cameraFns-BDl_D28X.js → cameraFns-BIIpsfds.js} +3 -3
- package/dist/{cameraFns-vHpapIZG.cjs → cameraFns-BJ35ht2H.cjs} +3 -3
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-Dyk5sKEN.js → cornerFinder-C8VCstc3.js} +1 -1
- package/dist/{cornerFinder-adDN0_C4.cjs → cornerFinder-D83OLL_I.cjs} +1 -1
- package/dist/{curveFns-RjNVzxNc.js → curveFns--TqXOi8f.js} +1 -1
- package/dist/{curveFns-HtjEh2W-.cjs → curveFns-B29Eot3K.cjs} +1 -1
- package/dist/{drawFns-B5gZtD_P.cjs → drawFns-Bqs4HPzo.cjs} +12 -12
- package/dist/{drawFns-stc8-Gma.js → drawFns-g9FrZ_P4.js} +12 -12
- package/dist/{faceFns-C7wBHMPv.cjs → faceFns-BeSpw0Dz.cjs} +2 -2
- package/dist/{faceFns-DaPoCzd-.js → faceFns-BzHfvPea.js} +2 -2
- package/dist/{healingFns-zYCbT8vR.cjs → healingFns-BtZg6i3J.cjs} +31 -14
- package/dist/{healingFns-C3Wq_hN3.js → healingFns-DtefNa-x.js} +31 -14
- package/dist/{helpers-BdtYVyP5.cjs → helpers-CFEuQ0ok.cjs} +6 -6
- package/dist/{helpers-CDzSlBi_.js → helpers-CHUowMmV.js} +6 -6
- package/dist/{importFns-DR7Adv-W.js → importFns-BLaneR8r.js} +34 -20
- package/dist/{importFns-CotbQ9l7.cjs → importFns-BX0866c6.cjs} +34 -20
- package/dist/io/importFns.d.ts +12 -5
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/brepkitWasmTypes.d.ts +0 -4
- package/dist/kernel/brepkit/helpers.d.ts +15 -0
- package/dist/kernel/brepkit/igesMerge.d.ts +13 -0
- package/dist/kernel/brepkit/measureOps.d.ts +7 -0
- package/dist/kernel/brepkit/modifierOps.d.ts +11 -1
- package/dist/kernel/brepkit/stepMerge.d.ts +14 -0
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-C9k9UAKh.cjs → loftFns-Byjbneme.cjs} +31 -16
- package/dist/{loftFns-Cbnrz3p8.js → loftFns-Cth8Le9X.js} +32 -17
- package/dist/{measureFns-Bi62maOJ.cjs → measureFns-BlS2xJcn.cjs} +53 -9
- package/dist/{measureFns-DivR02Xb.js → measureFns-CLsSuByu.js} +49 -11
- package/dist/measurement/measureFns.d.ts +16 -1
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-CcuY52tt.js → meshFns-CzpP9SBf.js} +4 -4
- package/dist/{meshFns-8MTf0Lo_.cjs → meshFns-ECQqx-8Q.cjs} +4 -4
- package/dist/{occtWasmAdapter-BNOuP9DA.cjs → occtWasmAdapter-4YnvqZOW.cjs} +72 -3
- package/dist/{occtWasmAdapter-1k4udeb3.js → occtWasmAdapter-CGsnjMOe.js} +72 -3
- package/dist/operations/sweepFns.d.ts +7 -3
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-BifV4IGL.cjs → primitiveFns-CzhQz02F.cjs} +5 -5
- package/dist/{primitiveFns-uDvN1FH6.js → primitiveFns-Kph3YP3A.js} +5 -5
- package/dist/{principalBoxFns-ez0xXLyK.js → principalBoxFns-C8ZmZNxJ.js} +3 -3
- package/dist/{principalBoxFns-DjxE8Rym.cjs → principalBoxFns-Ck9rR3Op.cjs} +3 -3
- 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/{refResolveFns-CTkAPUwM.cjs → refResolveFns-CVUSuVee.cjs} +6 -6
- package/dist/{refResolveFns-CuaYXFya.js → refResolveFns-Cf16q6AH.js} +6 -6
- package/dist/{shapeFns-Rmgd4x9I.cjs → shapeFns-BEwoFgq2.cjs} +2 -2
- package/dist/{shapeFns-DgpWLKra.js → shapeFns-Bepwarf3.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-BjitsJRQ.cjs → shapeTypes-CIw6-GFy.cjs} +899 -198
- package/dist/{shapeTypes-DbPghQD3.js → shapeTypes-hLHmANUz.js} +899 -198
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-Bs2NA3xl.cjs → solidBuilders-BVHK-era.cjs} +3 -3
- package/dist/{solidBuilders-BUI_fGzR.js → solidBuilders-IA8xNuxJ.js} +3 -3
- package/dist/{surfaceBuilders-CO_DKhWA.js → surfaceBuilders-BYwkPzfM.js} +3 -3
- package/dist/{surfaceBuilders-Cn1mkQ3j.cjs → surfaceBuilders-DIM5GSAT.cjs} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-CT0Kbw1f.js → textBlueprints-B4w-_4_D.js} +8 -8
- package/dist/{textBlueprints-P_D0KUVx.cjs → textBlueprints-CPJ6sBZZ.cjs} +8 -8
- package/dist/{textMetrics-CVyX8GyL.cjs → textMetrics-Dfr_9G6g.cjs} +1 -1
- package/dist/{textMetrics-CXKdzefS.js → textMetrics-na1BYw65.js} +1 -1
- package/dist/{threadFns-COs6jmaf.js → threadFns-BEO0-PP6.js} +7 -7
- package/dist/{threadFns-BV4HLdPE.cjs → threadFns-CAsRIX6c.cjs} +7 -7
- package/dist/topology/apiTypes.d.ts +7 -3
- package/dist/topology/chamferAngleFns.d.ts +2 -2
- package/dist/topology/evolutionFns.d.ts +1 -1
- package/dist/topology/modifierFns.d.ts +11 -4
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-s0LddGkF.cjs → topologyQueryFns-BNDmjz7x.cjs} +1 -1
- package/dist/{topologyQueryFns-J2ae_Gvc.js → topologyQueryFns-BYqsNs6q.js} +1 -1
- package/dist/{validityTypes-CD_Xz0vZ.js → validityTypes-BYhzdgTM.js} +1 -1
- package/dist/{validityTypes-BVZ0lSNi.cjs → validityTypes-Gd5B_HcL.cjs} +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge single-solid brepkit IGES documents into one.
|
|
3
|
+
*
|
|
4
|
+
* brepkit-wasm's `exportIges` takes one solid, but an IGES file holds one
|
|
5
|
+
* document. brepkit's writer emits only standalone entities that point at no
|
|
6
|
+
* other entity, so the merge appends each later document's directory and
|
|
7
|
+
* parameter entries, renumbering only the fixed-column fields that number or
|
|
8
|
+
* link them, and keeps the first document's start and global sections.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** One IGES document holding the entities of every brepkit IGES document in `docs`. */
|
|
13
|
+
export declare function mergeIgesDocuments(docs: readonly string[]): string;
|
|
@@ -10,6 +10,13 @@ export declare function boundingBox(bk: BrepkitKernel, shape: KernelShape): {
|
|
|
10
10
|
min: [number, number, number];
|
|
11
11
|
max: [number, number, number];
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Minimum distance between two shapes. brepkit-wasm measures from a point to a
|
|
15
|
+
* solid, face or edge, and between two solids; a wire, shell or compound is
|
|
16
|
+
* measured through its edges, faces or children, taking the closest pair. Any
|
|
17
|
+
* other pairing (face to face, edge to edge, face to solid, ...) has no exact
|
|
18
|
+
* brepkit measure and throws {@link UnsupportedKernelOperationError}.
|
|
19
|
+
*/
|
|
13
20
|
export declare function distance(bk: BrepkitKernel, shape1: KernelShape, shape2: KernelShape): DistanceResult;
|
|
14
21
|
export declare function surfaceCurvature(bk: BrepkitKernel, face: KernelShape, u: number, v: number): {
|
|
15
22
|
gaussian: number;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { BrepkitKernel } from './brepkitWasmTypes.js';
|
|
2
2
|
import { KernelShape } from '../types.js';
|
|
3
3
|
export declare function fillet(bk: BrepkitKernel, shape: KernelShape, edges: KernelShape[], radius: number | [number, number] | ((edge: KernelShape) => number | [number, number])): KernelShape;
|
|
4
|
+
/**
|
|
5
|
+
* A variable fillet spec on one edge: `{ edge: hashCode, radii: [{ param, radius }] }`
|
|
6
|
+
* from variableFillet, or `{ edgeId, startRadius, endRadius }`. A constant radius is
|
|
7
|
+
* an ordinary fillet; a radius that varies is unsupported (see
|
|
8
|
+
* {@link varyingFilletUnsupported}).
|
|
9
|
+
*/
|
|
10
|
+
export declare function filletVariable(bk: BrepkitKernel, shape: KernelShape, spec: string): KernelShape;
|
|
4
11
|
export declare function chamfer(bk: BrepkitKernel, shape: KernelShape, edges: KernelShape[], distance: number | [number, number] | ((edge: KernelShape) => number | [number, number])): KernelShape;
|
|
12
|
+
/**
|
|
13
|
+
* brepkit sets `distance` back on the edge's first face in its own face order
|
|
14
|
+
* and the other face back by distance·tan(angle).
|
|
15
|
+
*/
|
|
5
16
|
export declare function chamferDistAngle(bk: BrepkitKernel, shape: KernelShape, edges: KernelShape[], distance: number, angleDeg: number): KernelShape;
|
|
6
17
|
export declare function shell(bk: BrepkitKernel, shape: KernelShape, faces: KernelShape[], thickness: number, tolerance?: number): KernelShape;
|
|
7
18
|
export declare function thicken(bk: BrepkitKernel, shape: KernelShape, thickness: number): KernelShape;
|
|
8
19
|
export declare function offset(bk: BrepkitKernel, shape: KernelShape, distance: number, tolerance?: number): KernelShape;
|
|
9
|
-
export declare function filletVariable(bk: BrepkitKernel, shape: KernelShape, spec: string): KernelShape;
|
|
10
20
|
export declare function draft(bk: BrepkitKernel, shape: KernelShape, faces: KernelShape[], pullDirection: [number, number, number], neutralPlane: [number, number, number], angleDeg: number): KernelShape;
|
|
11
21
|
export declare function defeature(bk: BrepkitKernel, shape: KernelShape, faces: KernelShape[]): KernelShape;
|
|
12
22
|
export declare function offsetWire2D(bk: BrepkitKernel, wire: KernelShape, offsetVal: number, joinType?: number | 'arc' | 'intersection' | 'tangent'): KernelShape;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge single-solid brepkit STEP documents into one.
|
|
3
|
+
*
|
|
4
|
+
* brepkit-wasm's `exportStep` takes one solid, but a STEP file holds one
|
|
5
|
+
* document. brepkit's own multi-solid writer lists every solid in a single
|
|
6
|
+
* ADVANCED_BREP_SHAPE_REPRESENTATION under one product, so the merge rebuilds
|
|
7
|
+
* that layout: each later document contributes only the entities its solids
|
|
8
|
+
* reach, renumbered past the ids already used, and its solids join the first
|
|
9
|
+
* document's representation.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/** One STEP document holding the solids of every brepkit STEP document in `docs`. */
|
|
14
|
+
export declare function mergeStepDocuments(docs: readonly string[]): 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-4YnvqZOW.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as OcctWasmAdapter } from "../../occtWasmAdapter-
|
|
1
|
+
export { t as OcctWasmAdapter } from "../../occtWasmAdapter-CGsnjMOe.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CIw6-GFy.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-4YnvqZOW.cjs");
|
|
2
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
4
|
const require_types = require("./types-CjF9Rofr.cjs");
|
|
4
5
|
const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
|
|
@@ -81,6 +82,14 @@ function castSweepShellTuple(result) {
|
|
|
81
82
|
endWire
|
|
82
83
|
]);
|
|
83
84
|
}
|
|
85
|
+
/** `UNSUPPORTED_CAPABILITY` for a sweep option the kernel cannot build (a twist or a scaling law on brepkit). */
|
|
86
|
+
function sweepUnsupportedError(kernelId, e) {
|
|
87
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
88
|
+
return require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `sweep: the ${kernelId} kernel cannot build this sweep (${raw})`, e, {
|
|
89
|
+
kernel: kernelId,
|
|
90
|
+
operation: "sweep"
|
|
91
|
+
}, "Drop the twist or scaling law, or use the occt-wasm kernel");
|
|
92
|
+
}
|
|
84
93
|
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
85
94
|
if (config.mode === "simple" && !shellMode) {
|
|
86
95
|
const kernel = require_shapeTypes.getKernel();
|
|
@@ -101,21 +110,27 @@ function sweep(wire, spine, config = {}, shellMode = false) {
|
|
|
101
110
|
const { frenet = false, auxiliarySpine, law = null, transitionMode = "right", withContact, support, forceProfileSpineOthogonality, tolerance, boundTolerance, angularTolerance, maxDegree, maxSegments } = config;
|
|
102
111
|
const kernel = require_shapeTypes.getKernel();
|
|
103
112
|
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
let result;
|
|
114
|
+
try {
|
|
115
|
+
result = kernel.sweepPipeShell(wire.wrapped, spine.wrapped, {
|
|
116
|
+
transitionMode,
|
|
117
|
+
contact: !!withContact,
|
|
118
|
+
correction: withCorrection,
|
|
119
|
+
frenet,
|
|
120
|
+
shellMode,
|
|
121
|
+
...auxiliarySpine?.wrapped ? { auxiliary: auxiliarySpine.wrapped } : {},
|
|
122
|
+
...law !== null ? { law } : {},
|
|
123
|
+
...support !== null ? { support } : {},
|
|
124
|
+
tolerance,
|
|
125
|
+
boundTolerance,
|
|
126
|
+
angularTolerance,
|
|
127
|
+
maxDegree,
|
|
128
|
+
maxSegments
|
|
129
|
+
});
|
|
130
|
+
} catch (e) {
|
|
131
|
+
if (!require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) throw e;
|
|
132
|
+
return require_errors.err(sweepUnsupportedError(kernel.kernelId, e));
|
|
133
|
+
}
|
|
119
134
|
if (shellMode && typeof result === "object" && "firstShape" in result) return castSweepShellTuple(result);
|
|
120
135
|
const shape = require_shapeTypes.castResultShape(result);
|
|
121
136
|
if (!require_shapeTypes.isShape3D(shape)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-
|
|
2
|
-
import {
|
|
1
|
+
import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-hLHmANUz.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-CGsnjMOe.js";
|
|
3
|
+
import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode, u as unsupportedError } from "./errors-BTccWbtE.js";
|
|
3
4
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
4
5
|
import { c as vecLength, t as vecAdd } from "./vecOps-S-m9H_fe.js";
|
|
5
6
|
// src/operations/extrudeUtils.ts
|
|
@@ -81,6 +82,14 @@ function castSweepShellTuple(result) {
|
|
|
81
82
|
endWire
|
|
82
83
|
]);
|
|
83
84
|
}
|
|
85
|
+
/** `UNSUPPORTED_CAPABILITY` for a sweep option the kernel cannot build (a twist or a scaling law on brepkit). */
|
|
86
|
+
function sweepUnsupportedError(kernelId, e) {
|
|
87
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
88
|
+
return unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, `sweep: the ${kernelId} kernel cannot build this sweep (${raw})`, e, {
|
|
89
|
+
kernel: kernelId,
|
|
90
|
+
operation: "sweep"
|
|
91
|
+
}, "Drop the twist or scaling law, or use the occt-wasm kernel");
|
|
92
|
+
}
|
|
84
93
|
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
85
94
|
if (config.mode === "simple" && !shellMode) {
|
|
86
95
|
const kernel = getKernel();
|
|
@@ -101,21 +110,27 @@ function sweep(wire, spine, config = {}, shellMode = false) {
|
|
|
101
110
|
const { frenet = false, auxiliarySpine, law = null, transitionMode = "right", withContact, support, forceProfileSpineOthogonality, tolerance, boundTolerance, angularTolerance, maxDegree, maxSegments } = config;
|
|
102
111
|
const kernel = getKernel();
|
|
103
112
|
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
let result;
|
|
114
|
+
try {
|
|
115
|
+
result = kernel.sweepPipeShell(wire.wrapped, spine.wrapped, {
|
|
116
|
+
transitionMode,
|
|
117
|
+
contact: !!withContact,
|
|
118
|
+
correction: withCorrection,
|
|
119
|
+
frenet,
|
|
120
|
+
shellMode,
|
|
121
|
+
...auxiliarySpine?.wrapped ? { auxiliary: auxiliarySpine.wrapped } : {},
|
|
122
|
+
...law !== null ? { law } : {},
|
|
123
|
+
...support !== null ? { support } : {},
|
|
124
|
+
tolerance,
|
|
125
|
+
boundTolerance,
|
|
126
|
+
angularTolerance,
|
|
127
|
+
maxDegree,
|
|
128
|
+
maxSegments
|
|
129
|
+
});
|
|
130
|
+
} catch (e) {
|
|
131
|
+
if (!isUnsupportedKernelOperationError(e)) throw e;
|
|
132
|
+
return err(sweepUnsupportedError(kernel.kernelId, e));
|
|
133
|
+
}
|
|
119
134
|
if (shellMode && typeof result === "object" && "firstShape" in result) return castSweepShellTuple(result);
|
|
120
135
|
const shape = castResultShape(result);
|
|
121
136
|
if (!isShape3D(shape)) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CIw6-GFy.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-4YnvqZOW.cjs");
|
|
2
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BNDmjz7x.cjs");
|
|
5
|
+
const require_faceFns = require("./faceFns-BeSpw0Dz.cjs");
|
|
5
6
|
// src/measurement/measureCache.ts
|
|
6
7
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
8
|
function getCachedMeasurement(shape, key) {
|
|
@@ -214,24 +215,56 @@ function measureLength(shape) {
|
|
|
214
215
|
return require_errors.ok(props.value.mass);
|
|
215
216
|
}
|
|
216
217
|
/**
|
|
218
|
+
* The kernel's distance between two shapes, or `UNSUPPORTED_CAPABILITY` for a
|
|
219
|
+
* pair of shape types the kernel has no exact measure for (brepkit measures
|
|
220
|
+
* only from a point, or between solids).
|
|
221
|
+
*
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
function kernelDistance(fn, a, b) {
|
|
225
|
+
try {
|
|
226
|
+
return require_errors.ok(require_shapeTypes.getKernel().distance(a, b));
|
|
227
|
+
} catch (e) {
|
|
228
|
+
if (!require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) throw e;
|
|
229
|
+
return distanceUnsupported(fn, e);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function distanceUnsupported(fn, e) {
|
|
233
|
+
const kernelId = require_shapeTypes.getKernel().kernelId;
|
|
234
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
235
|
+
return require_errors.err(require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `${fn}: the ${kernelId} kernel cannot measure this distance (${raw})`, e, {
|
|
236
|
+
kernel: kernelId,
|
|
237
|
+
operation: fn
|
|
238
|
+
}, "Measure from a vertex or between two solids, or use the occt-wasm kernel"));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
217
241
|
* Measure the minimum distance between two shapes.
|
|
242
|
+
*
|
|
243
|
+
* @returns Err `UNSUPPORTED_CAPABILITY` for a pair of shapes the kernel cannot
|
|
244
|
+
* measure exactly (on brepkit, anything but a vertex against a shape or a
|
|
245
|
+
* solid against a solid).
|
|
218
246
|
*/
|
|
219
247
|
function measureDistance(shape1, shape2) {
|
|
220
248
|
if (shapeIsNull(shape1)) return nullShapeErr("measureDistance");
|
|
221
249
|
if (shapeIsNull(shape2)) return nullShapeErr("measureDistance");
|
|
222
|
-
|
|
250
|
+
const d = kernelDistance("measureDistance", shape1.wrapped, shape2.wrapped);
|
|
251
|
+
return d.ok ? require_errors.ok(d.value.value) : d;
|
|
223
252
|
}
|
|
224
253
|
/**
|
|
225
254
|
* Measure the minimum distance between two shapes, including witness points.
|
|
255
|
+
*
|
|
256
|
+
* @returns Err `UNSUPPORTED_CAPABILITY` for a pair of shapes the kernel cannot
|
|
257
|
+
* measure exactly, as {@link measureDistance} does.
|
|
226
258
|
*/
|
|
227
259
|
function measureDistanceProps(shape1, shape2) {
|
|
228
260
|
if (shapeIsNull(shape1)) return nullShapeErr("measureDistanceProps");
|
|
229
261
|
if (shapeIsNull(shape2)) return nullShapeErr("measureDistanceProps");
|
|
230
|
-
const d =
|
|
262
|
+
const d = kernelDistance("measureDistanceProps", shape1.wrapped, shape2.wrapped);
|
|
263
|
+
if (!d.ok) return d;
|
|
231
264
|
return require_errors.ok({
|
|
232
|
-
distance: d.value,
|
|
233
|
-
point1: d.point1,
|
|
234
|
-
point2: d.point2
|
|
265
|
+
distance: d.value.value,
|
|
266
|
+
point1: d.value.point1,
|
|
267
|
+
point2: d.value.point2
|
|
235
268
|
});
|
|
236
269
|
}
|
|
237
270
|
/**
|
|
@@ -248,7 +281,12 @@ function createDistanceQuery(referenceShape) {
|
|
|
248
281
|
return require_errors.ok({
|
|
249
282
|
distanceTo(other) {
|
|
250
283
|
if (shapeIsNull(other)) return nullShapeErr("createDistanceQuery.distanceTo");
|
|
251
|
-
|
|
284
|
+
try {
|
|
285
|
+
return require_errors.ok(query.distanceTo(other.wrapped).value);
|
|
286
|
+
} catch (e) {
|
|
287
|
+
if (!require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) throw e;
|
|
288
|
+
return distanceUnsupported("createDistanceQuery.distanceTo", e);
|
|
289
|
+
}
|
|
252
290
|
},
|
|
253
291
|
dispose() {
|
|
254
292
|
query.dispose();
|
|
@@ -307,6 +345,12 @@ Object.defineProperty(exports, "getCachedMeasurement", {
|
|
|
307
345
|
return getCachedMeasurement;
|
|
308
346
|
}
|
|
309
347
|
});
|
|
348
|
+
Object.defineProperty(exports, "kernelDistance", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function() {
|
|
351
|
+
return kernelDistance;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
310
354
|
Object.defineProperty(exports, "measureArea", {
|
|
311
355
|
enumerable: true,
|
|
312
356
|
get: function() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { q as getKernel } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import { E as
|
|
4
|
-
import {
|
|
1
|
+
import { q as getKernel } from "./shapeTypes-hLHmANUz.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-CGsnjMOe.js";
|
|
3
|
+
import { E as ok, d as validationError, g as err, t as BrepErrorCode, u as unsupportedError } from "./errors-BTccWbtE.js";
|
|
4
|
+
import { E as kernelCallRaw } from "./topologyQueryFns-BYqsNs6q.js";
|
|
5
|
+
import { m as uvBounds } from "./faceFns-BzHfvPea.js";
|
|
5
6
|
// src/measurement/measureCache.ts
|
|
6
7
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
8
|
function getCachedMeasurement(shape, key) {
|
|
@@ -214,24 +215,56 @@ function measureLength(shape) {
|
|
|
214
215
|
return ok(props.value.mass);
|
|
215
216
|
}
|
|
216
217
|
/**
|
|
218
|
+
* The kernel's distance between two shapes, or `UNSUPPORTED_CAPABILITY` for a
|
|
219
|
+
* pair of shape types the kernel has no exact measure for (brepkit measures
|
|
220
|
+
* only from a point, or between solids).
|
|
221
|
+
*
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
function kernelDistance(fn, a, b) {
|
|
225
|
+
try {
|
|
226
|
+
return ok(getKernel().distance(a, b));
|
|
227
|
+
} catch (e) {
|
|
228
|
+
if (!isUnsupportedKernelOperationError(e)) throw e;
|
|
229
|
+
return distanceUnsupported(fn, e);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function distanceUnsupported(fn, e) {
|
|
233
|
+
const kernelId = getKernel().kernelId;
|
|
234
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
235
|
+
return err(unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, `${fn}: the ${kernelId} kernel cannot measure this distance (${raw})`, e, {
|
|
236
|
+
kernel: kernelId,
|
|
237
|
+
operation: fn
|
|
238
|
+
}, "Measure from a vertex or between two solids, or use the occt-wasm kernel"));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
217
241
|
* Measure the minimum distance between two shapes.
|
|
242
|
+
*
|
|
243
|
+
* @returns Err `UNSUPPORTED_CAPABILITY` for a pair of shapes the kernel cannot
|
|
244
|
+
* measure exactly (on brepkit, anything but a vertex against a shape or a
|
|
245
|
+
* solid against a solid).
|
|
218
246
|
*/
|
|
219
247
|
function measureDistance(shape1, shape2) {
|
|
220
248
|
if (shapeIsNull(shape1)) return nullShapeErr("measureDistance");
|
|
221
249
|
if (shapeIsNull(shape2)) return nullShapeErr("measureDistance");
|
|
222
|
-
|
|
250
|
+
const d = kernelDistance("measureDistance", shape1.wrapped, shape2.wrapped);
|
|
251
|
+
return d.ok ? ok(d.value.value) : d;
|
|
223
252
|
}
|
|
224
253
|
/**
|
|
225
254
|
* Measure the minimum distance between two shapes, including witness points.
|
|
255
|
+
*
|
|
256
|
+
* @returns Err `UNSUPPORTED_CAPABILITY` for a pair of shapes the kernel cannot
|
|
257
|
+
* measure exactly, as {@link measureDistance} does.
|
|
226
258
|
*/
|
|
227
259
|
function measureDistanceProps(shape1, shape2) {
|
|
228
260
|
if (shapeIsNull(shape1)) return nullShapeErr("measureDistanceProps");
|
|
229
261
|
if (shapeIsNull(shape2)) return nullShapeErr("measureDistanceProps");
|
|
230
|
-
const d =
|
|
262
|
+
const d = kernelDistance("measureDistanceProps", shape1.wrapped, shape2.wrapped);
|
|
263
|
+
if (!d.ok) return d;
|
|
231
264
|
return ok({
|
|
232
|
-
distance: d.value,
|
|
233
|
-
point1: d.point1,
|
|
234
|
-
point2: d.point2
|
|
265
|
+
distance: d.value.value,
|
|
266
|
+
point1: d.value.point1,
|
|
267
|
+
point2: d.value.point2
|
|
235
268
|
});
|
|
236
269
|
}
|
|
237
270
|
/**
|
|
@@ -248,7 +281,12 @@ function createDistanceQuery(referenceShape) {
|
|
|
248
281
|
return ok({
|
|
249
282
|
distanceTo(other) {
|
|
250
283
|
if (shapeIsNull(other)) return nullShapeErr("createDistanceQuery.distanceTo");
|
|
251
|
-
|
|
284
|
+
try {
|
|
285
|
+
return ok(query.distanceTo(other.wrapped).value);
|
|
286
|
+
} catch (e) {
|
|
287
|
+
if (!isUnsupportedKernelOperationError(e)) throw e;
|
|
288
|
+
return distanceUnsupported("createDistanceQuery.distanceTo", e);
|
|
289
|
+
}
|
|
252
290
|
},
|
|
253
291
|
dispose() {
|
|
254
292
|
query.dispose();
|
|
@@ -295,4 +333,4 @@ function measureCurvatureAtMid(face) {
|
|
|
295
333
|
minDirection: result.minDirection
|
|
296
334
|
});
|
|
297
335
|
}
|
|
298
|
-
export {
|
|
336
|
+
export { measureCurvatureAtMid as a, measureLength as c, measureVolume as d, measureVolumeProps as f, setCachedMeasurement as g, getCachedMeasurement as h, measureCurvatureAt as i, measureLinearProps as l, withSubShapes as m, kernelDistance as n, measureDistance as o, withCompoundOf as p, measureArea as r, measureDistanceProps as s, createDistanceQuery as t, measureSurfaceProps as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KernelShape, ShapeType } from '../kernel/types.js';
|
|
1
|
+
import { DistanceResult, KernelShape, ShapeType } from '../kernel/types.js';
|
|
2
2
|
import { AnyShape, Dimension, Face, OrientedFace, Shape3D } from '../core/shapeTypes.js';
|
|
3
3
|
import { Result } from '../core/result.js';
|
|
4
4
|
import { CurvatureResult } from '../kernel/occt/measureOps.js';
|
|
@@ -64,12 +64,27 @@ export declare function measureArea(shape: Face<Dimension> | Shape3D): Result<nu
|
|
|
64
64
|
* @see {@link measureLinearProps} for the full property set including center of mass.
|
|
65
65
|
*/
|
|
66
66
|
export declare function measureLength(shape: AnyShape<Dimension>): Result<number>;
|
|
67
|
+
/**
|
|
68
|
+
* The kernel's distance between two shapes, or `UNSUPPORTED_CAPABILITY` for a
|
|
69
|
+
* pair of shape types the kernel has no exact measure for (brepkit measures
|
|
70
|
+
* only from a point, or between solids).
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare function kernelDistance(fn: string, a: KernelShape, b: KernelShape): Result<DistanceResult>;
|
|
67
75
|
/**
|
|
68
76
|
* Measure the minimum distance between two shapes.
|
|
77
|
+
*
|
|
78
|
+
* @returns Err `UNSUPPORTED_CAPABILITY` for a pair of shapes the kernel cannot
|
|
79
|
+
* measure exactly (on brepkit, anything but a vertex against a shape or a
|
|
80
|
+
* solid against a solid).
|
|
69
81
|
*/
|
|
70
82
|
export declare function measureDistance(shape1: AnyShape<Dimension>, shape2: AnyShape<Dimension>): Result<number>;
|
|
71
83
|
/**
|
|
72
84
|
* Measure the minimum distance between two shapes, including witness points.
|
|
85
|
+
*
|
|
86
|
+
* @returns Err `UNSUPPORTED_CAPABILITY` for a pair of shapes the kernel cannot
|
|
87
|
+
* measure exactly, as {@link measureDistance} does.
|
|
73
88
|
*/
|
|
74
89
|
export declare function measureDistanceProps(shape1: AnyShape<Dimension>, shape2: AnyShape<Dimension>): Result<DistanceProps>;
|
|
75
90
|
/**
|
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-BlS2xJcn.cjs");
|
|
3
|
+
const require_principalBoxFns = require("./principalBoxFns-Ck9rR3Op.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 {
|
|
2
|
-
import { t as principalBoundingBox } from "./principalBoxFns-
|
|
1
|
+
import { c as measureLength, d as measureVolume, f as measureVolumeProps, l as measureLinearProps, o as measureDistance, r as measureArea, s as measureDistanceProps, t as createDistanceQuery, u as measureSurfaceProps } from "./measureFns-CLsSuByu.js";
|
|
2
|
+
import { t as principalBoundingBox } from "./principalBoxFns-C8ZmZNxJ.js";
|
|
3
3
|
export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, principalBoundingBox };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-
|
|
2
|
-
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-
|
|
1
|
+
import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-hLHmANUz.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-CGsnjMOe.js";
|
|
3
3
|
import { E as ok, g as err, r as ioError, t as BrepErrorCode, u as unsupportedError } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { d as getSolids, n as getBounds } from "./topologyQueryFns-
|
|
5
|
-
import { d as getFaceOrigins } from "./solidBuilders-
|
|
4
|
+
import { d as getSolids, n as getBounds } from "./topologyQueryFns-BYqsNs6q.js";
|
|
5
|
+
import { d as getFaceOrigins } from "./solidBuilders-IA8xNuxJ.js";
|
|
6
6
|
// src/topology/meshCache.ts
|
|
7
7
|
/**
|
|
8
8
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CIw6-GFy.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-4YnvqZOW.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
5
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BNDmjz7x.cjs");
|
|
5
|
+
const require_solidBuilders = require("./solidBuilders-BVHK-era.cjs");
|
|
6
6
|
// src/topology/meshCache.ts
|
|
7
7
|
/**
|
|
8
8
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -4850,17 +4850,86 @@ function toBREP(k, shape) {
|
|
|
4850
4850
|
function fromBREP(k, data) {
|
|
4851
4851
|
return wrapResult(k, k.fromBREP(data));
|
|
4852
4852
|
}
|
|
4853
|
+
/**
|
|
4854
|
+
* A new XCAF document holding each part as a free shape of its own, tagged
|
|
4855
|
+
* with its name and color.
|
|
4856
|
+
*
|
|
4857
|
+
* XCAF stores a shape once. A part identical to an earlier one comes back as
|
|
4858
|
+
* that part's label, and a part sharing another part's geometry (`TShape`) at
|
|
4859
|
+
* another placement becomes a reference to it, which leaves the shared label
|
|
4860
|
+
* no longer free, so it is not written. Either way there are fewer free shapes
|
|
4861
|
+
* than parts; the document is then rebuilt once with those parts copied, and a
|
|
4862
|
+
* copy has a `TShape` of its own. Copying the part whose label became shared,
|
|
4863
|
+
* not the placed parts referencing it, keeps those sharing one geometry.
|
|
4864
|
+
*/
|
|
4853
4865
|
function addXcafParts(k, parts) {
|
|
4854
4866
|
const docId = k.xcafNewDocument();
|
|
4855
|
-
|
|
4856
|
-
|
|
4867
|
+
let merged;
|
|
4868
|
+
try {
|
|
4869
|
+
merged = mergedParts(addEachPart(k, docId, parts, /* @__PURE__ */ new Set()), freeShapes(k, docId));
|
|
4870
|
+
} catch (e) {
|
|
4871
|
+
k.xcafClose(docId);
|
|
4872
|
+
throw e;
|
|
4873
|
+
}
|
|
4874
|
+
if (merged.size === 0) return docId;
|
|
4875
|
+
k.xcafClose(docId);
|
|
4876
|
+
const rebuilt = k.xcafNewDocument();
|
|
4877
|
+
try {
|
|
4878
|
+
addEachPart(k, rebuilt, parts, merged);
|
|
4879
|
+
return rebuilt;
|
|
4880
|
+
} catch (e) {
|
|
4881
|
+
k.xcafClose(rebuilt);
|
|
4882
|
+
throw e;
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
/** Add `parts` in order, copying those in `copy`; the label each part went in as. */
|
|
4886
|
+
function addEachPart(k, docId, parts, copy) {
|
|
4887
|
+
return parts.map((entry, i) => {
|
|
4888
|
+
const labelId = addPartShape(k, docId, unwrap(entry.shape), copy.has(i));
|
|
4857
4889
|
if (entry.name) k.xcafSetName(docId, labelId, entry.name);
|
|
4858
4890
|
if (entry.color) {
|
|
4859
4891
|
const [r, g, b] = entry.color;
|
|
4860
4892
|
k.xcafSetColor(docId, labelId, r / 255, g / 255, b / 255);
|
|
4861
4893
|
}
|
|
4894
|
+
return labelId;
|
|
4895
|
+
});
|
|
4896
|
+
}
|
|
4897
|
+
/**
|
|
4898
|
+
* The parts that did not become a free shape of their own: a repeat of an
|
|
4899
|
+
* earlier part's label, or a label no longer free. Each part adds at most one
|
|
4900
|
+
* free shape, so as many free shapes as parts means none merged.
|
|
4901
|
+
*/
|
|
4902
|
+
function mergedParts(labels, free) {
|
|
4903
|
+
const merged = /* @__PURE__ */ new Set();
|
|
4904
|
+
if (free.length === labels.length) return merged;
|
|
4905
|
+
const freeLabels = new Set(free);
|
|
4906
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4907
|
+
labels.forEach((label, i) => {
|
|
4908
|
+
if (seen.has(label) || !freeLabels.has(label)) merged.add(i);
|
|
4909
|
+
seen.add(label);
|
|
4910
|
+
});
|
|
4911
|
+
return merged;
|
|
4912
|
+
}
|
|
4913
|
+
/** Add a shape, or a copy of it; the document keeps the copy's geometry once its slot is released. */
|
|
4914
|
+
function addPartShape(k, docId, shapeId, copy) {
|
|
4915
|
+
if (!copy) return k.xcafAddShape(docId, shapeId);
|
|
4916
|
+
const copyId = k.copy(shapeId);
|
|
4917
|
+
try {
|
|
4918
|
+
return k.xcafAddShape(docId, copyId);
|
|
4919
|
+
} finally {
|
|
4920
|
+
k.release(copyId);
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
/** The document's free shapes' label ids. */
|
|
4924
|
+
function freeShapes(k, docId) {
|
|
4925
|
+
const roots = k.xcafGetRootLabels(docId);
|
|
4926
|
+
try {
|
|
4927
|
+
const ids = [];
|
|
4928
|
+
for (let i = 0; i < roots.size(); i++) ids.push(roots.get(i));
|
|
4929
|
+
return ids;
|
|
4930
|
+
} finally {
|
|
4931
|
+
roots.delete();
|
|
4862
4932
|
}
|
|
4863
|
-
return docId;
|
|
4864
4933
|
}
|
|
4865
4934
|
function writeXcafDoc(k, docId, units) {
|
|
4866
4935
|
const roots = k.xcafGetRootLabels(docId);
|