brepjs 18.118.3 → 18.118.5
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-COWMJ1OX.cjs → adjacencyFns-CpyYIeax.cjs} +2 -2
- package/dist/{adjacencyFns-D026zKM3.js → adjacencyFns-cSvOB_Ze.js} +2 -2
- package/dist/{blueprint-BWO1xOcp.cjs → blueprint-D2GXPkIE.cjs} +17 -11
- package/dist/{blueprint-CWE241F5.js → blueprint-DLYo6s8j.js} +15 -10
- package/dist/{blueprintFns-D5_7KAuL.js → blueprintFns-Ds3dL4c8.js} +2 -2
- package/dist/{blueprintFns-DXXKh9Ex.cjs → blueprintFns-F0nZbsld.cjs} +2 -2
- package/dist/{blueprintSketcher-DADskw3h.cjs → blueprintSketcher-CgeBcSjd.cjs} +5 -4
- package/dist/{blueprintSketcher-JlCOsNp-.js → blueprintSketcher-u-yf9iTR.js} +5 -4
- package/dist/{boolean2D-Dz2WQyK7.cjs → boolean2D-CyNCdKrt.cjs} +7 -6
- package/dist/{boolean2D-B_JB01Pu.js → boolean2D-DbfzLbZ4.js} +5 -5
- package/dist/brepjs.cjs +29 -29
- package/dist/brepjs.js +29 -29
- package/dist/{cameraFns-BAm-2Clq.cjs → cameraFns-C3Xf7-I7.cjs} +2 -2
- package/dist/{cameraFns-CRln-7RT.js → cameraFns-DmLhH9Pr.js} +2 -2
- package/dist/core/shapeTypes.d.ts +40 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-DP74f1wh.cjs → cornerFinder-BOwew_zv.cjs} +1 -1
- package/dist/{cornerFinder-oxZraULr.js → cornerFinder-DL__YqRi.js} +1 -1
- package/dist/{curveFns-pGQFlJG-.js → curveFns-BAGamIGX.js} +1 -1
- package/dist/{curveFns-CpaxYpa4.cjs → curveFns-DVPQyYM7.cjs} +1 -1
- package/dist/{drawFns-BosHTxzi.cjs → drawFns-0R1HI7It.cjs} +14 -13
- package/dist/{drawFns-DKyAWSPe.js → drawFns-DPiGPDvQ.js} +14 -13
- package/dist/{faceFns-rbWcdpvj.cjs → faceFns-mARULpM7.cjs} +4 -3
- package/dist/{faceFns-Bc6sBrBV.js → faceFns-yqC4gDSc.js} +2 -2
- package/dist/{healingFns-DQquJMYs.cjs → healingFns-CM9gxI8q.cjs} +37 -34
- package/dist/{healingFns-CCsV3Ug-.js → healingFns-DHhGzFVL.js} +37 -34
- package/dist/{helpers-BuHUd7_4.js → helpers-CcpT5mna.js} +6 -6
- package/dist/{helpers-DlLQfATr.cjs → helpers-vBB_xxts.cjs} +6 -6
- package/dist/{importFns-Z6N8Addx.js → importFns-80hScxgP.js} +4 -4
- package/dist/{importFns-BRaiuN1y.cjs → importFns-BhatwR3O.cjs} +4 -4
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occtWasm/booleanOps.d.ts +9 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-BQktV4u4.cjs → loftFns-Bi5Osj4K.cjs} +1 -1
- package/dist/{loftFns-CXc9tRv6.js → loftFns-DtBK3brv.js} +1 -1
- package/dist/{measureFns-I5KcAgSb.cjs → measureFns-BD9_NT7u.cjs} +3 -3
- package/dist/{measureFns-B_vJqwDc.js → measureFns-CLWtxkh6.js} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-DVrZtr-f.js → meshFns-Cd2zde-k.js} +3 -3
- package/dist/{meshFns-BGmOr5aJ.cjs → meshFns-Cim4Y6vz.cjs} +3 -3
- package/dist/{occtWasmAdapter-B2TEQOjs.cjs → occtWasmAdapter-Bj9dX3Lb.cjs} +45 -10
- package/dist/{occtWasmAdapter-CKwtxwNH.js → occtWasmAdapter-wBLknH8f.js} +45 -10
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-DiOCVk8q.js → primitiveFns-BnZk1fEp.js} +4 -4
- package/dist/{primitiveFns-ht0yFv6T.cjs → primitiveFns-DpkSBopj.cjs} +4 -4
- 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-CEojVVeD.js → refResolveFns-CJ58ZH-S.js} +18 -11
- package/dist/{refResolveFns-Dku4ocdG.cjs → refResolveFns-TdGhQZUP.cjs} +18 -11
- package/dist/{shapeFns-C2pdUzdd.js → shapeFns-DjiKoRrd.js} +21 -12
- package/dist/{shapeFns-B1OEuRBI.cjs → shapeFns-DxbbLpGg.cjs} +21 -12
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-BLREi6xB.cjs → shapeTypes-BbUKvpaO.cjs} +104 -21
- package/dist/{shapeTypes-EI4Uxlsb.js → shapeTypes-Osdj5kMc.js} +81 -22
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-BOMmoOg7.cjs → solidBuilders-D3zaZO6E.cjs} +9 -18
- package/dist/{solidBuilders-BsAa59Dz.js → solidBuilders-DVBKEByu.js} +9 -18
- package/dist/{surfaceBuilders-C0pJwtCO.js → surfaceBuilders-CMUEd1bK.js} +2 -2
- package/dist/{surfaceBuilders-C-UhFlpS.cjs → surfaceBuilders-DDfVCOVg.cjs} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-bCq3ARXX.cjs → textBlueprints-Aicvgono.cjs} +9 -8
- package/dist/{textBlueprints-DU1Jqvx9.js → textBlueprints-iZABkf3e.js} +9 -8
- package/dist/{textMetrics-BltT5ICq.js → textMetrics-CpxOlmKV.js} +1 -1
- package/dist/{textMetrics-wX3dlabq.cjs → textMetrics-DjbEw5om.cjs} +1 -1
- package/dist/{threadFns-DluMGkMf.js → threadFns-CLgKc6Bl.js} +8 -8
- package/dist/{threadFns-BDdzaSTO.cjs → threadFns-aTVNbo4w.cjs} +8 -8
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-1PqfeHrV.cjs → topologyQueryFns-Cf2j9Zt0.cjs} +1 -1
- package/dist/{topologyQueryFns-BjgBf2t-.js → topologyQueryFns-DzOSCj5J.js} +1 -1
- package/package.json +13 -12
|
@@ -118,6 +118,46 @@ export declare function isShape1D<D extends Dimension>(s: AnyShape<D>): s is Sha
|
|
|
118
118
|
export declare function castShape<D extends Dimension = '3D'>(ocShape: KernelShape, dim?: D): AnyShape<D>;
|
|
119
119
|
/** Type-safe cast for shapes known to be 3D. */
|
|
120
120
|
export declare function castShape3D(ocShape: KernelShape): AnyShape;
|
|
121
|
+
/**
|
|
122
|
+
* Release the pre-downcast handle of a freshly-produced kernel result after it
|
|
123
|
+
* has been cast to `cast`.
|
|
124
|
+
*
|
|
125
|
+
* On occt-wasm `downcast` allocates a new arena slot and orphans the input; a
|
|
126
|
+
* handle's own `delete()` is a no-op there, so the input must be released via
|
|
127
|
+
* `getKernel().dispose()` to reclaim the slot. Kernels whose `downcast` is
|
|
128
|
+
* identity (manifold, brepkit) return the same handle as `cast`, so nothing is
|
|
129
|
+
* released — doing so would delete the shape being returned.
|
|
130
|
+
*
|
|
131
|
+
* Use only for a kernel result the caller owns outright — never for a shape
|
|
132
|
+
* received from elsewhere.
|
|
133
|
+
*/
|
|
134
|
+
export declare function disposeDowncastSource(source: KernelShape, cast: ShapeHandle): void;
|
|
135
|
+
/**
|
|
136
|
+
* Cast a freshly-produced kernel result to its branded type and release the
|
|
137
|
+
* orphaned pre-downcast handle. The result-owning counterpart to {@link castShape};
|
|
138
|
+
* see {@link disposeDowncastSource} for the arena semantics.
|
|
139
|
+
*/
|
|
140
|
+
export declare function castResultShape<D extends Dimension = '3D'>(ocShape: KernelShape, dim?: D): AnyShape<D>;
|
|
141
|
+
/**
|
|
142
|
+
* Fully release a transiently-branded sub-shape and the raw handle it was cast
|
|
143
|
+
* from — for a face/edge iterated only to read a property, then discarded.
|
|
144
|
+
*
|
|
145
|
+
* `handle`'s dispose updates stats and, on kernels that own their native object
|
|
146
|
+
* (Embind, manifold, brepkit), frees it. occt-wasm handles are arena-backed
|
|
147
|
+
* (their delete is a no-op), so when the downcast produced a distinct handle
|
|
148
|
+
* (`handle.wrapped !== rawSource`) both arena slots are released explicitly. The
|
|
149
|
+
* identity guard also skips manifold/brepkit — there `handle` *is* `rawSource`,
|
|
150
|
+
* already freed above, and their `dispose()` has no double-free guard.
|
|
151
|
+
*/
|
|
152
|
+
export declare function disposeTransientSubShape(handle: ShapeHandle, rawSource: KernelShape): void;
|
|
153
|
+
/**
|
|
154
|
+
* Release a branded shape on an error path — when a cast result is rejected and
|
|
155
|
+
* discarded. Releases the arena slot (occt-wasm's own `delete` is a no-op) then
|
|
156
|
+
* runs the handle's disposer for stats/registry. Safe on every kernel: the
|
|
157
|
+
* disposer's `delete()` runs inside createHandle's try/catch, so the repeated
|
|
158
|
+
* free after `getKernel().dispose()` is swallowed.
|
|
159
|
+
*/
|
|
160
|
+
export declare function disposeResultShape(handle: ShapeHandle): void;
|
|
121
161
|
/**
|
|
122
162
|
* Fast-path cast when the shape type is already known (e.g., from iterShapes).
|
|
123
163
|
* Skips the shapeType() WASM call — only performs downcast + branded handle creation.
|
package/dist/core.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
+
const require_shapeTypes = require("./shapeTypes-BbUKvpaO.cjs");
|
|
3
3
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
5
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { A as isValidSolid, B as is2D, C as isWire, D as isOrientedFace, E as isManifoldShell, F as validSolid, H as DisposalScope, I as getShapeKind, K as isLive, M as orientedFace, Q as withScopeResultAsync, S as isVertex, T as isClosedWire, U as createHandle, V as is3D, W as createKernelHandle, X as withScope, Z as withScopeResult, _ as isFace, b as isShell, g as isEdge, h as isCompound, j as manifoldShell, n as castShape, v as isShape1D, w as closedWire, x as isSolid, y as isShape3D } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { A as ok, B as unwrapOr, E as map, I as tryCatch, L as tryCatchAsync, O as mapErr, R as unwrap, T as isOk, V as unwrapOrElse, a as moduleInitError, b as err, c as sketcherStateError, d as validationError, g as OK, h as bug, i as kernelError, k as match, l as typeCastError, m as BrepBugError, n as computationError, o as queryError, r as ioError, u as unsupportedError, v as andThen, w as isErr, x as flatMap, y as collect, z as unwrapErr } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
4
4
|
import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-D24Y27N0.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
2
2
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
3
|
-
const require_helpers = require("./helpers-
|
|
3
|
+
const require_helpers = require("./helpers-vBB_xxts.cjs");
|
|
4
4
|
//#region src/query/cornerFinder.ts
|
|
5
5
|
var PI_2 = 2 * Math.PI;
|
|
6
6
|
function positiveHalfAngle(angle) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
2
2
|
import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
3
|
-
import { _ as samePoint, p as distance2d, u as angle2d } from "./helpers-
|
|
3
|
+
import { _ as samePoint, p as distance2d, u as angle2d } from "./helpers-CcpT5mna.js";
|
|
4
4
|
//#region src/query/cornerFinder.ts
|
|
5
5
|
var PI_2 = 2 * Math.PI;
|
|
6
6
|
function positiveHalfAngle(angle) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as isWire, g as isEdge, n as castShape, tt as getKernel } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { A as ok, b as err, l as typeCastError } from "./errors-DNWJsfVU.js";
|
|
3
3
|
//#region src/topology/curveFns.ts
|
|
4
4
|
/**
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
2
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_textBlueprints = require("./textBlueprints-Aicvgono.cjs");
|
|
2
|
+
const require_shapeTypes = require("./shapeTypes-BbUKvpaO.cjs");
|
|
3
3
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
4
4
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
5
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
5
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Cf2j9Zt0.cjs");
|
|
6
6
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
7
7
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
8
8
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
9
9
|
const require_planeOps = require("./planeOps-BA4HfgQu.cjs");
|
|
10
|
-
const require_faceFns = require("./faceFns-
|
|
11
|
-
const require_curveFns = require("./curveFns-
|
|
10
|
+
const require_faceFns = require("./faceFns-mARULpM7.cjs");
|
|
11
|
+
const require_curveFns = require("./curveFns-DVPQyYM7.cjs");
|
|
12
12
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
13
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
14
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
15
|
-
const require_helpers = require("./helpers-
|
|
16
|
-
const require_blueprint = require("./blueprint-
|
|
17
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
18
|
-
const require_boolean2D = require("./boolean2D-
|
|
19
|
-
const require_cameraFns = require("./cameraFns-
|
|
13
|
+
const require_surfaceBuilders = require("./surfaceBuilders-DDfVCOVg.cjs");
|
|
14
|
+
const require_blueprintSketcher = require("./blueprintSketcher-CgeBcSjd.cjs");
|
|
15
|
+
const require_helpers = require("./helpers-vBB_xxts.cjs");
|
|
16
|
+
const require_blueprint = require("./blueprint-D2GXPkIE.cjs");
|
|
17
|
+
const require_cornerFinder = require("./cornerFinder-BOwew_zv.cjs");
|
|
18
|
+
const require_boolean2D = require("./boolean2D-CyNCdKrt.cjs");
|
|
19
|
+
const require_cameraFns = require("./cameraFns-C3Xf7-I7.cjs");
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -451,7 +451,8 @@ var sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, sta
|
|
|
451
451
|
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : require_errors.unwrap(require_planeOps.resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin));
|
|
452
452
|
const stepSize = (stop - start) / pointsCount;
|
|
453
453
|
const points = [...Array(pointsCount + 1).keys()].map((t) => {
|
|
454
|
-
|
|
454
|
+
const point = func(start + t * stepSize);
|
|
455
|
+
return require_planeOps.planeToWorld(plane, point);
|
|
455
456
|
});
|
|
456
457
|
return new require_textBlueprints.Sketch(require_errors.unwrap(require_surfaceBuilders.assembleWire([scope.register(require_errors.unwrap(require_surfaceBuilders.makeBSplineApproximation(points, approximationConfig)))])), {
|
|
457
458
|
defaultOrigin: [...plane.origin],
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as _usingCtx, H as DisposalScope, d as createWire, o as createEdge, s as createFace, tt as getKernel } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { n as wasmIndex } from "./vec3-Dpha8d5k.js";
|
|
3
3
|
import { R as unwrap, h as bug, s as safeIndex } from "./errors-DNWJsfVU.js";
|
|
4
|
-
import { s as getEdges } from "./topologyQueryFns-
|
|
4
|
+
import { s as getEdges } from "./topologyQueryFns-DzOSCj5J.js";
|
|
5
5
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
6
6
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
7
7
|
import { d as vecNormalize, g as vecSub, h as vecScale, m as vecRotate, r as vecCross } from "./vecOps-SKPRvPH-.js";
|
|
8
8
|
import { a as planeToWorld, o as resolvePlane } from "./planeOps-DSjjtrjg.js";
|
|
9
|
-
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v 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 downcast } from "./faceFns-yqC4gDSc.js";
|
|
10
|
+
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-BAGamIGX.js";
|
|
11
11
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.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 { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-
|
|
15
|
-
import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } 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 wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } 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-CMUEd1bK.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-u-yf9iTR.js";
|
|
14
|
+
import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-CcpT5mna.js";
|
|
15
|
+
import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-DLYo6s8j.js";
|
|
16
|
+
import { t as cornerFinder } from "./cornerFinder-DL__YqRi.js";
|
|
17
|
+
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-DbfzLbZ4.js";
|
|
18
|
+
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-iZABkf3e.js";
|
|
19
|
+
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-DmLhH9Pr.js";
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -451,7 +451,8 @@ var sketchParametricFunction = (func, planeConfig = {}, { pointsCount = 400, sta
|
|
|
451
451
|
const plane = planeConfig.plane && typeof planeConfig.plane !== "string" ? { ...planeConfig.plane } : unwrap(resolvePlane(planeConfig.plane ?? "XY", planeConfig.origin));
|
|
452
452
|
const stepSize = (stop - start) / pointsCount;
|
|
453
453
|
const points = [...Array(pointsCount + 1).keys()].map((t) => {
|
|
454
|
-
|
|
454
|
+
const point = func(start + t * stepSize);
|
|
455
|
+
return planeToWorld(plane, point);
|
|
455
456
|
});
|
|
456
457
|
return new Sketch(unwrap(assembleWire([scope.register(unwrap(makeBSplineApproximation(points, approximationConfig)))])), {
|
|
457
458
|
defaultOrigin: [...plane.origin],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BbUKvpaO.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Cf2j9Zt0.cjs");
|
|
4
4
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
5
5
|
//#region src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -107,7 +107,8 @@ var KERNEL_TO_PUBLIC_SURFACE_TYPE = {
|
|
|
107
107
|
* @returns Ok with the surface type, or Err for unrecognized kernel surface types.
|
|
108
108
|
*/
|
|
109
109
|
function getSurfaceType(face) {
|
|
110
|
-
|
|
110
|
+
const kernelType = require_topologyQueryFns.getCachedSurfaceType(face);
|
|
111
|
+
return require_errors.ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[kernelType]);
|
|
111
112
|
}
|
|
112
113
|
/** Get the surface type of a face (unwrapped convenience). */
|
|
113
114
|
function faceGeomType(face) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as castShape, tt as getKernel } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { A as ok, R as unwrap, b as err, l as typeCastError } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { a as getCachedSurfaceType } from "./topologyQueryFns-
|
|
3
|
+
import { a as getCachedSurfaceType } from "./topologyQueryFns-DzOSCj5J.js";
|
|
4
4
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
5
5
|
//#region src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BbUKvpaO.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Cf2j9Zt0.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
|
-
const require_faceFns = require("./faceFns-
|
|
6
|
-
const require_shapeFns = require("./shapeFns-
|
|
5
|
+
const require_faceFns = require("./faceFns-mARULpM7.cjs");
|
|
6
|
+
const require_shapeFns = require("./shapeFns-DxbbLpGg.cjs");
|
|
7
7
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
8
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
8
|
+
const require_solidBuilders = require("./solidBuilders-D3zaZO6E.cjs");
|
|
9
9
|
//#region src/topology/threeHelpers.ts
|
|
10
10
|
/**
|
|
11
11
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -339,21 +339,12 @@ function validateNotNull$1(shape, label) {
|
|
|
339
339
|
function castToShape3D(shape, errorCode, errorMsg, suggestion) {
|
|
340
340
|
const wrapped = require_shapeTypes.castShape(shape);
|
|
341
341
|
if (!require_shapeTypes.isShape3D(wrapped)) {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
"COMPSOLID",
|
|
346
|
-
"SOLID",
|
|
347
|
-
"SHELL",
|
|
348
|
-
"FACE",
|
|
349
|
-
"WIRE",
|
|
350
|
-
"EDGE",
|
|
351
|
-
"VERTEX",
|
|
352
|
-
"SHAPE"
|
|
353
|
-
][shapeType] ?? `UNKNOWN(${shapeType})`;
|
|
354
|
-
wrapped[Symbol.dispose]();
|
|
342
|
+
const typeName = require_shapeTypes.getShapeKind(wrapped).toUpperCase();
|
|
343
|
+
require_shapeTypes.disposeDowncastSource(shape, wrapped);
|
|
344
|
+
require_shapeTypes.disposeResultShape(wrapped);
|
|
355
345
|
return require_errors.err(require_errors.typeCastError(errorCode, `${errorMsg}. Got ${typeName} instead.`, void 0, void 0, suggestion));
|
|
356
346
|
}
|
|
347
|
+
require_shapeTypes.disposeDowncastSource(shape, wrapped);
|
|
357
348
|
return require_errors.ok(wrapped);
|
|
358
349
|
}
|
|
359
350
|
function resolveEdgeCallback$1(selectedEdges, callbackFn) {
|
|
@@ -469,8 +460,11 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
469
460
|
}
|
|
470
461
|
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
471
462
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
472
|
-
const cast = require_shapeTypes.
|
|
473
|
-
if (!require_shapeTypes.isShape3D(cast))
|
|
463
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
464
|
+
if (!require_shapeTypes.isShape3D(cast)) {
|
|
465
|
+
require_shapeTypes.disposeResultShape(cast);
|
|
466
|
+
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
467
|
+
}
|
|
474
468
|
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
475
469
|
return require_errors.ok({
|
|
476
470
|
shape: cast,
|
|
@@ -513,8 +507,11 @@ function chamferWithEvolution(shape, edges, distance) {
|
|
|
513
507
|
}
|
|
514
508
|
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
515
509
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
516
|
-
const cast = require_shapeTypes.
|
|
517
|
-
if (!require_shapeTypes.isShape3D(cast))
|
|
510
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
511
|
+
if (!require_shapeTypes.isShape3D(cast)) {
|
|
512
|
+
require_shapeTypes.disposeResultShape(cast);
|
|
513
|
+
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
514
|
+
}
|
|
518
515
|
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
519
516
|
return require_errors.ok({
|
|
520
517
|
shape: cast,
|
|
@@ -545,8 +542,11 @@ function shellWithEvolution(shape, faces, thickness, tolerance = .001) {
|
|
|
545
542
|
try {
|
|
546
543
|
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
547
544
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
548
|
-
const cast = require_shapeTypes.
|
|
549
|
-
if (!require_shapeTypes.isShape3D(cast))
|
|
545
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
546
|
+
if (!require_shapeTypes.isShape3D(cast)) {
|
|
547
|
+
require_shapeTypes.disposeResultShape(cast);
|
|
548
|
+
return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
549
|
+
}
|
|
550
550
|
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
551
551
|
return require_errors.ok({
|
|
552
552
|
shape: cast,
|
|
@@ -638,8 +638,11 @@ function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
|
638
638
|
* Returns an error if the result is not a 3D shape.
|
|
639
639
|
*/
|
|
640
640
|
function finalizeShape3D(evolution, resultShape, inputs, not3dCode, not3dMessage) {
|
|
641
|
-
const cast = require_shapeTypes.
|
|
642
|
-
if (!require_shapeTypes.isShape3D(cast))
|
|
641
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
642
|
+
if (!require_shapeTypes.isShape3D(cast)) {
|
|
643
|
+
require_shapeTypes.disposeResultShape(cast);
|
|
644
|
+
return require_errors.err(require_errors.kernelError(not3dCode, not3dMessage));
|
|
645
|
+
}
|
|
643
646
|
require_shapeFns.propagateAllMetadata(evolution, inputs, cast);
|
|
644
647
|
return require_errors.ok(cast);
|
|
645
648
|
}
|
|
@@ -683,7 +686,7 @@ function thicken(shape, thickness) {
|
|
|
683
686
|
try {
|
|
684
687
|
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
685
688
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes, require_constants.HASH_CODE_MAX);
|
|
686
|
-
const cast = require_shapeTypes.
|
|
689
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
687
690
|
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
688
691
|
return require_errors.ok(cast);
|
|
689
692
|
} catch (e) {
|
|
@@ -736,7 +739,7 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
|
|
|
736
739
|
try {
|
|
737
740
|
const edgeShapes = filteredEdges.map((e) => e.wrapped);
|
|
738
741
|
if (!trackEvolution) {
|
|
739
|
-
const cast = require_shapeTypes.
|
|
742
|
+
const cast = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().fillet(shape.wrapped, edgeShapes, kernelRadius));
|
|
740
743
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
741
744
|
return require_errors.ok(cast);
|
|
742
745
|
}
|
|
@@ -809,13 +812,13 @@ function shell(shape, faces, thickness, tolerance = .001, { trackEvolution = tru
|
|
|
809
812
|
if (faces.length === 0) return require_errors.err(require_errors.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
810
813
|
try {
|
|
811
814
|
if (!trackEvolution) {
|
|
812
|
-
const cast = require_shapeTypes.
|
|
815
|
+
const cast = require_shapeTypes.castResultShape(require_shapeTypes.getKernel().shell(shape.wrapped, faces.map((f) => f.wrapped), thickness, tolerance));
|
|
813
816
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
814
817
|
return require_errors.ok(cast);
|
|
815
818
|
}
|
|
816
819
|
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
817
820
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
818
|
-
const cast = require_shapeTypes.
|
|
821
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
819
822
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
820
823
|
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
821
824
|
return require_errors.ok(cast);
|
|
@@ -841,7 +844,7 @@ function offset(shape, distance, tolerance = 1e-6) {
|
|
|
841
844
|
try {
|
|
842
845
|
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([shape]);
|
|
843
846
|
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, require_constants.HASH_CODE_MAX, tolerance);
|
|
844
|
-
const cast = require_shapeTypes.
|
|
847
|
+
const cast = require_shapeTypes.castResultShape(resultShape);
|
|
845
848
|
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
846
849
|
require_shapeFns.propagateAllMetadata(evolution, [shape], cast);
|
|
847
850
|
return require_errors.ok(cast);
|
|
@@ -922,13 +925,13 @@ function variableFillet(shape, edge, radii) {
|
|
|
922
925
|
radius: r.radius
|
|
923
926
|
}))
|
|
924
927
|
});
|
|
925
|
-
const wrapped = require_shapeTypes.
|
|
928
|
+
const wrapped = require_shapeTypes.castResultShape(kernel.filletVariable(shape.wrapped, spec));
|
|
926
929
|
if (!require_shapeTypes.isShape3D(wrapped)) {
|
|
927
|
-
|
|
930
|
+
require_shapeTypes.disposeResultShape(wrapped);
|
|
928
931
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet did not produce a 3D shape"));
|
|
929
932
|
}
|
|
930
933
|
if (!require_shapeTypes.isSolid(wrapped)) {
|
|
931
|
-
|
|
934
|
+
require_shapeTypes.disposeResultShape(wrapped);
|
|
932
935
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet did not produce a solid"));
|
|
933
936
|
}
|
|
934
937
|
return require_errors.ok(wrapped);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as isWire, I as getShapeKind, _ as isFace, f as disposeDowncastSource, n as castShape, p as disposeResultShape, t as castResultShape, tt as getKernel, x as isSolid, y as isShape3D } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { A as ok, T as isOk, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
3
|
+
import { c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-DzOSCj5J.js";
|
|
4
4
|
import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
|
|
5
|
-
import { v as downcast } from "./faceFns-
|
|
6
|
-
import { _ as collectInputFaceHashes, y as propagateAllMetadata } from "./shapeFns-
|
|
5
|
+
import { v as downcast } from "./faceFns-yqC4gDSc.js";
|
|
6
|
+
import { _ as collectInputFaceHashes, y as propagateAllMetadata } from "./shapeFns-DjiKoRrd.js";
|
|
7
7
|
import { t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
8
|
-
import { f as cut, h as fuseAll, m as fuse, p as cutAll } from "./solidBuilders-
|
|
8
|
+
import { f as cut, h as fuseAll, m as fuse, p as cutAll } from "./solidBuilders-DVBKEByu.js";
|
|
9
9
|
//#region src/topology/threeHelpers.ts
|
|
10
10
|
/**
|
|
11
11
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -339,21 +339,12 @@ function validateNotNull$1(shape, label) {
|
|
|
339
339
|
function castToShape3D(shape, errorCode, errorMsg, suggestion) {
|
|
340
340
|
const wrapped = castShape(shape);
|
|
341
341
|
if (!isShape3D(wrapped)) {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
"COMPSOLID",
|
|
346
|
-
"SOLID",
|
|
347
|
-
"SHELL",
|
|
348
|
-
"FACE",
|
|
349
|
-
"WIRE",
|
|
350
|
-
"EDGE",
|
|
351
|
-
"VERTEX",
|
|
352
|
-
"SHAPE"
|
|
353
|
-
][shapeType] ?? `UNKNOWN(${shapeType})`;
|
|
354
|
-
wrapped[Symbol.dispose]();
|
|
342
|
+
const typeName = getShapeKind(wrapped).toUpperCase();
|
|
343
|
+
disposeDowncastSource(shape, wrapped);
|
|
344
|
+
disposeResultShape(wrapped);
|
|
355
345
|
return err(typeCastError(errorCode, `${errorMsg}. Got ${typeName} instead.`, void 0, void 0, suggestion));
|
|
356
346
|
}
|
|
347
|
+
disposeDowncastSource(shape, wrapped);
|
|
357
348
|
return ok(wrapped);
|
|
358
349
|
}
|
|
359
350
|
function resolveEdgeCallback$1(selectedEdges, callbackFn) {
|
|
@@ -469,8 +460,11 @@ function filletWithEvolution(shape, edges, radius) {
|
|
|
469
460
|
}
|
|
470
461
|
const inputFaceHashes = collectInputFaceHashes([shape]);
|
|
471
462
|
const { shape: resultShape, evolution } = getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, HASH_CODE_MAX);
|
|
472
|
-
const cast =
|
|
473
|
-
if (!isShape3D(cast))
|
|
463
|
+
const cast = castResultShape(resultShape);
|
|
464
|
+
if (!isShape3D(cast)) {
|
|
465
|
+
disposeResultShape(cast);
|
|
466
|
+
return err(kernelError(BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
467
|
+
}
|
|
474
468
|
propagateAllMetadata(evolution, [shape], cast);
|
|
475
469
|
return ok({
|
|
476
470
|
shape: cast,
|
|
@@ -513,8 +507,11 @@ function chamferWithEvolution(shape, edges, distance) {
|
|
|
513
507
|
}
|
|
514
508
|
const inputFaceHashes = collectInputFaceHashes([shape]);
|
|
515
509
|
const { shape: resultShape, evolution } = getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, HASH_CODE_MAX);
|
|
516
|
-
const cast =
|
|
517
|
-
if (!isShape3D(cast))
|
|
510
|
+
const cast = castResultShape(resultShape);
|
|
511
|
+
if (!isShape3D(cast)) {
|
|
512
|
+
disposeResultShape(cast);
|
|
513
|
+
return err(kernelError(BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape"));
|
|
514
|
+
}
|
|
518
515
|
propagateAllMetadata(evolution, [shape], cast);
|
|
519
516
|
return ok({
|
|
520
517
|
shape: cast,
|
|
@@ -545,8 +542,11 @@ function shellWithEvolution(shape, faces, thickness, tolerance = .001) {
|
|
|
545
542
|
try {
|
|
546
543
|
const inputFaceHashes = collectInputFaceHashes([shape]);
|
|
547
544
|
const { shape: resultShape, evolution } = getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, HASH_CODE_MAX, tolerance);
|
|
548
|
-
const cast =
|
|
549
|
-
if (!isShape3D(cast))
|
|
545
|
+
const cast = castResultShape(resultShape);
|
|
546
|
+
if (!isShape3D(cast)) {
|
|
547
|
+
disposeResultShape(cast);
|
|
548
|
+
return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
549
|
+
}
|
|
550
550
|
propagateAllMetadata(evolution, [shape], cast);
|
|
551
551
|
return ok({
|
|
552
552
|
shape: cast,
|
|
@@ -638,8 +638,11 @@ function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
|
638
638
|
* Returns an error if the result is not a 3D shape.
|
|
639
639
|
*/
|
|
640
640
|
function finalizeShape3D(evolution, resultShape, inputs, not3dCode, not3dMessage) {
|
|
641
|
-
const cast =
|
|
642
|
-
if (!isShape3D(cast))
|
|
641
|
+
const cast = castResultShape(resultShape);
|
|
642
|
+
if (!isShape3D(cast)) {
|
|
643
|
+
disposeResultShape(cast);
|
|
644
|
+
return err(kernelError(not3dCode, not3dMessage));
|
|
645
|
+
}
|
|
643
646
|
propagateAllMetadata(evolution, inputs, cast);
|
|
644
647
|
return ok(cast);
|
|
645
648
|
}
|
|
@@ -683,7 +686,7 @@ function thicken(shape, thickness) {
|
|
|
683
686
|
try {
|
|
684
687
|
const inputFaceHashes = collectInputFaceHashes([shape]);
|
|
685
688
|
const { shape: resultShape, evolution } = getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes, HASH_CODE_MAX);
|
|
686
|
-
const cast =
|
|
689
|
+
const cast = castResultShape(resultShape);
|
|
687
690
|
propagateAllMetadata(evolution, [shape], cast);
|
|
688
691
|
return ok(cast);
|
|
689
692
|
} catch (e) {
|
|
@@ -736,7 +739,7 @@ function fillet(shape, edges, radius, { trackEvolution = true } = {}) {
|
|
|
736
739
|
try {
|
|
737
740
|
const edgeShapes = filteredEdges.map((e) => e.wrapped);
|
|
738
741
|
if (!trackEvolution) {
|
|
739
|
-
const cast =
|
|
742
|
+
const cast = castResultShape(getKernel().fillet(shape.wrapped, edgeShapes, kernelRadius));
|
|
740
743
|
if (!isShape3D(cast)) return err(kernelError(BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape"));
|
|
741
744
|
return ok(cast);
|
|
742
745
|
}
|
|
@@ -809,13 +812,13 @@ function shell(shape, faces, thickness, tolerance = .001, { trackEvolution = tru
|
|
|
809
812
|
if (faces.length === 0) return err(validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
810
813
|
try {
|
|
811
814
|
if (!trackEvolution) {
|
|
812
|
-
const cast =
|
|
815
|
+
const cast = castResultShape(getKernel().shell(shape.wrapped, faces.map((f) => f.wrapped), thickness, tolerance));
|
|
813
816
|
if (!isShape3D(cast)) return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
814
817
|
return ok(cast);
|
|
815
818
|
}
|
|
816
819
|
const inputFaceHashes = collectInputFaceHashes([shape]);
|
|
817
820
|
const { shape: resultShape, evolution } = getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, HASH_CODE_MAX, tolerance);
|
|
818
|
-
const cast =
|
|
821
|
+
const cast = castResultShape(resultShape);
|
|
819
822
|
if (!isShape3D(cast)) return err(kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
820
823
|
propagateAllMetadata(evolution, [shape], cast);
|
|
821
824
|
return ok(cast);
|
|
@@ -841,7 +844,7 @@ function offset(shape, distance, tolerance = 1e-6) {
|
|
|
841
844
|
try {
|
|
842
845
|
const inputFaceHashes = collectInputFaceHashes([shape]);
|
|
843
846
|
const { shape: resultShape, evolution } = getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, HASH_CODE_MAX, tolerance);
|
|
844
|
-
const cast =
|
|
847
|
+
const cast = castResultShape(resultShape);
|
|
845
848
|
if (!isShape3D(cast)) return err(kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
846
849
|
propagateAllMetadata(evolution, [shape], cast);
|
|
847
850
|
return ok(cast);
|
|
@@ -922,13 +925,13 @@ function variableFillet(shape, edge, radii) {
|
|
|
922
925
|
radius: r.radius
|
|
923
926
|
}))
|
|
924
927
|
});
|
|
925
|
-
const wrapped =
|
|
928
|
+
const wrapped = castResultShape(kernel.filletVariable(shape.wrapped, spec));
|
|
926
929
|
if (!isShape3D(wrapped)) {
|
|
927
|
-
wrapped
|
|
930
|
+
disposeResultShape(wrapped);
|
|
928
931
|
return err(kernelError(BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet did not produce a 3D shape"));
|
|
929
932
|
}
|
|
930
933
|
if (!isSolid(wrapped)) {
|
|
931
|
-
wrapped
|
|
934
|
+
disposeResultShape(wrapped);
|
|
932
935
|
return err(kernelError(BrepErrorCode.VARIABLE_FILLET_FAILED, "Variable-radius fillet did not produce a solid"));
|
|
933
936
|
}
|
|
934
937
|
return ok(wrapped);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as isFace, tt as getKernel } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { A as ok, T as isOk, b as err, h as bug, o as queryError } from "./errors-DNWJsfVU.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-DzOSCj5J.js";
|
|
4
4
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
5
5
|
import { a as vecDot, d as vecNormalize } from "./vecOps-SKPRvPH-.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-yqC4gDSc.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-DjiKoRrd.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-BAGamIGX.js";
|
|
9
|
+
import { n as measureArea } from "./measureFns-CLWtxkh6.js";
|
|
10
10
|
//#region 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-BbUKvpaO.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Cf2j9Zt0.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
5
|
const require_vecOps = require("./vecOps-CCnJt-yH.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-mARULpM7.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-DxbbLpGg.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-DVPQyYM7.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-BD9_NT7u.cjs");
|
|
10
10
|
//#region src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as castShape, tt as getKernel } from "./shapeTypes-Osdj5kMc.js";
|
|
2
2
|
import { n as wasmIndex, t as vec3At$1 } from "./vec3-Dpha8d5k.js";
|
|
3
3
|
import { A as ok, b as err, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
4
4
|
import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
5
|
-
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-
|
|
5
|
+
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-DLYo6s8j.js";
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
@@ -535,7 +535,7 @@ function exportDXF(entities, options) {
|
|
|
535
535
|
lines.push("0", "SECTION", "2", "HEADER");
|
|
536
536
|
lines.push("9", "$ACADVER", "1", "AC1009");
|
|
537
537
|
lines.push("0", "ENDSEC");
|
|
538
|
-
const layerNames = new Set([layer]);
|
|
538
|
+
const layerNames = /* @__PURE__ */ new Set([layer]);
|
|
539
539
|
for (const entity of entities) if (entity.layer) layerNames.add(entity.layer);
|
|
540
540
|
lines.push("0", "SECTION", "2", "TABLES");
|
|
541
541
|
lines.push("0", "TABLE", "2", "LAYER", "70", String(layerNames.size));
|
|
@@ -611,7 +611,7 @@ function approximateCurveAsPolyline(curve, segments) {
|
|
|
611
611
|
}
|
|
612
612
|
//#endregion
|
|
613
613
|
//#region src/io/threemfExportFns.ts
|
|
614
|
-
var crcTable = new Uint32Array(256);
|
|
614
|
+
var crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
615
615
|
for (let i = 0; i < 256; i++) {
|
|
616
616
|
let c = i;
|
|
617
617
|
for (let j = 0; j < 8; j++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|