brepjs 20.2.0 → 20.4.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 (114) hide show
  1. package/dist/2d.cjs +7 -7
  2. package/dist/2d.js +7 -7
  3. package/dist/{adjacencyFns-DZsPfYIq.cjs → adjacencyFns-1rxgJ6Hw.cjs} +3 -3
  4. package/dist/{adjacencyFns-k4GWh4n7.js → adjacencyFns-DeyXahej.js} +3 -3
  5. package/dist/{blueprint-CJuRunkd.cjs → blueprint-Yyoiz-U1.cjs} +7 -7
  6. package/dist/{blueprint-Dsp4t2ul.js → blueprint-rwJjYPzo.js} +7 -7
  7. package/dist/{blueprintFns-BRceCeZp.cjs → blueprintFns-Ce6OoPSX.cjs} +3 -3
  8. package/dist/{blueprintFns-DNyUtopT.js → blueprintFns-Q3Sq-Fse.js} +3 -3
  9. package/dist/{blueprintSketcher-DRXOTYuD.cjs → blueprintSketcher-CzKbxeTk.cjs} +4 -4
  10. package/dist/{blueprintSketcher-kV7aFwRS.js → blueprintSketcher-FywUpRiV.js} +4 -4
  11. package/dist/{boolean2D-DmPqFj_V.cjs → boolean2D-BzZ9iBSn.cjs} +5 -5
  12. package/dist/{boolean2D-TdJfMS8F.js → boolean2D-D8igCYc9.js} +5 -5
  13. package/dist/brepjs.cjs +35 -32
  14. package/dist/brepjs.js +35 -33
  15. package/dist/{cameraFns-u08iOn7p.js → cameraFns-Cs6v3bWQ.js} +4 -4
  16. package/dist/{cameraFns-B8Ai6b3Q.cjs → cameraFns-RHCb1F1s.cjs} +4 -4
  17. package/dist/core/errors.d.ts +3 -0
  18. package/dist/core.cjs +4 -4
  19. package/dist/core.js +4 -4
  20. package/dist/{cornerFinder-BVUuCBX-.cjs → cornerFinder-Cji_BK-R.cjs} +1 -1
  21. package/dist/{cornerFinder-DfoRecV-.js → cornerFinder-Dlae8IX5.js} +1 -1
  22. package/dist/{curveFns-DciWOppG.cjs → curveFns-6-ULFrEB.cjs} +2 -2
  23. package/dist/{curveFns-D5V4jm7S.js → curveFns-KS1BWGhF.js} +2 -2
  24. package/dist/{drawFns-BzuxoLHh.js → drawFns-3yRVBDgI.js} +14 -14
  25. package/dist/{drawFns-DeUXFpjR.cjs → drawFns-Ddlgp9gQ.cjs} +14 -14
  26. package/dist/{errors-CDSezF9z.js → errors-Zb3jBa0u.js} +3 -0
  27. package/dist/{errors-gG-7hA7k.cjs → errors-jwhfQJZK.cjs} +3 -0
  28. package/dist/{faceFns-DhdweJGk.js → faceFns-CTlJC5IY.js} +3 -3
  29. package/dist/{faceFns-DaXVpMr5.cjs → faceFns-CZeHWke7.cjs} +3 -3
  30. package/dist/faceRoleFns-CWU1-Pm8.js +37 -0
  31. package/dist/faceRoleFns-CtH_48MO.cjs +60 -0
  32. package/dist/{healingFns-HekFOO_s.js → healingFns-Ct3gEMvk.js} +5 -5
  33. package/dist/{healingFns-C_f03IV6.cjs → healingFns-DwSpJZfg.cjs} +5 -5
  34. package/dist/{helpers-BWNXoJz0.js → helpers-BN1mVMuZ.js} +7 -7
  35. package/dist/{helpers-Dh4qTGcQ.cjs → helpers-NRZVshPb.cjs} +7 -7
  36. package/dist/{importFns-DGnmgb9G.js → importFns-0kHGg-b8.js} +3 -3
  37. package/dist/{importFns-CKfKRdiq.cjs → importFns-BEi-HsSw.cjs} +3 -3
  38. package/dist/index.d.ts +1 -0
  39. package/dist/io.cjs +2 -2
  40. package/dist/io.js +2 -2
  41. package/dist/kernel/interfaces/measureOps.d.ts +19 -0
  42. package/dist/kernel/occtWasm/measureOps.d.ts +2 -1
  43. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  44. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +2 -1
  45. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  46. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +2 -0
  47. package/dist/{loftFns-DE1GYW9g.js → loftFns-B5mq1WDh.js} +2 -2
  48. package/dist/{loftFns-CI8uJc1D.cjs → loftFns-DL9UsQhd.cjs} +2 -2
  49. package/dist/{measureFns-BoA-Fmwy.js → measureFns-CyDVZomf.js} +5 -5
  50. package/dist/{measureFns-B8Yj_BMz.cjs → measureFns-D_GpQw5z.cjs} +16 -4
  51. package/dist/measurement/measureCache.d.ts +2 -1
  52. package/dist/measurement/measureTypes.d.ts +9 -0
  53. package/dist/measurement/principalBoxFns.d.ts +33 -0
  54. package/dist/measurement.cjs +3 -1
  55. package/dist/measurement.d.ts +1 -0
  56. package/dist/measurement.js +3 -2
  57. package/dist/{meshFns-BT7W4b1c.cjs → meshFns-CAxkaRTm.cjs} +4 -4
  58. package/dist/{meshFns-o9MnZeir.js → meshFns-COlno8TY.js} +4 -4
  59. package/dist/ns/measurement.d.ts +1 -0
  60. package/dist/{occtWasmAdapter-D4I0n537.js → occtWasmAdapter-BX10fyla.js} +21 -0
  61. package/dist/{occtWasmAdapter-wCKnmevS.cjs → occtWasmAdapter-CA6PmIIj.cjs} +21 -0
  62. package/dist/operations/extrudeFns.d.ts +4 -0
  63. package/dist/operations.cjs +2 -2
  64. package/dist/operations.js +2 -2
  65. package/dist/{originTrackingFns-B3-1bBED.cjs → originTrackingFns-CWo6NWHK.cjs} +2 -2
  66. package/dist/{originTrackingFns-BFmhk_Up.js → originTrackingFns-DiHy5BZC.js} +2 -2
  67. package/dist/{planeOps-BO6nvRja.js → planeOps-Cxws4Tiu.js} +1 -1
  68. package/dist/{planeOps-DqGSxcMr.cjs → planeOps-DJuclNxa.cjs} +1 -1
  69. package/dist/{primitiveFns-DfhjU_X9.js → primitiveFns-CGJzS4MO.js} +5 -5
  70. package/dist/{primitiveFns-Ke-n8Bib.cjs → primitiveFns-ZV3aMbqG.cjs} +5 -5
  71. package/dist/principalBoxFns-5FSbxAj-.cjs +212 -0
  72. package/dist/principalBoxFns-BJgGEoik.js +207 -0
  73. package/dist/projection.cjs +1 -1
  74. package/dist/projection.js +1 -1
  75. package/dist/query.cjs +2 -2
  76. package/dist/query.js +2 -2
  77. package/dist/{refResolveFns-C-6Xa_8k.js → refResolveFns-CpVZoeOT.js} +30 -12
  78. package/dist/{refResolveFns-BPqbBoxy.cjs → refResolveFns-Ct52Uw7R.cjs} +30 -12
  79. package/dist/result.cjs +1 -1
  80. package/dist/result.js +1 -1
  81. package/dist/{shapeFns-CUTM2ZDR.js → shapeFns--1wNlcc_.js} +3 -3
  82. package/dist/{shapeFns-CmJNoPsh.cjs → shapeFns-C2j6oZ2u.cjs} +3 -3
  83. package/dist/shapeRef.cjs +1 -1
  84. package/dist/shapeRef.js +1 -1
  85. package/dist/{shapeTypes-DVpJHhgk.js → shapeTypes-CqNJoSam.js} +1 -1
  86. package/dist/{shapeTypes-BWsKDxzf.cjs → shapeTypes-DH2ShBU_.cjs} +1 -1
  87. package/dist/sketching.cjs +3 -3
  88. package/dist/sketching.js +3 -3
  89. package/dist/{solidBuilders-B8t5h68e.cjs → solidBuilders-CgicU3le.cjs} +12 -10
  90. package/dist/{solidBuilders-p_ppeTkc.js → solidBuilders-IstbiWju.js} +12 -10
  91. package/dist/{surfaceBuilders-Dccm2kQX.js → surfaceBuilders-8nLk2PWk.js} +4 -4
  92. package/dist/{surfaceBuilders-Bn-c9xVR.cjs → surfaceBuilders-vYgSvgI6.cjs} +4 -4
  93. package/dist/text.cjs +2 -2
  94. package/dist/text.js +2 -2
  95. package/dist/{textBlueprints-bFsyNLkO.js → textBlueprints-C13NAA3C.js} +169 -10
  96. package/dist/{textBlueprints-DQi920gG.cjs → textBlueprints-fa7VHJZz.cjs} +168 -9
  97. package/dist/{textMetrics-DhysRMr7.cjs → textMetrics--cikHkGX.cjs} +2 -2
  98. package/dist/{textMetrics-CvTwh4tR.js → textMetrics-Dcc63qRm.js} +2 -2
  99. package/dist/{threadFns-DlGXBSK7.js → threadFns-3U9x4v_M.js} +8 -8
  100. package/dist/{threadFns-DAKMitvE.cjs → threadFns-BUQPg_vI.cjs} +8 -8
  101. package/dist/topology/metadata/faceRoleFns.d.ts +15 -0
  102. package/dist/topology/metadata/metadataPropagation.d.ts +2 -2
  103. package/dist/topology/shapeRef/extrudeRoleFns.d.ts +9 -0
  104. package/dist/topology/shapeRef/refResolveFns.d.ts +2 -1
  105. package/dist/topology/shapeRef/shapeRefFns.d.ts +8 -2
  106. package/dist/topology.cjs +9 -9
  107. package/dist/topology.js +9 -9
  108. package/dist/{topologyQueryFns-fNWsM4Lr.js → topologyQueryFns-DnfjQgP7.js} +3 -3
  109. package/dist/{topologyQueryFns-CI4j3NTE.cjs → topologyQueryFns-q2bGyuEV.cjs} +8 -2
  110. package/dist/{validityTypes-D9oxhu4U.cjs → validityTypes-r0A2YdNq.cjs} +2 -2
  111. package/dist/{validityTypes-2DNKAPEw.js → validityTypes-t7JpS0Ki.js} +2 -2
  112. package/dist/vectors.cjs +1 -1
  113. package/dist/vectors.js +1 -1
  114. package/package.json +1 -1
@@ -1,19 +1,173 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
3
3
  const require_bug = require("./bug-O02CsAmt.cjs");
4
- const require_errors = require("./errors-gG-7hA7k.cjs");
4
+ const require_errors = require("./errors-jwhfQJZK.cjs");
5
+ const require_constants = require("./constants-BOVyEYGH.cjs");
5
6
  const require_types = require("./types-KjA8tY4Y.cjs");
6
7
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
7
- const require_planeOps = require("./planeOps-DqGSxcMr.cjs");
8
- const require_faceFns = require("./faceFns-DaXVpMr5.cjs");
9
- const require_solidBuilders = require("./solidBuilders-B8t5h68e.cjs");
10
- const require_curveFns = require("./curveFns-DciWOppG.cjs");
8
+ const require_planeOps = require("./planeOps-DJuclNxa.cjs");
9
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
10
+ const require_solidBuilders = require("./solidBuilders-CgicU3le.cjs");
11
+ const require_faceRoleFns = require("./faceRoleFns-CtH_48MO.cjs");
12
+ const require_curveFns = require("./curveFns-6-ULFrEB.cjs");
11
13
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
12
- const require_surfaceBuilders = require("./surfaceBuilders-Bn-c9xVR.cjs");
13
- const require_blueprintSketcher = require("./blueprintSketcher-DRXOTYuD.cjs");
14
- const require_loftFns = require("./loftFns-CI8uJc1D.cjs");
14
+ const require_surfaceBuilders = require("./surfaceBuilders-vYgSvgI6.cjs");
15
+ const require_blueprintSketcher = require("./blueprintSketcher-CzKbxeTk.cjs");
16
+ const require_loftFns = require("./loftFns-DL9UsQhd.cjs");
15
17
  let opentype_js = require("opentype.js");
16
18
  opentype_js = require_rolldown_runtime.__toESM(opentype_js, 1);
19
+ //#region src/topology/shapeRef/extrudeRoleFns.ts
20
+ /** Match tolerance as a fraction of the extrusion's size. */
21
+ var RELATIVE_TOLERANCE = 1e-6;
22
+ function centerOf({ min, max }) {
23
+ return [
24
+ (min[0] + max[0]) / 2,
25
+ (min[1] + max[1]) / 2,
26
+ (min[2] + max[2]) / 2
27
+ ];
28
+ }
29
+ function boxCenter(shape) {
30
+ return centerOf(require_shapeTypes.getKernel().boundingBox(shape));
31
+ }
32
+ function edgeCenters(wire) {
33
+ const kernel = require_shapeTypes.getKernel();
34
+ const centers = [];
35
+ for (const edge of kernel.iterShapes(wire, "edge")) try {
36
+ centers.push(boxCenter(edge));
37
+ } finally {
38
+ kernel.dispose(edge);
39
+ }
40
+ return centers;
41
+ }
42
+ /**
43
+ * Where each role's face sits, as a bounding-box center. A face swept from an
44
+ * edge is the edge's Minkowski sum with the segment [0, vector], so its box
45
+ * center is the edge's box center + vector / 2; the caps are translated copies
46
+ * of the profile. This holds for exact boxes (OCCT) and vertex boxes (brepkit)
47
+ * alike, so predicted and actual centers agree to rounding.
48
+ */
49
+ function anchorsFor(profile, start, vector) {
50
+ const kernel = require_shapeTypes.getKernel();
51
+ const anchors = [{
52
+ role: "extrude:start",
53
+ point: start
54
+ }, {
55
+ role: "extrude:end",
56
+ point: require_vecOps.vecAdd(start, vector)
57
+ }];
58
+ const halfVector = require_vecOps.vecScale(vector, .5);
59
+ const outer = kernel.outerWire(profile);
60
+ try {
61
+ let hole = 0;
62
+ for (const wire of kernel.iterShapes(profile, "wire")) try {
63
+ const prefix = kernel.isSame(wire, outer) ? "extrude:side" : `extrude:hole${hole++}:side`;
64
+ edgeCenters(wire).forEach((center, i) => {
65
+ anchors.push({
66
+ role: `${prefix}:${i}`,
67
+ point: require_vecOps.vecAdd(center, halfVector)
68
+ });
69
+ });
70
+ } finally {
71
+ kernel.dispose(wire);
72
+ }
73
+ } finally {
74
+ kernel.dispose(outer);
75
+ }
76
+ return anchors;
77
+ }
78
+ function locateFaces(solid) {
79
+ const kernel = require_shapeTypes.getKernel();
80
+ const located = [];
81
+ for (const face of kernel.iterShapes(solid, "face")) try {
82
+ located.push({
83
+ hash: kernel.hashCode(face, require_constants.HASH_CODE_MAX),
84
+ point: boxCenter(face)
85
+ });
86
+ } finally {
87
+ kernel.dispose(face);
88
+ }
89
+ return located;
90
+ }
91
+ function lowerBound(sortedKeys, key) {
92
+ let lo = 0;
93
+ let hi = sortedKeys.length;
94
+ while (lo < hi) {
95
+ const mid = lo + hi >>> 1;
96
+ if ((sortedKeys[mid] ?? Infinity) < key) lo = mid + 1;
97
+ else hi = mid;
98
+ }
99
+ return lo;
100
+ }
101
+ /** The coordinate axis along which `points` spread furthest. */
102
+ function widestAxis(points) {
103
+ let axis = 0;
104
+ let widest = -Infinity;
105
+ for (const candidate of [
106
+ 0,
107
+ 1,
108
+ 2
109
+ ]) {
110
+ let min = Infinity;
111
+ let max = -Infinity;
112
+ for (const p of points) {
113
+ min = Math.min(min, p[candidate]);
114
+ max = Math.max(max, p[candidate]);
115
+ }
116
+ if (max - min > widest) {
117
+ axis = candidate;
118
+ widest = max - min;
119
+ }
120
+ }
121
+ return axis;
122
+ }
123
+ /**
124
+ * Pair each anchor with its nearest face within `tolerance`. Returns undefined
125
+ * unless the pairing is one-to-one over every face, so an unexpected topology
126
+ * records nothing rather than wrong names. Candidates are windowed along the
127
+ * axis the face centers spread furthest on: a profile in the YZ plane puts
128
+ * every side face at one X, which would make a fixed X window scan them all.
129
+ */
130
+ function matchAnchors(anchors, faces, tolerance) {
131
+ if (anchors.length !== faces.length) return void 0;
132
+ const axis = widestAxis(faces.map((f) => f.point));
133
+ const sorted = [...faces].sort((a, b) => a.point[axis] - b.point[axis]);
134
+ const keys = sorted.map((f) => f.point[axis]);
135
+ const claimed = /* @__PURE__ */ new Set();
136
+ const roles = /* @__PURE__ */ new Map();
137
+ for (const { role, point } of anchors) {
138
+ let best = -1;
139
+ let bestDistance = tolerance;
140
+ for (let i = lowerBound(keys, point[axis] - tolerance); i < sorted.length; i++) {
141
+ const face = sorted[i];
142
+ if (face === void 0 || face.point[axis] > point[axis] + tolerance) break;
143
+ const d = require_vecOps.vecDistance(face.point, point);
144
+ if (d <= bestDistance) {
145
+ best = i;
146
+ bestDistance = d;
147
+ }
148
+ }
149
+ const match = best < 0 ? void 0 : sorted[best];
150
+ if (match === void 0 || claimed.has(best)) return void 0;
151
+ claimed.add(best);
152
+ roles.set(match.hash, role);
153
+ }
154
+ return roles;
155
+ }
156
+ /**
157
+ * Record `extrude:*` face roles on `solid`, the extrusion of `profile` along
158
+ * `vector`, for `assignRoles(solid, 'extrude')` to read. Records nothing on a
159
+ * mesh kernel, or when the faces don't pair one-to-one with the profile's caps
160
+ * and edges; `assignRoles` then falls back to positional names.
161
+ */
162
+ function recordExtrudeRoles(solid, profile, vector) {
163
+ const kernel = require_shapeTypes.getKernel();
164
+ if (!kernel.capabilities.exact) return;
165
+ const profileBox = kernel.boundingBox(profile.wrapped);
166
+ const size = require_vecOps.vecDistance(profileBox.min, profileBox.max) + require_vecOps.vecLength(vector);
167
+ const roles = matchAnchors(anchorsFor(profile.wrapped, centerOf(profileBox), vector), locateFaces(solid.wrapped), RELATIVE_TOLERANCE * size);
168
+ if (roles) require_faceRoleFns.setFaceRoles(solid, roles);
169
+ }
170
+ //#endregion
17
171
  //#region src/operations/extrudeFns.ts
18
172
  /**
19
173
  * Basic extrusion operations — extrude and revolve.
@@ -24,6 +178,10 @@ opentype_js = require_rolldown_runtime.__toESM(opentype_js, 1);
24
178
  /**
25
179
  * Extrude a face along a vector to produce a solid.
26
180
  *
181
+ * The result carries semantic face roles (`extrude:start`, `extrude:end`,
182
+ * `extrude:side:<i>`, `extrude:hole<j>:side:<i>`) that
183
+ * `assignRoles(solid, 'extrude')` returns in place of positional names.
184
+ *
27
185
  * @param face - The planar face to extrude.
28
186
  * @param extrusionVec - Direction and magnitude of the extrusion as `[x, y, z]`.
29
187
  * @returns `Result` containing the extruded solid, or an error if validation or operation fails.
@@ -39,6 +197,7 @@ function extrude(face, extrusionVec) {
39
197
  const downcastShape = kernel.downcast(shape, "solid");
40
198
  const solid = require_shapeTypes.createSolid(downcastShape);
41
199
  require_shapeTypes.disposeDowncastSource(shape, solid);
200
+ recordExtrudeRoles(solid, face, extrusionVec);
42
201
  return require_errors.ok(solid);
43
202
  } catch (e) {
44
203
  return require_errors.err(require_errors.kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
@@ -1,5 +1,5 @@
1
- const require_errors = require("./errors-gG-7hA7k.cjs");
2
- const require_textBlueprints = require("./textBlueprints-DQi920gG.cjs");
1
+ const require_errors = require("./errors-jwhfQJZK.cjs");
2
+ const require_textBlueprints = require("./textBlueprints-fa7VHJZz.cjs");
3
3
  //#region src/text/sketchText.ts
4
4
  /**
5
5
  * Render text as 3D sketch outlines on a plane.
@@ -1,5 +1,5 @@
1
- import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-CDSezF9z.js";
2
- import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-bFsyNLkO.js";
1
+ import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-Zb3jBa0u.js";
2
+ import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-C13NAA3C.js";
3
3
  //#region src/text/sketchText.ts
4
4
  /**
5
5
  * Render text as 3D sketch outlines on a plane.
@@ -1,12 +1,12 @@
1
- import { F as createKernelHandle, G as _usingCtx, N as DisposalScope, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, d as validationError, g as err, n as computationError, r as ioError, t as BrepErrorCode, x as isOk } from "./errors-CDSezF9z.js";
1
+ import { F as createKernelHandle, G as _usingCtx, N as DisposalScope, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, d as validationError, g as err, n as computationError, r as ioError, t as BrepErrorCode, x as isOk } from "./errors-Zb3jBa0u.js";
3
3
  import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
4
- import { b as fromBREP } from "./faceFns-DhdweJGk.js";
5
- import { h as fuseAll } from "./solidBuilders-p_ppeTkc.js";
6
- import { E as wire, h as line } from "./primitiveFns-DfhjU_X9.js";
7
- import { s as toBREP } from "./shapeFns-CUTM2ZDR.js";
8
- import { t as loft } from "./loftFns-DE1GYW9g.js";
9
- import { c as resolveRefParams } from "./refResolveFns-C-6Xa_8k.js";
4
+ import { b as fromBREP } from "./faceFns-CTlJC5IY.js";
5
+ import { h as fuseAll } from "./solidBuilders-IstbiWju.js";
6
+ import { E as wire, h as line } from "./primitiveFns-CGJzS4MO.js";
7
+ import { s as toBREP } from "./shapeFns--1wNlcc_.js";
8
+ import { t as loft } from "./loftFns-B5mq1WDh.js";
9
+ import { c as resolveRefParams } from "./refResolveFns-CpVZoeOT.js";
10
10
  //#region src/utils/uuid.ts
11
11
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
12
12
  function uuidv() {
@@ -1,12 +1,12 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-gG-7hA7k.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
3
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
4
- const require_faceFns = require("./faceFns-DaXVpMr5.cjs");
5
- const require_solidBuilders = require("./solidBuilders-B8t5h68e.cjs");
6
- const require_primitiveFns = require("./primitiveFns-Ke-n8Bib.cjs");
7
- const require_shapeFns = require("./shapeFns-CmJNoPsh.cjs");
8
- const require_loftFns = require("./loftFns-CI8uJc1D.cjs");
9
- const require_refResolveFns = require("./refResolveFns-BPqbBoxy.cjs");
4
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
5
+ const require_solidBuilders = require("./solidBuilders-CgicU3le.cjs");
6
+ const require_primitiveFns = require("./primitiveFns-ZV3aMbqG.cjs");
7
+ const require_shapeFns = require("./shapeFns-C2j6oZ2u.cjs");
8
+ const require_loftFns = require("./loftFns-DL9UsQhd.cjs");
9
+ const require_refResolveFns = require("./refResolveFns-Ct52Uw7R.cjs");
10
10
  //#region src/utils/uuid.ts
11
11
  /** Generate a v4-style UUID string using `crypto.getRandomValues`. */
12
12
  function uuidv() {
@@ -0,0 +1,15 @@
1
+ import { ShapeEvolution } from '../../kernel/types.js';
2
+ import { AnyShape, Dimension } from '../../core/shapeTypes.js';
3
+ /** O(1) check whether a shape carries recorded face roles. */
4
+ export declare function hasFaceRoles(shape: AnyShape<Dimension>): boolean;
5
+ /** Record face roles (face hash → role name) on a shape, replacing any it had. */
6
+ export declare function setFaceRoles(shape: AnyShape<Dimension>, roles: ReadonlyMap<number, string>): void;
7
+ /** The face roles recorded on a shape (face hash → role name), if any. */
8
+ export declare function getFaceRoles(shape: AnyShape<Dimension>): ReadonlyMap<number, string> | undefined;
9
+ /**
10
+ * Carry recorded face roles from inputs to a result through a ShapeEvolution:
11
+ * deleted faces drop their role, a modified face passes it to every successor,
12
+ * and an untouched face keeps it. When two inputs' faces land on one result
13
+ * face, the first input's role wins.
14
+ */
15
+ export declare function propagateFaceRolesFromEvolution(evolution: ShapeEvolution, inputs: readonly AnyShape<Dimension>[], result: AnyShape<Dimension>): void;
@@ -8,13 +8,13 @@ import { AnyShape, Dimension } from '../../core/shapeTypes.js';
8
8
  */
9
9
  /**
10
10
  * O(1) check: does a shape carry any propagatable metadata (face origins,
11
- * tags, or colors)? Lets callers skip both expensive face iteration and
11
+ * tags, colors, or recorded roles)? Lets callers skip both expensive face iteration and
12
12
  * metadata-preserving slow paths when there's nothing to preserve.
13
13
  */
14
14
  export declare function hasAnyMetadata(shape: AnyShape<Dimension>): boolean;
15
15
  export declare function collectInputFaceHashes(inputs: readonly AnyShape<Dimension>[]): number[];
16
16
  /**
17
- * Propagate all metadata (origins, tags, colors) from inputs to result
17
+ * Propagate all metadata (origins, tags, colors, recorded roles) from inputs to result
18
18
  * using a kernel-provided ShapeEvolution record.
19
19
  *
20
20
  * This is the standard pipeline for any operation that returns
@@ -0,0 +1,9 @@
1
+ import { Vec3 } from '../../core/types.js';
2
+ import { Dimension, Face, Shape3D } from '../../core/shapeTypes.js';
3
+ /**
4
+ * Record `extrude:*` face roles on `solid`, the extrusion of `profile` along
5
+ * `vector`, for `assignRoles(solid, 'extrude')` to read. Records nothing on a
6
+ * mesh kernel, or when the faces don't pair one-to-one with the profile's caps
7
+ * and edges; `assignRoles` then falls back to positional names.
8
+ */
9
+ export declare function recordExtrudeRoles(solid: Shape3D, profile: Face<Dimension>, vector: Vec3): void;
@@ -39,7 +39,8 @@ export declare function resolveLineageRef(ref: LineageRef, roles: RoleTable, sha
39
39
  * Resolve a lineage ref against a freshly rebuilt `shape` with no maintained
40
40
  * role table, re-deriving roles via `assignRoles(shape, ref.origin)`. The ref's
41
41
  * `origin` must therefore be the role-assignment scheme (e.g. `'box'`), and
42
- * stability is bounded by that scheme — `'box'` names faces semantically
42
+ * stability is bounded by that scheme. The primitives (`'box'`, `'cylinder'`,
43
+ * `'cone'`, `'sphere'`) and `'extrude'` name faces semantically
43
44
  * (rebuild-stable); other schemes fall back to positional `face_N`.
44
45
  */
45
46
  export declare function resolveRefIn(ref: LineageRef, shape: Shape3D): LineageResolution;
@@ -13,12 +13,18 @@ export declare function captureHint(face: Face): GeometricHint;
13
13
  * - `cylinder`/`cone` (Z-axis): 'top'/'bottom' caps + 'lateral' wall.
14
14
  * - `sphere`: 'sphere:surface'.
15
15
  *
16
+ * Faces whose roles an operation recorded on the shape take those names when
17
+ * the namespace matches `operationType`. `extrude` records 'extrude:start',
18
+ * 'extrude:end', 'extrude:side:<i>' and 'extrude:hole<j>:side:<i>', which
19
+ * survive later moves and booleans.
20
+ *
16
21
  * Faces a primitive namer doesn't recognize (a rotated box's non-cardinal faces),
17
22
  * and every face of any other operation type, fall back to positional names
18
23
  * ('opType:face_0', 'opType:face_1', ...) — so each face always gets a role.
19
24
  *
20
- * @returns Map from role name to its face hash codes (one at assignment time;
21
- * a role accrues more hashes only later, when `updateRoles` tracks a split).
25
+ * @returns Map from role name to its face hash codes (one per role, except a
26
+ * recorded role whose face a later operation split; `updateRoles` adds more
27
+ * when it tracks a split).
22
28
  */
23
29
  export declare function assignRoles(shape: Shape3D, operationType: string): Map<string, number[]>;
24
30
  /** Create a ShapeRef from an origin ID, role name, and face. */
package/dist/topology.cjs CHANGED
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_topologyQueryFns = require("./topologyQueryFns-CI4j3NTE.cjs");
3
- const require_faceFns = require("./faceFns-DaXVpMr5.cjs");
4
- const require_solidBuilders = require("./solidBuilders-B8t5h68e.cjs");
5
- const require_primitiveFns = require("./primitiveFns-Ke-n8Bib.cjs");
6
- const require_shapeFns = require("./shapeFns-CmJNoPsh.cjs");
7
- const require_curveFns = require("./curveFns-DciWOppG.cjs");
8
- const require_meshFns = require("./meshFns-BT7W4b1c.cjs");
9
- const require_healingFns = require("./healingFns-C_f03IV6.cjs");
10
- const require_adjacencyFns = require("./adjacencyFns-DZsPfYIq.cjs");
2
+ const require_topologyQueryFns = require("./topologyQueryFns-q2bGyuEV.cjs");
3
+ const require_faceFns = require("./faceFns-CZeHWke7.cjs");
4
+ const require_solidBuilders = require("./solidBuilders-CgicU3le.cjs");
5
+ const require_primitiveFns = require("./primitiveFns-ZV3aMbqG.cjs");
6
+ const require_shapeFns = require("./shapeFns-C2j6oZ2u.cjs");
7
+ const require_curveFns = require("./curveFns-6-ULFrEB.cjs");
8
+ const require_meshFns = require("./meshFns-CAxkaRTm.cjs");
9
+ const require_healingFns = require("./healingFns-DwSpJZfg.cjs");
10
+ const require_adjacencyFns = require("./adjacencyFns-1rxgJ6Hw.cjs");
11
11
  exports.addHoles = require_primitiveFns.addHoles;
12
12
  exports.adjacentFaces = require_adjacencyFns.adjacentFaces;
13
13
  exports.approximateCurve = require_curveFns.approximateCurve;
package/dist/topology.js CHANGED
@@ -1,10 +1,10 @@
1
- import { C as vertexPosition, _ as iterFaces, b as iterVertices, c as getFaces, f as getVertices, g as iterEdges, m as invalidateShapeCache, n as getBounds, p as getWires, s as getEdges, x as iterWires } from "./topologyQueryFns-fNWsM4Lr.js";
2
- import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-DhdweJGk.js";
3
- import { h as fuseAll, p as cutAll } from "./solidBuilders-p_ppeTkc.js";
4
- import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-DfhjU_X9.js";
5
- import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-CUTM2ZDR.js";
6
- import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-D5V4jm7S.js";
7
- import { d as clearMeshCache, f as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-o9MnZeir.js";
8
- import { A as toBufferGeometryData, P as toLineGeometryData, S as chamferDistAngle, _ as checkBoolean, a as healFace, b as getNurbsCurveData, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, j as toGroupedBufferGeometryData, k as variableFillet, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-HekFOO_s.js";
9
- import { i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-k4GWh4n7.js";
1
+ import { _ as iterFaces, b as iterVertices, c as getFaces, f as getVertices, g as iterEdges, m as invalidateShapeCache, n as getBounds, p as getWires, s as getEdges, w as vertexPosition, x as iterWires } from "./topologyQueryFns-DnfjQgP7.js";
2
+ import { C as shapeType, S as iterTopo, _ as cast, a as faceOrientation, b as fromBREP, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, x as isCompSolid, y as downcast } from "./faceFns-CTlJC5IY.js";
3
+ import { h as fuseAll, p as cutAll } from "./solidBuilders-IstbiWju.js";
4
+ import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-CGJzS4MO.js";
5
+ import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns--1wNlcc_.js";
6
+ import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-KS1BWGhF.js";
7
+ import { d as clearMeshCache, f as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-COlno8TY.js";
8
+ import { A as toBufferGeometryData, P as toLineGeometryData, S as chamferDistAngle, _ as checkBoolean, a as healFace, b as getNurbsCurveData, d as chamferWithEvolution, f as cutWithEvolution, g as shellWithEvolution, h as intersectWithEvolution, j as toGroupedBufferGeometryData, k as variableFillet, l as solidFromShell, m as fuseWithEvolution, n as fixSelfIntersection, o as healSolid, p as filletWithEvolution, r as fixShape, s as healWire, t as autoHeal, u as positionOnCurve, v as cutAllBisect, x as getNurbsSurfaceData, y as fuseAllBisect } from "./healingFns-Ct3gEMvk.js";
9
+ import { i as facesOfEdge, l as wiresOfFace, n as adjacentFaces, o as sharedEdges, r as edgesOfFace, s as verticesOfEdge } from "./adjacencyFns-DeyXahej.js";
10
10
  export { addHoles, adjacentFaces, approximateCurve, asTopo, autoHeal, bezier, box, bsplineApprox, cast, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkBoolean, circle, classifyPointOnFace, clearMeshCache, compound, cone, createMeshCache, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cutAll, cutAllBisect, cutWithEvolution, cylinder, fromBREP as deserializeShape, downcast, edgesOfFace, ellipse, ellipseArc, ellipsoid, exportIGES, exportSTEP, exportSTL, face, faceAxis, faceCenter, faceGeomType, faceOrientation, facesOfEdge, filledFace, filletWithEvolution, fixSelfIntersection, fixShape, flipFaceOrientation, flipOrientation, fuseAll, fuseAllBisect, fuseWithEvolution, getBounds, getCurveType, getEdges, getFaces, getHashCode, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getSurfaceType, getVertices, getWires, healFace, healSolid, healWire, helix, innerWires, interpolateCurve, intersectWithEvolution, invalidateShapeCache, isCompSolid, isEqualShape, isSameShape, iterEdges, iterFaces, iterTopo, iterVertices, iterWires, line, normalAt, offsetFace, offsetWire2D, outerWire, pointOnSurface, polygon, positionOnCurve, projectPointOnFace, sewShells, shapeType, sharedEdges, shellWithEvolution, solid, solidFromShell, sphere, subFace, tangentArc, threePointArc, toBufferGeometryData, toGroupedBufferGeometryData, toLineGeometryData, torus, uvBounds, uvCoordinates, variableFillet, vertex, vertexPosition, verticesOfEdge, wire, wireLoop, wiresOfFace };
@@ -1,5 +1,5 @@
1
- import { G as _usingCtx, N as DisposalScope, O as getOrQueryType, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, g as err } from "./errors-CDSezF9z.js";
1
+ import { G as _usingCtx, N as DisposalScope, O as getOrQueryType, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, g as err } from "./errors-Zb3jBa0u.js";
3
3
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
4
4
  //#region src/core/kernelErrorTranslation.ts
5
5
  /**
@@ -429,4 +429,4 @@ function vertexPosition(vertex) {
429
429
  return getKernel().vertexPosition(vertex.wrapped);
430
430
  }
431
431
  //#endregion
432
- export { vertexPosition as C, kernelCallScoped as E, subShapeHashes as S, kernelCallRaw as T, iterFaces as _, getCachedSurfaceType as a, iterVertices as b, getFaces as c, getSolids as d, getVertices as f, iterEdges as g, iterCompSolids as h, getCachedIsValid as i, getOrCreateCache as l, invalidateShapeCache as m, getBounds as n, getCompSolids as o, getWires as p, getCacheEntry as r, getEdges as s, describe as t, getShells as u, iterShells as v, kernelCall as w, iterWires as x, iterSolids as y };
432
+ export { subShapeHashes as C, kernelCallScoped as D, kernelCallRaw as E, subShapeCount as S, kernelCall as T, iterFaces as _, getCachedSurfaceType as a, iterVertices as b, getFaces as c, getSolids as d, getVertices as f, iterEdges as g, iterCompSolids as h, getCachedIsValid as i, getOrCreateCache as l, invalidateShapeCache as m, getBounds as n, getCompSolids as o, getWires as p, getCacheEntry as r, getEdges as s, describe as t, getShells as u, iterShells as v, vertexPosition as w, iterWires as x, iterSolids as y };
@@ -1,5 +1,5 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-gG-7hA7k.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
3
  const require_constants = require("./constants-BOVyEYGH.cjs");
4
4
  //#region src/core/kernelErrorTranslation.ts
5
5
  /**
@@ -573,6 +573,12 @@ Object.defineProperty(exports, "kernelCallScoped", {
573
573
  return kernelCallScoped;
574
574
  }
575
575
  });
576
+ Object.defineProperty(exports, "subShapeCount", {
577
+ enumerable: true,
578
+ get: function() {
579
+ return subShapeCount;
580
+ }
581
+ });
576
582
  Object.defineProperty(exports, "subShapeHashes", {
577
583
  enumerable: true,
578
584
  get: function() {
@@ -1,5 +1,5 @@
1
- const require_shapeTypes = require("./shapeTypes-BWsKDxzf.cjs");
2
- const require_errors = require("./errors-gG-7hA7k.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-DH2ShBU_.cjs");
2
+ const require_errors = require("./errors-jwhfQJZK.cjs");
3
3
  //#region src/core/validityTypes.ts
4
4
  /**
5
5
  * Type guard — check if a wire is closed (forms a loop).
@@ -1,5 +1,5 @@
1
- import { q as getKernel } from "./shapeTypes-DVpJHhgk.js";
2
- import { E as ok, g as err } from "./errors-CDSezF9z.js";
1
+ import { q as getKernel } from "./shapeTypes-CqNJoSam.js";
2
+ import { E as ok, g as err } from "./errors-Zb3jBa0u.js";
3
3
  //#region src/core/validityTypes.ts
4
4
  /**
5
5
  * Type guard — check if a wire is closed (forms a loop).
package/dist/vectors.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_constants = require("./constants-BOVyEYGH.cjs");
3
3
  const require_types = require("./types-KjA8tY4Y.cjs");
4
4
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
5
- const require_planeOps = require("./planeOps-DqGSxcMr.cjs");
5
+ const require_planeOps = require("./planeOps-DJuclNxa.cjs");
6
6
  exports.DEG2RAD = require_constants.DEG2RAD;
7
7
  exports.RAD2DEG = require_constants.RAD2DEG;
8
8
  exports.createNamedPlane = require_planeOps.createNamedPlane;
package/dist/vectors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as RAD2DEG, t as DEG2RAD } from "./constants-ITRzCnCp.js";
2
2
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-D24Y27N0.js";
3
3
  import { a as vecDot, c as vecLength, d as vecNormalize, f as vecProjectToPlane, g as vecSub, h as vecScale, i as vecDistance, l as vecLengthSq, m as vecRotate, n as vecAngle, o as vecEquals, p as vecRepr, r as vecCross, s as vecIsZero, t as vecAdd, u as vecNegate } from "./vecOps-SKPRvPH-.js";
4
- import { i as pivotPlane, n as createPlane, o as resolvePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-BO6nvRja.js";
4
+ import { i as pivotPlane, n as createPlane, o as resolvePlane, s as translatePlane, t as createNamedPlane } from "./planeOps-Cxws4Tiu.js";
5
5
  export { DEG2RAD, RAD2DEG, createNamedPlane, createPlane, pivotPlane, resolveDirection, resolvePlane, toVec2, toVec3, translatePlane, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs",
3
- "version": "20.2.0",
3
+ "version": "20.4.0",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",