brepjs 13.0.0 → 13.2.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 +3 -3
- package/dist/2d.js +3 -3
- package/dist/{arrayAccess-CccV7jov.js → arrayAccess-Dps31ERU.js} +3 -3
- package/dist/{arrayAccess-BF8Hm4-H.cjs → arrayAccess-peFKE9Ob.cjs} +3 -3
- package/dist/{blueprint-mSGgCL3V.js → blueprint-DYCdRlW5.js} +8 -8
- package/dist/{blueprint-BP3P8Ado.cjs → blueprint-PLJan-W5.cjs} +8 -8
- package/dist/{blueprintFns-BQ-MP_Vy.cjs → blueprintFns-Bsx25BG7.cjs} +3 -3
- package/dist/{blueprintFns-DWFkjbDT.js → blueprintFns-eWh7NpZx.js} +3 -3
- package/dist/{boolean2D-Cqfwz60G.js → boolean2D-52qVCooY.js} +10 -10
- package/dist/{boolean2D-D76Hc7Wx.cjs → boolean2D-CtB21ajK.cjs} +10 -10
- package/dist/{booleanFns-CYPXeNVN.cjs → booleanFns-BrptUFkP.cjs} +25 -13
- package/dist/{booleanFns-B79ALtKn.js → booleanFns-iM6UPb8e.js} +25 -13
- package/dist/brepjs.cjs +43 -311
- package/dist/brepjs.js +23 -306
- package/dist/core/errors.d.ts +7 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core.cjs +3 -3
- package/dist/core.js +3 -3
- package/dist/{cornerFinder-BSwshSGB.js → cornerFinder-C7aDyYLJ.js} +2 -2
- package/dist/{cornerFinder-sg0JNgux.cjs → cornerFinder-SF-xmMO1.cjs} +2 -2
- package/dist/{curveFns-D_s3LdNT.js → curveFns-C-jU1_Y_.js} +2 -2
- package/dist/{curveFns-CJjkUGyW.cjs → curveFns-ywh7Ctyk.cjs} +2 -2
- package/dist/{drawFns-oyqai_HD.js → drawFns-D-0p86Lf.js} +13 -13
- package/dist/{drawFns-0CYuQn0J.cjs → drawFns-DknEB-Qs.cjs} +13 -13
- package/dist/{errors-B1fl3mAU.js → errors-B_T0aMQF.js} +7 -0
- package/dist/{errors-C85KVJr-.cjs → errors-DupKEMqI.cjs} +7 -0
- package/dist/{extrudeFns-0kBZvqJz.cjs → extrudeFns-CGCIbydL.cjs} +2 -2
- package/dist/{extrudeFns-lDvV4ir2.js → extrudeFns-LsH1rDMa.js} +2 -2
- package/dist/{faceFns-8BurpAGN.cjs → faceFns-8dGb8q3J.cjs} +2 -2
- package/dist/{faceFns-Bne5RIvn.js → faceFns-EnGcKFAr.js} +2 -2
- package/dist/{helpers-CxexSe1n.js → helpers-Rf0vhX6I.js} +6 -6
- package/dist/{helpers-D8DIMw2U.cjs → helpers-pQpV9Mwh.cjs} +6 -6
- package/dist/{historyFns-BTeasREV.js → historyFns-XkjLAQyu.js} +5 -5
- package/dist/{historyFns-BAzQr6EP.cjs → historyFns-lNalnOdR.cjs} +5 -5
- package/dist/{importFns-D__wN_Pq.cjs → importFns-BSH9cGIp.cjs} +36 -4
- package/dist/{importFns-clldr3EF.js → importFns-Bgs-FYAP.js} +31 -5
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/io/stepConfigFns.d.ts +27 -0
- package/dist/io/stepConfigFns.d.ts.map +1 -0
- package/dist/io.cjs +3 -2
- package/dist/io.d.ts +1 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +3 -3
- package/dist/kernel/brepkit/booleanOps.d.ts +7 -1
- package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -1
- package/dist/kernel/brepkit/brepkitAdapter.d.ts +5 -4
- package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkit/evolutionOps.d.ts +4 -4
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -1
- package/dist/kernel/interfaces/booleanOps.d.ts +3 -1
- package/dist/kernel/interfaces/booleanOps.d.ts.map +1 -1
- package/dist/kernel/interfaces/evolutionOps.d.ts +4 -4
- package/dist/kernel/interfaces/evolutionOps.d.ts.map +1 -1
- package/dist/kernel/occt/booleanOps.d.ts +7 -1
- package/dist/kernel/occt/booleanOps.d.ts.map +1 -1
- package/dist/kernel/occt/defaultAdapter.d.ts +5 -4
- package/dist/kernel/occt/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/occt/evolutionOps.d.ts +2 -2
- package/dist/kernel/occt/evolutionOps.d.ts.map +1 -1
- package/dist/kernel/occt/historyOps.d.ts +4 -4
- package/dist/kernel/occt/historyOps.d.ts.map +1 -1
- package/dist/kernel/occt/wasmTypes/occtBuilders.d.ts +4 -0
- package/dist/kernel/occt/wasmTypes/occtBuilders.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +30 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{measureFns-DrMZGJ6r.cjs → measureFns-CFdHa_fj.cjs} +3 -3
- package/dist/{measureFns-C4WqH4OT.js → measureFns-D7J6qUY_.js} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-DvOM43vV.cjs → meshFns-2XnDXgIh.cjs} +3 -3
- package/dist/{meshFns--M5PTyHG.js → meshFns-B7uklc4M.js} +3 -3
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{planeOps-DPintPbl.js → planeOps-BuBXTLBr.js} +1 -1
- package/dist/{planeOps-DdkIuVjk.cjs → planeOps-cTxDywpG.cjs} +1 -1
- package/dist/primitiveFns-CASk8g16.js +1452 -0
- package/dist/primitiveFns-DKtvEA0i.cjs +1817 -0
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{shapeTypes-GmE4D5Q_.cjs → shapeTypes-CElaawp7.cjs} +114 -9
- package/dist/{shapeTypes-D38b_BKF.js → shapeTypes-CYb8Byqj.js} +114 -9
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-FaTmd_PS.js → solidBuilders-ClJxiUa3.js} +3 -3
- package/dist/{solidBuilders-BqU0oT2q.cjs → solidBuilders-Cs4XyL58.cjs} +3 -3
- package/dist/{surfaceBuilders-DiCVk_Un.js → surfaceBuilders-DnGdDW8i.js} +3 -3
- package/dist/{surfaceBuilders-BzDQQ4EG.cjs → surfaceBuilders-ZUTb3z6i.cjs} +3 -3
- package/dist/topology/booleanDiagnosticFns.d.ts +18 -0
- package/dist/topology/booleanDiagnosticFns.d.ts.map +1 -0
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/evolutionFns.d.ts +71 -0
- package/dist/topology/evolutionFns.d.ts.map +1 -0
- package/dist/topology/healingFns.d.ts +17 -0
- package/dist/topology/healingFns.d.ts.map +1 -1
- package/dist/topology/modifierFns.d.ts +15 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/positionFns.d.ts +15 -0
- package/dist/topology/positionFns.d.ts.map +1 -0
- package/dist/topology.cjs +18 -6
- package/dist/topology.d.ts +6 -1
- package/dist/topology.d.ts.map +1 -1
- package/dist/topology.js +7 -7
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +1 -1
- package/package.json +1 -1
- package/dist/primitiveFns-BXufrcii.cjs +0 -1063
- package/dist/primitiveFns-u3Bbdvlw.js +0 -806
package/dist/brepjs.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_drawFns = require("./drawFns-
|
|
3
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
4
|
-
const require_errors = require("./errors-
|
|
2
|
+
const require_drawFns = require("./drawFns-DknEB-Qs.cjs");
|
|
3
|
+
const require_shapeTypes = require("./shapeTypes-CElaawp7.cjs");
|
|
4
|
+
const require_errors = require("./errors-DupKEMqI.cjs");
|
|
5
5
|
const require_vecOps = require("./vecOps-4iBMiet9.cjs");
|
|
6
6
|
const require_types = require("./types-BD-VVaWB.cjs");
|
|
7
|
-
const require_planeOps = require("./planeOps-
|
|
8
|
-
const require_faceFns = require("./faceFns-
|
|
9
|
-
const require_arrayAccess = require("./arrayAccess-
|
|
10
|
-
const require_curveFns = require("./curveFns-
|
|
11
|
-
const require_meshFns = require("./meshFns-
|
|
12
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
13
|
-
const require_booleanFns = require("./booleanFns-
|
|
14
|
-
const require_primitiveFns = require("./primitiveFns-
|
|
15
|
-
const require_historyFns = require("./historyFns-
|
|
16
|
-
const require_boolean2D = require("./boolean2D-
|
|
17
|
-
const require_helpers = require("./helpers-
|
|
18
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
19
|
-
const require_measureFns = require("./measureFns-
|
|
20
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
21
|
-
const require_extrudeFns = require("./extrudeFns-
|
|
22
|
-
const require_blueprintFns = require("./blueprintFns-
|
|
23
|
-
const require_importFns = require("./importFns-
|
|
7
|
+
const require_planeOps = require("./planeOps-cTxDywpG.cjs");
|
|
8
|
+
const require_faceFns = require("./faceFns-8dGb8q3J.cjs");
|
|
9
|
+
const require_arrayAccess = require("./arrayAccess-peFKE9Ob.cjs");
|
|
10
|
+
const require_curveFns = require("./curveFns-ywh7Ctyk.cjs");
|
|
11
|
+
const require_meshFns = require("./meshFns-2XnDXgIh.cjs");
|
|
12
|
+
const require_surfaceBuilders = require("./surfaceBuilders-ZUTb3z6i.cjs");
|
|
13
|
+
const require_booleanFns = require("./booleanFns-BrptUFkP.cjs");
|
|
14
|
+
const require_primitiveFns = require("./primitiveFns-DKtvEA0i.cjs");
|
|
15
|
+
const require_historyFns = require("./historyFns-lNalnOdR.cjs");
|
|
16
|
+
const require_boolean2D = require("./boolean2D-CtB21ajK.cjs");
|
|
17
|
+
const require_helpers = require("./helpers-pQpV9Mwh.cjs");
|
|
18
|
+
const require_solidBuilders = require("./solidBuilders-Cs4XyL58.cjs");
|
|
19
|
+
const require_measureFns = require("./measureFns-CFdHa_fj.cjs");
|
|
20
|
+
const require_cornerFinder = require("./cornerFinder-SF-xmMO1.cjs");
|
|
21
|
+
const require_extrudeFns = require("./extrudeFns-CGCIbydL.cjs");
|
|
22
|
+
const require_blueprintFns = require("./blueprintFns-Bsx25BG7.cjs");
|
|
23
|
+
const require_importFns = require("./importFns-BSH9cGIp.cjs");
|
|
24
24
|
const require_workerHandler = require("./workerHandler-nLkvSOKX.cjs");
|
|
25
25
|
//#region src/core/kernelCall.ts
|
|
26
26
|
var errorFactories = {
|
|
@@ -446,7 +446,7 @@ async function surfaceFromImage(blob, options = {}) {
|
|
|
446
446
|
*
|
|
447
447
|
* Computes the 3D convex hull of one or more shapes using QuickHull.
|
|
448
448
|
*/
|
|
449
|
-
function validateNotNull
|
|
449
|
+
function validateNotNull(shape, label) {
|
|
450
450
|
if (require_shapeTypes.getKernel().isNull(shape.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
|
|
451
451
|
return require_errors.ok(void 0);
|
|
452
452
|
}
|
|
@@ -461,7 +461,7 @@ function validateNotNull$1(shape, label) {
|
|
|
461
461
|
function hull(shapes, options = {}) {
|
|
462
462
|
if (shapes.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.HULL_EMPTY_INPUT, "hull: at least one shape is required", void 0, void 0, "Provide one or more shapes to compute a convex hull"));
|
|
463
463
|
for (const [i, shape] of shapes.entries()) {
|
|
464
|
-
const check = validateNotNull
|
|
464
|
+
const check = validateNotNull(shape, `hull: shapes[${i}]`);
|
|
465
465
|
if (require_errors.isErr(check)) return check;
|
|
466
466
|
}
|
|
467
467
|
const tolerance = options.tolerance ?? .1;
|
|
@@ -2089,289 +2089,6 @@ function resolve3D(s) {
|
|
|
2089
2089
|
return resolve(s);
|
|
2090
2090
|
}
|
|
2091
2091
|
//#endregion
|
|
2092
|
-
//#region src/topology/modifierFns.ts
|
|
2093
|
-
/**
|
|
2094
|
-
* Functional modifier operations — fillet, chamfer, shell, thicken, offset, draft.
|
|
2095
|
-
*
|
|
2096
|
-
* These are standalone functions that operate on branded shape types
|
|
2097
|
-
* and return Result values.
|
|
2098
|
-
*/
|
|
2099
|
-
function validateNotNull(shape, label) {
|
|
2100
|
-
if (require_shapeTypes.getKernel().isNull(shape.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
|
|
2101
|
-
return require_errors.ok(void 0);
|
|
2102
|
-
}
|
|
2103
|
-
/**
|
|
2104
|
-
* Validate that a scalar or `[a, b]` pair is positive.
|
|
2105
|
-
* Returns an Err Result on failure, `undefined` on success.
|
|
2106
|
-
*
|
|
2107
|
-
* Function-type values (per-edge callbacks) are intentionally skipped here --
|
|
2108
|
-
* they are validated lazily in {@link resolveEdgeCallback} when each edge is processed.
|
|
2109
|
-
*/
|
|
2110
|
-
function validatePositiveParam(value, msgs) {
|
|
2111
|
-
if (typeof value === "number" && value <= 0) return require_errors.err(require_errors.validationError(msgs.code, msgs.scalar, void 0, void 0, msgs.scalarHint));
|
|
2112
|
-
if (Array.isArray(value) && (value[0] <= 0 || value[1] <= 0)) return require_errors.err(require_errors.validationError(msgs.code, msgs.pair, void 0, void 0, msgs.pairHint));
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
* When the user supplies a per-edge callback, pre-filter edges and build a
|
|
2116
|
-
* hash-indexed lookup for the kernel. Returns `null` if no edges survive.
|
|
2117
|
-
*/
|
|
2118
|
-
function resolveEdgeCallback(selectedEdges, callbackFn) {
|
|
2119
|
-
const filteredEdges = [];
|
|
2120
|
-
const hashToValue = /* @__PURE__ */ new Map();
|
|
2121
|
-
for (const edge of selectedEdges) {
|
|
2122
|
-
const val = callbackFn(edge) ?? 0;
|
|
2123
|
-
if (typeof val === "number" && val <= 0) continue;
|
|
2124
|
-
if (Array.isArray(val) && (val[0] <= 0 || val[1] <= 0)) continue;
|
|
2125
|
-
filteredEdges.push(edge);
|
|
2126
|
-
hashToValue.set(require_shapeTypes.getKernel().hashCode(edge.wrapped, require_vecOps.HASH_CODE_MAX), val);
|
|
2127
|
-
}
|
|
2128
|
-
if (filteredEdges.length === 0) return null;
|
|
2129
|
-
const kernelParam = (ocEdge) => {
|
|
2130
|
-
return hashToValue.get(ocEdge.HashCode(2147483647)) ?? 1;
|
|
2131
|
-
};
|
|
2132
|
-
return {
|
|
2133
|
-
edges: filteredEdges,
|
|
2134
|
-
kernelParam
|
|
2135
|
-
};
|
|
2136
|
-
}
|
|
2137
|
-
/**
|
|
2138
|
-
* Cast a kernel result to a Shape3D, propagate metadata, and wrap in `ok()`.
|
|
2139
|
-
* Returns an error if the result is not a 3D shape.
|
|
2140
|
-
*/
|
|
2141
|
-
function finalizeShape3D(evolution, resultShape, inputs, not3dCode, not3dMessage) {
|
|
2142
|
-
const cast = require_shapeTypes.castShape(resultShape);
|
|
2143
|
-
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError(not3dCode, not3dMessage));
|
|
2144
|
-
require_arrayAccess.propagateAllMetadata(evolution, inputs, cast);
|
|
2145
|
-
return require_errors.ok(cast);
|
|
2146
|
-
}
|
|
2147
|
-
/**
|
|
2148
|
-
* When the user supplies a per-face callback for draft angle, pre-filter
|
|
2149
|
-
* faces and build a hash-indexed lookup for the kernel.
|
|
2150
|
-
*/
|
|
2151
|
-
function resolveDraftCallback(faces, angle) {
|
|
2152
|
-
if (typeof angle !== "function") return {
|
|
2153
|
-
filteredFaces: [...faces],
|
|
2154
|
-
kernelAngle: angle
|
|
2155
|
-
};
|
|
2156
|
-
const filteredFaces = [];
|
|
2157
|
-
const hashToAngle = /* @__PURE__ */ new Map();
|
|
2158
|
-
for (const face of faces) {
|
|
2159
|
-
const a = angle(face);
|
|
2160
|
-
if (a === null || a === 0 || Math.abs(a) >= 90) continue;
|
|
2161
|
-
filteredFaces.push(face);
|
|
2162
|
-
hashToAngle.set(require_shapeTypes.getKernel().hashCode(face.wrapped, require_vecOps.HASH_CODE_MAX), a);
|
|
2163
|
-
}
|
|
2164
|
-
const kernelAngle = (ocFace) => {
|
|
2165
|
-
const a = hashToAngle.get(ocFace.HashCode(require_vecOps.HASH_CODE_MAX));
|
|
2166
|
-
if (a === void 0) throw new Error("draft: face hash not found — possible hash collision");
|
|
2167
|
-
return a;
|
|
2168
|
-
};
|
|
2169
|
-
return {
|
|
2170
|
-
filteredFaces,
|
|
2171
|
-
kernelAngle
|
|
2172
|
-
};
|
|
2173
|
-
}
|
|
2174
|
-
/**
|
|
2175
|
-
* Thickens a surface (face or shell) into a solid by offsetting it.
|
|
2176
|
-
*
|
|
2177
|
-
* Takes a planar or non-planar surface shape and creates a solid
|
|
2178
|
-
* by offsetting it by the given thickness. Positive thickness offsets
|
|
2179
|
-
* along the surface normal; negative thickness offsets against it.
|
|
2180
|
-
*/
|
|
2181
|
-
function thicken$1(shape, thickness) {
|
|
2182
|
-
const check = validateNotNull(shape, "thicken: shape");
|
|
2183
|
-
if (require_errors.isErr(check)) return check;
|
|
2184
|
-
try {
|
|
2185
|
-
const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([shape]);
|
|
2186
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().thickenWithHistory(shape.wrapped, thickness, inputFaceHashes, require_vecOps.HASH_CODE_MAX);
|
|
2187
|
-
const cast = require_shapeTypes.castShape(resultShape);
|
|
2188
|
-
require_arrayAccess.propagateAllMetadata(evolution, [shape], cast);
|
|
2189
|
-
return require_errors.ok(cast);
|
|
2190
|
-
} catch (e) {
|
|
2191
|
-
return require_errors.err(require_errors.kernelError("THICKEN_FAILED", `Thicken operation failed: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
/**
|
|
2195
|
-
* Apply a fillet (rounded edge) to selected edges of a 3D shape.
|
|
2196
|
-
*
|
|
2197
|
-
* @param shape - The shape to modify.
|
|
2198
|
-
* @param edges - Edges to fillet. Pass `undefined` to fillet all edges.
|
|
2199
|
-
* @param radius - Constant radius, variable radius `[r1, r2]`, or per-edge callback.
|
|
2200
|
-
*/
|
|
2201
|
-
function fillet$1(shape, edges, radius) {
|
|
2202
|
-
const check = validateNotNull(shape, "fillet: shape");
|
|
2203
|
-
if (require_errors.isErr(check)) return check;
|
|
2204
|
-
const paramErr = validatePositiveParam(radius, {
|
|
2205
|
-
code: "INVALID_FILLET_RADIUS",
|
|
2206
|
-
scalar: "Fillet radius must be positive",
|
|
2207
|
-
pair: "Fillet radii must both be positive",
|
|
2208
|
-
scalarHint: "Provide a positive radius value greater than 0",
|
|
2209
|
-
pairHint: "Both radius values must be greater than 0"
|
|
2210
|
-
});
|
|
2211
|
-
if (paramErr) return paramErr;
|
|
2212
|
-
const selectedEdges = edges ?? require_arrayAccess.getEdges(shape);
|
|
2213
|
-
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FILLET_NO_EDGES, "No edges found for fillet", void 0, void 0, "Check that the shape has edges, or adjust your edge finder criteria"));
|
|
2214
|
-
try {
|
|
2215
|
-
let filteredEdges;
|
|
2216
|
-
let kernelRadius;
|
|
2217
|
-
if (typeof radius === "function") {
|
|
2218
|
-
const resolved = resolveEdgeCallback(selectedEdges, radius);
|
|
2219
|
-
if (!resolved) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.FILLET_NO_EDGES, "No edges with positive radius for fillet", void 0, void 0, "Check that the radius callback returns positive values"));
|
|
2220
|
-
filteredEdges = resolved.edges;
|
|
2221
|
-
kernelRadius = resolved.kernelParam;
|
|
2222
|
-
} else {
|
|
2223
|
-
filteredEdges = [...selectedEdges];
|
|
2224
|
-
kernelRadius = radius;
|
|
2225
|
-
}
|
|
2226
|
-
const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([shape]);
|
|
2227
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().filletWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelRadius, inputFaceHashes, require_vecOps.HASH_CODE_MAX);
|
|
2228
|
-
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.FILLET_NOT_3D, "Fillet result is not a 3D shape");
|
|
2229
|
-
} catch (e) {
|
|
2230
|
-
return require_errors.err(require_errors.kernelError("FILLET_FAILED", `Fillet operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
2231
|
-
operation: "fillet",
|
|
2232
|
-
edgeCount: selectedEdges.length,
|
|
2233
|
-
radius
|
|
2234
|
-
}));
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
/**
|
|
2238
|
-
* Apply a chamfer (beveled edge) to selected edges of a 3D shape.
|
|
2239
|
-
*
|
|
2240
|
-
* @param shape - The shape to modify.
|
|
2241
|
-
* @param edges - Edges to chamfer. Pass `undefined` to chamfer all edges.
|
|
2242
|
-
* @param distance - Symmetric distance, asymmetric `[d1, d2]`, or per-edge callback.
|
|
2243
|
-
*/
|
|
2244
|
-
function chamfer$1(shape, edges, distance) {
|
|
2245
|
-
const check = validateNotNull(shape, "chamfer: shape");
|
|
2246
|
-
if (require_errors.isErr(check)) return check;
|
|
2247
|
-
const paramErr = validatePositiveParam(distance, {
|
|
2248
|
-
code: "INVALID_CHAMFER_DISTANCE",
|
|
2249
|
-
scalar: "Chamfer distance must be positive",
|
|
2250
|
-
pair: "Chamfer distances must both be positive",
|
|
2251
|
-
scalarHint: "Provide a positive distance value greater than 0",
|
|
2252
|
-
pairHint: "Both distance values must be greater than 0"
|
|
2253
|
-
});
|
|
2254
|
-
if (paramErr) return paramErr;
|
|
2255
|
-
const selectedEdges = edges ?? require_arrayAccess.getEdges(shape);
|
|
2256
|
-
if (selectedEdges.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges found for chamfer"));
|
|
2257
|
-
try {
|
|
2258
|
-
let filteredEdges;
|
|
2259
|
-
let kernelDistance;
|
|
2260
|
-
if (typeof distance === "function") {
|
|
2261
|
-
const resolved = resolveEdgeCallback(selectedEdges, distance);
|
|
2262
|
-
if (!resolved) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.CHAMFER_NO_EDGES, "No edges with positive distance for chamfer"));
|
|
2263
|
-
filteredEdges = resolved.edges;
|
|
2264
|
-
kernelDistance = resolved.kernelParam;
|
|
2265
|
-
} else {
|
|
2266
|
-
filteredEdges = [...selectedEdges];
|
|
2267
|
-
kernelDistance = distance;
|
|
2268
|
-
}
|
|
2269
|
-
const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([shape]);
|
|
2270
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().chamferWithHistory(shape.wrapped, filteredEdges.map((e) => e.wrapped), kernelDistance, inputFaceHashes, require_vecOps.HASH_CODE_MAX);
|
|
2271
|
-
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.CHAMFER_NOT_3D, "Chamfer result is not a 3D shape");
|
|
2272
|
-
} catch (e) {
|
|
2273
|
-
return require_errors.err(require_errors.kernelError("CHAMFER_FAILED", `Chamfer operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
2274
|
-
operation: "chamfer",
|
|
2275
|
-
edgeCount: selectedEdges.length,
|
|
2276
|
-
distance
|
|
2277
|
-
}));
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Create a hollow shell by removing faces and offsetting remaining walls.
|
|
2282
|
-
*
|
|
2283
|
-
* @param shape - The solid to hollow out.
|
|
2284
|
-
* @param faces - Faces to remove.
|
|
2285
|
-
* @param thickness - Wall thickness.
|
|
2286
|
-
* @param tolerance - Shell operation tolerance (default 1e-3).
|
|
2287
|
-
*/
|
|
2288
|
-
function shell$1(shape, faces, thickness, tolerance = .001) {
|
|
2289
|
-
const check = validateNotNull(shape, "shell: shape");
|
|
2290
|
-
if (require_errors.isErr(check)) return check;
|
|
2291
|
-
if (thickness <= 0) return require_errors.err(require_errors.validationError("INVALID_THICKNESS", "Shell thickness must be positive"));
|
|
2292
|
-
if (faces.length === 0) return require_errors.err(require_errors.validationError("NO_FACES", "At least one face must be specified for shell"));
|
|
2293
|
-
try {
|
|
2294
|
-
const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([shape]);
|
|
2295
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().shellWithHistory(shape.wrapped, faces.map((f) => f.wrapped), thickness, inputFaceHashes, require_vecOps.HASH_CODE_MAX, tolerance);
|
|
2296
|
-
const cast = require_shapeTypes.castShape(resultShape);
|
|
2297
|
-
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
|
|
2298
|
-
require_arrayAccess.propagateAllMetadata(evolution, [shape], cast);
|
|
2299
|
-
return require_errors.ok(cast);
|
|
2300
|
-
} catch (e) {
|
|
2301
|
-
return require_errors.err(require_errors.kernelError("SHELL_FAILED", `Shell operation failed: ${e instanceof Error ? e.message : String(e)}`, e, {
|
|
2302
|
-
operation: "shell",
|
|
2303
|
-
faceCount: faces.length,
|
|
2304
|
-
thickness
|
|
2305
|
-
}));
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
/**
|
|
2309
|
-
* Offset all faces of a shape by a given distance.
|
|
2310
|
-
*
|
|
2311
|
-
* @param shape - The shape to offset (must be a 3D shape with faces).
|
|
2312
|
-
* @param distance - Offset distance (positive = outward, negative = inward).
|
|
2313
|
-
* @param tolerance - Offset tolerance (default 1e-6).
|
|
2314
|
-
*/
|
|
2315
|
-
function offset$1(shape, distance, tolerance = 1e-6) {
|
|
2316
|
-
const check = validateNotNull(shape, "offset: shape");
|
|
2317
|
-
if (require_errors.isErr(check)) return check;
|
|
2318
|
-
if (distance === 0) return require_errors.err(require_errors.validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
|
|
2319
|
-
try {
|
|
2320
|
-
const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([shape]);
|
|
2321
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().offsetWithHistory(shape.wrapped, distance, inputFaceHashes, require_vecOps.HASH_CODE_MAX, tolerance);
|
|
2322
|
-
const cast = require_shapeTypes.castShape(resultShape);
|
|
2323
|
-
if (!require_shapeTypes.isShape3D(cast)) return require_errors.err(require_errors.kernelError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
|
|
2324
|
-
require_arrayAccess.propagateAllMetadata(evolution, [shape], cast);
|
|
2325
|
-
return require_errors.ok(cast);
|
|
2326
|
-
} catch (e) {
|
|
2327
|
-
return require_errors.err(require_errors.kernelError("OFFSET_FAILED", `Offset operation failed: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
/**
|
|
2331
|
-
* Apply a draft (taper) to selected faces of a 3D shape.
|
|
2332
|
-
*
|
|
2333
|
-
* Draft tilts faces by a specified angle relative to a pull direction,
|
|
2334
|
-
* pivoting about a neutral plane. This is essential for injection molding
|
|
2335
|
-
* and casting workflows where parts must release from a mold.
|
|
2336
|
-
*
|
|
2337
|
-
* @param shape - The solid to modify.
|
|
2338
|
-
* @param faces - Faces to draft.
|
|
2339
|
-
* @param pullDirection - Mold opening direction vector.
|
|
2340
|
-
* @param neutralPlane - A point on the plane where faces are not displaced.
|
|
2341
|
-
* @param angle - Constant angle in degrees, or per-face callback returning degrees (null to skip).
|
|
2342
|
-
*/
|
|
2343
|
-
function draft$1(shape, faces, pullDirection, neutralPlane, angle) {
|
|
2344
|
-
const check = validateNotNull(shape, "draft: shape");
|
|
2345
|
-
if (require_errors.isErr(check)) return check;
|
|
2346
|
-
if (typeof angle === "number") {
|
|
2347
|
-
if (angle === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.DRAFT_INVALID_ANGLE, "Draft angle cannot be zero", void 0, void 0, "Provide a non-zero angle in degrees"));
|
|
2348
|
-
if (Math.abs(angle) >= 90) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.DRAFT_INVALID_ANGLE, "Draft angle must be between -90 and 90 degrees (exclusive)", void 0, void 0, "Typical draft angles are 1-5 degrees for injection molding"));
|
|
2349
|
-
}
|
|
2350
|
-
if (faces.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.DRAFT_NO_FACES, "No faces specified for draft", void 0, void 0, "Select at least one face to apply the draft angle to"));
|
|
2351
|
-
try {
|
|
2352
|
-
const { filteredFaces, kernelAngle } = resolveDraftCallback(faces, angle);
|
|
2353
|
-
if (filteredFaces.length === 0) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.DRAFT_NO_FACES, "No faces with valid draft angle", void 0, void 0, "Check that the angle callback returns non-zero values between -90 and 90 degrees"));
|
|
2354
|
-
const inputFaceHashes = require_arrayAccess.collectInputFaceHashes([shape]);
|
|
2355
|
-
const { shape: resultShape, evolution } = require_shapeTypes.getKernel().draftWithHistory(shape.wrapped, filteredFaces.map((f) => f.wrapped), [
|
|
2356
|
-
pullDirection[0],
|
|
2357
|
-
pullDirection[1],
|
|
2358
|
-
pullDirection[2]
|
|
2359
|
-
], [
|
|
2360
|
-
neutralPlane[0],
|
|
2361
|
-
neutralPlane[1],
|
|
2362
|
-
neutralPlane[2]
|
|
2363
|
-
], kernelAngle, inputFaceHashes, require_vecOps.HASH_CODE_MAX);
|
|
2364
|
-
return finalizeShape3D(evolution, resultShape, [shape], require_errors.BrepErrorCode.DRAFT_NOT_3D, "Draft result is not a 3D shape");
|
|
2365
|
-
} catch (e) {
|
|
2366
|
-
const raw = e instanceof Error ? e.message : String(e);
|
|
2367
|
-
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.DRAFT_FAILED, `Draft operation failed: ${raw}`, e, {
|
|
2368
|
-
operation: "draft",
|
|
2369
|
-
faceCount: faces.length,
|
|
2370
|
-
angle
|
|
2371
|
-
}));
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
//#endregion
|
|
2375
2092
|
//#region src/topology/api.ts
|
|
2376
2093
|
/** Translate a shape by a vector. Returns a new shape. */
|
|
2377
2094
|
function translate(shape, v) {
|
|
@@ -2502,7 +2219,7 @@ function fillet(shape, edgesOrRadius, maybeRadius) {
|
|
|
2502
2219
|
edges = void 0;
|
|
2503
2220
|
radius = edgesOrRadius;
|
|
2504
2221
|
}
|
|
2505
|
-
return fillet
|
|
2222
|
+
return require_primitiveFns.fillet(s, edges, radius);
|
|
2506
2223
|
}
|
|
2507
2224
|
function chamfer(shape, edgesOrDistance, maybeDistance) {
|
|
2508
2225
|
const s = resolve(shape);
|
|
@@ -2520,20 +2237,21 @@ function chamfer(shape, edgesOrDistance, maybeDistance) {
|
|
|
2520
2237
|
const selectedEdges = edges ?? require_arrayAccess.getEdges(s);
|
|
2521
2238
|
return require_primitiveFns.chamferDistAngle(s, [...selectedEdges], normalized.distance, normalized.angle);
|
|
2522
2239
|
}
|
|
2523
|
-
return chamfer
|
|
2240
|
+
return require_primitiveFns.chamfer(s, edges, normalized.distance);
|
|
2524
2241
|
}
|
|
2525
2242
|
/** Create a hollow shell by removing faces and offsetting remaining walls. */
|
|
2526
2243
|
function shell(shape, faces, thickness, options) {
|
|
2527
2244
|
const s = resolve(shape);
|
|
2528
|
-
|
|
2245
|
+
const resolvedFaces = resolveFaces(faces, s);
|
|
2246
|
+
return require_primitiveFns.shell(s, resolvedFaces, thickness, options?.tolerance);
|
|
2529
2247
|
}
|
|
2530
2248
|
/** Offset all faces of a valid solid by a given distance. */
|
|
2531
2249
|
function offset(shape, distance, options) {
|
|
2532
|
-
return offset
|
|
2250
|
+
return require_primitiveFns.offset(resolve(shape), distance, options?.tolerance);
|
|
2533
2251
|
}
|
|
2534
2252
|
/** Thicken a surface (face or shell) into a solid. */
|
|
2535
2253
|
function thicken(shape, thickness) {
|
|
2536
|
-
return thicken
|
|
2254
|
+
return require_primitiveFns.thicken(resolve(shape), thickness);
|
|
2537
2255
|
}
|
|
2538
2256
|
/**
|
|
2539
2257
|
* Draft (taper) selected faces of a 3D shape.
|
|
@@ -2544,7 +2262,8 @@ function thicken(shape, thickness) {
|
|
|
2544
2262
|
*/
|
|
2545
2263
|
function draft(shape, faces, options) {
|
|
2546
2264
|
const s = resolve(shape);
|
|
2547
|
-
|
|
2265
|
+
const resolvedFaces = resolveFaces(faces, s);
|
|
2266
|
+
return require_primitiveFns.draft(s, resolvedFaces, options.pullDirection, options.neutralPlane, options.angle);
|
|
2548
2267
|
}
|
|
2549
2268
|
/** Heal a shape using the appropriate fixer. */
|
|
2550
2269
|
function heal(shape) {
|
|
@@ -3049,7 +2768,9 @@ exports.castShape = require_shapeTypes.castShape;
|
|
|
3049
2768
|
exports.castShape3D = require_shapeTypes.castShape3D;
|
|
3050
2769
|
exports.chamfer = chamfer;
|
|
3051
2770
|
exports.chamferDistAngleShape = require_primitiveFns.chamferDistAngle;
|
|
2771
|
+
exports.chamferWithEvolution = require_primitiveFns.chamferWithEvolution;
|
|
3052
2772
|
exports.checkAllInterferences = checkAllInterferences;
|
|
2773
|
+
exports.checkBoolean = require_primitiveFns.checkBoolean;
|
|
3053
2774
|
exports.checkInterference = checkInterference;
|
|
3054
2775
|
exports.circle = require_primitiveFns.circle;
|
|
3055
2776
|
exports.circularPattern = require_historyFns.circularPattern;
|
|
@@ -3118,6 +2839,7 @@ exports.cut = cut;
|
|
|
3118
2839
|
exports.cut2D = require_boolean2D.cut2D;
|
|
3119
2840
|
exports.cutAll = require_booleanFns.cutAll;
|
|
3120
2841
|
exports.cutBlueprints = require_boolean2D.cutBlueprints;
|
|
2842
|
+
exports.cutWithEvolution = require_primitiveFns.cutWithEvolution;
|
|
3121
2843
|
exports.cylinder = require_primitiveFns.cylinder;
|
|
3122
2844
|
exports.dequeueTask = require_workerHandler.dequeueTask;
|
|
3123
2845
|
exports.describe = describe;
|
|
@@ -3160,6 +2882,7 @@ exports.exportGltf = require_importFns.exportGltf;
|
|
|
3160
2882
|
exports.exportIGES = require_meshFns.exportIGES;
|
|
3161
2883
|
exports.exportOBJ = require_importFns.exportOBJ;
|
|
3162
2884
|
exports.exportSTEP = require_meshFns.exportSTEP;
|
|
2885
|
+
exports.exportSTEPConfigured = require_importFns.exportSTEPConfigured;
|
|
3163
2886
|
exports.exportSTL = require_meshFns.exportSTL;
|
|
3164
2887
|
exports.exportThreeMF = require_importFns.exportThreeMF;
|
|
3165
2888
|
exports.extrude = extrude;
|
|
@@ -3172,9 +2895,12 @@ exports.facesOfEdge = require_primitiveFns.facesOfEdge;
|
|
|
3172
2895
|
exports.fill = require_surfaceBuilders.fill;
|
|
3173
2896
|
exports.filledFace = require_primitiveFns.filledFace;
|
|
3174
2897
|
exports.fillet = fillet;
|
|
2898
|
+
exports.filletWithEvolution = require_primitiveFns.filletWithEvolution;
|
|
3175
2899
|
exports.findFacesByTag = require_arrayAccess.findFacesByTag;
|
|
3176
2900
|
exports.findNode = require_historyFns.findNode;
|
|
3177
2901
|
exports.findStep = require_historyFns.findStep;
|
|
2902
|
+
exports.fixSelfIntersection = require_primitiveFns.fixSelfIntersection;
|
|
2903
|
+
exports.fixShape = require_primitiveFns.fixShape;
|
|
3178
2904
|
exports.flatMap = require_errors.flatMap;
|
|
3179
2905
|
exports.flatten = require_errors.flatten;
|
|
3180
2906
|
exports.flipFaceOrientation = require_faceFns.flipFaceOrientation;
|
|
@@ -3189,6 +2915,7 @@ exports.fuse = fuse;
|
|
|
3189
2915
|
exports.fuse2D = require_boolean2D.fuse2D;
|
|
3190
2916
|
exports.fuseAll = require_booleanFns.fuseAll;
|
|
3191
2917
|
exports.fuseBlueprints = require_boolean2D.fuseBlueprints;
|
|
2918
|
+
exports.fuseWithEvolution = require_primitiveFns.fuseWithEvolution;
|
|
3192
2919
|
exports.getBounds = require_arrayAccess.getBounds;
|
|
3193
2920
|
exports.getBounds2D = require_blueprintFns.getBounds2D;
|
|
3194
2921
|
exports.getCurveType = require_curveFns.getCurveType;
|
|
@@ -3234,6 +2961,7 @@ exports.interpolateCurve = require_curveFns.interpolateCurve;
|
|
|
3234
2961
|
exports.intersect = intersect;
|
|
3235
2962
|
exports.intersect2D = require_boolean2D.intersect2D;
|
|
3236
2963
|
exports.intersectBlueprints = require_boolean2D.intersectBlueprints;
|
|
2964
|
+
exports.intersectWithEvolution = require_primitiveFns.intersectWithEvolution;
|
|
3237
2965
|
exports.invalidateShapeCache = require_arrayAccess.invalidateShapeCache;
|
|
3238
2966
|
exports.ioError = require_errors.ioError;
|
|
3239
2967
|
exports.is2D = require_shapeTypes.is2D;
|
|
@@ -3334,6 +3062,7 @@ exports.polygon = require_primitiveFns.polygon;
|
|
|
3334
3062
|
exports.polyhedron = polyhedron;
|
|
3335
3063
|
exports.polysideInnerRadius = require_drawFns.polysideInnerRadius;
|
|
3336
3064
|
exports.polysidesBlueprint = require_boolean2D.polysidesBlueprint;
|
|
3065
|
+
exports.positionOnCurve = require_primitiveFns.positionOnCurve;
|
|
3337
3066
|
exports.prewarm = require_shapeTypes.prewarm;
|
|
3338
3067
|
exports.projectEdges = require_drawFns.projectEdges;
|
|
3339
3068
|
exports.projectPointOnFace = require_faceFns.projectPointOnFace;
|
|
@@ -3374,6 +3103,7 @@ exports.shape = shape;
|
|
|
3374
3103
|
exports.shapeType = require_faceFns.shapeType;
|
|
3375
3104
|
exports.sharedEdges = require_primitiveFns.sharedEdges;
|
|
3376
3105
|
exports.shell = shell;
|
|
3106
|
+
exports.shellWithEvolution = require_primitiveFns.shellWithEvolution;
|
|
3377
3107
|
exports.simplify = simplify;
|
|
3378
3108
|
exports.sketchCircle = require_drawFns.sketchCircle;
|
|
3379
3109
|
exports.sketchEllipse = require_drawFns.sketchEllipse;
|
|
@@ -3395,6 +3125,7 @@ exports.sketchWires = require_drawFns.sketchWires;
|
|
|
3395
3125
|
exports.sketcherStateError = require_errors.sketcherStateError;
|
|
3396
3126
|
exports.slice = slice;
|
|
3397
3127
|
exports.solid = require_primitiveFns.solid;
|
|
3128
|
+
exports.solidFromShell = require_primitiveFns.solidFromShell;
|
|
3398
3129
|
exports.solveAssembly = solveAssembly;
|
|
3399
3130
|
exports.sphere = require_primitiveFns.sphere;
|
|
3400
3131
|
exports.split = split;
|
|
@@ -3445,6 +3176,7 @@ exports.uvBounds = require_faceFns.uvBounds;
|
|
|
3445
3176
|
exports.uvCoordinates = require_faceFns.uvCoordinates;
|
|
3446
3177
|
exports.validSolid = require_shapeTypes.validSolid;
|
|
3447
3178
|
exports.validationError = require_errors.validationError;
|
|
3179
|
+
exports.variableFillet = require_primitiveFns.variableFillet;
|
|
3448
3180
|
exports.vecAdd = require_vecOps.vecAdd;
|
|
3449
3181
|
exports.vecAngle = require_vecOps.vecAngle;
|
|
3450
3182
|
exports.vecCross = require_vecOps.vecCross;
|