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
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { G as _usingCtx, N as DisposalScope, c as createEdge, l as createFace, p as createWire, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { G as _usingCtx, N as DisposalScope, c as createEdge, l as createFace, p as createWire, q as getKernel } from "./shapeTypes-hLHmANUz.js";
|
|
2
2
|
import { i as wasmIndex, n as bug } from "./bug-ClMTAJhe.js";
|
|
3
3
|
import { P as unwrap, s as safeIndex } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { s as getEdges } from "./topologyQueryFns-
|
|
4
|
+
import { s as getEdges } from "./topologyQueryFns-BYqsNs6q.js";
|
|
5
5
|
import { t as DEG2RAD } from "./constants-iraOnb2p.js";
|
|
6
6
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
7
7
|
import { d as vecNormalize, g as vecSub, h as vecScale, m as vecRotate, r as vecCross } from "./vecOps-S-m9H_fe.js";
|
|
8
8
|
import { a as planeToWorld, o as resolvePlane } from "./planeOps-D3yDuMux.js";
|
|
9
|
-
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as copyShape, y as downcast } from "./faceFns-
|
|
10
|
-
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns
|
|
9
|
+
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as copyShape, y as downcast } from "./faceFns-BzHfvPea.js";
|
|
10
|
+
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns--TqXOi8f.js";
|
|
11
11
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
12
|
-
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-
|
|
13
|
-
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-
|
|
14
|
-
import { b as squareDistance2d, l as add2d, s as PRECISION_OFFSET, v as samePoint$1, x as subtract2d } from "./helpers-
|
|
15
|
-
import { _ as approximateAsSvgCompatibleCurve, a as edgeToCurve, f as make2dInerpolatedBSplineCurve, i as curvesAsEdgesOnPlane, l as make2dCircle, p as make2dSegmentCurve, s as make2dArcFromCenter, t as Blueprint, u as make2dEllipse, v as Curve2D, x as BoundingBox2d, y as deserializeCurve2D } from "./blueprint-
|
|
16
|
-
import { t as cornerFinder } from "./cornerFinder-
|
|
17
|
-
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
18
|
-
import { _ as wrapSketchData, a as Sketches, o as Sketch, t as textBlueprints, v as wrapSketchDataArray } from "./textBlueprints-
|
|
19
|
-
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-
|
|
12
|
+
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-BYwkPzfM.js";
|
|
13
|
+
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-DG_2zJg7.js";
|
|
14
|
+
import { b as squareDistance2d, l as add2d, s as PRECISION_OFFSET, v as samePoint$1, x as subtract2d } from "./helpers-CHUowMmV.js";
|
|
15
|
+
import { _ as approximateAsSvgCompatibleCurve, a as edgeToCurve, f as make2dInerpolatedBSplineCurve, i as curvesAsEdgesOnPlane, l as make2dCircle, p as make2dSegmentCurve, s as make2dArcFromCenter, t as Blueprint, u as make2dEllipse, v as Curve2D, x as BoundingBox2d, y as deserializeCurve2D } from "./blueprint-CDmOJybf.js";
|
|
16
|
+
import { t as cornerFinder } from "./cornerFinder-C8VCstc3.js";
|
|
17
|
+
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-DqCcYA2X.js";
|
|
18
|
+
import { _ as wrapSketchData, a as Sketches, o as Sketch, t as textBlueprints, v as wrapSketchDataArray } from "./textBlueprints-B4w-_4_D.js";
|
|
19
|
+
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-BIIpsfds.js";
|
|
20
20
|
// src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CIw6-GFy.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BNDmjz7x.cjs");
|
|
4
4
|
const require_types = require("./types-CjF9Rofr.cjs");
|
|
5
5
|
// src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as getOrQueryType, i as castShape, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { O as getOrQueryType, i as castShape, q as getKernel } from "./shapeTypes-hLHmANUz.js";
|
|
2
2
|
import { E as ok, P as unwrap, g as err, l as typeCastError } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { a as getCachedSurfaceType } from "./topologyQueryFns-
|
|
3
|
+
import { a as getCachedSurfaceType } from "./topologyQueryFns-BYqsNs6q.js";
|
|
4
4
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
5
5
|
// src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,13 +1,13 @@
|
|
|
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-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BNDmjz7x.cjs");
|
|
5
5
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_booleanFns = require("./booleanFns-
|
|
8
|
-
const require_shapeFns = require("./shapeFns-
|
|
6
|
+
const require_faceFns = require("./faceFns-BeSpw0Dz.cjs");
|
|
7
|
+
const require_booleanFns = require("./booleanFns-CA9tvtqr.cjs");
|
|
8
|
+
const require_shapeFns = require("./shapeFns-BEwoFgq2.cjs");
|
|
9
9
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
10
|
-
const require_adjacencyFns = require("./adjacencyFns-
|
|
10
|
+
const require_adjacencyFns = require("./adjacencyFns-BBugwmvl.cjs");
|
|
11
11
|
// src/topology/threeHelpers.ts
|
|
12
12
|
/**
|
|
13
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -368,6 +368,7 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
|
|
|
368
368
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, edgeShapes, kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
369
369
|
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
|
|
370
370
|
} catch (e) {
|
|
371
|
+
if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) return require_errors.err(filletUnsupportedError(e));
|
|
371
372
|
return require_errors.err(edgeTreatmentError("fillet", e, filteredEdges, {
|
|
372
373
|
edgeCount: selectedCount,
|
|
373
374
|
radius
|
|
@@ -375,6 +376,19 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
|
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
378
|
/**
|
|
379
|
+
* `UNSUPPORTED_CAPABILITY` for a fillet the kernel cannot build as asked (a
|
|
380
|
+
* radius that varies along an edge on brepkit), from its
|
|
381
|
+
* `UnsupportedKernelOperationError`.
|
|
382
|
+
*/
|
|
383
|
+
function filletUnsupportedError(e) {
|
|
384
|
+
const kernelId = require_shapeTypes.getKernel().kernelId;
|
|
385
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
386
|
+
return require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `fillet: the ${kernelId} kernel cannot build this fillet (${raw})`, e, {
|
|
387
|
+
kernel: kernelId,
|
|
388
|
+
operation: "fillet"
|
|
389
|
+
}, "Use one constant radius per edge, or use the occt-wasm kernel");
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
378
392
|
* `FILLET_FAILED` / `CHAMFER_FAILED`, with `metadata.failedEdges` set to the
|
|
379
393
|
* edges the kernel named when it could not build them (occt-wasm 5.8+).
|
|
380
394
|
*/
|
|
@@ -406,7 +420,7 @@ function chamferUnsupportedError(e) {
|
|
|
406
420
|
* @param edges - Edges to chamfer. Pass `undefined` to chamfer all edges.
|
|
407
421
|
* @param distance - Symmetric distance, asymmetric `[d1, d2]`, or per-edge callback.
|
|
408
422
|
* @returns Err `UNSUPPORTED_CAPABILITY` when the kernel cannot build the
|
|
409
|
-
* distances asked for
|
|
423
|
+
* distances asked for.
|
|
410
424
|
*/
|
|
411
425
|
function chamfer(shape, edges, distance) {
|
|
412
426
|
const check = validateNotNull$1(shape, "chamfer: shape");
|
|
@@ -582,9 +596,10 @@ function draft(shape, faces, pullDirection, neutralPlane, angle) {
|
|
|
582
596
|
* The radius varies along the edge according to the provided spec points.
|
|
583
597
|
* Each point specifies a normalized parameter (0 = start, 1 = end) and radius.
|
|
584
598
|
*
|
|
585
|
-
* **Cross-kernel note:**
|
|
586
|
-
*
|
|
587
|
-
*
|
|
599
|
+
* **Cross-kernel note:** occt-wasm supports a linear (start/end, <=2-point)
|
|
600
|
+
* profile; brepkit supports only a constant radius. Either returns
|
|
601
|
+
* `UNSUPPORTED_CAPABILITY` for a profile it cannot build. The opencascade.js
|
|
602
|
+
* kernel does not implement it.
|
|
588
603
|
*/
|
|
589
604
|
function variableFillet(shape, edge, radii) {
|
|
590
605
|
if (radii.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.VARIABLE_FILLET_FAILED, "radii must contain at least one radius spec"));
|
|
@@ -610,6 +625,7 @@ function variableFillet(shape, edge, radii) {
|
|
|
610
625
|
}
|
|
611
626
|
return require_errors.ok(wrapped);
|
|
612
627
|
} catch (e) {
|
|
628
|
+
if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) return require_errors.err(filletUnsupportedError(e));
|
|
613
629
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet failed", e));
|
|
614
630
|
}
|
|
615
631
|
}
|
|
@@ -803,7 +819,7 @@ function castChamferResult(input, { raw, evolution }) {
|
|
|
803
819
|
* @param distance - Chamfer distance along the face (must be positive).
|
|
804
820
|
* @param angleDeg - Chamfer angle in degrees (must be in range (0, 90)).
|
|
805
821
|
* @returns Ok with the chamfered shape, or Err on invalid input or kernel
|
|
806
|
-
* failure. A kernel without a distance-angle chamfer
|
|
822
|
+
* failure. A kernel without a distance-angle chamfer returns
|
|
807
823
|
* `UNSUPPORTED_CAPABILITY`.
|
|
808
824
|
*
|
|
809
825
|
* @remarks Uses `BRepFilletAPI_MakeChamfer.AddDA(dist, angle, edge, face)` internally.
|
|
@@ -842,7 +858,7 @@ function entryWithStrayFace(shape, entries) {
|
|
|
842
858
|
* Chamfer each edge by its own distance and angle, in one operation.
|
|
843
859
|
*
|
|
844
860
|
* Edges that all share one distance and angle, with no reference face given,
|
|
845
|
-
* go through {@link chamferDistAngle}, which every kernel
|
|
861
|
+
* go through {@link chamferDistAngle}, which every kernel provides.
|
|
846
862
|
* Different values, or any `face`, need a kernel with a per-edge distance-angle
|
|
847
863
|
* chamfer (occt-wasm 5.9.0 or later); on any other kernel the result is an
|
|
848
864
|
* `UNSUPPORTED_CAPABILITY` error. On occt-wasm the edges of one
|
|
@@ -1263,6 +1279,7 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
1263
1279
|
evolution
|
|
1264
1280
|
});
|
|
1265
1281
|
} catch (e) {
|
|
1282
|
+
if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) return require_errors.err(filletUnsupportedError(e));
|
|
1266
1283
|
const raw = e instanceof Error ? e.message : String(e);
|
|
1267
1284
|
return require_errors.err(require_errors.kernelError("FILLET_FAILED", `Fillet operation failed: ${raw}`, e, {
|
|
1268
1285
|
operation: "fillet",
|
|
@@ -1279,7 +1296,7 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
1279
1296
|
* @param edges - Edges to chamfer. Pass `undefined` to chamfer all edges.
|
|
1280
1297
|
* @param distance - Symmetric distance, asymmetric `[d1, d2]`, or per-edge callback.
|
|
1281
1298
|
* @returns Err `UNSUPPORTED_CAPABILITY` when the kernel cannot build the
|
|
1282
|
-
* distances asked for
|
|
1299
|
+
* distances asked for.
|
|
1283
1300
|
*/
|
|
1284
1301
|
function chamferWithEvolution(shape, edges, distance) {
|
|
1285
1302
|
const check = validateNotNull(shape, "chamferWithEvolution: shape");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType, x as isShape3D, y as isFace } from "./shapeTypes-
|
|
2
|
-
import { j as isUnsupportedKernelOperationError, n as faultyEdgeIndexesOf } from "./occtWasmAdapter-
|
|
1
|
+
import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType, x as isShape3D, y as isFace } from "./shapeTypes-hLHmANUz.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError, n as faultyEdgeIndexesOf } from "./occtWasmAdapter-CGsnjMOe.js";
|
|
3
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, x as isOk } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
4
|
+
import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-BYqsNs6q.js";
|
|
5
5
|
import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
|
|
6
|
-
import { y as downcast } from "./faceFns-
|
|
7
|
-
import { a as fuse, f as collectInputFaceHashes, h as propagateMetadataByHash, i as cutAll, m as propagateAllMetadata, n as copyAsBooleanResult, o as fuseAll, r as cut } from "./booleanFns-
|
|
8
|
-
import { a as isSameShape } from "./shapeFns-
|
|
6
|
+
import { y as downcast } from "./faceFns-BzHfvPea.js";
|
|
7
|
+
import { a as fuse, f as collectInputFaceHashes, h as propagateMetadataByHash, i as cutAll, m as propagateAllMetadata, n as copyAsBooleanResult, o as fuseAll, r as cut } from "./booleanFns-CopMFBLS.js";
|
|
8
|
+
import { a as isSameShape } from "./shapeFns-Bepwarf3.js";
|
|
9
9
|
import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
10
|
-
import { i as facesOfEdge } from "./adjacencyFns-
|
|
10
|
+
import { i as facesOfEdge } from "./adjacencyFns-V29Gvfs9.js";
|
|
11
11
|
// src/topology/threeHelpers.ts
|
|
12
12
|
/**
|
|
13
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -368,6 +368,7 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
|
|
|
368
368
|
const { shape: resultShape, evolution } = getKernel().filletWithHistory(shape.wrapped, edgeShapes, kernelRadius, inputFaceHashes, HASH_CODE_MAX);
|
|
369
369
|
return finalizeShape3D(evolution, resultShape, [shape], BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
|
|
370
370
|
} catch (e) {
|
|
371
|
+
if (isUnsupportedKernelOperationError(e)) return err(filletUnsupportedError(e));
|
|
371
372
|
return err(edgeTreatmentError("fillet", e, filteredEdges, {
|
|
372
373
|
edgeCount: selectedCount,
|
|
373
374
|
radius
|
|
@@ -375,6 +376,19 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
|
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
378
|
/**
|
|
379
|
+
* `UNSUPPORTED_CAPABILITY` for a fillet the kernel cannot build as asked (a
|
|
380
|
+
* radius that varies along an edge on brepkit), from its
|
|
381
|
+
* `UnsupportedKernelOperationError`.
|
|
382
|
+
*/
|
|
383
|
+
function filletUnsupportedError(e) {
|
|
384
|
+
const kernelId = getKernel().kernelId;
|
|
385
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
386
|
+
return unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, `fillet: the ${kernelId} kernel cannot build this fillet (${raw})`, e, {
|
|
387
|
+
kernel: kernelId,
|
|
388
|
+
operation: "fillet"
|
|
389
|
+
}, "Use one constant radius per edge, or use the occt-wasm kernel");
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
378
392
|
* `FILLET_FAILED` / `CHAMFER_FAILED`, with `metadata.failedEdges` set to the
|
|
379
393
|
* edges the kernel named when it could not build them (occt-wasm 5.8+).
|
|
380
394
|
*/
|
|
@@ -406,7 +420,7 @@ function chamferUnsupportedError(e) {
|
|
|
406
420
|
* @param edges - Edges to chamfer. Pass `undefined` to chamfer all edges.
|
|
407
421
|
* @param distance - Symmetric distance, asymmetric `[d1, d2]`, or per-edge callback.
|
|
408
422
|
* @returns Err `UNSUPPORTED_CAPABILITY` when the kernel cannot build the
|
|
409
|
-
* distances asked for
|
|
423
|
+
* distances asked for.
|
|
410
424
|
*/
|
|
411
425
|
function chamfer(shape, edges, distance) {
|
|
412
426
|
const check = validateNotNull$1(shape, "chamfer: shape");
|
|
@@ -582,9 +596,10 @@ function draft(shape, faces, pullDirection, neutralPlane, angle) {
|
|
|
582
596
|
* The radius varies along the edge according to the provided spec points.
|
|
583
597
|
* Each point specifies a normalized parameter (0 = start, 1 = end) and radius.
|
|
584
598
|
*
|
|
585
|
-
* **Cross-kernel note:**
|
|
586
|
-
*
|
|
587
|
-
*
|
|
599
|
+
* **Cross-kernel note:** occt-wasm supports a linear (start/end, <=2-point)
|
|
600
|
+
* profile; brepkit supports only a constant radius. Either returns
|
|
601
|
+
* `UNSUPPORTED_CAPABILITY` for a profile it cannot build. The opencascade.js
|
|
602
|
+
* kernel does not implement it.
|
|
588
603
|
*/
|
|
589
604
|
function variableFillet(shape, edge, radii) {
|
|
590
605
|
if (radii.length === 0) return err(validationError(BrepErrorCode.VARIABLE_FILLET_FAILED, "radii must contain at least one radius spec"));
|
|
@@ -610,6 +625,7 @@ function variableFillet(shape, edge, radii) {
|
|
|
610
625
|
}
|
|
611
626
|
return ok(wrapped);
|
|
612
627
|
} catch (e) {
|
|
628
|
+
if (isUnsupportedKernelOperationError(e)) return err(filletUnsupportedError(e));
|
|
613
629
|
return err(kernelError(BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet failed", e));
|
|
614
630
|
}
|
|
615
631
|
}
|
|
@@ -803,7 +819,7 @@ function castChamferResult(input, { raw, evolution }) {
|
|
|
803
819
|
* @param distance - Chamfer distance along the face (must be positive).
|
|
804
820
|
* @param angleDeg - Chamfer angle in degrees (must be in range (0, 90)).
|
|
805
821
|
* @returns Ok with the chamfered shape, or Err on invalid input or kernel
|
|
806
|
-
* failure. A kernel without a distance-angle chamfer
|
|
822
|
+
* failure. A kernel without a distance-angle chamfer returns
|
|
807
823
|
* `UNSUPPORTED_CAPABILITY`.
|
|
808
824
|
*
|
|
809
825
|
* @remarks Uses `BRepFilletAPI_MakeChamfer.AddDA(dist, angle, edge, face)` internally.
|
|
@@ -842,7 +858,7 @@ function entryWithStrayFace(shape, entries) {
|
|
|
842
858
|
* Chamfer each edge by its own distance and angle, in one operation.
|
|
843
859
|
*
|
|
844
860
|
* Edges that all share one distance and angle, with no reference face given,
|
|
845
|
-
* go through {@link chamferDistAngle}, which every kernel
|
|
861
|
+
* go through {@link chamferDistAngle}, which every kernel provides.
|
|
846
862
|
* Different values, or any `face`, need a kernel with a per-edge distance-angle
|
|
847
863
|
* chamfer (occt-wasm 5.9.0 or later); on any other kernel the result is an
|
|
848
864
|
* `UNSUPPORTED_CAPABILITY` error. On occt-wasm the edges of one
|
|
@@ -1263,6 +1279,7 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
1263
1279
|
evolution
|
|
1264
1280
|
});
|
|
1265
1281
|
} catch (e) {
|
|
1282
|
+
if (isUnsupportedKernelOperationError(e)) return err(filletUnsupportedError(e));
|
|
1266
1283
|
const raw = e instanceof Error ? e.message : String(e);
|
|
1267
1284
|
return err(kernelError("FILLET_FAILED", `Fillet operation failed: ${raw}`, e, {
|
|
1268
1285
|
operation: "fillet",
|
|
@@ -1279,7 +1296,7 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
1279
1296
|
* @param edges - Edges to chamfer. Pass `undefined` to chamfer all edges.
|
|
1280
1297
|
* @param distance - Symmetric distance, asymmetric `[d1, d2]`, or per-edge callback.
|
|
1281
1298
|
* @returns Err `UNSUPPORTED_CAPABILITY` when the kernel cannot build the
|
|
1282
|
-
* distances asked for
|
|
1299
|
+
* distances asked for.
|
|
1283
1300
|
*/
|
|
1284
1301
|
function chamferWithEvolution(shape, edges, distance) {
|
|
1285
1302
|
const check = validateNotNull(shape, "chamferWithEvolution: shape");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CIw6-GFy.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BNDmjz7x.cjs");
|
|
4
4
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
5
5
|
const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_shapeFns = require("./shapeFns-
|
|
8
|
-
const require_curveFns = require("./curveFns-
|
|
9
|
-
const require_measureFns = require("./measureFns-
|
|
6
|
+
const require_faceFns = require("./faceFns-BeSpw0Dz.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-BEwoFgq2.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-B29Eot3K.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-BlS2xJcn.cjs");
|
|
10
10
|
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { q as getKernel, y as isFace } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel, y as isFace } from "./shapeTypes-hLHmANUz.js";
|
|
2
2
|
import { E as ok, g as err, o as queryError, x as isOk } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
3
|
+
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-BYqsNs6q.js";
|
|
4
4
|
import { t as DEG2RAD } from "./constants-iraOnb2p.js";
|
|
5
5
|
import { a as vecDot, d as vecNormalize } from "./vecOps-S-m9H_fe.js";
|
|
6
|
-
import { l as normalAt, s as getSurfaceType } from "./faceFns-
|
|
7
|
-
import { a as isSameShape, n as getHashCode } from "./shapeFns-
|
|
8
|
-
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns
|
|
9
|
-
import {
|
|
6
|
+
import { l as normalAt, s as getSurfaceType } from "./faceFns-BzHfvPea.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-Bepwarf3.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns--TqXOi8f.js";
|
|
9
|
+
import { r as measureArea } from "./measureFns-CLsSuByu.js";
|
|
10
10
|
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as isSolid, G as _usingCtx, S as isShell, _ as isCompound, n as castResultShape, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { C as isSolid, G as _usingCtx, S as isShell, _ as isCompound, n as castResultShape, q as getKernel } from "./shapeTypes-hLHmANUz.js";
|
|
2
2
|
import { i as wasmIndex, r as vec3At$1 } from "./bug-ClMTAJhe.js";
|
|
3
3
|
import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { S as subShapeCount, c as getFaces, u as getShells } from "./topologyQueryFns-
|
|
4
|
+
import { S as subShapeCount, c as getFaces, u as getShells } from "./topologyQueryFns-BYqsNs6q.js";
|
|
5
5
|
import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
|
|
6
|
-
import { t as makeCompound } from "./solidBuilders-
|
|
7
|
-
import { u as igesUnsupportedError } from "./meshFns-
|
|
6
|
+
import { t as makeCompound } from "./solidBuilders-IA8xNuxJ.js";
|
|
7
|
+
import { u as igesUnsupportedError } from "./meshFns-CzpP9SBf.js";
|
|
8
8
|
import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
9
|
-
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-
|
|
9
|
+
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-CDmOJybf.js";
|
|
10
10
|
// src/io/objExportFns.ts
|
|
11
11
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
12
12
|
function vec3At(arr, i) {
|
|
@@ -1999,15 +1999,33 @@ function binaryPositions(data) {
|
|
|
1999
1999
|
* Supports STEP, STL, and IGES formats.
|
|
2000
2000
|
*/
|
|
2001
2001
|
/**
|
|
2002
|
+
* The whole model a reader returned: its one shape as is, or a compound of
|
|
2003
|
+
* every top-level shape (brepkit returns a solid per part, the OCCT kernels
|
|
2004
|
+
* one shape for the file).
|
|
2005
|
+
*/
|
|
2006
|
+
function wholeModel(shapes) {
|
|
2007
|
+
const [only] = shapes;
|
|
2008
|
+
if (shapes.length === 1 && only !== void 0) return castResultShape(only);
|
|
2009
|
+
const parts = shapes.map((s) => castResultShape(s));
|
|
2010
|
+
try {
|
|
2011
|
+
return makeCompound(parts);
|
|
2012
|
+
} finally {
|
|
2013
|
+
for (const part of parts) part[Symbol.dispose]();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2002
2017
|
* Import a STEP file from a Blob.
|
|
2003
2018
|
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2019
|
+
* Reads every part in the file. A file holding one solid comes back as that
|
|
2020
|
+
* solid; an assembly or a file with several parts comes back as a `Compound`
|
|
2021
|
+
* of every part, each at the placement the file gives it.
|
|
2006
2022
|
*
|
|
2007
2023
|
* @param blob - A Blob or File containing STEP data (.step / .stp).
|
|
2008
|
-
* @returns A `Result` wrapping the imported shape
|
|
2024
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2025
|
+
* holds several parts), or an error if parsing fails.
|
|
2009
2026
|
*
|
|
2010
|
-
* @remarks
|
|
2027
|
+
* @remarks Part names and colors in the file are not read. The temporary file
|
|
2028
|
+
* on the WASM FS is cleaned up automatically.
|
|
2011
2029
|
*
|
|
2012
2030
|
* @example
|
|
2013
2031
|
* ```ts
|
|
@@ -2020,11 +2038,7 @@ async function importSTEP(blob) {
|
|
|
2020
2038
|
const data = await blob.arrayBuffer();
|
|
2021
2039
|
const shapes = getKernel().importSTEP(data);
|
|
2022
2040
|
if (shapes.length === 0) return err(ioError("STEP_IMPORT_FAILED", "STEP file contains no valid geometry"));
|
|
2023
|
-
|
|
2024
|
-
const extra = shapes[i];
|
|
2025
|
-
if (extra) getKernel().dispose(extra);
|
|
2026
|
-
}
|
|
2027
|
-
return ok(castResultShape(shapes[0]));
|
|
2041
|
+
return ok(wholeModel(shapes));
|
|
2028
2042
|
} catch (e) {
|
|
2029
2043
|
return err(ioError("STEP_IMPORT_FAILED", "Failed to load STEP file", e));
|
|
2030
2044
|
}
|
|
@@ -2081,8 +2095,12 @@ async function importSTL(blob) {
|
|
|
2081
2095
|
/**
|
|
2082
2096
|
* Import an IGES file from a Blob.
|
|
2083
2097
|
*
|
|
2098
|
+
* Reads every part in the file: one solid comes back as that solid, several as
|
|
2099
|
+
* a `Compound` of every part.
|
|
2100
|
+
*
|
|
2084
2101
|
* @param blob - A Blob or File containing IGES data (.iges / .igs).
|
|
2085
|
-
* @returns A `Result` wrapping the imported shape
|
|
2102
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2103
|
+
* holds several parts), or an error if parsing fails.
|
|
2086
2104
|
*
|
|
2087
2105
|
* @remarks The temporary file on the WASM FS is cleaned up automatically. The
|
|
2088
2106
|
* default occt-wasm kernel is built without an IGES translator, so there this
|
|
@@ -2098,11 +2116,7 @@ async function importIGES(blob) {
|
|
|
2098
2116
|
const data = await blob.arrayBuffer();
|
|
2099
2117
|
const shapes = getKernel().importIGES(data);
|
|
2100
2118
|
if (shapes.length === 0) return err(ioError("IGES_IMPORT_FAILED", "IGES file contains no valid geometry"));
|
|
2101
|
-
|
|
2102
|
-
const extra = shapes[i];
|
|
2103
|
-
if (extra) getKernel().dispose(extra);
|
|
2104
|
-
}
|
|
2105
|
-
return ok(castResultShape(shapes[0]));
|
|
2119
|
+
return ok(wholeModel(shapes));
|
|
2106
2120
|
} catch (e) {
|
|
2107
2121
|
return err(igesUnsupportedError("importIGES", e) ?? ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
|
|
2108
2122
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CIw6-GFy.cjs");
|
|
2
2
|
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-BNDmjz7x.cjs");
|
|
5
5
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
6
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
7
|
-
const require_meshFns = require("./meshFns-
|
|
6
|
+
const require_solidBuilders = require("./solidBuilders-BVHK-era.cjs");
|
|
7
|
+
const require_meshFns = require("./meshFns-ECQqx-8Q.cjs");
|
|
8
8
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
9
|
-
const require_blueprint = require("./blueprint-
|
|
9
|
+
const require_blueprint = require("./blueprint-BO8zuqoy.cjs");
|
|
10
10
|
// src/io/objExportFns.ts
|
|
11
11
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
12
12
|
function vec3At(arr, i) {
|
|
@@ -1999,15 +1999,33 @@ function binaryPositions(data) {
|
|
|
1999
1999
|
* Supports STEP, STL, and IGES formats.
|
|
2000
2000
|
*/
|
|
2001
2001
|
/**
|
|
2002
|
+
* The whole model a reader returned: its one shape as is, or a compound of
|
|
2003
|
+
* every top-level shape (brepkit returns a solid per part, the OCCT kernels
|
|
2004
|
+
* one shape for the file).
|
|
2005
|
+
*/
|
|
2006
|
+
function wholeModel(shapes) {
|
|
2007
|
+
const [only] = shapes;
|
|
2008
|
+
if (shapes.length === 1 && only !== void 0) return require_shapeTypes.castResultShape(only);
|
|
2009
|
+
const parts = shapes.map((s) => require_shapeTypes.castResultShape(s));
|
|
2010
|
+
try {
|
|
2011
|
+
return require_solidBuilders.makeCompound(parts);
|
|
2012
|
+
} finally {
|
|
2013
|
+
for (const part of parts) part[Symbol.dispose]();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2002
2017
|
* Import a STEP file from a Blob.
|
|
2003
2018
|
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2019
|
+
* Reads every part in the file. A file holding one solid comes back as that
|
|
2020
|
+
* solid; an assembly or a file with several parts comes back as a `Compound`
|
|
2021
|
+
* of every part, each at the placement the file gives it.
|
|
2006
2022
|
*
|
|
2007
2023
|
* @param blob - A Blob or File containing STEP data (.step / .stp).
|
|
2008
|
-
* @returns A `Result` wrapping the imported shape
|
|
2024
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2025
|
+
* holds several parts), or an error if parsing fails.
|
|
2009
2026
|
*
|
|
2010
|
-
* @remarks
|
|
2027
|
+
* @remarks Part names and colors in the file are not read. The temporary file
|
|
2028
|
+
* on the WASM FS is cleaned up automatically.
|
|
2011
2029
|
*
|
|
2012
2030
|
* @example
|
|
2013
2031
|
* ```ts
|
|
@@ -2020,11 +2038,7 @@ async function importSTEP(blob) {
|
|
|
2020
2038
|
const data = await blob.arrayBuffer();
|
|
2021
2039
|
const shapes = require_shapeTypes.getKernel().importSTEP(data);
|
|
2022
2040
|
if (shapes.length === 0) return require_errors.err(require_errors.ioError("STEP_IMPORT_FAILED", "STEP file contains no valid geometry"));
|
|
2023
|
-
|
|
2024
|
-
const extra = shapes[i];
|
|
2025
|
-
if (extra) require_shapeTypes.getKernel().dispose(extra);
|
|
2026
|
-
}
|
|
2027
|
-
return require_errors.ok(require_shapeTypes.castResultShape(shapes[0]));
|
|
2041
|
+
return require_errors.ok(wholeModel(shapes));
|
|
2028
2042
|
} catch (e) {
|
|
2029
2043
|
return require_errors.err(require_errors.ioError("STEP_IMPORT_FAILED", "Failed to load STEP file", e));
|
|
2030
2044
|
}
|
|
@@ -2081,8 +2095,12 @@ async function importSTL(blob) {
|
|
|
2081
2095
|
/**
|
|
2082
2096
|
* Import an IGES file from a Blob.
|
|
2083
2097
|
*
|
|
2098
|
+
* Reads every part in the file: one solid comes back as that solid, several as
|
|
2099
|
+
* a `Compound` of every part.
|
|
2100
|
+
*
|
|
2084
2101
|
* @param blob - A Blob or File containing IGES data (.iges / .igs).
|
|
2085
|
-
* @returns A `Result` wrapping the imported shape
|
|
2102
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2103
|
+
* holds several parts), or an error if parsing fails.
|
|
2086
2104
|
*
|
|
2087
2105
|
* @remarks The temporary file on the WASM FS is cleaned up automatically. The
|
|
2088
2106
|
* default occt-wasm kernel is built without an IGES translator, so there this
|
|
@@ -2098,11 +2116,7 @@ async function importIGES(blob) {
|
|
|
2098
2116
|
const data = await blob.arrayBuffer();
|
|
2099
2117
|
const shapes = require_shapeTypes.getKernel().importIGES(data);
|
|
2100
2118
|
if (shapes.length === 0) return require_errors.err(require_errors.ioError("IGES_IMPORT_FAILED", "IGES file contains no valid geometry"));
|
|
2101
|
-
|
|
2102
|
-
const extra = shapes[i];
|
|
2103
|
-
if (extra) require_shapeTypes.getKernel().dispose(extra);
|
|
2104
|
-
}
|
|
2105
|
-
return require_errors.ok(require_shapeTypes.castResultShape(shapes[0]));
|
|
2119
|
+
return require_errors.ok(wholeModel(shapes));
|
|
2106
2120
|
} catch (e) {
|
|
2107
2121
|
return require_errors.err(require_meshFns.igesUnsupportedError("importIGES", e) ?? require_errors.ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
|
|
2108
2122
|
}
|
package/dist/io/importFns.d.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { Result } from '../core/result.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Import a STEP file from a Blob.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Reads every part in the file. A file holding one solid comes back as that
|
|
7
|
+
* solid; an assembly or a file with several parts comes back as a `Compound`
|
|
8
|
+
* of every part, each at the placement the file gives it.
|
|
8
9
|
*
|
|
9
10
|
* @param blob - A Blob or File containing STEP data (.step / .stp).
|
|
10
|
-
* @returns A `Result` wrapping the imported shape
|
|
11
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
12
|
+
* holds several parts), or an error if parsing fails.
|
|
11
13
|
*
|
|
12
|
-
* @remarks
|
|
14
|
+
* @remarks Part names and colors in the file are not read. The temporary file
|
|
15
|
+
* on the WASM FS is cleaned up automatically.
|
|
13
16
|
*
|
|
14
17
|
* @example
|
|
15
18
|
* ```ts
|
|
@@ -48,8 +51,12 @@ export declare function importSTL(blob: Blob): Promise<Result<UnknownDimShape>>;
|
|
|
48
51
|
/**
|
|
49
52
|
* Import an IGES file from a Blob.
|
|
50
53
|
*
|
|
54
|
+
* Reads every part in the file: one solid comes back as that solid, several as
|
|
55
|
+
* a `Compound` of every part.
|
|
56
|
+
*
|
|
51
57
|
* @param blob - A Blob or File containing IGES data (.iges / .igs).
|
|
52
|
-
* @returns A `Result` wrapping the imported shape
|
|
58
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
59
|
+
* holds several parts), or an error if parsing fails.
|
|
53
60
|
*
|
|
54
61
|
* @remarks The temporary file on the WASM FS is cleaned up automatically. The
|
|
55
62
|
* default occt-wasm kernel is built without an IGES translator, so there this
|
package/dist/io.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_meshFns = require("./meshFns-
|
|
3
|
-
const require_importFns = require("./importFns-
|
|
2
|
+
const require_meshFns = require("./meshFns-ECQqx-8Q.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-BX0866c6.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
|
6
6
|
exports.exportGlb = require_importFns.exportGlb;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-
|
|
2
|
-
import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-CzpP9SBf.js";
|
|
2
|
+
import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-BLaneR8r.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -118,9 +118,7 @@ export interface BrepkitKernel {
|
|
|
118
118
|
filletV2(solid: number, edgeHandles: Uint32Array | number[], radius: number): number;
|
|
119
119
|
filletVariable(solid: number, json: string): number;
|
|
120
120
|
chamfer(solid: number, edgeHandles: Uint32Array | number[], distance: number): number;
|
|
121
|
-
/** @unwired */
|
|
122
121
|
chamferV2(solid: number, edgeHandles: Uint32Array | number[], d1: number, d2: number): number;
|
|
123
|
-
/** @unwired */
|
|
124
122
|
chamferDistanceAngle(solid: number, edgeHandles: Uint32Array | number[], distance: number, angle: number): number;
|
|
125
123
|
shell(solid: number, thickness: number, openFaces: Uint32Array | number[]): number;
|
|
126
124
|
/** @unwired */
|
|
@@ -340,8 +338,6 @@ export interface BrepkitKernel {
|
|
|
340
338
|
toBrepJson(solid: number): string;
|
|
341
339
|
transformFace(face: number, matrix: Float64Array | number[]): void;
|
|
342
340
|
/** @future Not in brepkit-wasm 3.0.0. Referenced with feature detection in adapter. */
|
|
343
|
-
chamferAsymmetric?(solid: number, edgeHandles: Uint32Array | number[], d1: number, d2: number): number;
|
|
344
|
-
/** @future Not in brepkit-wasm 3.0.0. Referenced with feature detection in adapter. */
|
|
345
341
|
copyEdge?(edge: number): number;
|
|
346
342
|
/** @future Not in brepkit-wasm 3.0.0. Referenced with feature detection in adapter. */
|
|
347
343
|
transformEdge?(edge: number, matrix: Float64Array | number[]): void;
|
|
@@ -53,6 +53,20 @@ export declare function unwrapSolidOrThrow(shape: KernelShape, methodName: strin
|
|
|
53
53
|
export declare function unwrapSolidsForExport(bk: BrepkitKernel, shape: KernelShape, methodName: string): number[];
|
|
54
54
|
/** Euclidean distance between two 3D points. */
|
|
55
55
|
export declare function dist3(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number;
|
|
56
|
+
type Point = [number, number, number];
|
|
57
|
+
/**
|
|
58
|
+
* The curve parameters an edge spans. brepkit reports a circle or ellipse edge's
|
|
59
|
+
* domain as the whole [0, 2π] even for an arc; the arc runs counterclockwise
|
|
60
|
+
* about the curve's axis from the angle of its start vertex to that of its end
|
|
61
|
+
* vertex (brepkit's own `circle_param_range`), angles read off the curve's frame.
|
|
62
|
+
*/
|
|
63
|
+
export declare function edgeParamRange(bk: BrepkitKernel, edgeId: number): [number, number];
|
|
64
|
+
/**
|
|
65
|
+
* Points whose bounding box is the edge's: its ends, plus for a circle or
|
|
66
|
+
* ellipse the points where each coordinate peaks within the arc (exact), and
|
|
67
|
+
* for any other curve samples along its parameter range.
|
|
68
|
+
*/
|
|
69
|
+
export declare function edgeBoxPoints(bk: BrepkitKernel, edgeId: number): Point[];
|
|
56
70
|
/** Copy a WASM-backed Uint8Array into an independent ArrayBuffer. */
|
|
57
71
|
export declare function copyWasmBytes(bytes: Uint8Array): ArrayBuffer;
|
|
58
72
|
/** Build a row-major 4x4 translation matrix. */
|
|
@@ -95,3 +109,4 @@ export declare function bb2d(h: BBox2dHandle): BkBBox2d;
|
|
|
95
109
|
* callback would produce distinct angles per face.
|
|
96
110
|
*/
|
|
97
111
|
export declare function resolveUniformAngle(faces: KernelShape[], angleDeg: number | ((face: KernelShape) => number)): number;
|
|
112
|
+
export {};
|