brepjs 8.8.2 → 8.8.3
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/curves.d.ts.map +1 -1
- package/dist/2d/lib/Curve2D.d.ts.map +1 -1
- package/dist/2d/lib/approximations.d.ts.map +1 -1
- package/dist/2d/lib/makeCurves.d.ts.map +1 -1
- package/dist/2d/lib/ocWrapper.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/Blueprint-BmFJ4caY.cjs +1439 -0
- package/dist/Blueprint-DsoGiJNJ.js +1440 -0
- package/dist/{boolean2D-q5FOdOQW.cjs → boolean2D-BQk8LNmZ.cjs} +212 -127
- package/dist/{boolean2D-Dgnuy63w.js → boolean2D-D5O0F3J8.js} +212 -127
- package/dist/{booleanFns-CFit7JYt.cjs → booleanFns-CVM3dOTP.cjs} +210 -130
- package/dist/{booleanFns--Orezl-b.js → booleanFns-DOyKxL7q.js} +210 -130
- package/dist/brepjs.cjs +457 -304
- package/dist/brepjs.js +551 -398
- package/dist/core/disposal.d.ts +44 -3
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/geometryHelpers.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts +20 -0
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.d.ts.map +1 -1
- package/dist/core.cjs +4 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -8
- package/dist/{cornerFinder-KNTFoGrm.js → cornerFinder-DH6EwYfL.js} +1 -1
- package/dist/{cornerFinder-v4un1Fr9.cjs → cornerFinder-XAV2ywVS.cjs} +1 -1
- package/dist/curveFns-BHRYwxBM.js +281 -0
- package/dist/{curveFns-6ovDM_sR.cjs → curveFns-BsAHC3Qv.cjs} +137 -36
- package/dist/{drawFns-WgXeXHH1.cjs → drawFns-CsmUF97U.cjs} +181 -101
- package/dist/{drawFns-XwroLxdb.js → drawFns-hD05g0ZQ.js} +181 -101
- package/dist/faceFns-DNQss51F.cjs +358 -0
- package/dist/faceFns-q5CR9pOW.js +359 -0
- package/dist/{helpers-CRfqaW0Y.cjs → helpers-aylLv0_I.cjs} +13 -10
- package/dist/{helpers-CtBCzEqs.js → helpers-tNdaX01G.js} +13 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/io/importFns.d.ts.map +1 -1
- package/dist/io.cjs +131 -63
- package/dist/io.js +131 -63
- package/dist/loft-CjEEqz2P.cjs +530 -0
- package/dist/loft-DTRcYrq2.js +531 -0
- package/dist/measurement-B6_cxjpw.cjs +200 -0
- package/dist/measurement-BXqFvcGh.js +201 -0
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CPNNlpbw.cjs → meshFns-CTc1CRkF.cjs} +1 -1
- package/dist/{meshFns-DAmWVyEp.js → meshFns-DDFl7gLN.js} +1 -1
- package/dist/operations/exporterFns.d.ts.map +1 -1
- package/dist/operations/exporterUtils.d.ts +3 -3
- package/dist/operations/exporterUtils.d.ts.map +1 -1
- package/dist/operations/exporters.d.ts.map +1 -1
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/loft.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/{operations-vN0tcoaU.js → operations-jRE2QbPo.js} +261 -166
- package/dist/{operations-BQ25CPI8.cjs → operations-pxjbW4Er.cjs} +261 -166
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query/shapeDistanceFilter.d.ts.map +1 -1
- package/dist/query.cjs +66 -14
- package/dist/query.js +67 -15
- package/dist/{shapeFns-C785aeVn.cjs → shapeFns-D4CRxxmF.cjs} +61 -7
- package/dist/{shapeFns-ClpALED4.js → shapeFns-DNnBK8fG.js} +61 -7
- package/dist/{shapeTypes-DnwCo942.js → shapeTypes-Bi_9RZa2.js} +50 -19
- package/dist/{shapeTypes-CIijJxCz.cjs → shapeTypes-CWuX602K.cjs} +32 -1
- package/dist/sketching/CompoundSketch.d.ts.map +1 -1
- package/dist/sketching/Sketch.d.ts.map +1 -1
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketcher2d.d.ts.map +1 -1
- package/dist/sketching/cannedSketches.d.ts.map +1 -1
- package/dist/sketching/draw.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/surfaceBuilders-CLal3WlK.cjs +429 -0
- package/dist/surfaceBuilders-W9Y25CIb.js +430 -0
- package/dist/topology/curveBuilders.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/solidBuilders.d.ts.map +1 -1
- package/dist/topology/surfaceBuilders.d.ts.map +1 -1
- package/dist/{topology-CqyxpmEh.js → topology-CMM6vAzx.js} +6 -6
- package/dist/{topology-zG8maSDK.cjs → topology-CNw-wsmG.cjs} +6 -6
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/package.json +4 -1
- package/dist/Blueprint-BmbNUnGI.cjs +0 -1185
- package/dist/Blueprint-C-JJkkwL.js +0 -1186
- package/dist/curveFns-BhQECv8e.js +0 -180
- package/dist/faceFns-3PDjBeW7.js +0 -272
- package/dist/faceFns-CxaLWOjc.cjs +0 -271
- package/dist/loft-CVb-IjEI.cjs +0 -372
- package/dist/loft-DMFjK6lk.js +0 -373
- package/dist/measurement-CecYIt3s.cjs +0 -134
- package/dist/measurement-DHDLAH7-.js +0 -135
- package/dist/surfaceBuilders-CC0ZQGix.cjs +0 -289
- package/dist/surfaceBuilders-CrJtFu2a.js +0 -290
package/dist/core/disposal.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { OcShape } from '../kernel/types.js';
|
|
2
|
+
import { BrepError } from './errors.js';
|
|
3
|
+
import { Result } from './result.js';
|
|
2
4
|
/** Any object that can be cleaned up by calling `delete()` (OCCT WASM objects). */
|
|
3
5
|
export interface Deletable {
|
|
4
6
|
delete: () => void;
|
|
@@ -40,10 +42,49 @@ export declare function withScope<T>(fn: (scope: DisposalScope) => T): T;
|
|
|
40
42
|
export declare function registerForCleanup(owner: object, deletable: Deletable): void;
|
|
41
43
|
/** Unregister a previously-registered deletable (call before manual delete). */
|
|
42
44
|
export declare function unregisterFromCleanup(deletable: Deletable): void;
|
|
43
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use `using scope = new DisposalScope()` + `scope.register()` instead.
|
|
47
|
+
* DisposalScope provides deterministic cleanup on all exit paths including throws.
|
|
48
|
+
* @see DisposalScope
|
|
49
|
+
*/
|
|
44
50
|
export declare function gcWithScope(): <T extends Deletable>(value: T) => T;
|
|
45
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use `using scope = new DisposalScope()` + `scope.register()` instead.
|
|
53
|
+
* DisposalScope provides deterministic cleanup on all exit paths including throws.
|
|
54
|
+
* @see DisposalScope
|
|
55
|
+
*/
|
|
46
56
|
export declare function gcWithObject(obj: object): <T extends Deletable>(value: T) => T;
|
|
47
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Use `using scope = new DisposalScope()` + `scope.register()` instead.
|
|
59
|
+
* DisposalScope provides deterministic cleanup on all exit paths including throws.
|
|
60
|
+
* @see DisposalScope
|
|
61
|
+
*/
|
|
48
62
|
export declare function localGC(debug?: boolean): [<T extends Deletable>(v: T) => T, () => void, Set<Deletable> | undefined];
|
|
63
|
+
/**
|
|
64
|
+
* Run fn inside a DisposalScope. The scope is disposed on all exit paths:
|
|
65
|
+
* Ok return, Err return, and throw. Use in any function that allocates
|
|
66
|
+
* OCCT objects and returns Result<T>.
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* return withScopeResult((scope) => {
|
|
70
|
+
* const axis = scope.register(makeOcAx1(origin, dir));
|
|
71
|
+
* return ok(castShape(getKernel().makeSomething(axis)) as Solid);
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function withScopeResult<T, E = BrepError>(fn: (scope: DisposalScope) => Result<T, E>): Result<T, E>;
|
|
76
|
+
/**
|
|
77
|
+
* Async variant of withScopeResult. The scope is disposed after the
|
|
78
|
+
* returned promise settles (resolved or rejected).
|
|
79
|
+
*/
|
|
80
|
+
export declare function withScopeResultAsync<T, E = BrepError>(fn: (scope: DisposalScope) => Promise<Result<T, E>>): Promise<Result<T, E>>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns true if the handle has not been disposed.
|
|
83
|
+
* Provides a named alternative to checking `.disposed` directly.
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* if (!isLive(handle)) return err(validationError('DISPOSED_HANDLE', '...'));
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function isLive(handle: ShapeHandle | OcHandle<Deletable>): boolean;
|
|
49
90
|
//# sourceMappingURL=disposal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disposal.d.ts","sourceRoot":"","sources":["../../src/core/disposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"disposal.d.ts","sourceRoot":"","sources":["../../src/core/disposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAM1C,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAqCD,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1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} from '../kernel/types.js';
|
|
|
2
2
|
import { AnyShape } from './shapeTypes.js';
|
|
3
3
|
import { Result } from './result.js';
|
|
4
4
|
import { BrepErrorKind } from './errors.js';
|
|
5
|
+
import { DisposalScope } from './disposal.js';
|
|
5
6
|
/**
|
|
6
7
|
* Wrap a kernel call that returns an OcShape, automatically casting
|
|
7
8
|
* the result into a branded AnyShape. On exception, returns an Err
|
|
@@ -19,4 +20,23 @@ export declare function kernelCall(fn: () => OcShape, code: string, message: str
|
|
|
19
20
|
* explanations when the error kind is OCCT_OPERATION.
|
|
20
21
|
*/
|
|
21
22
|
export declare function kernelCallRaw<T>(fn: () => T, code: string, message: string, kind?: BrepErrorKind): Result<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Wrap a kernel call that needs intermediate OCCT allocations.
|
|
25
|
+
*
|
|
26
|
+
* A DisposalScope is created and passed to fn. The scope is disposed
|
|
27
|
+
* deterministically after fn returns or throws — ensuring no intermediate
|
|
28
|
+
* handles are leaked even on error paths.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* return kernelCallScoped(
|
|
32
|
+
* (scope) => {
|
|
33
|
+
* const axis = scope.register(makeOcAx1(origin, dir));
|
|
34
|
+
* return getKernel().oc.BRepBuilderAPI_MakeRevol_1(shape.wrapped, axis).Shape();
|
|
35
|
+
* },
|
|
36
|
+
* BrepErrorCode.REVOLUTION_NOT_3D,
|
|
37
|
+
* 'Revolution failed'
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function kernelCallScoped(fn: (scope: DisposalScope) => OcShape, code: string, message: string, kind?: BrepErrorKind): Result<AnyShape>;
|
|
22
42
|
//# sourceMappingURL=kernelCall.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernelCall.d.ts","sourceRoot":"","sources":["../../src/core/kernelCall.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"kernelCall.d.ts","sourceRoot":"","sources":["../../src/core/kernelCall.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAe9C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,MAAM,OAAO,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,aAAgC,GACrC,MAAM,CAAC,QAAQ,CAAC,CASlB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,EAAE,EAAE,MAAM,CAAC,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,aAAgC,GACrC,MAAM,CAAC,CAAC,CAAC,CASX;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,EACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,aAAgC,GACrC,MAAM,CAAC,QAAQ,CAAC,CAGlB"}
|
package/dist/core/memory.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Memory management utilities — re-export hub for disposal.ts.
|
|
3
3
|
*/
|
|
4
4
|
export type { Deletable } from './disposal.js';
|
|
5
|
-
export { createHandle, createOcHandle, DisposalScope, withScope, gcWithScope, gcWithObject, localGC, registerForCleanup, unregisterFromCleanup, type ShapeHandle, type OcHandle, } from './disposal.js';
|
|
5
|
+
export { createHandle, createOcHandle, DisposalScope, withScope, withScopeResult, withScopeResultAsync, isLive, gcWithScope, gcWithObject, localGC, registerForCleanup, unregisterFromCleanup, type ShapeHandle, type OcHandle, } from './disposal.js';
|
|
6
6
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/core/memory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/core/memory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,MAAM,EAEN,WAAW,EAEX,YAAY,EAEZ,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,GACd,MAAM,eAAe,CAAC"}
|
package/dist/core.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const occtBoundary = require("./occtBoundary-Cqfsau2c.cjs");
|
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
5
|
const errors = require("./errors-NNmTtM5u.cjs");
|
|
6
6
|
const vectors = require("./vectors-CGLqemPY.cjs");
|
|
7
|
-
const shapeTypes = require("./shapeTypes-
|
|
7
|
+
const shapeTypes = require("./shapeTypes-CWuX602K.cjs");
|
|
8
8
|
const result = require("./result.cjs");
|
|
9
9
|
exports.resolveDirection = occtBoundary.resolveDirection;
|
|
10
10
|
exports.toVec2 = occtBoundary.toVec2;
|
|
@@ -66,6 +66,7 @@ exports.getShapeKind = shapeTypes.getShapeKind;
|
|
|
66
66
|
exports.isCompound = shapeTypes.isCompound;
|
|
67
67
|
exports.isEdge = shapeTypes.isEdge;
|
|
68
68
|
exports.isFace = shapeTypes.isFace;
|
|
69
|
+
exports.isLive = shapeTypes.isLive;
|
|
69
70
|
exports.isShape1D = shapeTypes.isShape1D;
|
|
70
71
|
exports.isShape3D = shapeTypes.isShape3D;
|
|
71
72
|
exports.isShell = shapeTypes.isShell;
|
|
@@ -73,5 +74,7 @@ exports.isSolid = shapeTypes.isSolid;
|
|
|
73
74
|
exports.isVertex = shapeTypes.isVertex;
|
|
74
75
|
exports.isWire = shapeTypes.isWire;
|
|
75
76
|
exports.withScope = shapeTypes.withScope;
|
|
77
|
+
exports.withScopeResult = shapeTypes.withScopeResult;
|
|
78
|
+
exports.withScopeResultAsync = shapeTypes.withScopeResultAsync;
|
|
76
79
|
exports.BrepBugError = result.BrepBugError;
|
|
77
80
|
exports.bug = result.bug;
|
package/dist/core.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export { createPlane, createNamedPlane, resolvePlane, translatePlane, pivotPlane
|
|
|
13
13
|
export type { ShapeKind, Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Compound, AnyShape, Shape1D, Shape3D, } from './core/shapeTypes.js';
|
|
14
14
|
export { castShape, getShapeKind, isVertex, isEdge, isWire, isFace, isShell, isSolid, isCompound, isShape3D, isShape1D, } from './core/shapeTypes.js';
|
|
15
15
|
export type { ShapeHandle, OcHandle } from './core/disposal.js';
|
|
16
|
-
export { createHandle, createOcHandle, DisposalScope, withScope } from './core/disposal.js';
|
|
16
|
+
export { createHandle, createOcHandle, DisposalScope, withScope, withScopeResult, withScopeResultAsync, isLive, } from './core/disposal.js';
|
|
17
17
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,EAAE,EACF,GAAG,EACH,EAAE,EACF,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,GAAG,EACR,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,SAAS,EACT,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,GAAG,EACH,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OA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AAG,EACR,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,SAAS,EACT,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,GAAG,EACH,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GACR,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,MAAM,GACP,MAAM,oBAAoB,CAAC"}
|
package/dist/core.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r, t, a } from "./occtBoundary-DvBywHyU.js";
|
|
|
2
2
|
import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
|
|
3
3
|
import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-DJ92ermb.js";
|
|
4
4
|
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-2lOjaa8N.js";
|
|
5
|
-
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-
|
|
5
|
+
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, w as w2, o as o3, p as p3 } from "./shapeTypes-Bi_9RZa2.js";
|
|
6
6
|
import { BrepBugError, bug } from "./result.js";
|
|
7
7
|
export {
|
|
8
8
|
BrepBugError,
|
|
@@ -28,13 +28,14 @@ export {
|
|
|
28
28
|
d3 as isEdge,
|
|
29
29
|
d2 as isErr,
|
|
30
30
|
e3 as isFace,
|
|
31
|
+
f3 as isLive,
|
|
31
32
|
g2 as isOk,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
h3 as isShape1D,
|
|
34
|
+
j3 as isShape3D,
|
|
35
|
+
k3 as isShell,
|
|
36
|
+
l3 as isSolid,
|
|
37
|
+
m3 as isVertex,
|
|
38
|
+
n3 as isWire,
|
|
38
39
|
m2 as map,
|
|
39
40
|
h2 as mapErr,
|
|
40
41
|
j2 as match,
|
|
@@ -73,5 +74,7 @@ export {
|
|
|
73
74
|
m as vecRotate,
|
|
74
75
|
n as vecScale,
|
|
75
76
|
o as vecSub,
|
|
76
|
-
w2 as withScope
|
|
77
|
+
w2 as withScope,
|
|
78
|
+
o3 as withScopeResult,
|
|
79
|
+
p3 as withScopeResultAsync
|
|
77
80
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-
|
|
1
|
+
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-tNdaX01G.js";
|
|
2
2
|
import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
3
3
|
const PI_2 = 2 * Math.PI;
|
|
4
4
|
function positiveHalfAngle(angle) {
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __using = (stack, value, async) => {
|
|
6
|
+
if (value != null) {
|
|
7
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
8
|
+
var dispose, inner;
|
|
9
|
+
if (async) dispose = value[__knownSymbol("asyncDispose")];
|
|
10
|
+
if (dispose === void 0) {
|
|
11
|
+
dispose = value[__knownSymbol("dispose")];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
15
|
+
if (inner) dispose = function() {
|
|
16
|
+
try {
|
|
17
|
+
inner.call(this);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return Promise.reject(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
stack.push([async, dispose, value]);
|
|
23
|
+
} else if (async) {
|
|
24
|
+
stack.push([async]);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
var __callDispose = (stack, error, hasError) => {
|
|
29
|
+
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
30
|
+
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
31
|
+
};
|
|
32
|
+
var fail = (e) => error = hasError ? new E(e, error, "An error was suppressed during disposal") : (hasError = true, e);
|
|
33
|
+
var next = (it) => {
|
|
34
|
+
while (it = stack.pop()) {
|
|
35
|
+
try {
|
|
36
|
+
var result = it[1] && it[1].call(it[2]);
|
|
37
|
+
if (it[0]) return Promise.resolve(result).then(next, (e) => (fail(e), next()));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
fail(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (hasError) throw error;
|
|
43
|
+
};
|
|
44
|
+
return next();
|
|
45
|
+
};
|
|
46
|
+
import { g as getKernel } from "./occtBoundary-DvBywHyU.js";
|
|
47
|
+
import { D as DisposalScope, c as castShape, d as isEdge, n as isWire } from "./shapeTypes-Bi_9RZa2.js";
|
|
48
|
+
import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-DJ92ermb.js";
|
|
49
|
+
let CURVE_TYPES_MAP = null;
|
|
50
|
+
const getCurveTypesMap = (refresh) => {
|
|
51
|
+
if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
|
|
52
|
+
const oc = getKernel().oc;
|
|
53
|
+
const ga = oc.GeomAbs_CurveType;
|
|
54
|
+
CURVE_TYPES_MAP = /* @__PURE__ */ new Map([
|
|
55
|
+
[ga.GeomAbs_Line, "LINE"],
|
|
56
|
+
[ga.GeomAbs_Circle, "CIRCLE"],
|
|
57
|
+
[ga.GeomAbs_Ellipse, "ELLIPSE"],
|
|
58
|
+
[ga.GeomAbs_Hyperbola, "HYPERBOLA"],
|
|
59
|
+
[ga.GeomAbs_Parabola, "PARABOLA"],
|
|
60
|
+
[ga.GeomAbs_BezierCurve, "BEZIER_CURVE"],
|
|
61
|
+
[ga.GeomAbs_BSplineCurve, "BSPLINE_CURVE"],
|
|
62
|
+
[ga.GeomAbs_OffsetCurve, "OFFSET_CURVE"],
|
|
63
|
+
[ga.GeomAbs_OtherCurve, "OTHER_CURVE"]
|
|
64
|
+
]);
|
|
65
|
+
return CURVE_TYPES_MAP;
|
|
66
|
+
};
|
|
67
|
+
const findCurveType = (type) => {
|
|
68
|
+
let shapeType = getCurveTypesMap().get(type);
|
|
69
|
+
if (!shapeType) shapeType = getCurveTypesMap(true).get(type);
|
|
70
|
+
if (!shapeType) return err(typeCastError("UNKNOWN_CURVE_TYPE", "Unknown curve type"));
|
|
71
|
+
return ok(shapeType);
|
|
72
|
+
};
|
|
73
|
+
function getAdaptor(shape) {
|
|
74
|
+
const oc = getKernel().oc;
|
|
75
|
+
const st = shape.wrapped.ShapeType();
|
|
76
|
+
const e = oc.TopAbs_ShapeEnum;
|
|
77
|
+
if (st === e.TopAbs_WIRE) {
|
|
78
|
+
return new oc.BRepAdaptor_CompCurve_2(shape.wrapped, false);
|
|
79
|
+
}
|
|
80
|
+
return new oc.BRepAdaptor_Curve_2(shape.wrapped);
|
|
81
|
+
}
|
|
82
|
+
function mapParam(adaptor, t) {
|
|
83
|
+
const first = Number(adaptor.FirstParameter());
|
|
84
|
+
const last = Number(adaptor.LastParameter());
|
|
85
|
+
return first + (last - first) * t;
|
|
86
|
+
}
|
|
87
|
+
function getCurveType(shape) {
|
|
88
|
+
var _stack = [];
|
|
89
|
+
try {
|
|
90
|
+
const scope = __using(_stack, new DisposalScope());
|
|
91
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
92
|
+
const technicalType = adaptor.GetType && adaptor.GetType();
|
|
93
|
+
return unwrap(findCurveType(technicalType));
|
|
94
|
+
} catch (_) {
|
|
95
|
+
var _error = _, _hasError = true;
|
|
96
|
+
} finally {
|
|
97
|
+
__callDispose(_stack, _error, _hasError);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function curveStartPoint(shape) {
|
|
101
|
+
var _stack = [];
|
|
102
|
+
try {
|
|
103
|
+
const scope = __using(_stack, new DisposalScope());
|
|
104
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
105
|
+
const pnt = scope.register(adaptor.Value(adaptor.FirstParameter()));
|
|
106
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
107
|
+
} catch (_) {
|
|
108
|
+
var _error = _, _hasError = true;
|
|
109
|
+
} finally {
|
|
110
|
+
__callDispose(_stack, _error, _hasError);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function curveEndPoint(shape) {
|
|
114
|
+
var _stack = [];
|
|
115
|
+
try {
|
|
116
|
+
const scope = __using(_stack, new DisposalScope());
|
|
117
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
118
|
+
const pnt = scope.register(adaptor.Value(adaptor.LastParameter()));
|
|
119
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
120
|
+
} catch (_) {
|
|
121
|
+
var _error = _, _hasError = true;
|
|
122
|
+
} finally {
|
|
123
|
+
__callDispose(_stack, _error, _hasError);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function curvePointAt(shape, position = 0.5) {
|
|
127
|
+
var _stack = [];
|
|
128
|
+
try {
|
|
129
|
+
const scope = __using(_stack, new DisposalScope());
|
|
130
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
131
|
+
const pnt = scope.register(adaptor.Value(mapParam(adaptor, position)));
|
|
132
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
133
|
+
} catch (_) {
|
|
134
|
+
var _error = _, _hasError = true;
|
|
135
|
+
} finally {
|
|
136
|
+
__callDispose(_stack, _error, _hasError);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function curveTangentAt(shape, position = 0.5) {
|
|
140
|
+
var _stack = [];
|
|
141
|
+
try {
|
|
142
|
+
const oc = getKernel().oc;
|
|
143
|
+
const scope = __using(_stack, new DisposalScope());
|
|
144
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
145
|
+
const param = mapParam(adaptor, position);
|
|
146
|
+
const tmpPnt = scope.register(new oc.gp_Pnt_1());
|
|
147
|
+
const tmpVec = scope.register(new oc.gp_Vec_1());
|
|
148
|
+
adaptor.D1(param, tmpPnt, tmpVec);
|
|
149
|
+
return [tmpVec.X(), tmpVec.Y(), tmpVec.Z()];
|
|
150
|
+
} catch (_) {
|
|
151
|
+
var _error = _, _hasError = true;
|
|
152
|
+
} finally {
|
|
153
|
+
__callDispose(_stack, _error, _hasError);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function curveLength(shape) {
|
|
157
|
+
var _stack = [];
|
|
158
|
+
try {
|
|
159
|
+
const oc = getKernel().oc;
|
|
160
|
+
const scope = __using(_stack, new DisposalScope());
|
|
161
|
+
const props = scope.register(new oc.GProp_GProps_1());
|
|
162
|
+
oc.BRepGProp.LinearProperties(shape.wrapped, props, true, false);
|
|
163
|
+
return props.Mass();
|
|
164
|
+
} catch (_) {
|
|
165
|
+
var _error = _, _hasError = true;
|
|
166
|
+
} finally {
|
|
167
|
+
__callDispose(_stack, _error, _hasError);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function curveIsClosed(shape) {
|
|
171
|
+
var _stack = [];
|
|
172
|
+
try {
|
|
173
|
+
const scope = __using(_stack, new DisposalScope());
|
|
174
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
175
|
+
return adaptor.IsClosed();
|
|
176
|
+
} catch (_) {
|
|
177
|
+
var _error = _, _hasError = true;
|
|
178
|
+
} finally {
|
|
179
|
+
__callDispose(_stack, _error, _hasError);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function curveIsPeriodic(shape) {
|
|
183
|
+
var _stack = [];
|
|
184
|
+
try {
|
|
185
|
+
const scope = __using(_stack, new DisposalScope());
|
|
186
|
+
const adaptor = scope.register(getAdaptor(shape));
|
|
187
|
+
return adaptor.IsPeriodic();
|
|
188
|
+
} catch (_) {
|
|
189
|
+
var _error = _, _hasError = true;
|
|
190
|
+
} finally {
|
|
191
|
+
__callDispose(_stack, _error, _hasError);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function curvePeriod(shape) {
|
|
195
|
+
const adaptor = getAdaptor(shape);
|
|
196
|
+
const result = adaptor.Period();
|
|
197
|
+
adaptor.delete();
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
function getOrientation(shape) {
|
|
201
|
+
const oc = getKernel().oc;
|
|
202
|
+
const orient = shape.wrapped.Orientation_1();
|
|
203
|
+
return orient === oc.TopAbs_Orientation.TopAbs_FORWARD ? "forward" : "backward";
|
|
204
|
+
}
|
|
205
|
+
function flipOrientation(shape) {
|
|
206
|
+
return castShape(shape.wrapped.Reversed());
|
|
207
|
+
}
|
|
208
|
+
function interpolateCurve(points, options = {}) {
|
|
209
|
+
if (points.length < 2) {
|
|
210
|
+
return err(typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
const result = getKernel().interpolatePoints(points, options);
|
|
214
|
+
const cast = castShape(result);
|
|
215
|
+
if (!isEdge(cast)) {
|
|
216
|
+
return err(typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
|
|
217
|
+
}
|
|
218
|
+
return ok(cast);
|
|
219
|
+
} catch (e) {
|
|
220
|
+
return err(
|
|
221
|
+
typeCastError(
|
|
222
|
+
"INTERPOLATE_FAILED",
|
|
223
|
+
`Interpolation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
224
|
+
)
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function approximateCurve(points, options = {}) {
|
|
229
|
+
if (points.length < 2) {
|
|
230
|
+
return err(typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const result = getKernel().approximatePoints(points, options);
|
|
234
|
+
const cast = castShape(result);
|
|
235
|
+
if (!isEdge(cast)) {
|
|
236
|
+
return err(typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
|
|
237
|
+
}
|
|
238
|
+
return ok(cast);
|
|
239
|
+
} catch (e) {
|
|
240
|
+
return err(
|
|
241
|
+
typeCastError(
|
|
242
|
+
"APPROXIMATE_FAILED",
|
|
243
|
+
`Approximation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
244
|
+
)
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function offsetWire2D(wire, offset, kind = "arc") {
|
|
249
|
+
const oc = getKernel().oc;
|
|
250
|
+
const joinTypes = {
|
|
251
|
+
arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
252
|
+
intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
|
|
253
|
+
tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent,
|
|
254
|
+
chamfer: oc.GeomAbs_JoinType.GeomAbs_Intersection
|
|
255
|
+
// sharp/miter corners
|
|
256
|
+
};
|
|
257
|
+
const resultShape = getKernel().offsetWire2D(wire.wrapped, offset, joinTypes[kind]);
|
|
258
|
+
const wrapped = castShape(resultShape);
|
|
259
|
+
if (!isWire(wrapped)) {
|
|
260
|
+
wrapped[Symbol.dispose]();
|
|
261
|
+
return err(typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
|
|
262
|
+
}
|
|
263
|
+
return ok(wrapped);
|
|
264
|
+
}
|
|
265
|
+
export {
|
|
266
|
+
curveEndPoint as a,
|
|
267
|
+
getCurveType as b,
|
|
268
|
+
curveTangentAt as c,
|
|
269
|
+
curveStartPoint as d,
|
|
270
|
+
curveIsClosed as e,
|
|
271
|
+
findCurveType as f,
|
|
272
|
+
getOrientation as g,
|
|
273
|
+
curvePointAt as h,
|
|
274
|
+
curveLength as i,
|
|
275
|
+
approximateCurve as j,
|
|
276
|
+
curveIsPeriodic as k,
|
|
277
|
+
curvePeriod as l,
|
|
278
|
+
flipOrientation as m,
|
|
279
|
+
interpolateCurve as n,
|
|
280
|
+
offsetWire2D as o
|
|
281
|
+
};
|