brepjs 20.12.15 → 20.13.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.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{adjacencyFns-BHdJW5pd.cjs → adjacencyFns-BXzEHSC5.cjs} +3 -3
- package/dist/{adjacencyFns-C4yjxKu4.js → adjacencyFns-BYjzMejn.js} +3 -3
- package/dist/{blueprint-D4juQWXs.cjs → blueprint-464KGkzc.cjs} +5 -5
- package/dist/{blueprint-ku_wYIZl.js → blueprint-D-4-uTkr.js} +5 -5
- package/dist/{blueprintFns-8obtvMEn.cjs → blueprintFns-BdyFiuiC.cjs} +2 -2
- package/dist/{blueprintFns-B0cqtoFB.js → blueprintFns-CE5RdX-E.js} +2 -2
- package/dist/{blueprintSketcher-CRFpnZAS.cjs → blueprintSketcher-C4XHzqTw.cjs} +3 -3
- package/dist/{blueprintSketcher-Dpdgf5aR.js → blueprintSketcher-CQ9LxcIl.js} +3 -3
- package/dist/{boolean2D-D3jxohLZ.cjs → boolean2D-CKE32vHV.cjs} +4 -4
- package/dist/{boolean2D-CnCDsRJ4.js → boolean2D-DwJvQ4p_.js} +4 -4
- package/dist/{booleanFns-CItcObM_.js → booleanFns-CsTz48A3.js} +5 -5
- package/dist/{booleanFns-GBPAGQ5g.cjs → booleanFns-MkzdfjDv.cjs} +5 -5
- package/dist/brepjs.cjs +30 -30
- package/dist/brepjs.js +30 -30
- package/dist/{cameraFns-B6ujpyKy.js → cameraFns-BDl_D28X.js} +3 -3
- package/dist/{cameraFns-C2XhSqrr.cjs → cameraFns-vHpapIZG.cjs} +3 -3
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-D3nBhdfi.js → cornerFinder-Dyk5sKEN.js} +1 -1
- package/dist/{cornerFinder-CqHx_Itj.cjs → cornerFinder-adDN0_C4.cjs} +1 -1
- package/dist/{curveFns-BQjw0VBB.cjs → curveFns-HtjEh2W-.cjs} +1 -1
- package/dist/{curveFns-nAwtilbz.js → curveFns-RjNVzxNc.js} +1 -1
- package/dist/{drawFns-hFjTvdw4.cjs → drawFns-B5gZtD_P.cjs} +12 -12
- package/dist/{drawFns-D9q4Hxc_.js → drawFns-stc8-Gma.js} +12 -12
- package/dist/{faceFns-DdMpocg9.cjs → faceFns-C7wBHMPv.cjs} +2 -2
- package/dist/{faceFns-Dodcduw8.js → faceFns-DaPoCzd-.js} +2 -2
- package/dist/{healingFns-GNF1rFuw.js → healingFns-C3Wq_hN3.js} +79 -31
- package/dist/{healingFns-Cdpu44d0.cjs → healingFns-zYCbT8vR.cjs} +79 -31
- package/dist/{helpers-TWIfnyto.cjs → helpers-BdtYVyP5.cjs} +6 -6
- package/dist/{helpers-CoVtL5c9.js → helpers-CDzSlBi_.js} +6 -6
- package/dist/{importFns-P-TcOJ1G.cjs → importFns-CotbQ9l7.cjs} +5 -5
- package/dist/{importFns-C9TUFscx.js → importFns-DR7Adv-W.js} +5 -5
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/interfaces/evolutionOps.d.ts +8 -0
- package/dist/kernel/interfaces/modifierOps.d.ts +17 -8
- package/dist/kernel/occtWasm/evolutionOps.d.ts +2 -0
- package/dist/kernel/occtWasm/helpers.d.ts +6 -0
- package/dist/kernel/occtWasm/modifierOps.d.ts +2 -8
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +3 -5
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/occtWasm/occtWasmTypes.d.ts +2 -0
- package/dist/{loftFns-Uq6BhPVL.cjs → loftFns-C9k9UAKh.cjs} +1 -1
- package/dist/{loftFns-DVsWk-9v.js → loftFns-Cbnrz3p8.js} +1 -1
- package/dist/{measureFns-B0Cy7GcQ.cjs → measureFns-Bi62maOJ.cjs} +3 -3
- package/dist/{measureFns-DoUWDfAP.js → measureFns-DivR02Xb.js} +3 -3
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-Bz9PPZWP.cjs → meshFns-8MTf0Lo_.cjs} +4 -4
- package/dist/{meshFns-BpBgKIIE.js → meshFns-CcuY52tt.js} +4 -4
- package/dist/{occtWasmAdapter-DeVQrL5n.js → occtWasmAdapter-1k4udeb3.js} +50 -6
- package/dist/{occtWasmAdapter-DzxyXpLG.cjs → occtWasmAdapter-BNOuP9DA.cjs} +50 -6
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-DE1RROq-.cjs → primitiveFns-BifV4IGL.cjs} +5 -5
- package/dist/{primitiveFns-Crqsdby_.js → primitiveFns-uDvN1FH6.js} +5 -5
- package/dist/{principalBoxFns-CzEBI6tC.cjs → principalBoxFns-DjxE8Rym.cjs} +3 -3
- package/dist/{principalBoxFns-DwitCsif.js → principalBoxFns-ez0xXLyK.js} +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-DgM_B9WU.cjs → refResolveFns-CTkAPUwM.cjs} +6 -6
- package/dist/{refResolveFns-BJz9UvXM.js → refResolveFns-CuaYXFya.js} +6 -6
- package/dist/{shapeFns-Ddh0M4Iz.js → shapeFns-DgpWLKra.js} +2 -2
- package/dist/{shapeFns-B9LB54_t.cjs → shapeFns-Rmgd4x9I.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-C1Ljs72p.cjs → shapeTypes-BjitsJRQ.cjs} +1 -1
- package/dist/{shapeTypes-DiCMRU6Z.js → shapeTypes-DbPghQD3.js} +1 -1
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-Dzhk5L6w.js → solidBuilders-BUI_fGzR.js} +3 -3
- package/dist/{solidBuilders-C6_6tZXG.cjs → solidBuilders-Bs2NA3xl.cjs} +3 -3
- package/dist/{surfaceBuilders-Idshk6C3.js → surfaceBuilders-CO_DKhWA.js} +3 -3
- package/dist/{surfaceBuilders-CU_vd71e.cjs → surfaceBuilders-Cn1mkQ3j.cjs} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-DyT-kfxc.js → textBlueprints-CT0Kbw1f.js} +8 -8
- package/dist/{textBlueprints-BmIxy1fi.cjs → textBlueprints-P_D0KUVx.cjs} +8 -8
- package/dist/{textMetrics-CbDASt0r.cjs → textMetrics-CVyX8GyL.cjs} +1 -1
- package/dist/{textMetrics-DuzBLY9z.js → textMetrics-CXKdzefS.js} +1 -1
- package/dist/{threadFns-YPn7KF9u.cjs → threadFns-BV4HLdPE.cjs} +7 -7
- package/dist/{threadFns-CN1R3YKa.js → threadFns-COs6jmaf.js} +7 -7
- package/dist/topology/apiTypes.d.ts +9 -0
- package/dist/topology/chamferAngleFns.d.ts +18 -9
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-CNOqc1rB.js → topologyQueryFns-J2ae_Gvc.js} +1 -1
- package/dist/{topologyQueryFns-0Ycw298Y.cjs → topologyQueryFns-s0LddGkF.cjs} +1 -1
- package/dist/{validityTypes-CXnc46WG.cjs → validityTypes-BVZ0lSNi.cjs} +1 -1
- package/dist/{validityTypes-rUpnumpL.js → validityTypes-CD_Xz0vZ.js} +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-s0LddGkF.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-DbPghQD3.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-J2ae_Gvc.js";
|
|
4
4
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
5
5
|
// src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,11 +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-DbPghQD3.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError, n as faultyEdgeIndexesOf } from "./occtWasmAdapter-1k4udeb3.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-J2ae_Gvc.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-
|
|
6
|
+
import { y as downcast } from "./faceFns-DaPoCzd-.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-CsTz48A3.js";
|
|
8
|
+
import { a as isSameShape } from "./shapeFns-DgpWLKra.js";
|
|
8
9
|
import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
10
|
+
import { i as facesOfEdge } from "./adjacencyFns-BYjzMejn.js";
|
|
9
11
|
// src/topology/threeHelpers.ts
|
|
10
12
|
/**
|
|
11
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -729,6 +731,10 @@ function removeFaces(shape, faces) {
|
|
|
729
731
|
* Provides chamferDistAngle(), which chamfers edges using one distance
|
|
730
732
|
* measured along one face and one angle that determines the chamfer on the
|
|
731
733
|
* other, and chamferDistAngles(), which gives each edge its own pair.
|
|
734
|
+
*
|
|
735
|
+
* Face origins, tags and colors carry over to the faces a chamfer keeps where
|
|
736
|
+
* the kernel reports face history for it (occt-wasm 5.11.0 or later);
|
|
737
|
+
* elsewhere only face origins do.
|
|
732
738
|
*/
|
|
733
739
|
function validateDistAngle(distance, angleDeg) {
|
|
734
740
|
if (distance <= 0) return err(validationError("CHAMFER_ANGLE_BAD_DISTANCE", `distance must be positive, got ${distance}`, void 0, { distance }));
|
|
@@ -746,10 +752,31 @@ function chamferAngleFailed(operation, e, edges, metadata) {
|
|
|
746
752
|
}, failedEdges && failedEdges.length > 0 ? "The chamfer could not be built on metadata.failedEdges: use a smaller distance there, or leave those edges out" : void 0));
|
|
747
753
|
}
|
|
748
754
|
/**
|
|
755
|
+
* Chamfer `entries` with the kernel's distance-angle chamfer that reports face
|
|
756
|
+
* history. A kernel without one, or a build that rejects it as unsupported
|
|
757
|
+
* (occt-wasm before 5.11), runs `withoutHistory` instead.
|
|
758
|
+
*/
|
|
759
|
+
function buildChamfer(shape, entries, withoutHistory) {
|
|
760
|
+
const kernel = getKernel();
|
|
761
|
+
if (kernel.chamferDistAnglesWithHistory) try {
|
|
762
|
+
const { shape: raw, evolution } = kernel.chamferDistAnglesWithHistory(shape.wrapped, entries, collectInputFaceHashes([shape]), HASH_CODE_MAX);
|
|
763
|
+
return {
|
|
764
|
+
raw,
|
|
765
|
+
evolution
|
|
766
|
+
};
|
|
767
|
+
} catch (e) {
|
|
768
|
+
if (!isUnsupportedKernelOperationError(e)) throw e;
|
|
769
|
+
}
|
|
770
|
+
return {
|
|
771
|
+
raw: withoutHistory(),
|
|
772
|
+
evolution: void 0
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
749
776
|
* Cast a fresh kernel result to a 3D shape, releasing every intermediate slot,
|
|
750
|
-
* and carry the face
|
|
777
|
+
* and carry the face metadata of `input` over to it.
|
|
751
778
|
*/
|
|
752
|
-
function castChamferResult(input, raw) {
|
|
779
|
+
function castChamferResult(input, { raw, evolution }) {
|
|
753
780
|
const downcastResult = downcast(raw);
|
|
754
781
|
if (isErr(downcastResult)) {
|
|
755
782
|
getKernel().dispose(raw);
|
|
@@ -761,7 +788,8 @@ function castChamferResult(input, raw) {
|
|
|
761
788
|
disposeResultShape(wrapped);
|
|
762
789
|
return err(typeCastError("CHAMFER_ANGLE_NOT_3D", "chamferDistAngle did not produce a 3D shape"));
|
|
763
790
|
}
|
|
764
|
-
|
|
791
|
+
if (evolution) propagateAllMetadata(evolution, [input], wrapped);
|
|
792
|
+
else propagateMetadataByHash([input], wrapped);
|
|
765
793
|
return ok(wrapped);
|
|
766
794
|
}
|
|
767
795
|
/**
|
|
@@ -785,10 +813,14 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
785
813
|
const invalid = validateDistAngle(distance, angleDeg);
|
|
786
814
|
if (invalid) return invalid;
|
|
787
815
|
const kernel = getKernel();
|
|
788
|
-
let
|
|
816
|
+
let built;
|
|
789
817
|
try {
|
|
790
818
|
const rawEdges = edges.map((e) => e.wrapped);
|
|
791
|
-
|
|
819
|
+
built = buildChamfer(shape, rawEdges.map((edge) => ({
|
|
820
|
+
edge,
|
|
821
|
+
distance,
|
|
822
|
+
angleDeg
|
|
823
|
+
})), () => kernel.chamferDistAngle(shape.wrapped, rawEdges, distance, angleDeg));
|
|
792
824
|
} catch (e) {
|
|
793
825
|
if (isUnsupportedKernelOperationError(e)) return err(unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, `chamferDistAngle: the ${kernel.kernelId} kernel has no distance-angle chamfer`, e, { kernel: kernel.kernelId }, "Chamfer by one symmetric distance instead, or use the occt-wasm kernel"));
|
|
794
826
|
return chamferAngleFailed("chamferDistAngle", e, edges, {
|
|
@@ -797,24 +829,32 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
797
829
|
edgeCount: edges.length
|
|
798
830
|
});
|
|
799
831
|
}
|
|
800
|
-
return castChamferResult(shape,
|
|
832
|
+
return castChamferResult(shape, built);
|
|
801
833
|
}
|
|
802
|
-
function perEdgeUnsupported(kernelId, cause) {
|
|
803
|
-
return err(unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, `chamferDistAngles: the ${kernelId} kernel cannot give each edge its own distance and angle`, cause, { kernel: kernelId }, "Use the occt-wasm kernel (5.9.0 or later), or give every edge the same { distance, angle } on a kernel that has a distance-angle chamfer"));
|
|
834
|
+
function perEdgeUnsupported(kernelId, cause, facesGiven) {
|
|
835
|
+
return err(unsupportedError(BrepErrorCode.UNSUPPORTED_CAPABILITY, facesGiven ? `chamferDistAngles: the ${kernelId} kernel cannot measure a distance-angle chamfer from a given face` : `chamferDistAngles: the ${kernelId} kernel cannot give each edge its own distance and angle`, cause, { kernel: kernelId }, facesGiven ? "Use the occt-wasm kernel (5.9.0 or later), or leave out face so the kernel picks it" : "Use the occt-wasm kernel (5.9.0 or later), or give every edge the same { distance, angle } on a kernel that has a distance-angle chamfer"));
|
|
836
|
+
}
|
|
837
|
+
/** The first entry whose `face` is not one of the faces of `shape` its edge joins. */
|
|
838
|
+
function entryWithStrayFace(shape, entries) {
|
|
839
|
+
return entries.find(({ edge, face }) => face !== void 0 && !facesOfEdge(shape, edge).some((f) => isSameShape(f, face)));
|
|
804
840
|
}
|
|
805
841
|
/**
|
|
806
842
|
* Chamfer each edge by its own distance and angle, in one operation.
|
|
807
843
|
*
|
|
808
|
-
* Edges that all share one distance and angle
|
|
809
|
-
* {@link chamferDistAngle}, which every kernel but brepkit provides.
|
|
810
|
-
* values need a kernel with a per-edge distance-angle
|
|
811
|
-
* or later); on any other kernel the result is an
|
|
812
|
-
* occt-wasm the edges of one
|
|
813
|
-
*
|
|
844
|
+
* Edges that all share one distance and angle, with no reference face given,
|
|
845
|
+
* go through {@link chamferDistAngle}, which every kernel but brepkit provides.
|
|
846
|
+
* Different values, or any `face`, need a kernel with a per-edge distance-angle
|
|
847
|
+
* chamfer (occt-wasm 5.9.0 or later); on any other kernel the result is an
|
|
848
|
+
* `UNSUPPORTED_CAPABILITY` error. On occt-wasm the edges of one
|
|
849
|
+
* tangent-continuous contour must state the same chamfer, or the result is
|
|
850
|
+
* `CHAMFER_ANGLE_FAILED`; from 5.11.0 an edge may state it from the face on
|
|
851
|
+
* the other side of the contour.
|
|
814
852
|
*
|
|
815
853
|
* @param shape - The 3D shape to chamfer.
|
|
816
|
-
* @param entries - Each edge with its distance
|
|
817
|
-
*
|
|
854
|
+
* @param entries - Each edge with its distance, angle and optional reference
|
|
855
|
+
* face (must not be empty).
|
|
856
|
+
* @returns Ok with the chamfered shape, or Err on invalid input (a `face` not
|
|
857
|
+
* adjacent to its edge is `CHAMFER_ANGLE_FACE_NOT_ADJACENT`), an unsupported
|
|
818
858
|
* kernel, or kernel failure.
|
|
819
859
|
*/
|
|
820
860
|
function chamferDistAngles(shape, entries) {
|
|
@@ -824,23 +864,31 @@ function chamferDistAngles(shape, entries) {
|
|
|
824
864
|
const invalid = validateDistAngle(distance, angle);
|
|
825
865
|
if (invalid) return invalid;
|
|
826
866
|
}
|
|
867
|
+
const stray = entryWithStrayFace(shape, entries);
|
|
868
|
+
if (stray) return err(validationError("CHAMFER_ANGLE_FACE_NOT_ADJACENT", "chamferDistAngles: a reference face is not one of the two faces its edge joins", void 0, {
|
|
869
|
+
edge: stray.edge,
|
|
870
|
+
face: stray.face
|
|
871
|
+
}, "Pick the face from facesOfEdge(shape, edge) on the shape being chamfered, or leave out face"));
|
|
827
872
|
const edges = entries.map((e) => e.edge);
|
|
828
|
-
|
|
873
|
+
const facesGiven = entries.some((e) => e.face !== void 0);
|
|
874
|
+
if (entries.every((e) => e.distance === first.distance && e.angle === first.angle) && !facesGiven) return chamferDistAngle(shape, edges, first.distance, first.angle);
|
|
829
875
|
const kernel = getKernel();
|
|
830
876
|
const perEdge = kernel.chamferDistAngles?.bind(kernel);
|
|
831
|
-
if (!perEdge) return perEdgeUnsupported(kernel.kernelId, void 0);
|
|
832
|
-
|
|
877
|
+
if (!perEdge) return perEdgeUnsupported(kernel.kernelId, void 0, facesGiven);
|
|
878
|
+
const kernelEntries = entries.map(({ edge, distance, angle, face }) => ({
|
|
879
|
+
edge: edge.wrapped,
|
|
880
|
+
distance,
|
|
881
|
+
angleDeg: angle,
|
|
882
|
+
face: face?.wrapped
|
|
883
|
+
}));
|
|
884
|
+
let built;
|
|
833
885
|
try {
|
|
834
|
-
|
|
835
|
-
edge: edge.wrapped,
|
|
836
|
-
distance,
|
|
837
|
-
angleDeg: angle
|
|
838
|
-
})));
|
|
886
|
+
built = buildChamfer(shape, kernelEntries, () => perEdge(shape.wrapped, kernelEntries));
|
|
839
887
|
} catch (e) {
|
|
840
|
-
if (isUnsupportedKernelOperationError(e)) return perEdgeUnsupported(kernel.kernelId, e);
|
|
888
|
+
if (isUnsupportedKernelOperationError(e)) return perEdgeUnsupported(kernel.kernelId, e, facesGiven);
|
|
841
889
|
return chamferAngleFailed("chamferDistAngles", e, edges, { edgeCount: entries.length });
|
|
842
890
|
}
|
|
843
|
-
return castChamferResult(shape,
|
|
891
|
+
return castChamferResult(shape, built);
|
|
844
892
|
}
|
|
845
893
|
// src/topology/nurbsFns.ts
|
|
846
894
|
/**
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-BNOuP9DA.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-s0LddGkF.cjs");
|
|
5
5
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_booleanFns = require("./booleanFns-
|
|
6
|
+
const require_faceFns = require("./faceFns-C7wBHMPv.cjs");
|
|
7
|
+
const require_booleanFns = require("./booleanFns-MkzdfjDv.cjs");
|
|
8
|
+
const require_shapeFns = require("./shapeFns-Rmgd4x9I.cjs");
|
|
8
9
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
10
|
+
const require_adjacencyFns = require("./adjacencyFns-BXzEHSC5.cjs");
|
|
9
11
|
// src/topology/threeHelpers.ts
|
|
10
12
|
/**
|
|
11
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -729,6 +731,10 @@ function removeFaces(shape, faces) {
|
|
|
729
731
|
* Provides chamferDistAngle(), which chamfers edges using one distance
|
|
730
732
|
* measured along one face and one angle that determines the chamfer on the
|
|
731
733
|
* other, and chamferDistAngles(), which gives each edge its own pair.
|
|
734
|
+
*
|
|
735
|
+
* Face origins, tags and colors carry over to the faces a chamfer keeps where
|
|
736
|
+
* the kernel reports face history for it (occt-wasm 5.11.0 or later);
|
|
737
|
+
* elsewhere only face origins do.
|
|
732
738
|
*/
|
|
733
739
|
function validateDistAngle(distance, angleDeg) {
|
|
734
740
|
if (distance <= 0) return require_errors.err(require_errors.validationError("CHAMFER_ANGLE_BAD_DISTANCE", `distance must be positive, got ${distance}`, void 0, { distance }));
|
|
@@ -746,10 +752,31 @@ function chamferAngleFailed(operation, e, edges, metadata) {
|
|
|
746
752
|
}, failedEdges && failedEdges.length > 0 ? "The chamfer could not be built on metadata.failedEdges: use a smaller distance there, or leave those edges out" : void 0));
|
|
747
753
|
}
|
|
748
754
|
/**
|
|
755
|
+
* Chamfer `entries` with the kernel's distance-angle chamfer that reports face
|
|
756
|
+
* history. A kernel without one, or a build that rejects it as unsupported
|
|
757
|
+
* (occt-wasm before 5.11), runs `withoutHistory` instead.
|
|
758
|
+
*/
|
|
759
|
+
function buildChamfer(shape, entries, withoutHistory) {
|
|
760
|
+
const kernel = require_shapeTypes.getKernel();
|
|
761
|
+
if (kernel.chamferDistAnglesWithHistory) try {
|
|
762
|
+
const { shape: raw, evolution } = kernel.chamferDistAnglesWithHistory(shape.wrapped, entries, require_booleanFns.collectInputFaceHashes([shape]), require_constants.HASH_CODE_MAX);
|
|
763
|
+
return {
|
|
764
|
+
raw,
|
|
765
|
+
evolution
|
|
766
|
+
};
|
|
767
|
+
} catch (e) {
|
|
768
|
+
if (!require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) throw e;
|
|
769
|
+
}
|
|
770
|
+
return {
|
|
771
|
+
raw: withoutHistory(),
|
|
772
|
+
evolution: void 0
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
749
776
|
* Cast a fresh kernel result to a 3D shape, releasing every intermediate slot,
|
|
750
|
-
* and carry the face
|
|
777
|
+
* and carry the face metadata of `input` over to it.
|
|
751
778
|
*/
|
|
752
|
-
function castChamferResult(input, raw) {
|
|
779
|
+
function castChamferResult(input, { raw, evolution }) {
|
|
753
780
|
const downcastResult = require_faceFns.downcast(raw);
|
|
754
781
|
if (require_errors.isErr(downcastResult)) {
|
|
755
782
|
require_shapeTypes.getKernel().dispose(raw);
|
|
@@ -761,7 +788,8 @@ function castChamferResult(input, raw) {
|
|
|
761
788
|
require_shapeTypes.disposeResultShape(wrapped);
|
|
762
789
|
return require_errors.err(require_errors.typeCastError("CHAMFER_ANGLE_NOT_3D", "chamferDistAngle did not produce a 3D shape"));
|
|
763
790
|
}
|
|
764
|
-
require_booleanFns.
|
|
791
|
+
if (evolution) require_booleanFns.propagateAllMetadata(evolution, [input], wrapped);
|
|
792
|
+
else require_booleanFns.propagateMetadataByHash([input], wrapped);
|
|
765
793
|
return require_errors.ok(wrapped);
|
|
766
794
|
}
|
|
767
795
|
/**
|
|
@@ -785,10 +813,14 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
785
813
|
const invalid = validateDistAngle(distance, angleDeg);
|
|
786
814
|
if (invalid) return invalid;
|
|
787
815
|
const kernel = require_shapeTypes.getKernel();
|
|
788
|
-
let
|
|
816
|
+
let built;
|
|
789
817
|
try {
|
|
790
818
|
const rawEdges = edges.map((e) => e.wrapped);
|
|
791
|
-
|
|
819
|
+
built = buildChamfer(shape, rawEdges.map((edge) => ({
|
|
820
|
+
edge,
|
|
821
|
+
distance,
|
|
822
|
+
angleDeg
|
|
823
|
+
})), () => kernel.chamferDistAngle(shape.wrapped, rawEdges, distance, angleDeg));
|
|
792
824
|
} catch (e) {
|
|
793
825
|
if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) return require_errors.err(require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `chamferDistAngle: the ${kernel.kernelId} kernel has no distance-angle chamfer`, e, { kernel: kernel.kernelId }, "Chamfer by one symmetric distance instead, or use the occt-wasm kernel"));
|
|
794
826
|
return chamferAngleFailed("chamferDistAngle", e, edges, {
|
|
@@ -797,24 +829,32 @@ function chamferDistAngle(shape, edges, distance, angleDeg) {
|
|
|
797
829
|
edgeCount: edges.length
|
|
798
830
|
});
|
|
799
831
|
}
|
|
800
|
-
return castChamferResult(shape,
|
|
832
|
+
return castChamferResult(shape, built);
|
|
801
833
|
}
|
|
802
|
-
function perEdgeUnsupported(kernelId, cause) {
|
|
803
|
-
return require_errors.err(require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, `chamferDistAngles: the ${kernelId} kernel cannot give each edge its own distance and angle`, cause, { kernel: kernelId }, "Use the occt-wasm kernel (5.9.0 or later), or give every edge the same { distance, angle } on a kernel that has a distance-angle chamfer"));
|
|
834
|
+
function perEdgeUnsupported(kernelId, cause, facesGiven) {
|
|
835
|
+
return require_errors.err(require_errors.unsupportedError(require_errors.BrepErrorCode.UNSUPPORTED_CAPABILITY, facesGiven ? `chamferDistAngles: the ${kernelId} kernel cannot measure a distance-angle chamfer from a given face` : `chamferDistAngles: the ${kernelId} kernel cannot give each edge its own distance and angle`, cause, { kernel: kernelId }, facesGiven ? "Use the occt-wasm kernel (5.9.0 or later), or leave out face so the kernel picks it" : "Use the occt-wasm kernel (5.9.0 or later), or give every edge the same { distance, angle } on a kernel that has a distance-angle chamfer"));
|
|
836
|
+
}
|
|
837
|
+
/** The first entry whose `face` is not one of the faces of `shape` its edge joins. */
|
|
838
|
+
function entryWithStrayFace(shape, entries) {
|
|
839
|
+
return entries.find(({ edge, face }) => face !== void 0 && !require_adjacencyFns.facesOfEdge(shape, edge).some((f) => require_shapeFns.isSameShape(f, face)));
|
|
804
840
|
}
|
|
805
841
|
/**
|
|
806
842
|
* Chamfer each edge by its own distance and angle, in one operation.
|
|
807
843
|
*
|
|
808
|
-
* Edges that all share one distance and angle
|
|
809
|
-
* {@link chamferDistAngle}, which every kernel but brepkit provides.
|
|
810
|
-
* values need a kernel with a per-edge distance-angle
|
|
811
|
-
* or later); on any other kernel the result is an
|
|
812
|
-
* occt-wasm the edges of one
|
|
813
|
-
*
|
|
844
|
+
* Edges that all share one distance and angle, with no reference face given,
|
|
845
|
+
* go through {@link chamferDistAngle}, which every kernel but brepkit provides.
|
|
846
|
+
* Different values, or any `face`, need a kernel with a per-edge distance-angle
|
|
847
|
+
* chamfer (occt-wasm 5.9.0 or later); on any other kernel the result is an
|
|
848
|
+
* `UNSUPPORTED_CAPABILITY` error. On occt-wasm the edges of one
|
|
849
|
+
* tangent-continuous contour must state the same chamfer, or the result is
|
|
850
|
+
* `CHAMFER_ANGLE_FAILED`; from 5.11.0 an edge may state it from the face on
|
|
851
|
+
* the other side of the contour.
|
|
814
852
|
*
|
|
815
853
|
* @param shape - The 3D shape to chamfer.
|
|
816
|
-
* @param entries - Each edge with its distance
|
|
817
|
-
*
|
|
854
|
+
* @param entries - Each edge with its distance, angle and optional reference
|
|
855
|
+
* face (must not be empty).
|
|
856
|
+
* @returns Ok with the chamfered shape, or Err on invalid input (a `face` not
|
|
857
|
+
* adjacent to its edge is `CHAMFER_ANGLE_FACE_NOT_ADJACENT`), an unsupported
|
|
818
858
|
* kernel, or kernel failure.
|
|
819
859
|
*/
|
|
820
860
|
function chamferDistAngles(shape, entries) {
|
|
@@ -824,23 +864,31 @@ function chamferDistAngles(shape, entries) {
|
|
|
824
864
|
const invalid = validateDistAngle(distance, angle);
|
|
825
865
|
if (invalid) return invalid;
|
|
826
866
|
}
|
|
867
|
+
const stray = entryWithStrayFace(shape, entries);
|
|
868
|
+
if (stray) return require_errors.err(require_errors.validationError("CHAMFER_ANGLE_FACE_NOT_ADJACENT", "chamferDistAngles: a reference face is not one of the two faces its edge joins", void 0, {
|
|
869
|
+
edge: stray.edge,
|
|
870
|
+
face: stray.face
|
|
871
|
+
}, "Pick the face from facesOfEdge(shape, edge) on the shape being chamfered, or leave out face"));
|
|
827
872
|
const edges = entries.map((e) => e.edge);
|
|
828
|
-
|
|
873
|
+
const facesGiven = entries.some((e) => e.face !== void 0);
|
|
874
|
+
if (entries.every((e) => e.distance === first.distance && e.angle === first.angle) && !facesGiven) return chamferDistAngle(shape, edges, first.distance, first.angle);
|
|
829
875
|
const kernel = require_shapeTypes.getKernel();
|
|
830
876
|
const perEdge = kernel.chamferDistAngles?.bind(kernel);
|
|
831
|
-
if (!perEdge) return perEdgeUnsupported(kernel.kernelId, void 0);
|
|
832
|
-
|
|
877
|
+
if (!perEdge) return perEdgeUnsupported(kernel.kernelId, void 0, facesGiven);
|
|
878
|
+
const kernelEntries = entries.map(({ edge, distance, angle, face }) => ({
|
|
879
|
+
edge: edge.wrapped,
|
|
880
|
+
distance,
|
|
881
|
+
angleDeg: angle,
|
|
882
|
+
face: face?.wrapped
|
|
883
|
+
}));
|
|
884
|
+
let built;
|
|
833
885
|
try {
|
|
834
|
-
|
|
835
|
-
edge: edge.wrapped,
|
|
836
|
-
distance,
|
|
837
|
-
angleDeg: angle
|
|
838
|
-
})));
|
|
886
|
+
built = buildChamfer(shape, kernelEntries, () => perEdge(shape.wrapped, kernelEntries));
|
|
839
887
|
} catch (e) {
|
|
840
|
-
if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) return perEdgeUnsupported(kernel.kernelId, e);
|
|
888
|
+
if (require_occtWasmAdapter.isUnsupportedKernelOperationError(e)) return perEdgeUnsupported(kernel.kernelId, e, facesGiven);
|
|
841
889
|
return chamferAngleFailed("chamferDistAngles", e, edges, { edgeCount: entries.length });
|
|
842
890
|
}
|
|
843
|
-
return castChamferResult(shape,
|
|
891
|
+
return castChamferResult(shape, built);
|
|
844
892
|
}
|
|
845
893
|
// src/topology/nurbsFns.ts
|
|
846
894
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BjitsJRQ.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-s0LddGkF.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-C7wBHMPv.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-Rmgd4x9I.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-HtjEh2W-.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-Bi62maOJ.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-DbPghQD3.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-J2ae_Gvc.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 { n as measureArea } from "./measureFns-
|
|
6
|
+
import { l as normalAt, s as getSurfaceType } from "./faceFns-DaPoCzd-.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-DgpWLKra.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-RjNVzxNc.js";
|
|
9
|
+
import { n as measureArea } from "./measureFns-DivR02Xb.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
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BjitsJRQ.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-s0LddGkF.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-Bs2NA3xl.cjs");
|
|
7
|
+
const require_meshFns = require("./meshFns-8MTf0Lo_.cjs");
|
|
8
8
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
9
|
-
const require_blueprint = require("./blueprint-
|
|
9
|
+
const require_blueprint = require("./blueprint-464KGkzc.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) {
|
|
@@ -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-DbPghQD3.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-J2ae_Gvc.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-BUI_fGzR.js";
|
|
7
|
+
import { u as igesUnsupportedError } from "./meshFns-CcuY52tt.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-D-4-uTkr.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) {
|
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-8MTf0Lo_.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-CotbQ9l7.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-CcuY52tt.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-DR7Adv-W.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BooleanOptions, DiagnosticOperationResult, KernelShape, KernelType, OperationResult } from '../types.js';
|
|
2
|
+
import { ChamferDistAngleEdge } from './modifierOps.js';
|
|
2
3
|
export interface KernelEvolutionOps {
|
|
3
4
|
translateWithHistory(shape: KernelShape, x: number, y: number, z: number, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
4
5
|
/** {@link KernelTransformOps.rotate} with face history: `angle` is in radians. */
|
|
@@ -18,6 +19,13 @@ export interface KernelEvolutionOps {
|
|
|
18
19
|
cutAllWithHistory?: ((shape: KernelShape, tools: KernelShape[], inputFaceHashes: number[], hashUpperBound: number, options?: BooleanOptions) => DiagnosticOperationResult) | undefined;
|
|
19
20
|
filletWithHistory(shape: KernelShape, edges: KernelShape[], radius: number | [number, number] | ((edge: KernelShape) => number | [number, number]), inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
20
21
|
chamferWithHistory(shape: KernelShape, edges: KernelShape[], distance: number | [number, number] | ((edge: KernelShape) => number | [number, number]), inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
22
|
+
/**
|
|
23
|
+
* {@link KernelModifierOps.chamferDistAngles} with face history. Optional, and
|
|
24
|
+
* may throw `UnsupportedKernelOperationError` on a build without it: there a
|
|
25
|
+
* distance-angle chamfer carries over face origins only, matched by hash and
|
|
26
|
+
* geometry.
|
|
27
|
+
*/
|
|
28
|
+
chamferDistAnglesWithHistory?(shape: KernelShape, edges: ReadonlyArray<ChamferDistAngleEdge>, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
21
29
|
shellWithHistory(shape: KernelShape, faces: KernelShape[], thickness: number, inputFaceHashes: number[], hashUpperBound: number, tolerance?: number): OperationResult;
|
|
22
30
|
thickenWithHistory(shape: KernelShape, thickness: number, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
23
31
|
offsetWithHistory(shape: KernelShape, distance: number, inputFaceHashes: number[], hashUpperBound: number, tolerance?: number): OperationResult;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { KernelShape } from '../types.js';
|
|
2
|
+
/** One edge of a distance-angle chamfer that gives each edge its own values. */
|
|
3
|
+
export interface ChamferDistAngleEdge {
|
|
4
|
+
readonly edge: KernelShape;
|
|
5
|
+
/** Setback on the reference face. */
|
|
6
|
+
readonly distance: number;
|
|
7
|
+
/** Angle from the reference face, in degrees. */
|
|
8
|
+
readonly angleDeg: number;
|
|
9
|
+
/**
|
|
10
|
+
* The reference face, one of the two faces the edge joins. Omitted, the
|
|
11
|
+
* kernel picks it as {@link KernelModifierOps.chamferDistAngle} does.
|
|
12
|
+
*/
|
|
13
|
+
readonly face?: KernelShape | undefined;
|
|
14
|
+
}
|
|
2
15
|
export interface KernelModifierOps {
|
|
3
16
|
fillet(shape: KernelShape, edges: KernelShape[], radius: number | [number, number] | ((edge: KernelShape) => number | [number, number])): KernelShape;
|
|
4
17
|
chamfer(shape: KernelShape, edges: KernelShape[], distance: number | [number, number] | ((edge: KernelShape) => number | [number, number])): KernelShape;
|
|
5
18
|
chamferDistAngle(shape: KernelShape, edges: KernelShape[], distance: number, angleDeg: number): KernelShape;
|
|
6
19
|
/**
|
|
7
20
|
* Distance-angle chamfer with its own values on each edge, in one operation:
|
|
8
|
-
* `distance` is set back on the edge's reference face (
|
|
9
|
-
* picks it) and `angleDeg` is measured from that face.
|
|
21
|
+
* `distance` is set back on the edge's reference face (its `face`, or as
|
|
22
|
+
* {@link chamferDistAngle} picks it) and `angleDeg` is measured from that face.
|
|
10
23
|
* Optional: kernels without it can chamfer by distance and angle only with
|
|
11
|
-
* one value for every edge.
|
|
24
|
+
* one value for every edge and no reference faces.
|
|
12
25
|
*/
|
|
13
|
-
chamferDistAngles?(shape: KernelShape, edges: ReadonlyArray<
|
|
14
|
-
edge: KernelShape;
|
|
15
|
-
distance: number;
|
|
16
|
-
angleDeg: number;
|
|
17
|
-
}>): KernelShape;
|
|
26
|
+
chamferDistAngles?(shape: KernelShape, edges: ReadonlyArray<ChamferDistAngleEdge>): KernelShape;
|
|
18
27
|
shell(shape: KernelShape, faces: KernelShape[], thickness: number, tolerance?: number): KernelShape;
|
|
19
28
|
thicken(shape: KernelShape, thickness: number): KernelShape;
|
|
20
29
|
offset(shape: KernelShape, distance: number, tolerance?: number): KernelShape;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BooleanOptions, DiagnosticOperationResult, KernelShape, KernelType, OperationResult } from '../types.js';
|
|
2
|
+
import { ChamferDistAngleEdge } from '../interfaces/modifierOps.js';
|
|
2
3
|
import { OcctKernelWasm, OcctWasmModule } from './occtWasmTypes.js';
|
|
3
4
|
import { EdgeValueSpec } from './helpers.js';
|
|
4
5
|
/**
|
|
@@ -19,6 +20,7 @@ export declare function fuseAllWithHistory(k: OcctKernelWasm, Module: OcctWasmMo
|
|
|
19
20
|
export declare function cutAllWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, tools: KernelShape[], inputFaceHashes: number[], hashUpperBound: number, options?: BooleanOptions): DiagnosticOperationResult;
|
|
20
21
|
export declare function filletWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, edges: KernelShape[], radius: EdgeValueSpec, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
21
22
|
export declare function chamferWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, edges: KernelShape[], distance: EdgeValueSpec, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
23
|
+
export declare function chamferDistAnglesWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, entries: ReadonlyArray<ChamferDistAngleEdge>, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
22
24
|
export declare function shellWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, faces: KernelShape[], thickness: number, inputFaceHashes: number[], hashUpperBound: number, tolerance?: number): OperationResult;
|
|
23
25
|
export declare function thickenWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, thickness: number, inputFaceHashes: number[], hashUpperBound: number): OperationResult;
|
|
24
26
|
export declare function offsetWithHistory(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, distance: number, inputFaceHashes: number[], hashUpperBound: number, tolerance?: number): OperationResult;
|
|
@@ -35,11 +35,17 @@ export type EdgeValueSpec = EdgeValue | ((edge: KernelShape) => EdgeValue);
|
|
|
35
35
|
* and `second`.
|
|
36
36
|
*/
|
|
37
37
|
export declare function runEdgeTreatment<T>(Module: OcctWasmModule, edges: KernelShape[], value: EdgeValueSpec, uniform: (edgeVec: EmVectorUint32, value: number) => T, perEdge: (edgeVec: EmVectorUint32, first: EmVectorDouble, second: EmVectorDouble) => T): T;
|
|
38
|
+
/**
|
|
39
|
+
* A per-edge chamfer's `referenceFaceIds`: empty when no edge names its
|
|
40
|
+
* reference face, else one id per edge, 0 where the facade picks the face.
|
|
41
|
+
*/
|
|
42
|
+
export declare function referenceFaceIds(faces: ReadonlyArray<KernelShape | undefined>): number[];
|
|
38
43
|
/** Each face's draft angle, in radians. */
|
|
39
44
|
export declare function draftAnglesRad(faces: readonly KernelShape[], angleDeg: number | ((face: KernelShape) => number)): number[];
|
|
40
45
|
/** The peer range still admits older builds, which lack the per-edge and unit entry points. */
|
|
41
46
|
export declare function needsOcctWasm59(what: string): UnsupportedKernelOperationError;
|
|
42
47
|
export declare function needsOcctWasm510(what: string): UnsupportedKernelOperationError;
|
|
48
|
+
export declare function needsOcctWasm511(what: string): UnsupportedKernelOperationError;
|
|
43
49
|
/**
|
|
44
50
|
* Rotate a shape from the kernel's default Z-axis to an arbitrary direction.
|
|
45
51
|
* Used by primitives whose creation API only takes a Z-aligned form.
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { KernelShape } from '../types.js';
|
|
2
|
+
import { ChamferDistAngleEdge } from '../interfaces/modifierOps.js';
|
|
2
3
|
import { OcctKernelWasm, OcctWasmModule } from './occtWasmTypes.js';
|
|
3
4
|
import { EdgeValueSpec } from './helpers.js';
|
|
4
5
|
export declare function fillet(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, edges: KernelShape[], radius: EdgeValueSpec): KernelShape;
|
|
5
6
|
export declare function chamfer(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, edges: KernelShape[], distance: EdgeValueSpec): KernelShape;
|
|
6
|
-
interface DistAngle {
|
|
7
|
-
readonly distance: number;
|
|
8
|
-
readonly angleDeg: number;
|
|
9
|
-
}
|
|
10
7
|
export declare function chamferDistAngle(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, edges: KernelShape[], distance: number, angleDeg: number): KernelShape;
|
|
11
|
-
export declare function chamferDistAngles(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, entries: ReadonlyArray<
|
|
12
|
-
edge: KernelShape;
|
|
13
|
-
} & DistAngle>): KernelShape;
|
|
8
|
+
export declare function chamferDistAngles(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, entries: ReadonlyArray<ChamferDistAngleEdge>): KernelShape;
|
|
14
9
|
export declare function shell(k: OcctKernelWasm, Module: OcctWasmModule, shape: KernelShape, faces: KernelShape[], thickness: number, tolerance?: number): KernelShape;
|
|
15
10
|
export declare function thicken(k: OcctKernelWasm, shape: KernelShape, thickness: number): KernelShape;
|
|
16
11
|
export declare function offset(k: OcctKernelWasm, shape: KernelShape, distance: number, tolerance?: number): KernelShape;
|
|
@@ -21,4 +16,3 @@ export declare function defeature(k: OcctKernelWasm, Module: OcctWasmModule, sha
|
|
|
21
16
|
export declare function offsetWire2D(k: OcctKernelWasm, wire: KernelShape, offset: number, joinType?: number | 'arc' | 'intersection' | 'tangent'): KernelShape;
|
|
22
17
|
export declare function simplify(k: OcctKernelWasm, shape: KernelShape): KernelShape;
|
|
23
18
|
export declare function reverseShape(k: OcctKernelWasm, shape: KernelShape): KernelShape;
|
|
24
|
-
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_occtWasmAdapter = require("../../occtWasmAdapter-
|
|
2
|
+
const require_occtWasmAdapter = require("../../occtWasmAdapter-BNOuP9DA.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|