brepjs 12.8.2 → 12.10.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/2d/blueprints/{approximations.d.ts → blueprintApproximations.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintApproximations.d.ts.map +1 -0
- package/dist/2d/blueprints/{customCorners.d.ts → blueprintCustomCorners.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +1 -0
- package/dist/2d/blueprints/blueprintFns.d.ts +17 -3
- package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
- package/dist/2d/blueprints/{offset.d.ts → blueprintOffset.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintOffset.d.ts.map +1 -0
- package/dist/2d/blueprints/index.d.ts +4 -4
- package/dist/2d/blueprints/index.d.ts.map +1 -1
- package/dist/2d/lib/Curve2D.d.ts +1 -1
- package/dist/2d/lib/Curve2D.d.ts.map +1 -1
- package/dist/2d/lib/svgPath.d.ts.map +1 -1
- package/dist/2d/lib/vectorOperations.d.ts +4 -1
- package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
- package/dist/2d-CzEysb7A.js +108 -0
- package/dist/2d-DCxS_sb_.cjs +107 -0
- package/dist/2d.cjs +24 -88
- package/dist/2d.d.ts +1 -1
- package/dist/2d.js +34 -99
- package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-BoC0DsDm.cjs} +15 -45
- package/dist/{Blueprint-DbVaf6k7.js → Blueprint-CQNRtmYG.js} +33 -63
- package/dist/{boolean2D-y3E92F0u.js → boolean2D-DXAt4GAK.js} +132 -62
- package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-N9Pgumgg.cjs} +112 -42
- package/dist/{booleanFns-BCTjYZAg.js → booleanFns-BXV7Oh0h.js} +53 -50
- package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-CxArUj_q.cjs} +43 -40
- package/dist/brepjs.cjs +448 -379
- package/dist/brepjs.js +1634 -1563
- package/dist/core/dimensionTypes.d.ts +52 -0
- package/dist/core/dimensionTypes.d.ts.map +1 -0
- package/dist/core/disposal.d.ts +18 -0
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/errors.d.ts +7 -8
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +15 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
- package/dist/core/planeOps.d.ts +14 -0
- package/dist/core/planeOps.d.ts.map +1 -1
- package/dist/core/result.d.ts +4 -0
- package/dist/core/result.d.ts.map +1 -1
- package/dist/core/shapeTypes.d.ts +14 -146
- package/dist/core/shapeTypes.d.ts.map +1 -1
- package/dist/core/{definitionMaps.d.ts → typeDiscriminants.d.ts} +5 -1
- package/dist/core/typeDiscriminants.d.ts.map +1 -0
- package/dist/core/validityTypes.d.ts +100 -0
- package/dist/core/validityTypes.d.ts.map +1 -0
- package/dist/core.cjs +52 -11
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +119 -76
- package/dist/{curveFns-BZngcnQ1.cjs → curveFns-CWZRuXQ3.cjs} +2 -2
- package/dist/{curveFns-mROFhiuG.js → curveFns-OmbtFSG8.js} +14 -14
- package/dist/{drawFns-Bwakrq7w.js → drawFns-8S0ULGRj.js} +146 -118
- package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-voV2wEp8.cjs} +153 -125
- package/dist/{faceFns-B8GnxjdY.js → faceFns-Bn2seBfp.js} +16 -24
- package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-CmIrjdt1.cjs} +2 -10
- package/dist/{helpers-X0juxnwj.js → helpers-CEn618MW.js} +89 -21
- package/dist/{helpers-C8NoT0Wu.cjs → helpers-mipaxDTy.cjs} +77 -9
- package/dist/index.d.ts +20 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/io/gltfImportFns.d.ts +18 -0
- package/dist/io/gltfImportFns.d.ts.map +1 -0
- package/dist/io/ioUtils.d.ts +16 -0
- package/dist/io/ioUtils.d.ts.map +1 -0
- package/dist/io/objImportFns.d.ts.map +1 -1
- package/dist/io/threemfImportFns.d.ts.map +1 -1
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
- package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
- package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
- package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/helpers.d.ts +84 -0
- package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
- package/dist/kernel/brepkit/internalOps.d.ts +28 -0
- package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/ioOps.d.ts +43 -0
- package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/measureOps.d.ts +30 -0
- package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/meshOps.d.ts +7 -0
- package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
- package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/repairOps.d.ts +14 -0
- package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
- package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
- package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/transformOps.d.ts +14 -0
- package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
- package/dist/kernel/brepkitAdapter.d.ts +1 -1
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/extendedConstructorOps.d.ts +9 -1
- package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -0
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
- package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/builder-ops.d.ts +57 -0
- package/dist/kernel/interfaces/builder-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/core.d.ts +30 -0
- package/dist/kernel/interfaces/core.d.ts.map +1 -0
- package/dist/kernel/interfaces/curve-ops.d.ts +41 -0
- package/dist/kernel/interfaces/curve-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/index.d.ts +37 -0
- package/dist/kernel/interfaces/index.d.ts.map +1 -0
- package/dist/kernel/interfaces/io-ops.d.ts +66 -0
- package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
- package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/primitive-ops.d.ts +13 -0
- package/dist/kernel/interfaces/primitive-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
- package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/surface-ops.d.ts +50 -0
- package/dist/kernel/interfaces/surface-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
- package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/transform-ops.d.ts +35 -0
- package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
- package/dist/kernel/modifierOps.d.ts +2 -2
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +2 -446
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/measurement/measureCache.d.ts +11 -9
- package/dist/measurement/measureCache.d.ts.map +1 -1
- package/dist/measurement/measureFns.d.ts +24 -71
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/measurement/measureTypes.d.ts +30 -0
- package/dist/measurement/measureTypes.d.ts.map +1 -0
- package/dist/{measurement-D8EJ694A.js → measurement-fJWDEpz0.js} +53 -34
- package/dist/measurement-ph-kanQ7.cjs +154 -0
- package/dist/measurement.cjs +2 -1
- package/dist/measurement.d.ts +1 -1
- package/dist/measurement.d.ts.map +1 -1
- package/dist/measurement.js +4 -3
- package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-B9p4EVV8.cjs} +4 -4
- package/dist/{meshFns-nQjK38EC.js → meshFns-D0qIoxm-.js} +3 -3
- package/dist/operations/compoundOpsFns.d.ts +38 -0
- package/dist/operations/compoundOpsFns.d.ts.map +1 -0
- package/dist/operations/convexHullFns.d.ts +21 -0
- package/dist/operations/convexHullFns.d.ts.map +1 -0
- package/dist/operations/extrudeFns.d.ts +2 -93
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/guidedSweepFns.d.ts +3 -22
- package/dist/operations/guidedSweepFns.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts +3 -29
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/operations/roofFns.d.ts +2 -2
- package/dist/operations/roofFns.d.ts.map +1 -1
- package/dist/operations/straightSkeleton.d.ts.map +1 -1
- package/dist/operations/sweepFns.d.ts +121 -0
- package/dist/operations/sweepFns.d.ts.map +1 -0
- package/dist/{operations-BfbkK6DU.js → operations-DX_qy_TB.js} +29 -177
- package/dist/{operations-CYpmLSC4.cjs → operations-Ds4xoyxR.cjs} +6 -154
- package/dist/operations.cjs +6 -10
- package/dist/operations.d.ts +0 -2
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +26 -30
- package/dist/originTrackingFns-BOCAMfd0.js +137 -0
- package/dist/originTrackingFns-SPU7ly3_.cjs +136 -0
- package/dist/query/edgeFinder.d.ts +4 -14
- package/dist/query/edgeFinder.d.ts.map +1 -1
- package/dist/query/faceFinder.d.ts +4 -14
- package/dist/query/faceFinder.d.ts.map +1 -1
- package/dist/query/finderCore.d.ts +6 -0
- package/dist/query/finderCore.d.ts.map +1 -1
- package/dist/query/shapeFinders.d.ts +32 -0
- package/dist/query/shapeFinders.d.ts.map +1 -0
- package/dist/query/wireFinder.d.ts +4 -9
- package/dist/query/wireFinder.d.ts.map +1 -1
- package/dist/query.cjs +54 -32
- package/dist/query.js +56 -34
- package/dist/{result-BaSD1fqR.js → result-CoDaWsvc.js} +48 -90
- package/dist/{result-fAX0OZzI.cjs → result-DULetAht.cjs} +17 -59
- package/dist/result.cjs +1 -1
- package/dist/result.js +23 -23
- package/dist/shapeFns-BZ6zk7nd.js +34 -0
- package/dist/shapeFns-bRkrwI8R.cjs +33 -0
- package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-T0n6mRmt.cjs} +170 -137
- package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-dhhm-T5A.js} +205 -172
- package/dist/sketching/CompoundSketch.d.ts +4 -4
- package/dist/sketching/CompoundSketch.d.ts.map +1 -1
- package/dist/sketching/Sketch.d.ts +3 -3
- package/dist/sketching/Sketch.d.ts.map +1 -1
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketches.d.ts +1 -1
- package/dist/sketching/Sketches.d.ts.map +1 -1
- package/dist/sketching/draw.d.ts +1 -20
- package/dist/sketching/draw.d.ts.map +1 -1
- package/dist/sketching/draw3d.d.ts +22 -0
- package/dist/sketching/draw3d.d.ts.map +1 -0
- package/dist/sketching/sketchFns.d.ts +3 -3
- package/dist/sketching/sketchFns.d.ts.map +1 -1
- package/dist/sketching/sketchLib.d.ts +2 -2
- package/dist/sketching/sketchLib.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.d.ts +2 -1
- package/dist/sketching.d.ts.map +1 -1
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BEAoLYvr.cjs} +3 -3
- package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-tVmD3R7Z.js} +12 -12
- package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-DYS8AMSS.cjs} +3 -3
- package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dl0ATFbO.js} +15 -15
- package/dist/sweepFns-BKnQs59A.js +215 -0
- package/dist/sweepFns-COqeYIUp.cjs +214 -0
- package/dist/text/textBlueprints.d.ts +4 -3
- package/dist/text/textBlueprints.d.ts.map +1 -1
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/cast.d.ts +1 -5
- package/dist/topology/cast.d.ts.map +1 -1
- package/dist/topology/compoundOpsFns.d.ts +3 -35
- package/dist/topology/compoundOpsFns.d.ts.map +1 -1
- package/dist/topology/curveFns.d.ts +1 -1
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +2 -3
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/{colorFns.d.ts → metadata/colorFns.d.ts} +2 -2
- package/dist/topology/metadata/colorFns.d.ts.map +1 -0
- package/dist/topology/{faceTagFns.d.ts → metadata/faceTagFns.d.ts} +2 -2
- package/dist/topology/metadata/faceTagFns.d.ts.map +1 -0
- package/dist/topology/metadata/metadataPropagation.d.ts +30 -0
- package/dist/topology/metadata/metadataPropagation.d.ts.map +1 -0
- package/dist/topology/metadata/originTrackingFns.d.ts +23 -0
- package/dist/topology/metadata/originTrackingFns.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts +6 -120
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/topologyQueryFns.d.ts +67 -0
- package/dist/topology/topologyQueryFns.d.ts.map +1 -0
- package/dist/topology/transformFns.d.ts +49 -0
- package/dist/topology/transformFns.d.ts.map +1 -0
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-C7x98OVn.js → topology-C1oUQXZS.js} +235 -50
- package/dist/{topology-ANwCzGL8.cjs → topology-xyDYbkHW.cjs} +205 -20
- package/dist/topology.cjs +18 -17
- package/dist/topology.js +97 -96
- package/dist/topologyQueryFns-0IptTUCo.cjs +118 -0
- package/dist/topologyQueryFns-Dj4Xd5kx.js +119 -0
- package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
- package/dist/utils/precisionRound.d.ts +4 -0
- package/dist/utils/precisionRound.d.ts.map +1 -1
- package/dist/utils/vec2d.d.ts +5 -0
- package/dist/utils/vec2d.d.ts.map +1 -1
- package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
- package/dist/{vectors-Bx8wkNui.js → vectors-B8juLsQB.js} +15 -7
- package/dist/{vectors-D_IiZx0q.cjs → vectors-I_0zdD3O.cjs} +9 -1
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +23 -23
- package/package.json +9 -9
- package/dist/2d/blueprints/approximations.d.ts.map +0 -1
- package/dist/2d/blueprints/customCorners.d.ts.map +0 -1
- package/dist/2d/blueprints/offset.d.ts.map +0 -1
- package/dist/core/definitionMaps.d.ts.map +0 -1
- package/dist/core/geometryHelpers.d.ts +0 -30
- package/dist/core/geometryHelpers.d.ts.map +0 -1
- package/dist/core/memory.d.ts +0 -6
- package/dist/core/memory.d.ts.map +0 -1
- package/dist/core/typeErrors.d.ts +0 -17
- package/dist/core/typeErrors.d.ts.map +0 -1
- package/dist/cornerFinder-Ckz-mPHE.js +0 -59
- package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
- package/dist/loft-Bhw-FMoL.js +0 -228
- package/dist/loft-hp3pc1M7.cjs +0 -227
- package/dist/measurement-BoNTUBAp.cjs +0 -135
- package/dist/operations/extrude.d.ts +0 -72
- package/dist/operations/extrude.d.ts.map +0 -1
- package/dist/operations/loft.d.ts +0 -33
- package/dist/operations/loft.d.ts.map +0 -1
- package/dist/shapeFns-C2SnNvdH.cjs +0 -468
- package/dist/shapeFns-FDuKkrDR.js +0 -469
- package/dist/topology/colorFns.d.ts.map +0 -1
- package/dist/topology/faceTagFns.d.ts.map +0 -1
- package/dist/utils/round2.d.ts +0 -3
- package/dist/utils/round2.d.ts.map +0 -1
- package/dist/utils/round5.d.ts +0 -3
- package/dist/utils/round5.d.ts.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Vec3 } from '../core/types.js';
|
|
2
|
+
import { Edge, Face, Wire } from '../core/shapeTypes.js';
|
|
3
|
+
import { SurfaceType } from '../topology/faceFns.js';
|
|
4
|
+
import { CurveType } from '../core/typeDiscriminants.js';
|
|
5
|
+
import { ShapeFinder } from './finderCore.js';
|
|
6
|
+
import { DirectionInput } from './directionUtils.js';
|
|
7
|
+
export interface EdgeFinderFn extends ShapeFinder<Edge> {
|
|
8
|
+
readonly inDirection: (dir?: DirectionInput, angle?: number) => EdgeFinderFn;
|
|
9
|
+
readonly ofLength: (length: number, tolerance?: number) => EdgeFinderFn;
|
|
10
|
+
readonly ofCurveType: (curveType: CurveType) => EdgeFinderFn;
|
|
11
|
+
readonly parallelTo: (dir?: DirectionInput) => EdgeFinderFn;
|
|
12
|
+
readonly atDistance: (distance: number, point?: Vec3) => EdgeFinderFn;
|
|
13
|
+
}
|
|
14
|
+
/** Create an immutable edge finder. */
|
|
15
|
+
export declare function edgeFinder(): EdgeFinderFn;
|
|
16
|
+
export interface FaceFinderFn extends ShapeFinder<Face> {
|
|
17
|
+
readonly inDirection: (dir?: DirectionInput, angle?: number) => FaceFinderFn;
|
|
18
|
+
readonly parallelTo: (dir?: DirectionInput) => FaceFinderFn;
|
|
19
|
+
readonly ofSurfaceType: (surfaceType: SurfaceType) => FaceFinderFn;
|
|
20
|
+
readonly ofArea: (area: number, tolerance?: number) => FaceFinderFn;
|
|
21
|
+
readonly atDistance: (distance: number, point?: Vec3) => FaceFinderFn;
|
|
22
|
+
}
|
|
23
|
+
/** Create an immutable face finder. */
|
|
24
|
+
export declare function faceFinder(): FaceFinderFn;
|
|
25
|
+
export interface WireFinderFn extends ShapeFinder<Wire> {
|
|
26
|
+
readonly isClosed: () => WireFinderFn;
|
|
27
|
+
readonly isOpen: () => WireFinderFn;
|
|
28
|
+
readonly ofEdgeCount: (count: number) => WireFinderFn;
|
|
29
|
+
}
|
|
30
|
+
/** Create an immutable wire finder. */
|
|
31
|
+
export declare function wireFinder(): WireFinderFn;
|
|
32
|
+
//# sourceMappingURL=shapeFinders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapeFinders.d.ts","sourceRoot":"","sources":["../../src/query/shapeFinders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK9D,OAAO,EAA4C,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,KAAK,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAOtE,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7E,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IACxE,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,YAAY,CAAC;IAC7D,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,KAAK,YAAY,CAAC;IAC5D,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC;CACvE;AAqCD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC;AAMD,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7E,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,KAAK,YAAY,CAAC;IAC5D,QAAQ,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,YAAY,CAAC;IACnE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IACpE,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC;CACvE;AAqCD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC;AAMD,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CACvD;AAwBD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
readonly isOpen: () => WireFinderFn;
|
|
6
|
-
readonly ofEdgeCount: (count: number) => WireFinderFn;
|
|
7
|
-
}
|
|
8
|
-
/** Create an immutable wire finder. */
|
|
9
|
-
export declare function wireFinder(): WireFinderFn;
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports from `./shapeFinders.js` for backward compatibility.
|
|
3
|
+
*/
|
|
4
|
+
export { wireFinder, type WireFinderFn } from './shapeFinders.js';
|
|
10
5
|
//# sourceMappingURL=wireFinder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireFinder.d.ts","sourceRoot":"","sources":["../../src/query/wireFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"wireFinder.d.ts","sourceRoot":"","sources":["../../src/query/wireFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/query.cjs
CHANGED
|
@@ -1,40 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const helpers = require("./helpers-
|
|
4
|
-
const cornerFinder = require("./cornerFinder-ZmOyOOsh.cjs");
|
|
5
|
-
const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
|
|
3
|
+
const helpers = require("./helpers-mipaxDTy.cjs");
|
|
6
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
const PI_2 = 2 * Math.PI;
|
|
6
|
+
function positiveHalfAngle(angle) {
|
|
7
|
+
const limitedAngle = angle % PI_2;
|
|
8
|
+
const coterminalAngle = limitedAngle < 0 ? limitedAngle + PI_2 : limitedAngle;
|
|
9
|
+
if (coterminalAngle < Math.PI) return coterminalAngle;
|
|
10
|
+
if (coterminalAngle === Math.PI) return 0;
|
|
11
|
+
return Math.abs(coterminalAngle - PI_2);
|
|
12
|
+
}
|
|
13
|
+
function blueprintCorners(blueprint) {
|
|
14
|
+
return blueprint.curves.map((curve, index) => ({
|
|
15
|
+
firstCurve: curve,
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- modulo wraps within bounds
|
|
17
|
+
secondCurve: blueprint.curves[(index + 1) % blueprint.curves.length],
|
|
18
|
+
point: curve.lastPoint
|
|
19
|
+
}));
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
function buildCornerFinder(filters) {
|
|
22
|
+
const withFilter = (pred) => buildCornerFinder([...filters, pred]);
|
|
23
|
+
const shouldKeep = (corner) => filters.every((f) => f(corner));
|
|
24
|
+
return {
|
|
25
|
+
shouldKeep,
|
|
26
|
+
when: (pred) => withFilter(pred),
|
|
27
|
+
inList: (points) => withFilter((corner) => points.some((p) => helpers.samePoint(p, corner.point))),
|
|
28
|
+
atDistance: (distance, point = [0, 0]) => withFilter((corner) => Math.abs(helpers.distance2d(point, corner.point) - distance) < 1e-9),
|
|
29
|
+
atPoint: (point) => withFilter((corner) => helpers.samePoint(point, corner.point)),
|
|
30
|
+
inBox: (corner1, corner2) => {
|
|
31
|
+
const minX = Math.min(corner1[0], corner2[0]);
|
|
32
|
+
const maxX = Math.max(corner1[0], corner2[0]);
|
|
33
|
+
const minY = Math.min(corner1[1], corner2[1]);
|
|
34
|
+
const maxY = Math.max(corner1[1], corner2[1]);
|
|
35
|
+
return withFilter((corner) => {
|
|
36
|
+
const [x, y] = corner.point;
|
|
37
|
+
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
ofAngle: (angle) => withFilter((corner) => {
|
|
41
|
+
const tgt1 = corner.firstCurve.tangentAt(1);
|
|
42
|
+
const tgt2 = corner.secondCurve.tangentAt(0);
|
|
43
|
+
return Math.abs(positiveHalfAngle(helpers.angle2d(tgt1, tgt2)) - positiveHalfAngle(vecOps.DEG2RAD * angle)) < 1e-9;
|
|
44
|
+
}),
|
|
45
|
+
not: (fn) => {
|
|
46
|
+
const inner = fn(buildCornerFinder([]));
|
|
47
|
+
return withFilter((corner) => !inner.shouldKeep(corner));
|
|
48
|
+
},
|
|
49
|
+
either: (fns) => {
|
|
50
|
+
const builtFinders = fns.map((fn) => fn(buildCornerFinder([])));
|
|
51
|
+
return withFilter((corner) => builtFinders.some((f) => f.shouldKeep(corner)));
|
|
52
|
+
},
|
|
53
|
+
find: (blueprint) => blueprintCorners(blueprint).filter(shouldKeep)
|
|
54
|
+
};
|
|
33
55
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
56
|
+
function cornerFinder() {
|
|
57
|
+
return buildCornerFinder([]);
|
|
36
58
|
}
|
|
59
|
+
exports.edgeFinder = helpers.edgeFinder;
|
|
37
60
|
exports.faceFinder = helpers.faceFinder;
|
|
38
61
|
exports.getSingleFace = helpers.getSingleFace;
|
|
39
|
-
exports.cornerFinder = cornerFinder
|
|
40
|
-
exports.edgeFinder = edgeFinder;
|
|
62
|
+
exports.cornerFinder = cornerFinder;
|
package/dist/query.js
CHANGED
|
@@ -1,41 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m, g } from "./helpers-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { o as angle2d, s as samePoint, d as distance2d } from "./helpers-CEn618MW.js";
|
|
2
|
+
import { l, m, g } from "./helpers-CEn618MW.js";
|
|
3
|
+
import { D as DEG2RAD } from "./vecOps-LTN--A58.js";
|
|
4
|
+
const PI_2 = 2 * Math.PI;
|
|
5
|
+
function positiveHalfAngle(angle) {
|
|
6
|
+
const limitedAngle = angle % PI_2;
|
|
7
|
+
const coterminalAngle = limitedAngle < 0 ? limitedAngle + PI_2 : limitedAngle;
|
|
8
|
+
if (coterminalAngle < Math.PI) return coterminalAngle;
|
|
9
|
+
if (coterminalAngle === Math.PI) return 0;
|
|
10
|
+
return Math.abs(coterminalAngle - PI_2);
|
|
11
|
+
}
|
|
12
|
+
function blueprintCorners(blueprint) {
|
|
13
|
+
return blueprint.curves.map((curve, index) => ({
|
|
14
|
+
firstCurve: curve,
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- modulo wraps within bounds
|
|
16
|
+
secondCurve: blueprint.curves[(index + 1) % blueprint.curves.length],
|
|
17
|
+
point: curve.lastPoint
|
|
18
|
+
}));
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
function buildCornerFinder(filters) {
|
|
21
|
+
const withFilter = (pred) => buildCornerFinder([...filters, pred]);
|
|
22
|
+
const shouldKeep = (corner) => filters.every((f) => f(corner));
|
|
23
|
+
return {
|
|
24
|
+
shouldKeep,
|
|
25
|
+
when: (pred) => withFilter(pred),
|
|
26
|
+
inList: (points) => withFilter((corner) => points.some((p) => samePoint(p, corner.point))),
|
|
27
|
+
atDistance: (distance, point = [0, 0]) => withFilter((corner) => Math.abs(distance2d(point, corner.point) - distance) < 1e-9),
|
|
28
|
+
atPoint: (point) => withFilter((corner) => samePoint(point, corner.point)),
|
|
29
|
+
inBox: (corner1, corner2) => {
|
|
30
|
+
const minX = Math.min(corner1[0], corner2[0]);
|
|
31
|
+
const maxX = Math.max(corner1[0], corner2[0]);
|
|
32
|
+
const minY = Math.min(corner1[1], corner2[1]);
|
|
33
|
+
const maxY = Math.max(corner1[1], corner2[1]);
|
|
34
|
+
return withFilter((corner) => {
|
|
35
|
+
const [x, y] = corner.point;
|
|
36
|
+
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
ofAngle: (angle) => withFilter((corner) => {
|
|
40
|
+
const tgt1 = corner.firstCurve.tangentAt(1);
|
|
41
|
+
const tgt2 = corner.secondCurve.tangentAt(0);
|
|
42
|
+
return Math.abs(positiveHalfAngle(angle2d(tgt1, tgt2)) - positiveHalfAngle(DEG2RAD * angle)) < 1e-9;
|
|
43
|
+
}),
|
|
44
|
+
not: (fn) => {
|
|
45
|
+
const inner = fn(buildCornerFinder([]));
|
|
46
|
+
return withFilter((corner) => !inner.shouldKeep(corner));
|
|
47
|
+
},
|
|
48
|
+
either: (fns) => {
|
|
49
|
+
const builtFinders = fns.map((fn) => fn(buildCornerFinder([])));
|
|
50
|
+
return withFilter((corner) => builtFinders.some((f) => f.shouldKeep(corner)));
|
|
51
|
+
},
|
|
52
|
+
find: (blueprint) => blueprintCorners(blueprint).filter(shouldKeep)
|
|
53
|
+
};
|
|
32
54
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
55
|
+
function cornerFinder() {
|
|
56
|
+
return buildCornerFinder([]);
|
|
35
57
|
}
|
|
36
58
|
export {
|
|
37
|
-
|
|
38
|
-
edgeFinder,
|
|
59
|
+
cornerFinder,
|
|
60
|
+
l as edgeFinder,
|
|
39
61
|
m as faceFinder,
|
|
40
62
|
g as getSingleFace
|
|
41
63
|
};
|
|
@@ -46,6 +46,12 @@ function tapErr(result, fn) {
|
|
|
46
46
|
if (!result.ok) fn(result.error);
|
|
47
47
|
return result;
|
|
48
48
|
}
|
|
49
|
+
function flatten(result) {
|
|
50
|
+
return result.ok ? result.value : result;
|
|
51
|
+
}
|
|
52
|
+
function mapBoth(result, okFn, errFn) {
|
|
53
|
+
return result.ok ? ok(okFn(result.value)) : err(errFn(result.error));
|
|
54
|
+
}
|
|
49
55
|
function fromNullable(value, errorFn) {
|
|
50
56
|
if (value === null || value === void 0) return err(errorFn());
|
|
51
57
|
return ok(value);
|
|
@@ -233,6 +239,15 @@ const BrepErrorCode = {
|
|
|
233
239
|
ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID",
|
|
234
240
|
ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED",
|
|
235
241
|
ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED",
|
|
242
|
+
// Blueprint / CompoundBlueprint errors
|
|
243
|
+
BLUEPRINT_EMPTY_CURVES: "BLUEPRINT_EMPTY_CURVES",
|
|
244
|
+
COMPOUND_BLUEPRINT_EMPTY: "COMPOUND_BLUEPRINT_EMPTY",
|
|
245
|
+
// GLB/glTF import errors
|
|
246
|
+
GLB_IMPORT_FAILED: "GLB_IMPORT_FAILED",
|
|
247
|
+
// Font/text errors
|
|
248
|
+
FONT_FETCH_FAILED: "FONT_FETCH_FAILED",
|
|
249
|
+
FONT_PARSE_FAILED: "FONT_PARSE_FAILED",
|
|
250
|
+
NO_FONT_LOADED: "NO_FONT_LOADED",
|
|
236
251
|
// Unsupported capability errors (ADR-0006 Phase 4)
|
|
237
252
|
UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY"
|
|
238
253
|
};
|
|
@@ -273,64 +288,6 @@ function queryError(code, message, cause, metadata, suggestion) {
|
|
|
273
288
|
function unsupportedError(code, message, cause, metadata, suggestion) {
|
|
274
289
|
return makeError("UNSUPPORTED", code, message, cause, metadata, suggestion);
|
|
275
290
|
}
|
|
276
|
-
const kernel_ERROR_PATTERNS = [
|
|
277
|
-
{
|
|
278
|
-
pattern: /invalid edge configuration|edges?.*(not|fail|invalid)/i,
|
|
279
|
-
translation: "The edges may not form a continuous loop. Check that edges connect end-to-end without gaps."
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
pattern: /BRepAlgoAPI.*failed|boolean.*operation.*failed/i,
|
|
283
|
-
translation: "Boolean operation failed. Common causes: overlapping faces, zero-thickness geometry, or degenerate shapes. Try healing input shapes first."
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
pattern: /fillet.*radius.*too.*large|fillet.*failed/i,
|
|
287
|
-
translation: "Fillet operation failed. The radius may be too large for the selected edges. Try reducing the radius or check that edges have enough room."
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
pattern: /chamfer.*failed|chamfer.*distance.*too.*large/i,
|
|
291
|
-
translation: "Chamfer operation failed. The distance may be too large for the selected edges. Try reducing the distance or check edge geometry."
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
pattern: /shell.*failed|offset.*failed/i,
|
|
295
|
-
translation: "Shell/offset operation failed. The thickness may be too large, or the shape may have complex geometry. Try reducing thickness."
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
pattern: /sweep.*failed|pipe.*failed/i,
|
|
299
|
-
translation: "Sweep operation failed. Check that the profile and spine are compatible, and that the spine has no sharp twists or self-intersections."
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
pattern: /loft.*failed/i,
|
|
303
|
-
translation: "Loft operation failed. Profiles may be incompatible or have different orientations. Ensure profiles are ordered consistently."
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
pattern: /extrude.*failed|prism.*failed/i,
|
|
307
|
-
translation: "Extrusion failed. The profile may be invalid or self-intersecting. Check that the profile forms a valid closed wire."
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
pattern: /revolve.*failed|revolution.*failed/i,
|
|
311
|
-
translation: "Revolution operation failed. The profile may intersect the axis of revolution, or the angle may be invalid."
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
pattern: /self.*intersect|self-intersect/i,
|
|
315
|
-
translation: "Shape has self-intersections. The operation resulted in overlapping geometry. Simplify the input or adjust parameters."
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
pattern: /degener|degenerat/i,
|
|
319
|
-
translation: "Degenerate geometry detected. The shape has edges or faces with zero length/area. Check input geometry for collapsed elements."
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
pattern: /BRepCheck.*fail|shape.*invalid|shape.*not.*valid/i,
|
|
323
|
-
translation: "Shape validation failed. The resulting shape has invalid topology. Try healing the shape or checking input geometry."
|
|
324
|
-
}
|
|
325
|
-
];
|
|
326
|
-
function translateKernelError(kernelMessage) {
|
|
327
|
-
for (const { pattern, translation } of kernel_ERROR_PATTERNS) {
|
|
328
|
-
if (pattern.test(kernelMessage)) {
|
|
329
|
-
return `${translation} (kernel: ${kernelMessage})`;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
return kernelMessage;
|
|
333
|
-
}
|
|
334
291
|
function safeIndex(arr, index, context) {
|
|
335
292
|
if (index < 0 || index >= arr.length) {
|
|
336
293
|
bug(context ?? "safeIndex", `Index ${index} is out of bounds (array length ${arr.length})`);
|
|
@@ -338,43 +295,44 @@ function safeIndex(arr, index, context) {
|
|
|
338
295
|
return arr[index];
|
|
339
296
|
}
|
|
340
297
|
export {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
298
|
+
orElse as A,
|
|
299
|
+
BrepErrorCode as B,
|
|
300
|
+
pipeline as C,
|
|
301
|
+
sketcherStateError as D,
|
|
302
|
+
tap as E,
|
|
303
|
+
tapErr as F,
|
|
304
|
+
tryCatch as G,
|
|
305
|
+
tryCatchAsync as H,
|
|
306
|
+
unsupportedError as I,
|
|
307
|
+
unwrapErr as J,
|
|
308
|
+
unwrapOr as K,
|
|
309
|
+
unwrapOrElse as L,
|
|
310
|
+
zip as M,
|
|
353
311
|
OK as O,
|
|
354
312
|
andThen as a,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
313
|
+
isErr as b,
|
|
314
|
+
isOk as c,
|
|
315
|
+
bug as d,
|
|
358
316
|
err as e,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
317
|
+
computationError as f,
|
|
318
|
+
BrepBugError as g,
|
|
319
|
+
all as h,
|
|
362
320
|
ioError as i,
|
|
363
|
-
|
|
321
|
+
collect as j,
|
|
364
322
|
kernelError as k,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
323
|
+
flatMap as l,
|
|
324
|
+
flatten as m,
|
|
325
|
+
fromNullable as n,
|
|
368
326
|
ok as o,
|
|
369
|
-
|
|
327
|
+
map as p,
|
|
370
328
|
queryError as q,
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
329
|
+
mapBoth as r,
|
|
330
|
+
safeIndex as s,
|
|
331
|
+
typeCastError as t,
|
|
332
|
+
unwrap as u,
|
|
333
|
+
validationError as v,
|
|
334
|
+
mapErr as w,
|
|
335
|
+
match as x,
|
|
336
|
+
moduleInitError as y,
|
|
337
|
+
or as z
|
|
380
338
|
};
|
|
@@ -47,6 +47,12 @@ function tapErr(result, fn) {
|
|
|
47
47
|
if (!result.ok) fn(result.error);
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
+
function flatten(result) {
|
|
51
|
+
return result.ok ? result.value : result;
|
|
52
|
+
}
|
|
53
|
+
function mapBoth(result, okFn, errFn) {
|
|
54
|
+
return result.ok ? ok(okFn(result.value)) : err(errFn(result.error));
|
|
55
|
+
}
|
|
50
56
|
function fromNullable(value, errorFn) {
|
|
51
57
|
if (value === null || value === void 0) return err(errorFn());
|
|
52
58
|
return ok(value);
|
|
@@ -234,6 +240,15 @@ const BrepErrorCode = {
|
|
|
234
240
|
ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID",
|
|
235
241
|
ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED",
|
|
236
242
|
ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED",
|
|
243
|
+
// Blueprint / CompoundBlueprint errors
|
|
244
|
+
BLUEPRINT_EMPTY_CURVES: "BLUEPRINT_EMPTY_CURVES",
|
|
245
|
+
COMPOUND_BLUEPRINT_EMPTY: "COMPOUND_BLUEPRINT_EMPTY",
|
|
246
|
+
// GLB/glTF import errors
|
|
247
|
+
GLB_IMPORT_FAILED: "GLB_IMPORT_FAILED",
|
|
248
|
+
// Font/text errors
|
|
249
|
+
FONT_FETCH_FAILED: "FONT_FETCH_FAILED",
|
|
250
|
+
FONT_PARSE_FAILED: "FONT_PARSE_FAILED",
|
|
251
|
+
NO_FONT_LOADED: "NO_FONT_LOADED",
|
|
237
252
|
// Unsupported capability errors (ADR-0006 Phase 4)
|
|
238
253
|
UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY"
|
|
239
254
|
};
|
|
@@ -274,64 +289,6 @@ function queryError(code, message, cause, metadata, suggestion) {
|
|
|
274
289
|
function unsupportedError(code, message, cause, metadata, suggestion) {
|
|
275
290
|
return makeError("UNSUPPORTED", code, message, cause, metadata, suggestion);
|
|
276
291
|
}
|
|
277
|
-
const kernel_ERROR_PATTERNS = [
|
|
278
|
-
{
|
|
279
|
-
pattern: /invalid edge configuration|edges?.*(not|fail|invalid)/i,
|
|
280
|
-
translation: "The edges may not form a continuous loop. Check that edges connect end-to-end without gaps."
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
pattern: /BRepAlgoAPI.*failed|boolean.*operation.*failed/i,
|
|
284
|
-
translation: "Boolean operation failed. Common causes: overlapping faces, zero-thickness geometry, or degenerate shapes. Try healing input shapes first."
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
pattern: /fillet.*radius.*too.*large|fillet.*failed/i,
|
|
288
|
-
translation: "Fillet operation failed. The radius may be too large for the selected edges. Try reducing the radius or check that edges have enough room."
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
pattern: /chamfer.*failed|chamfer.*distance.*too.*large/i,
|
|
292
|
-
translation: "Chamfer operation failed. The distance may be too large for the selected edges. Try reducing the distance or check edge geometry."
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
pattern: /shell.*failed|offset.*failed/i,
|
|
296
|
-
translation: "Shell/offset operation failed. The thickness may be too large, or the shape may have complex geometry. Try reducing thickness."
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
pattern: /sweep.*failed|pipe.*failed/i,
|
|
300
|
-
translation: "Sweep operation failed. Check that the profile and spine are compatible, and that the spine has no sharp twists or self-intersections."
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
pattern: /loft.*failed/i,
|
|
304
|
-
translation: "Loft operation failed. Profiles may be incompatible or have different orientations. Ensure profiles are ordered consistently."
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
pattern: /extrude.*failed|prism.*failed/i,
|
|
308
|
-
translation: "Extrusion failed. The profile may be invalid or self-intersecting. Check that the profile forms a valid closed wire."
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
pattern: /revolve.*failed|revolution.*failed/i,
|
|
312
|
-
translation: "Revolution operation failed. The profile may intersect the axis of revolution, or the angle may be invalid."
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
pattern: /self.*intersect|self-intersect/i,
|
|
316
|
-
translation: "Shape has self-intersections. The operation resulted in overlapping geometry. Simplify the input or adjust parameters."
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
pattern: /degener|degenerat/i,
|
|
320
|
-
translation: "Degenerate geometry detected. The shape has edges or faces with zero length/area. Check input geometry for collapsed elements."
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
pattern: /BRepCheck.*fail|shape.*invalid|shape.*not.*valid/i,
|
|
324
|
-
translation: "Shape validation failed. The resulting shape has invalid topology. Try healing the shape or checking input geometry."
|
|
325
|
-
}
|
|
326
|
-
];
|
|
327
|
-
function translateKernelError(kernelMessage) {
|
|
328
|
-
for (const { pattern, translation } of kernel_ERROR_PATTERNS) {
|
|
329
|
-
if (pattern.test(kernelMessage)) {
|
|
330
|
-
return `${translation} (kernel: ${kernelMessage})`;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return kernelMessage;
|
|
334
|
-
}
|
|
335
292
|
function safeIndex(arr, index, context) {
|
|
336
293
|
if (index < 0 || index >= arr.length) {
|
|
337
294
|
bug(context ?? "safeIndex", `Index ${index} is out of bounds (array length ${arr.length})`);
|
|
@@ -348,12 +305,14 @@ exports.collect = collect;
|
|
|
348
305
|
exports.computationError = computationError;
|
|
349
306
|
exports.err = err;
|
|
350
307
|
exports.flatMap = flatMap;
|
|
308
|
+
exports.flatten = flatten;
|
|
351
309
|
exports.fromNullable = fromNullable;
|
|
352
310
|
exports.ioError = ioError;
|
|
353
311
|
exports.isErr = isErr;
|
|
354
312
|
exports.isOk = isOk;
|
|
355
313
|
exports.kernelError = kernelError;
|
|
356
314
|
exports.map = map;
|
|
315
|
+
exports.mapBoth = mapBoth;
|
|
357
316
|
exports.mapErr = mapErr;
|
|
358
317
|
exports.match = match;
|
|
359
318
|
exports.moduleInitError = moduleInitError;
|
|
@@ -366,7 +325,6 @@ exports.safeIndex = safeIndex;
|
|
|
366
325
|
exports.sketcherStateError = sketcherStateError;
|
|
367
326
|
exports.tap = tap;
|
|
368
327
|
exports.tapErr = tapErr;
|
|
369
|
-
exports.translateKernelError = translateKernelError;
|
|
370
328
|
exports.tryCatch = tryCatch;
|
|
371
329
|
exports.tryCatchAsync = tryCatchAsync;
|
|
372
330
|
exports.typeCastError = typeCastError;
|
package/dist/result.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const result = require("./result-
|
|
3
|
+
const result = require("./result-DULetAht.cjs");
|
|
4
4
|
exports.BrepBugError = result.BrepBugError;
|
|
5
5
|
exports.BrepErrorCode = result.BrepErrorCode;
|
|
6
6
|
exports.OK = result.OK;
|
package/dist/result.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g, B, O, a, d, j, f, e, l, i, b, c, k, p, w, x, y, o, C, q, D, G, H, t, u, J, K, L, v } from "./result-CoDaWsvc.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
g as BrepBugError,
|
|
4
|
+
B as BrepErrorCode,
|
|
5
5
|
O as OK,
|
|
6
6
|
a as andThen,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
d as bug,
|
|
8
|
+
j as collect,
|
|
9
|
+
f as computationError,
|
|
10
10
|
e as err,
|
|
11
|
-
|
|
11
|
+
l as flatMap,
|
|
12
12
|
i as ioError,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
b as isErr,
|
|
14
|
+
c as isOk,
|
|
15
15
|
k as kernelError,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
p as map,
|
|
17
|
+
w as mapErr,
|
|
18
|
+
x as match,
|
|
19
|
+
y as moduleInitError,
|
|
20
20
|
o as ok,
|
|
21
|
-
|
|
21
|
+
C as pipeline,
|
|
22
22
|
q as queryError,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
D as sketcherStateError,
|
|
24
|
+
G as tryCatch,
|
|
25
|
+
H as tryCatchAsync,
|
|
26
|
+
t as typeCastError,
|
|
27
|
+
u as unwrap,
|
|
28
|
+
J as unwrapErr,
|
|
29
|
+
K as unwrapOr,
|
|
30
|
+
L as unwrapOrElse,
|
|
31
|
+
v as validationError
|
|
32
32
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { g as getKernel, c as castShape } from "./shapeTypes-dhhm-T5A.js";
|
|
2
|
+
import { H as HASH_CODE_MAX } from "./vecOps-LTN--A58.js";
|
|
3
|
+
import { d as downcast } from "./faceFns-Bn2seBfp.js";
|
|
4
|
+
import { u as unwrap } from "./result-CoDaWsvc.js";
|
|
5
|
+
function clone(shape) {
|
|
6
|
+
return castShape(unwrap(downcast(shape.wrapped)));
|
|
7
|
+
}
|
|
8
|
+
function toBREP(shape) {
|
|
9
|
+
return getKernel().toBREP(shape.wrapped);
|
|
10
|
+
}
|
|
11
|
+
function getHashCode(shape) {
|
|
12
|
+
return getKernel().hashCode(shape.wrapped, HASH_CODE_MAX);
|
|
13
|
+
}
|
|
14
|
+
function isEmpty(shape) {
|
|
15
|
+
return getKernel().isNull(shape.wrapped);
|
|
16
|
+
}
|
|
17
|
+
function isSameShape(a, b) {
|
|
18
|
+
return getKernel().isSame(a.wrapped, b.wrapped);
|
|
19
|
+
}
|
|
20
|
+
function isEqualShape(a, b) {
|
|
21
|
+
return getKernel().isEqual(a.wrapped, b.wrapped);
|
|
22
|
+
}
|
|
23
|
+
function simplify(shape) {
|
|
24
|
+
return castShape(getKernel().simplify(shape.wrapped));
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
isEmpty as a,
|
|
28
|
+
isEqualShape as b,
|
|
29
|
+
clone as c,
|
|
30
|
+
getHashCode as g,
|
|
31
|
+
isSameShape as i,
|
|
32
|
+
simplify as s,
|
|
33
|
+
toBREP as t
|
|
34
|
+
};
|