brepjs 8.2.0 → 8.3.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.
Files changed (45) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/{Blueprint-D_luVeES.js → Blueprint-CdVaHDSx.js} +3 -2
  4. package/dist/{Blueprint-CTAwjJMN.cjs → Blueprint-a3ukJMG4.cjs} +4 -3
  5. package/dist/{boolean2D-vw76Gayn.js → boolean2D-DzA0STqC.js} +3 -3
  6. package/dist/{boolean2D-B5axNhjN.cjs → boolean2D-pvPIs21j.cjs} +3 -3
  7. package/dist/{booleanFns-BhqXpQoZ.js → booleanFns-BcQUqjUu.js} +42 -5
  8. package/dist/{booleanFns-Yc3EBxdm.cjs → booleanFns-Cd414V3l.cjs} +42 -5
  9. package/dist/brepjs.cjs +189 -100
  10. package/dist/brepjs.js +255 -165
  11. package/dist/{cornerFinder-DuStF5jK.cjs → cornerFinder-BdKtobgb.cjs} +1 -1
  12. package/dist/{cornerFinder-CPm2baSJ.js → cornerFinder-DvPiz-VR.js} +1 -1
  13. package/dist/curveFns-B5EQsSwv.cjs +177 -0
  14. package/dist/curveFns-CyHyk29c.js +178 -0
  15. package/dist/{drawFns-CzBbcoXA.js → drawFns-CAAE4Z88.js} +6 -5
  16. package/dist/{drawFns-CiNxPu6J.cjs → drawFns-Mr2pghU8.cjs} +9 -8
  17. package/dist/{helpers-Dje6wrKi.cjs → helpers-CP2KrBZl.cjs} +4 -4
  18. package/dist/{helpers-BSQfs538.js → helpers-r_e-u1JM.js} +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/io.cjs +2 -2
  22. package/dist/io.js +2 -2
  23. package/dist/{meshFns-BKSPaPXS.js → meshFns-BEvGVcym.js} +4 -1
  24. package/dist/{meshFns-CFVxKBlE.cjs → meshFns-CJV_k_EQ.cjs} +4 -1
  25. package/dist/{operations-CjQHEu1h.js → operations-B314mytX.js} +1 -1
  26. package/dist/{operations-CdGb6IBU.cjs → operations-CYGNxn5D.cjs} +1 -1
  27. package/dist/operations.cjs +1 -1
  28. package/dist/operations.js +1 -1
  29. package/dist/query.cjs +3 -3
  30. package/dist/query.js +4 -4
  31. package/dist/{curveFns-C5gSZ5EY.js → shapeFns-CWd_ASDV.js} +115 -194
  32. package/dist/{curveFns-ByeCqutv.cjs → shapeFns-Z_ScEjmn.cjs} +94 -173
  33. package/dist/sketching.cjs +2 -2
  34. package/dist/sketching.js +2 -2
  35. package/dist/topology/booleanFns.d.ts.map +1 -1
  36. package/dist/topology/meshFns.d.ts +1 -0
  37. package/dist/topology/meshFns.d.ts.map +1 -1
  38. package/dist/topology/modifierFns.d.ts.map +1 -1
  39. package/dist/topology/shapeFns.d.ts +30 -0
  40. package/dist/topology/shapeFns.d.ts.map +1 -1
  41. package/dist/{topology-D8Au8q4i.cjs → topology-A7-jUtHB.cjs} +9 -8
  42. package/dist/{topology-BFB3LI_y.js → topology-BupialMm.js} +4 -3
  43. package/dist/topology.cjs +32 -31
  44. package/dist/topology.js +57 -56
  45. package/package.json +1 -1
package/dist/brepjs.js CHANGED
@@ -6,37 +6,39 @@ import { c as castShape, s as createSolid, p as gcWithScope, h as isShape3D, e a
6
6
  import { D, q, o, u, a as a2, b as b2, v as v2, r as r3, n as n2, x, g as g2, i as i3, f as f3, j as j3, k as k3, l as l2, t as t3, w as w3 } from "./shapeTypes-BU2LKv2S.js";
7
7
  import { c as vecDistance, D as DEG2RAD, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
8
8
  import { H, R, v as v3, a as a3, b as b3, d, e, g as g3, h as h3, i as i4, k as k4, l as l3, m as m2, o as o2 } from "./vecOps-ZDdZWbwT.js";
9
- import { a as addHolesInFace, m as makeFace, b as makeNonPlanarFace, c as makePolygon, d as makeNewFaceWithinFace } from "./Blueprint-D_luVeES.js";
10
- import { B, e as e2, C, f as f4, g as g4 } from "./Blueprint-D_luVeES.js";
11
- import { c as curveIsClosed, v as vertexPosition, t as translate$1, a as getEdges, b as applyMatrix$1, d as clone$1, e as describe$1, f as isEmpty$1, m as mirror$1, r as rotate$1, s as scale$1, h as simplify$1, j as toBREP$1, k as transformCopy$1, l as getBounds, n as getFaces, o as curveTangentAt, p as curvePointAt, q as curveEndPoint, u as curveStartPoint, w as curveLength, x as getVertices, y as getWires } from "./curveFns-C5gSZ5EY.js";
12
- import { z as z2, A, B as B2, C as C2, D as D2, E, F, g as g5, G, H as H2, I, i as i5, J, K, L, M, N } from "./curveFns-C5gSZ5EY.js";
9
+ import { a as addHolesInFace, m as makeFace, b as makeNonPlanarFace, c as makePolygon, d as makeNewFaceWithinFace } from "./Blueprint-CdVaHDSx.js";
10
+ import { B, e as e2, C, f as f4, g as g4 } from "./Blueprint-CdVaHDSx.js";
11
+ import { c as curveIsClosed, a as curveTangentAt, b as curvePointAt, d as curveEndPoint, e as curveStartPoint, f as curveLength } from "./curveFns-CyHyk29c.js";
12
+ import { g as g5, h as h4, i as i5, j as j4, k as k5, l as l4, m as m3, n as n3, o as o3 } from "./curveFns-CyHyk29c.js";
13
13
  import { m as makeCompound, a as makeCone, b as makeCylinder, c as makeEllipsoid, d as makeOffset, w as weldShellsAndFaces, e as makeSolid, f as makeSphere, g as makeTorus, h as makeVertex } from "./loft-BHn7GKm8.js";
14
- import { i as i6, j as j4, r as r4 } from "./loft-BHn7GKm8.js";
15
- import { e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-CjQHEu1h.js";
16
- import { a as a4, b as b4, d as d2, f as f5, g as g6, h as h4, i as i7, j as j5, k as k5, m as m3, n as n3, o as o3, p, q as q2, t as t4, u as u2, v as v4, w as w4, x as x2, y, z as z3, A as A2, B as B3, C as C3, D as D3, E as E2 } from "./operations-CjQHEu1h.js";
17
- import { B as B4, a as a5, b as b5, C as C4, F as F2, S, c as c3, d as d3, f as f6, e as e3, i as i8, g as g7, o as o4, p as p2, r as r5 } from "./boolean2D-vw76Gayn.js";
14
+ import { i as i6, j as j5, r as r4 } from "./loft-BHn7GKm8.js";
15
+ import { e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-B314mytX.js";
16
+ import { a as a4, b as b4, d as d2, f as f5, g as g6, h as h5, i as i7, j as j6, k as k6, m as m4, n as n4, o as o4, p, q as q2, t as t4, u as u2, v as v4, w as w4, x as x2, y, z as z2, A, B as B2, C as C2, D as D2, E } from "./operations-B314mytX.js";
17
+ import { B as B3, a as a5, b as b5, C as C3, F, S, c as c3, d as d3, f as f6, e as e3, i as i8, g as g7, o as o5, p as p2, r as r5 } from "./boolean2D-DzA0STqC.js";
18
18
  import { createBlueprint, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, getBounds2D, getOrientation2D, isInside2D, mirror2D, reverseCurve, rotate2D, scale2D, sketch2DOnFace, sketch2DOnPlane, stretch2D, toSVGPathD, translate2D } from "./2d.js";
19
- import { c as createTypedFinder, f as faceFinder } from "./helpers-BSQfs538.js";
20
- import { g as g8 } from "./helpers-BSQfs538.js";
19
+ import { c as createTypedFinder, f as faceFinder } from "./helpers-r_e-u1JM.js";
20
+ import { g as g8 } from "./helpers-r_e-u1JM.js";
21
21
  import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
22
- import { C as C5, D as D4, a as a6, S as S2, b as b6, X, Y, c as c4, d as d4, e as e4, f as f7, Z, g as g9, h as h5, i as i9, j as j6, k as k6, l as l4, m as m4, n as n4, o as o5, p as p3, q as q3, r as r6, s as s2, t as t5, u as u3, v as v5, w as w5, x as x3, y as y2, z as z4, _, $, a0, A as A3, a1, B as B5, E as E3, a2 as a22, F as F3, G as G2, H as H3, I as I2, J as J2, K as K2, L as L2, M as M2, N as N2, O as O2, P, Q, R as R2, T, U, a3 as a32, V, a4 as a42, W } from "./drawFns-CzBbcoXA.js";
22
+ import { C as C4, D as D3, a as a6, S as S2, b as b6, X, Y, c as c4, d as d4, e as e4, f as f7, Z, g as g9, h as h6, i as i9, j as j7, k as k7, l as l5, m as m5, n as n5, o as o6, p as p3, q as q3, r as r6, s as s2, t as t5, u as u3, v as v5, w as w5, x as x3, y as y2, z as z3, _, $, a0, A as A2, a1, B as B4, E as E2, a2 as a22, F as F2, G, H as H2, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a3 as a32, V, a4 as a42, W } from "./drawFns-CAAE4Z88.js";
23
23
  import { c as c5, a as a7, p as p4, r as r7, t as t6 } from "./vectors-BhfKwL9J.js";
24
- import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-BFB3LI_y.js";
25
- import { a as a8, b as b7, e as e5, f as f8, d as d5, g as g10, j as j7, s as s3, t as t7, k as k7, l as l5, v as v6, w as w6 } from "./topology-BFB3LI_y.js";
24
+ import { v as vertexPosition, t as translate$1, c as getEdges, p as propagateOrigins, d as applyMatrix$1, e as clone$1, f as describe$1, h as isEmpty$1, m as mirror$1, r as rotate$1, s as scale$1, j as simplify$1, k as toBREP$1, l as transformCopy$1, n as getBounds, o as getFaces, q as getVertices, u as getWires } from "./shapeFns-CWd_ASDV.js";
25
+ import { w as w6, g as g10, b as b7, x as x4, i as i10, y as y3, z as z4, A as A3, B as B5, C as C5 } from "./shapeFns-CWd_ASDV.js";
26
+ import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-BupialMm.js";
27
+ import { a as a8, b as b8, e as e5, f as f8, d as d5, g as g11, j as j8, s as s3, t as t7, k as k8, l as l6, v as v6, w as w7 } from "./topology-BupialMm.js";
26
28
  import { n as normalAt, f as faceCenter, i as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-ub3CugDN.js";
27
- import { c as c6, a as a9, b as b8, d as d6, p as p5, e as e6, u as u4, h as h6 } from "./faceFns-ub3CugDN.js";
28
- import { m as mesh$1, a as meshEdges$1 } from "./meshFns-BKSPaPXS.js";
29
- import { c as c7, b as b9, e as e7, d as d7, f as f9 } from "./meshFns-BKSPaPXS.js";
30
- import { c as cut$1, f as fuse$1, i as intersect$1, s as section$1, a as slice$1, b as split$1, d as fuseAll, e as cutAll } from "./booleanFns-BhqXpQoZ.js";
31
- import { g as g11 } from "./booleanFns-BhqXpQoZ.js";
29
+ import { c as c6, a as a9, b as b9, d as d6, p as p5, e as e6, u as u4, h as h7 } from "./faceFns-ub3CugDN.js";
30
+ import { m as mesh$1, a as meshEdges$1 } from "./meshFns-BEvGVcym.js";
31
+ import { c as c7, b as b10, e as e7, d as d7, f as f9 } from "./meshFns-BEvGVcym.js";
32
+ import { c as cut$1, f as fuse$1, i as intersect$1, s as section$1, a as slice$1, b as split$1, d as fuseAll, e as cutAll } from "./booleanFns-BcQUqjUu.js";
33
+ import { g as g12 } from "./booleanFns-BcQUqjUu.js";
32
34
  import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-BfhEneUl.js";
33
- import { d as d8, e as e8, f as f10, g as g12, h as h7, i as i10 } from "./measurement-BfhEneUl.js";
35
+ import { d as d8, e as e8, f as f10, g as g13, h as h8, i as i11 } from "./measurement-BfhEneUl.js";
34
36
  import { c as makeBezierCurve, d as makeBSplineApproximation, e as makeCircle, f as makeEllipse, g as makeEllipseArc, b as makeHelix, m as makeLine, h as makeTangentArc, i as makeThreePointArc, a as assembleWire } from "./curveBuilders-CN72XaIQ.js";
35
37
  import { i as iterTopo, f as fromBREP$1 } from "./cast-D0OhP1nV.js";
36
- import { e as e9, c as c8, d as d9, g as g13, s as s4 } from "./cast-D0OhP1nV.js";
38
+ import { e as e9, c as c8, d as d9, g as g14, s as s4 } from "./cast-D0OhP1nV.js";
37
39
  import { edgeFinder } from "./query.js";
38
40
  import { BrepBugError, bug } from "./result.js";
39
- import { c as c9 } from "./cornerFinder-CPm2baSJ.js";
41
+ import { c as c9 } from "./cornerFinder-DvPiz-VR.js";
40
42
  import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
41
43
  const errorFactories = {
42
44
  OCCT_OPERATION: (code, message, cause) => ({ kind: "OCCT_OPERATION", code, message, cause }),
@@ -111,11 +113,11 @@ function withNearestPostFilter(baseFinder, nearestPoint) {
111
113
  if (candidates.length === 0) return [];
112
114
  let bestIdx = 0;
113
115
  let bestDist = vecDistance(vertexPosition(candidates[0]), nearestPoint);
114
- for (let i11 = 1; i11 < candidates.length; i11++) {
115
- const d10 = vecDistance(vertexPosition(candidates[i11]), nearestPoint);
116
+ for (let i12 = 1; i12 < candidates.length; i12++) {
117
+ const d10 = vecDistance(vertexPosition(candidates[i12]), nearestPoint);
116
118
  if (d10 < bestDist) {
117
119
  bestDist = d10;
118
- bestIdx = i11;
120
+ bestIdx = i12;
119
121
  }
120
122
  }
121
123
  return [candidates[bestIdx]];
@@ -184,11 +186,11 @@ function checkInterference(shape1, shape2, tolerance = 1e-6) {
184
186
  }
185
187
  function checkAllInterferences(shapes, tolerance = 1e-6) {
186
188
  const pairs = [];
187
- shapes.forEach((si, i11) => {
188
- for (let j8 = i11 + 1; j8 < shapes.length; j8++) {
189
- const result = unwrap(checkInterference(si, shapes[j8], tolerance));
189
+ shapes.forEach((si, i12) => {
190
+ for (let j9 = i12 + 1; j9 < shapes.length; j9++) {
191
+ const result = unwrap(checkInterference(si, shapes[j9], tolerance));
190
192
  if (result.hasInterference) {
191
- pairs.push({ i: i11, j: j8, result });
193
+ pairs.push({ i: i12, j: j9, result });
192
194
  }
193
195
  }
194
196
  });
@@ -307,14 +309,14 @@ function tangentArc(startPoint, startTgt, endPoint) {
307
309
  function wire(listOfEdges) {
308
310
  return assembleWire(listOfEdges);
309
311
  }
310
- function face(w7, holes) {
311
- return makeFace(w7, holes);
312
+ function face(w8, holes) {
313
+ return makeFace(w8, holes);
312
314
  }
313
- function filledFace(w7) {
314
- return makeNonPlanarFace(w7);
315
+ function filledFace(w8) {
316
+ return makeNonPlanarFace(w8);
315
317
  }
316
- function subFace(originFace, w7) {
317
- return makeNewFaceWithinFace(originFace, w7);
318
+ function subFace(originFace, w8) {
319
+ return makeNewFaceWithinFace(originFace, w8);
318
320
  }
319
321
  function polygon(points) {
320
322
  return makePolygon(points);
@@ -346,11 +348,21 @@ function validateNotNull(shape2, label) {
346
348
  function thicken$1(shape2, thickness) {
347
349
  const check = validateNotNull(shape2, "thicken: shape");
348
350
  if (isErr(check)) return check;
349
- return kernelCall(
350
- () => getKernel().thicken(shape2.wrapped, thickness),
351
- "THICKEN_FAILED",
352
- "Thicken operation failed"
353
- );
351
+ try {
352
+ const oc = getKernel().oc;
353
+ const r8 = gcWithScope();
354
+ const builder = r8(new oc.BRepOffsetAPI_MakeThickSolid());
355
+ builder.MakeThickSolidBySimple(shape2.wrapped, thickness);
356
+ const progress = r8(new oc.Message_ProgressRange_1());
357
+ builder.Build(progress);
358
+ const resultOc = builder.Shape();
359
+ const cast = castShape(resultOc);
360
+ propagateOrigins(builder, [shape2], cast);
361
+ return ok(cast);
362
+ } catch (e10) {
363
+ const raw = e10 instanceof Error ? e10.message : String(e10);
364
+ return err(occtError("THICKEN_FAILED", `Thicken operation failed: ${raw}`, e10));
365
+ }
354
366
  }
355
367
  function fillet$1(shape2, edges, radius) {
356
368
  const check = validateNotNull(shape2, "fillet: shape");
@@ -390,23 +402,26 @@ function fillet$1(shape2, edges, radius) {
390
402
  );
391
403
  }
392
404
  try {
393
- const kernel = getKernel();
394
- const kernelRadius = typeof radius === "function" ? (
395
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- kernel expects OcShape callback
396
- ((ocEdge) => {
397
- const edgeWrapped = castShape(ocEdge);
398
- return radius(edgeWrapped) ?? 0;
399
- })
400
- ) : radius;
401
- const result = kernel.fillet(
402
- shape2.wrapped,
403
- selectedEdges.map((e10) => e10.wrapped),
404
- kernelRadius
405
+ const oc = getKernel().oc;
406
+ const r8 = gcWithScope();
407
+ const builder = r8(
408
+ new oc.BRepFilletAPI_MakeFillet(shape2.wrapped, oc.ChFi3d_FilletShape.ChFi3d_Rational)
405
409
  );
406
- const cast = castShape(result);
410
+ for (const edge of selectedEdges) {
411
+ const rad = typeof radius === "function" ? radius(edge) ?? 0 : radius;
412
+ if (typeof rad === "number") {
413
+ if (rad > 0) builder.Add_2(rad, edge.wrapped);
414
+ } else {
415
+ const [r1, r22] = rad;
416
+ if (r1 > 0 && r22 > 0) builder.Add_3(r1, r22, edge.wrapped);
417
+ }
418
+ }
419
+ const resultOc = builder.Shape();
420
+ const cast = castShape(resultOc);
407
421
  if (!isShape3D(cast)) {
408
422
  return err(occtError("FILLET_RESULT_NOT_3D", "Fillet result is not a 3D shape"));
409
423
  }
424
+ propagateOrigins(builder, [shape2], cast);
410
425
  return ok(cast);
411
426
  } catch (e10) {
412
427
  const raw = e10 instanceof Error ? e10.message : String(e10);
@@ -449,23 +464,58 @@ function chamfer$1(shape2, edges, distance) {
449
464
  return err(validationError("NO_EDGES", "No edges found for chamfer"));
450
465
  }
451
466
  try {
452
- const kernel = getKernel();
453
- const kernelDistance = typeof distance === "function" ? (
454
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- kernel expects OcShape callback
455
- ((ocEdge) => {
456
- const edgeWrapped = castShape(ocEdge);
457
- return distance(edgeWrapped) ?? 0;
458
- })
459
- ) : distance;
460
- const result = kernel.chamfer(
461
- shape2.wrapped,
462
- selectedEdges.map((e10) => e10.wrapped),
463
- kernelDistance
464
- );
465
- const cast = castShape(result);
467
+ let getEdgeFaceMap = function() {
468
+ if (edgeFaceMap) return edgeFaceMap;
469
+ edgeFaceMap = /* @__PURE__ */ new Map();
470
+ const faceExp = new oc.TopExp_Explorer_2(
471
+ shape2.wrapped,
472
+ oc.TopAbs_ShapeEnum.TopAbs_FACE,
473
+ oc.TopAbs_ShapeEnum.TopAbs_SHAPE
474
+ );
475
+ while (faceExp.More()) {
476
+ const face2 = oc.TopoDS.Face_1(faceExp.Current());
477
+ const edgeExp = new oc.TopExp_Explorer_2(
478
+ face2,
479
+ oc.TopAbs_ShapeEnum.TopAbs_EDGE,
480
+ oc.TopAbs_ShapeEnum.TopAbs_SHAPE
481
+ );
482
+ while (edgeExp.More()) {
483
+ const hash = edgeExp.Current().HashCode(2147483647);
484
+ if (!edgeFaceMap.has(hash)) {
485
+ edgeFaceMap.set(hash, face2);
486
+ }
487
+ edgeExp.Next();
488
+ }
489
+ edgeExp.delete();
490
+ faceExp.Next();
491
+ }
492
+ faceExp.delete();
493
+ return edgeFaceMap;
494
+ };
495
+ const oc = getKernel().oc;
496
+ const r8 = gcWithScope();
497
+ const builder = r8(new oc.BRepFilletAPI_MakeChamfer(shape2.wrapped));
498
+ let edgeFaceMap = null;
499
+ for (const edge of selectedEdges) {
500
+ const d10 = typeof distance === "function" ? distance(edge) ?? 0 : distance;
501
+ if (typeof d10 === "number") {
502
+ if (d10 > 0) builder.Add_2(d10, edge.wrapped);
503
+ } else {
504
+ const [d1, d22] = d10;
505
+ if (d1 > 0 && d22 > 0) {
506
+ const face2 = getEdgeFaceMap().get(edge.wrapped.HashCode(2147483647));
507
+ if (face2) {
508
+ builder.Add_3(d1, d22, oc.TopoDS.Edge_1(edge.wrapped), face2);
509
+ }
510
+ }
511
+ }
512
+ }
513
+ const resultOc = builder.Shape();
514
+ const cast = castShape(resultOc);
466
515
  if (!isShape3D(cast)) {
467
516
  return err(occtError("CHAMFER_RESULT_NOT_3D", "Chamfer result is not a 3D shape"));
468
517
  }
518
+ propagateOrigins(builder, [shape2], cast);
469
519
  return ok(cast);
470
520
  } catch (e10) {
471
521
  const raw = e10 instanceof Error ? e10.message : String(e10);
@@ -488,16 +538,32 @@ function shell$1(shape2, faces, thickness, tolerance = 1e-3) {
488
538
  return err(validationError("NO_FACES", "At least one face must be specified for shell"));
489
539
  }
490
540
  try {
491
- const result = getKernel().shell(
541
+ const oc = getKernel().oc;
542
+ const r8 = gcWithScope();
543
+ const facesToRemove = r8(new oc.TopTools_ListOfShape_1());
544
+ for (const face2 of faces) {
545
+ facesToRemove.Append_1(face2.wrapped);
546
+ }
547
+ const progress = r8(new oc.Message_ProgressRange_1());
548
+ const builder = r8(new oc.BRepOffsetAPI_MakeThickSolid());
549
+ builder.MakeThickSolidByJoin(
492
550
  shape2.wrapped,
493
- faces.map((f11) => f11.wrapped),
494
- thickness,
495
- tolerance
551
+ facesToRemove,
552
+ -thickness,
553
+ tolerance,
554
+ oc.BRepOffset_Mode.BRepOffset_Skin,
555
+ false,
556
+ false,
557
+ oc.GeomAbs_JoinType.GeomAbs_Arc,
558
+ false,
559
+ progress
496
560
  );
497
- const cast = castShape(result);
561
+ const resultOc = builder.Shape();
562
+ const cast = castShape(resultOc);
498
563
  if (!isShape3D(cast)) {
499
564
  return err(occtError("SHELL_RESULT_NOT_3D", "Shell result is not a 3D shape"));
500
565
  }
566
+ propagateOrigins(builder, [shape2], cast);
501
567
  return ok(cast);
502
568
  } catch (e10) {
503
569
  const raw = e10 instanceof Error ? e10.message : String(e10);
@@ -516,11 +582,33 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
516
582
  if (distance === 0) {
517
583
  return err(validationError("ZERO_OFFSET", "Offset distance cannot be zero"));
518
584
  }
519
- return kernelCall(
520
- () => getKernel().offset(shape2.wrapped, distance, tolerance),
521
- "OFFSET_FAILED",
522
- "Offset operation failed"
523
- );
585
+ try {
586
+ const oc = getKernel().oc;
587
+ const r8 = gcWithScope();
588
+ const progress = r8(new oc.Message_ProgressRange_1());
589
+ const builder = r8(new oc.BRepOffsetAPI_MakeOffsetShape());
590
+ builder.PerformByJoin(
591
+ shape2.wrapped,
592
+ distance,
593
+ tolerance,
594
+ oc.BRepOffset_Mode.BRepOffset_Skin,
595
+ false,
596
+ false,
597
+ oc.GeomAbs_JoinType.GeomAbs_Arc,
598
+ false,
599
+ progress
600
+ );
601
+ const resultOc = builder.Shape();
602
+ const cast = castShape(resultOc);
603
+ if (!isShape3D(cast)) {
604
+ return err(occtError("OFFSET_RESULT_NOT_3D", "Offset result is not a 3D shape"));
605
+ }
606
+ propagateOrigins(builder, [shape2], cast);
607
+ return ok(cast);
608
+ } catch (e10) {
609
+ const raw = e10 instanceof Error ? e10.message : String(e10);
610
+ return err(occtError("OFFSET_FAILED", `Offset operation failed: ${raw}`, e10));
611
+ }
524
612
  }
525
613
  function translate(shape2, v7) {
526
614
  return translate$1(resolve(shape2), v7);
@@ -545,14 +633,14 @@ function applyMatrix(shape2, matrix) {
545
633
  function transformCopy(shape2, composed) {
546
634
  return transformCopy$1(resolve(shape2), composed);
547
635
  }
548
- function fuse(a10, b10, options) {
549
- return fuse$1(resolve(a10), resolve(b10), options);
636
+ function fuse(a10, b11, options) {
637
+ return fuse$1(resolve(a10), resolve(b11), options);
550
638
  }
551
639
  function cut(base, tool, options) {
552
640
  return cut$1(resolve(base), resolve(tool), options);
553
641
  }
554
- function intersect(a10, b10, options) {
555
- return intersect$1(resolve(a10), resolve(b10), options);
642
+ function intersect(a10, b11, options) {
643
+ return intersect$1(resolve(a10), resolve(b11), options);
556
644
  }
557
645
  function section(shape2, plane, options) {
558
646
  return section$1(resolve(shape2), plane, options);
@@ -686,8 +774,8 @@ function loft$1(wires, { ruled = true, startPoint, endPoint } = {}, returnShell
686
774
  const vMaker = r8(new oc.BRepBuilderAPI_MakeVertex(pnt));
687
775
  builder.AddVertex(vMaker.Vertex());
688
776
  }
689
- for (const w7 of wires) {
690
- builder.AddWire(w7.wrapped);
777
+ for (const w8 of wires) {
778
+ builder.AddWire(w8.wrapped);
691
779
  }
692
780
  if (endPoint) {
693
781
  const pnt = r8(toOcPnt(toVec3(endPoint)));
@@ -720,7 +808,7 @@ function revolve(face2, options) {
720
808
  );
721
809
  }
722
810
  function loft(wires, options) {
723
- const resolvedWires = wires.map((w7) => resolve(w7));
811
+ const resolvedWires = wires.map((w8) => resolve(w8));
724
812
  return loft$1(resolvedWires, options);
725
813
  }
726
814
  function resolveTargetFace(shape2, faceSpec) {
@@ -731,8 +819,8 @@ function resolveTargetFace(shape2, faceSpec) {
731
819
  }
732
820
  let best = faces[0];
733
821
  let bestZ = faceCenter(best)[2];
734
- for (let i11 = 1; i11 < faces.length; i11++) {
735
- const f11 = faces[i11];
822
+ for (let i12 = 1; i12 < faces.length; i12++) {
823
+ const f11 = faces[i12];
736
824
  const z5 = faceCenter(f11)[2];
737
825
  if (z5 > bestZ) {
738
826
  best = f11;
@@ -771,10 +859,10 @@ function drill(shape2, options) {
771
859
  const pos = at.length === 2 ? [at[0], at[1], 0] : [at[0], at[1], at[2]];
772
860
  let depth = options.depth;
773
861
  if (depth === void 0) {
774
- const b10 = getBounds(s5);
775
- const dx = b10.xMax - b10.xMin;
776
- const dy = b10.yMax - b10.yMin;
777
- const dz = b10.zMax - b10.zMin;
862
+ const b11 = getBounds(s5);
863
+ const dx = b11.xMax - b11.xMin;
864
+ const dy = b11.yMax - b11.yMin;
865
+ const dz = b11.zMax - b11.zMin;
778
866
  depth = Math.sqrt(dx * dx + dy * dy + dz * dz) + 1;
779
867
  }
780
868
  const cyl = makeCylinder(radius, depth, pos, dir);
@@ -790,8 +878,8 @@ function pocket(shape2, options) {
790
878
  }
791
879
  const targetFace = resolveTargetFace(s5, options.face);
792
880
  const normal = normalAt(targetFace);
793
- const w7 = toWire(profile);
794
- const faceResult = makeFace(w7);
881
+ const w8 = toWire(profile);
882
+ const faceResult = makeFace(w8);
795
883
  if (isErr(faceResult)) return faceResult;
796
884
  const extDir = vecScale(vecNormalize(normal), -depth);
797
885
  const toolResult = extrude$1(faceResult.value, extDir);
@@ -806,8 +894,8 @@ function boss(shape2, options) {
806
894
  }
807
895
  const targetFace = resolveTargetFace(s5, options.face);
808
896
  const normal = normalAt(targetFace);
809
- const w7 = toWire(profile);
810
- const faceResult = makeFace(w7);
897
+ const w8 = toWire(profile);
898
+ const faceResult = makeFace(w8);
811
899
  if (isErr(faceResult)) return faceResult;
812
900
  const extDir = vecScale(vecNormalize(normal), height);
813
901
  const toolResult = extrude$1(faceResult.value, extDir);
@@ -975,8 +1063,8 @@ function createWrappedCurve(val) {
975
1063
  isClosed: () => curveIsClosed(val),
976
1064
  sweep(spine, opts) {
977
1065
  if (!isWire(val)) throw new Error("sweep requires a Wire");
978
- const w7 = val;
979
- const result = unwrapOrThrow(sweep(w7, resolve(spine), opts));
1066
+ const w8 = val;
1067
+ const result = unwrapOrThrow(sweep(w8, resolve(spine), opts));
980
1068
  const shape3D = Array.isArray(result) ? result[0] : result;
981
1069
  return wrap3D(shape3D);
982
1070
  }
@@ -1018,7 +1106,7 @@ function shape(s5) {
1018
1106
  throw new Error("shape() requires a Sketch or branded shape type");
1019
1107
  }
1020
1108
  export {
1021
- B4 as BaseSketcher2d,
1109
+ B3 as BaseSketcher2d,
1022
1110
  B as Blueprint,
1023
1111
  a5 as BlueprintSketcher,
1024
1112
  b5 as Blueprints,
@@ -1026,14 +1114,14 @@ export {
1026
1114
  BrepBugError,
1027
1115
  BrepErrorCode,
1028
1116
  BrepWrapperError,
1029
- C4 as CompoundBlueprint,
1030
- C5 as CompoundSketch,
1117
+ C3 as CompoundBlueprint,
1118
+ C4 as CompoundSketch,
1031
1119
  C as Curve2D,
1032
1120
  DEG2RAD,
1033
1121
  D as DisposalScope,
1034
- D4 as Drawing,
1122
+ D3 as Drawing,
1035
1123
  a6 as DrawingPen,
1036
- F2 as FaceSketcher,
1124
+ F as FaceSketcher,
1037
1125
  H as HASH_CODE_MAX,
1038
1126
  O as OK,
1039
1127
  R as RAD2DEG,
@@ -1045,11 +1133,11 @@ export {
1045
1133
  b4 as addStep,
1046
1134
  a8 as adjacentFaces,
1047
1135
  a as andThen,
1048
- g11 as applyGlue,
1136
+ g12 as applyGlue,
1049
1137
  applyMatrix,
1050
- z2 as approximateCurve,
1138
+ g5 as approximateCurve,
1051
1139
  e9 as asTopo,
1052
- b7 as autoHeal,
1140
+ b8 as autoHeal,
1053
1141
  f4 as axis2d,
1054
1142
  i6 as basicFaceExtrusion,
1055
1143
  bezier,
@@ -1074,7 +1162,7 @@ export {
1074
1162
  c2 as collect,
1075
1163
  d2 as collectShapes,
1076
1164
  f5 as complexExtrude,
1077
- A as composeTransforms,
1165
+ w6 as composeTransforms,
1078
1166
  compound,
1079
1167
  c4 as compoundSketchExtrude,
1080
1168
  d4 as compoundSketchFace,
@@ -1084,7 +1172,7 @@ export {
1084
1172
  cone,
1085
1173
  c9 as cornerFinder,
1086
1174
  g6 as countNodes,
1087
- h4 as createAssembly,
1175
+ h5 as createAssembly,
1088
1176
  i7 as createAssemblyNode,
1089
1177
  createBlueprint,
1090
1178
  Z as createCamera,
@@ -1093,13 +1181,13 @@ export {
1093
1181
  o as createEdge,
1094
1182
  u as createFace,
1095
1183
  a2 as createHandle,
1096
- j5 as createHistory,
1097
- b9 as createMeshCache,
1184
+ j6 as createHistory,
1185
+ b10 as createMeshCache,
1098
1186
  c5 as createNamedPlane,
1099
1187
  b2 as createOcHandle,
1100
1188
  createOperationRegistry,
1101
1189
  a7 as createPlane,
1102
- k5 as createRegistry,
1190
+ k6 as createRegistry,
1103
1191
  v2 as createShell,
1104
1192
  createSolid,
1105
1193
  createTaskQueue,
@@ -1117,9 +1205,9 @@ export {
1117
1205
  curve2dTangentAt,
1118
1206
  curveEndPoint,
1119
1207
  curveIsClosed,
1120
- B2 as curveIsPeriodic,
1208
+ h4 as curveIsPeriodic,
1121
1209
  curveLength,
1122
- C2 as curvePeriod,
1210
+ i5 as curvePeriod,
1123
1211
  curvePointAt,
1124
1212
  curveStartPoint,
1125
1213
  curveTangentAt,
@@ -1133,14 +1221,14 @@ export {
1133
1221
  g9 as deserializeDrawing,
1134
1222
  fromBREP$1 as deserializeShape,
1135
1223
  d9 as downcast,
1136
- h5 as draw,
1224
+ h6 as draw,
1137
1225
  i9 as drawCircle,
1138
- j6 as drawEllipse,
1139
- k6 as drawFaceOutline,
1140
- l4 as drawParametricFunction,
1141
- m4 as drawPointsInterpolation,
1142
- n4 as drawPolysides,
1143
- o5 as drawProjection,
1226
+ j7 as drawEllipse,
1227
+ k7 as drawFaceOutline,
1228
+ l5 as drawParametricFunction,
1229
+ m5 as drawPointsInterpolation,
1230
+ n5 as drawPolysides,
1231
+ o6 as drawProjection,
1144
1232
  p3 as drawRectangle,
1145
1233
  q3 as drawRoundedRectangle,
1146
1234
  r6 as drawSingleCircle,
@@ -1151,7 +1239,7 @@ export {
1151
1239
  w5 as drawingFillet,
1152
1240
  x3 as drawingFuse,
1153
1241
  y2 as drawingIntersect,
1154
- z4 as drawingToSketchOnPlane,
1242
+ z3 as drawingToSketchOnPlane,
1155
1243
  drill,
1156
1244
  edgeFinder,
1157
1245
  e5 as edgesOfFace,
@@ -1160,7 +1248,7 @@ export {
1160
1248
  ellipsoid,
1161
1249
  enqueueTask,
1162
1250
  err,
1163
- m3 as exportAssemblySTEP,
1251
+ m4 as exportAssemblySTEP,
1164
1252
  exportDXF,
1165
1253
  exportGlb,
1166
1254
  exportGltf,
@@ -1174,16 +1262,16 @@ export {
1174
1262
  faceCenter,
1175
1263
  faceFinder,
1176
1264
  a9 as faceGeomType,
1177
- b8 as faceOrientation,
1265
+ b9 as faceOrientation,
1178
1266
  f8 as facesOfEdge,
1179
1267
  filledFace,
1180
1268
  fillet,
1181
- D2 as findCurveType,
1182
- n3 as findNode,
1183
- o3 as findStep,
1269
+ j4 as findCurveType,
1270
+ n4 as findNode,
1271
+ o4 as findStep,
1184
1272
  f2 as flatMap,
1185
1273
  d6 as flipFaceOrientation,
1186
- E as flipOrientation,
1274
+ k5 as flipOrientation,
1187
1275
  fromBREP,
1188
1276
  f as fromOcDir,
1189
1277
  h as fromOcPnt,
@@ -1194,17 +1282,18 @@ export {
1194
1282
  e3 as fuseBlueprints,
1195
1283
  x as gcWithObject,
1196
1284
  gcWithScope,
1197
- j4 as genericSweep,
1285
+ j5 as genericSweep,
1198
1286
  getBounds,
1199
1287
  getBounds2D,
1200
- F as getCurveType,
1288
+ l4 as getCurveType,
1201
1289
  getEdges,
1290
+ g10 as getFaceOrigins,
1202
1291
  getFaces,
1203
1292
  _ as getFont,
1204
- g5 as getHashCode,
1293
+ b7 as getHashCode,
1205
1294
  p as getHistoryShape,
1206
1295
  getKernel,
1207
- G as getOrientation,
1296
+ m3 as getOrientation,
1208
1297
  getOrientation2D,
1209
1298
  g2 as getShapeKind,
1210
1299
  g8 as getSingleFace,
@@ -1213,8 +1302,8 @@ export {
1213
1302
  getWires,
1214
1303
  heal,
1215
1304
  d5 as healFace,
1216
- g10 as healSolid,
1217
- j7 as healWire,
1305
+ g11 as healSolid,
1306
+ j8 as healWire,
1218
1307
  helix,
1219
1308
  importIGES,
1220
1309
  importSTEP,
@@ -1223,18 +1312,18 @@ export {
1223
1312
  importSVGPathD,
1224
1313
  j as initFromOC,
1225
1314
  innerWires,
1226
- H2 as interpolateCurve,
1315
+ n3 as interpolateCurve,
1227
1316
  intersect,
1228
1317
  i8 as intersect2D,
1229
1318
  g7 as intersectBlueprints,
1230
1319
  i2 as ioError,
1231
1320
  isChamferRadius,
1232
- g13 as isCompSolid,
1321
+ g14 as isCompSolid,
1233
1322
  i3 as isCompound,
1234
1323
  isDisposeRequest,
1235
1324
  isEdge,
1236
1325
  isEmpty,
1237
- I as isEqualShape,
1326
+ x4 as isEqualShape,
1238
1327
  isErr,
1239
1328
  isErrorResponse,
1240
1329
  isFace,
@@ -1246,7 +1335,7 @@ export {
1246
1335
  isOperationRequest,
1247
1336
  $ as isProjectionPlane,
1248
1337
  isQueueEmpty,
1249
- i5 as isSameShape,
1338
+ i10 as isSameShape,
1250
1339
  f3 as isShape1D,
1251
1340
  isShape3D,
1252
1341
  j3 as isShell,
@@ -1255,11 +1344,11 @@ export {
1255
1344
  isValid,
1256
1345
  l2 as isVertex,
1257
1346
  isWire,
1258
- J as iterEdges,
1259
- K as iterFaces,
1347
+ y3 as iterEdges,
1348
+ z4 as iterFaces,
1260
1349
  iterTopo,
1261
- L as iterVertices,
1262
- M as iterWires,
1350
+ A3 as iterVertices,
1351
+ B5 as iterWires,
1263
1352
  kernelCall,
1264
1353
  kernelCallRaw,
1265
1354
  line,
@@ -1267,7 +1356,7 @@ export {
1267
1356
  a0 as loadFont,
1268
1357
  t3 as localGC,
1269
1358
  loft,
1270
- A3 as makeBaseBox,
1359
+ A2 as makeBaseBox,
1271
1360
  g4 as makePlane,
1272
1361
  a1 as makeProjectedEdges,
1273
1362
  m as map,
@@ -1276,9 +1365,9 @@ export {
1276
1365
  measureArea,
1277
1366
  e8 as measureCurvatureAt,
1278
1367
  f10 as measureCurvatureAtMid,
1279
- g12 as measureDistance,
1280
- h7 as measureLength,
1281
- i10 as measureLinearProps,
1368
+ g13 as measureDistance,
1369
+ h8 as measureLength,
1370
+ i11 as measureLinearProps,
1282
1371
  measureSurfaceProps,
1283
1372
  measureVolume,
1284
1373
  measureVolumeProps,
@@ -1286,7 +1375,7 @@ export {
1286
1375
  meshEdges,
1287
1376
  mirror,
1288
1377
  mirror2D,
1289
- B5 as mirrorDrawing,
1378
+ B4 as mirrorDrawing,
1290
1379
  mirrorJoin,
1291
1380
  q2 as modifyStep,
1292
1381
  k2 as moduleInitError,
@@ -1294,9 +1383,9 @@ export {
1294
1383
  occtError,
1295
1384
  offset,
1296
1385
  offsetFace,
1297
- N as offsetWire2D,
1386
+ o3 as offsetWire2D,
1298
1387
  ok,
1299
- o4 as organiseBlueprints,
1388
+ o5 as organiseBlueprints,
1300
1389
  outerWire,
1301
1390
  pendingCount,
1302
1391
  z as pipeline,
@@ -1304,7 +1393,7 @@ export {
1304
1393
  pocket,
1305
1394
  p5 as pointOnSurface,
1306
1395
  polygon,
1307
- E3 as polysideInnerRadius,
1396
+ E2 as polysideInnerRadius,
1308
1397
  p2 as polysidesBlueprint,
1309
1398
  a22 as projectEdges,
1310
1399
  e6 as projectPointOnFace,
@@ -1326,12 +1415,13 @@ export {
1326
1415
  revolve,
1327
1416
  rotate,
1328
1417
  rotate2D,
1329
- F3 as rotateDrawing,
1418
+ F2 as rotateDrawing,
1330
1419
  r5 as roundedRectangleBlueprint,
1331
1420
  scale,
1332
1421
  scale2D,
1333
- G2 as scaleDrawing,
1422
+ G as scaleDrawing,
1334
1423
  section,
1424
+ C5 as setShapeOrigin,
1335
1425
  sewShells,
1336
1426
  shape,
1337
1427
  s4 as shapeType,
@@ -1340,13 +1430,13 @@ export {
1340
1430
  simplify,
1341
1431
  sketch2DOnFace,
1342
1432
  sketch2DOnPlane,
1343
- H3 as sketchCircle,
1344
- I2 as sketchEllipse,
1345
- J2 as sketchExtrude,
1346
- K2 as sketchFace,
1347
- L2 as sketchFaceOffset,
1348
- M2 as sketchHelix,
1349
- N2 as sketchLoft,
1433
+ H2 as sketchCircle,
1434
+ I as sketchEllipse,
1435
+ J as sketchExtrude,
1436
+ K as sketchFace,
1437
+ L as sketchFaceOffset,
1438
+ M as sketchHelix,
1439
+ N as sketchLoft,
1350
1440
  O2 as sketchParametricFunction,
1351
1441
  P as sketchPolysides,
1352
1442
  Q as sketchRectangle,
@@ -1361,10 +1451,10 @@ export {
1361
1451
  sphere,
1362
1452
  split,
1363
1453
  y as stepCount,
1364
- z3 as stepsFrom,
1454
+ z2 as stepsFrom,
1365
1455
  stretch2D,
1366
1456
  subFace,
1367
- A2 as supportExtrude,
1457
+ A as supportExtrude,
1368
1458
  sweep,
1369
1459
  tangentArc,
1370
1460
  a42 as textBlueprints,
@@ -1372,8 +1462,8 @@ export {
1372
1462
  threePointArc,
1373
1463
  toBREP,
1374
1464
  t7 as toBufferGeometryData,
1375
- k7 as toGroupedBufferGeometryData,
1376
- l5 as toLineGeometryData,
1465
+ k8 as toGroupedBufferGeometryData,
1466
+ l6 as toLineGeometryData,
1377
1467
  c as toOcVec,
1378
1468
  toSVGPathD,
1379
1469
  t as toVec2,
@@ -1386,16 +1476,16 @@ export {
1386
1476
  t6 as translatePlane,
1387
1477
  t2 as tryCatch,
1388
1478
  n as tryCatchAsync,
1389
- B3 as twistExtrude,
1479
+ B2 as twistExtrude,
1390
1480
  typeCastError,
1391
- C3 as undoLast,
1481
+ C2 as undoLast,
1392
1482
  unwrap,
1393
1483
  r2 as unwrapErr,
1394
1484
  v as unwrapOr,
1395
1485
  w2 as unwrapOrElse,
1396
- D3 as updateNode,
1486
+ D2 as updateNode,
1397
1487
  u4 as uvBounds,
1398
- h6 as uvCoordinates,
1488
+ h7 as uvCoordinates,
1399
1489
  validationError,
1400
1490
  v3 as vecAdd,
1401
1491
  a3 as vecAngle,
@@ -1417,10 +1507,10 @@ export {
1417
1507
  vertexFinder,
1418
1508
  vertexPosition,
1419
1509
  v6 as verticesOfEdge,
1420
- E2 as walkAssembly,
1510
+ E as walkAssembly,
1421
1511
  wire,
1422
1512
  wireFinder,
1423
- w6 as wiresOfFace,
1513
+ w7 as wiresOfFace,
1424
1514
  w as withOcDir,
1425
1515
  k as withOcPnt,
1426
1516
  l as withOcVec,