@toolpath/dfm 0.5.0 → 1.0.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.
@@ -1,1423 +1,80 @@
1
1
  import {
2
2
  CRITICAL_COLOR,
3
3
  FILE_KIND,
4
- ID_KINDS,
5
- LENGTH_PLACES,
4
+ MAX_DATASHEET_FIELDS,
6
5
  MILLING_RULES,
6
+ OPS,
7
+ PINCH_TOOL_MM,
8
+ PRESENCE_METRIC,
9
+ QUICK_SUBJECTS,
10
+ RANGE_HIGHS,
11
+ RANGE_LOWS,
7
12
  RULE_COLORS,
8
13
  TURNING_RULES,
9
- TYPE_SUBJECT,
10
14
  WARNING_COLOR,
11
- breaks,
15
+ brokenRules,
16
+ checkPart,
17
+ checkTurnedPart,
12
18
  compareColors,
19
+ datasheetFields,
13
20
  describeRule,
14
21
  dfmFeatures,
15
- featureLd,
22
+ directionLabel,
23
+ featureColor,
24
+ featureMeasurements,
16
25
  featureProfile,
26
+ featureRows,
27
+ featureSheet,
17
28
  featureTypeLabel,
29
+ formatMeasured,
30
+ fromField,
31
+ highOf,
18
32
  hitFigure,
19
- isDrilled,
33
+ isNoReading,
34
+ isSurfaceType,
20
35
  lengthValue,
21
36
  llmRulePrompt,
37
+ lowOf,
22
38
  makeRule,
39
+ maxBallDiameter,
23
40
  metricInfo,
41
+ metricsForSubject,
42
+ opSymbol,
24
43
  parseRuleSetFile,
25
44
  parseRules,
26
- partTop,
27
45
  peakHeight,
46
+ pinchLabel,
47
+ pinchMark,
48
+ placePinchTool,
49
+ quantityUnit,
50
+ readPinch,
28
51
  readReachCurve,
29
52
  runStart,
30
53
  sameDepth,
31
54
  serializeRuleSet,
32
- subjectInfo,
55
+ subjectLabel,
56
+ toField,
33
57
  trimmedCurve,
58
+ turnedStretches,
34
59
  turnedTypeLabel,
35
60
  unitLabel,
36
- worseUpward
37
- } from "../chunk-4IRNLDE6.js";
38
-
39
- // src/model/broken-rules.ts
40
- var byColor = (hits) => [...hits].sort((a, b) => compareColors(a.rule.color, b.rule.color));
41
- var worstHits = (hits) => {
42
- const seen = /* @__PURE__ */ new Set();
43
- return byColor(hits).filter((hit) => {
44
- if (seen.has(hit.metric.key)) return false;
45
- seen.add(hit.metric.key);
46
- return true;
47
- });
48
- };
49
- var brokenRules = (check, tag, units, vocabulary = MILLING_RULES) => worstHits(check.hitsByTag.get(tag.toLowerCase()) ?? []).map((hit) => {
50
- const figure = hitFigure(hit, units);
51
- return {
52
- key: hit.rule.id,
53
- color: hit.rule.color,
54
- text: describeRule(hit.rule, units, vocabulary),
55
- ...figure ? { figure } : {}
56
- };
57
- });
58
- var featureColor = (check, tag, region = null) => {
59
- const key = tag.toLowerCase();
60
- const face = region === null ? void 0 : check.paintedFaces.get(region);
61
- if (face && face.tag.toLowerCase() === key) return face.color;
62
- const whole = check.paintedWhole.get(key);
63
- if (whole) return whole.color;
64
- if (!check.required.has(key)) return void 0;
65
- return byColor(check.hitsByTag.get(key) ?? [])[0]?.rule.color;
66
- };
67
-
68
- // src/model/dfm-flags.ts
69
- var howCut = (sheet) => {
70
- const drilled = isDrilled(sheet);
71
- return { drilled, milled: !drilled };
72
- };
73
- var featureIs = (subject, featureType, sheet) => {
74
- const type = featureType.toLowerCase();
75
- const kind = sheet?.kind?.toLowerCase() ?? "";
76
- if (subject.startsWith(TYPE_SUBJECT)) return type === subject.slice(TYPE_SUBJECT.length);
77
- switch (subject) {
78
- case "any":
79
- return true;
80
- case "milled":
81
- return howCut(sheet).milled;
82
- case "drilled":
83
- return howCut(sheet).drilled;
84
- case "hole":
85
- return type.includes("hole") || kind === "hole";
86
- case "threadedHole":
87
- return sheet?.threading !== void 0;
88
- case "pocket":
89
- return type.includes("pocket") || kind === "pocket";
90
- case "slot":
91
- return type.includes("slot") || kind === "tslot";
92
- case "undercut":
93
- return kind === "tslot" || type.includes("undercut") || type.includes("tslot");
94
- case "contour":
95
- return type.includes("contour") || kind.includes("contour");
96
- case "wall":
97
- return type.includes("wall") || kind === "wall";
98
- case "face":
99
- return type === "face" || kind === "face";
100
- case "fillet":
101
- return type.split("_").includes("fillet") || kind.includes("fillet");
102
- case "chamfer":
103
- return type.includes("chamfer") || kind === "chamfer";
104
- case "boss":
105
- return type.includes("boss") || kind === "boss";
106
- case "countersink":
107
- return type === "sink";
108
- case "profile":
109
- return type === "profile" || kind === "profile";
110
- default:
111
- return false;
112
- }
113
- };
114
- var at = (record2, path) => path.split(".").reduce(
115
- (value, key) => typeof value === "object" && value !== null ? value[key] : void 0,
116
- record2
117
- );
118
- var readPath = (datasheet, metric) => {
119
- for (const path of metric.path ?? []) {
120
- const value = at(datasheet, path);
121
- if (value === void 0 || value === null) continue;
122
- if (typeof value === "boolean") return value ? 1 : 0;
123
- if (metric.quantity === "flag") return 1;
124
- if (typeof value === "number" && Number.isFinite(value)) return value;
125
- return null;
126
- }
127
- return metric.quantity === "flag" && metric.path ? 0 : null;
128
- };
129
- var TILT = 1e-6;
130
- var isTilted = ({ x, y, z }) => [x, y, z].filter((each) => Math.abs(each) > TILT).length > 1;
131
- var featureMeasure = (metric, features, feature, { sheets, datasheets, regionAreas }) => {
132
- const tag = feature.tag.toLowerCase();
133
- const sheet = sheets[tag];
134
- const datasheet = datasheets[tag];
135
- const positive = (value) => value !== void 0 && value > 0 ? { value } : null;
136
- switch (metric.key) {
137
- case "present":
138
- return { value: 1 };
139
- case "tilted":
140
- return { value: isTilted(feature.machiningDirection) ? 1 : 0 };
141
- case "faceCount":
142
- return { value: new Set(feature.regionIdxs).size };
143
- case "ld": {
144
- const ld = featureLd(features, feature, sheets);
145
- return ld ? { value: ld.ratio, drilling: ld.drilling } : null;
146
- }
147
- case "featureLd": {
148
- const ld = featureLd(features, feature, sheets);
149
- return ld?.featureRatio !== void 0 ? { value: ld.featureRatio, drilling: ld.drilling } : null;
150
- }
151
- case "depthBelowTop": {
152
- const top = partTop(features, sheets, feature.machiningDirection);
153
- return top !== null && sheet?.zMin !== void 0 ? { value: top - sheet.zMin } : null;
154
- }
155
- case "featureDepth":
156
- return sheet?.zMax !== void 0 && sheet.zMin !== void 0 ? { value: sheet.zMax - sheet.zMin } : null;
157
- // Zero is no measure at all for these: no bore, no tool, a sharp floor rather than a tiny fillet.
158
- case "diameter":
159
- return positive(sheet?.diameter);
160
- // Zero is a measure here: a sharp corner, which a "radius ≤" rule is most of all about.
161
- case "cornerRadius":
162
- return sheet?.cornerRadius === void 0 ? null : { value: sheet.cornerRadius };
163
- case "maxTool":
164
- return positive(sheet?.maxTool);
165
- case "floorFillet":
166
- return positive(sheet?.filletRadius);
167
- case "sharpCorner":
168
- return sheet ? { value: sheet.sharpCorners ? 1 : 0 } : null;
169
- case "noToolFits":
170
- return sheet ? { value: sheet.noToolFits ? 1 : 0 } : null;
171
- case "pinchPoints": {
172
- const points = at(datasheet, "pinchPoints");
173
- return Array.isArray(points) ? { value: points.length } : null;
174
- }
175
- // A disc under a hundredth is a sharp corner, which `sharpCorner` is for: see `pinchDiameter`.
176
- case "pinchDiameter":
177
- return positive(sheet?.pinchDiameter);
178
- case "reachHeight": {
179
- const heights = at(datasheet, "reachCurve.verticalOffset");
180
- const numbers = Array.isArray(heights) ? heights.filter(
181
- (each) => typeof each === "number" && Number.isFinite(each)
182
- ) : [];
183
- return numbers.length > 0 ? { value: Math.max(...numbers) } : null;
184
- }
185
- case "surfaceArea": {
186
- const areas = at(datasheet, "areas");
187
- if (typeof areas === "object" && areas !== null) {
188
- const parts = Object.values(areas).filter(
189
- (each) => typeof each === "number" && Number.isFinite(each)
190
- );
191
- if (parts.length > 0) return { value: parts.reduce((sum, each) => sum + each, 0) };
192
- }
193
- const faces = [...new Set(feature.regionIdxs)].flatMap(
194
- (region) => regionAreas.get(region) ?? []
195
- );
196
- return faces.length > 0 ? { value: faces.reduce((sum, each) => sum + each, 0) } : null;
197
- }
198
- default: {
199
- if (!datasheet) return null;
200
- const value = readPath(datasheet, metric);
201
- return value === null ? null : { value };
202
- }
203
- }
204
- };
205
- var featureHits = (features, feature, sources, rules) => {
206
- const sheet = sources.sheets[feature.tag.toLowerCase()];
207
- return rules.flatMap((rule) => {
208
- const info = metricInfo(rule.metric);
209
- if (!info || !featureIs(rule.subject, feature.featureType, sheet)) return [];
210
- const measured = featureMeasure(info, features, feature, sources);
211
- if (!measured || !breaks(rule, info.quantity, measured.value)) return [];
212
- return [{ rule, metric: info, ...measured }];
213
- });
214
- };
215
- var requiredTags = (features) => {
216
- const owners = /* @__PURE__ */ new Map();
217
- for (const feature of features) {
218
- for (const region of new Set(feature.regionIdxs))
219
- owners.set(region, (owners.get(region) ?? 0) + 1);
220
- }
221
- return new Set(
222
- features.filter((feature) => feature.regionIdxs.some((region) => owners.get(region) === 1)).map((feature) => feature.tag.toLowerCase())
223
- );
224
- };
225
- var worstColor = (hits) => hits?.map((hit) => hit.rule.color).sort(compareColors)[0];
226
- var ruleResults = (rules, features, hitsByTag, required) => rules.map((rule) => {
227
- const hits = features.flatMap((feature) => {
228
- const tag = feature.tag.toLowerCase();
229
- const hit = hitsByTag.get(tag)?.find((each) => each.rule.id === rule.id);
230
- return hit ? [{ tag: feature.tag, value: hit.value, metric: hit.metric, required: required.has(tag) }] : [];
231
- });
232
- const [first] = hits;
233
- const up = first ? worseUpward(rule, first.metric) : true;
234
- hits.sort((a, b) => up ? b.value - a.value : a.value - b.value);
235
- return {
236
- rule,
237
- tags: hits.filter((hit) => hit.required).map((hit) => hit.tag),
238
- otherTags: hits.filter((hit) => !hit.required).map((hit) => hit.tag)
239
- };
240
- });
241
- var QUALIFIERS = ["undercut", "filleted", "tslot", "dovetail"];
242
- var EDGE_TYPES = ["fillet", "chamfer", "sink"];
243
- var featureComplexity = (featureType) => {
244
- const words = featureType.toLowerCase().split("_");
245
- const edge = EDGE_TYPES.some((type) => words.includes(type)) ? 1 : 0;
246
- return edge + QUALIFIERS.filter((word) => words.includes(word)).length;
247
- };
248
- var CONTOUR = "contour_surface";
249
- var unavoidableFaces = (features, hitsByTag, regionAreas) => {
250
- const areaOf = (feature) => [...new Set(feature.regionIdxs)].reduce(
251
- (sum, region) => sum + (regionAreas.get(region) ?? 0),
252
- 0
253
- );
254
- const owners = /* @__PURE__ */ new Map();
255
- for (const feature of features) {
256
- for (const region of new Set(feature.regionIdxs)) {
257
- owners.set(region, [...owners.get(region) ?? [], feature]);
258
- }
259
- }
260
- const faces = /* @__PURE__ */ new Map();
261
- const whole = /* @__PURE__ */ new Map();
262
- for (const [region, candidates] of owners) {
263
- const colored = candidates.map((feature) => ({
264
- feature,
265
- color: worstColor(hitsByTag.get(feature.tag.toLowerCase())),
266
- area: areaOf(feature)
267
- }));
268
- const isContour = ({ feature }) => feature.featureType === CONTOUR;
269
- const machined = colored.filter((each) => !isContour(each));
270
- const pool = machined.length > 0 ? machined : colored;
271
- if (pool.some(({ color }) => color === void 0)) continue;
272
- const contour = colored.filter(isContour).reduce((kept, each) => kept === void 0 || each.area > kept.area ? each : kept, void 0);
273
- if (contour?.color && colored.every(({ color }) => color !== void 0)) {
274
- whole.set(contour.feature.tag.toLowerCase(), {
275
- tag: contour.feature.tag,
276
- color: contour.color
277
- });
278
- continue;
279
- }
280
- const best = pool.reduce((kept, each) => {
281
- const plainer = featureComplexity(kept.feature.featureType) - featureComplexity(each.feature.featureType);
282
- if (plainer !== 0) return plainer > 0 ? each : kept;
283
- const milder = compareColors(each.color ?? "", kept.color ?? "");
284
- return milder > 0 || milder === 0 && each.area > kept.area ? each : kept;
285
- });
286
- if (best.color) faces.set(region, { tag: best.feature.tag, color: best.color });
287
- }
288
- return { paintedFaces: faces, paintedWhole: whole };
289
- };
290
- var withSurroundedFaces = (check, features, adjacency) => {
291
- const paintedFor = new Map(check.paintedFaces);
292
- const regionsOf2 = /* @__PURE__ */ new Map();
293
- for (const feature of features) {
294
- const key = feature.tag.toLowerCase();
295
- regionsOf2.set(key, new Set(feature.regionIdxs));
296
- const whole = check.paintedWhole.get(key);
297
- if (whole) {
298
- for (const region of feature.regionIdxs)
299
- if (!paintedFor.has(region)) paintedFor.set(region, whole);
300
- }
301
- }
302
- const surrounded = /* @__PURE__ */ new Map();
303
- for (const [region, neighbours] of adjacency) {
304
- if (paintedFor.has(region)) continue;
305
- const counts = /* @__PURE__ */ new Map();
306
- for (const neighbour of neighbours) {
307
- const paint2 = neighbour === region ? void 0 : paintedFor.get(neighbour);
308
- if (!paint2) continue;
309
- const key = paint2.tag.toLowerCase();
310
- counts.set(key, { paint: paint2, count: (counts.get(key)?.count ?? 0) + 1 });
311
- }
312
- const most = Math.max(0, ...[...counts.values()].map(({ count }) => count));
313
- const [paint] = [...counts].filter(([key, { count }]) => count === most && regionsOf2.get(key)?.has(region)).map(([, { paint: paint2 }]) => paint2).sort((a, b) => compareColors(a.color, b.color));
314
- if (paint) surrounded.set(region, paint);
315
- }
316
- if (surrounded.size === 0) return check;
317
- return { ...check, paintedFaces: new Map([...check.paintedFaces, ...surrounded]) };
318
- };
319
- var checkPart = (features, sources, rules) => {
320
- const required = requiredTags(features);
321
- const hitsByTag = new Map(
322
- features.map((feature) => [
323
- feature.tag.toLowerCase(),
324
- featureHits(features, feature, sources, rules)
325
- ])
326
- );
327
- return {
328
- hitsByTag,
329
- required,
330
- byRule: ruleResults(rules, features, hitsByTag, required),
331
- ...unavoidableFaces(features, hitsByTag, sources.regionAreas)
332
- };
333
- };
334
-
335
- // src/model/pinch.ts
336
- var asNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
337
- var recordOf = (value) => typeof value === "object" && value !== null ? value : {};
338
- var clearanceFit = (datasheet) => {
339
- const sheet = recordOf(datasheet);
340
- const facts = recordOf(sheet.facts);
341
- const chamfer = facts.kind === "Chamfer";
342
- const band = recordOf(chamfer ? recordOf(facts.three).cd : facts.cd);
343
- const tolerance = recordOf(sheet.toleranceBand);
344
- const strict = asNumber(recordOf(band.ignore).min);
345
- if (strict === void 0) return void 0;
346
- const bandPath = chamfer ? "facts.three.cd" : "facts.cd";
347
- const loose = asNumber(recordOf(band.deviate).min);
348
- const atStrict = asNumber(tolerance.atolIgnore);
349
- const atLoose = asNumber(tolerance.atolDeviate);
350
- const source = { bandPath, strict, loose, atStrict, atLoose };
351
- if (loose === void 0 || atStrict === void 0 || atLoose === void 0 || atLoose <= atStrict)
352
- return { ...source, slack: 0, resolved: false };
353
- const growth = (loose - strict) / (atLoose - atStrict);
354
- const slack = growth > 0 ? Math.min(growth * atStrict, strict) : 0;
355
- return { ...source, slack, resolved: true };
356
- };
357
- var readPinch = (datasheet) => {
358
- const sheet = recordOf(datasheet);
359
- const zMin = asNumber(sheet.zMin);
360
- const zMax = asNumber(sheet.zMax);
361
- if (zMin === void 0 || zMax === void 0 || !Array.isArray(sheet.pinchPoints)) return null;
362
- const fit = clearanceFit(datasheet);
363
- const slack = fit?.slack ?? 0;
364
- const discs = sheet.pinchPoints.flatMap((point) => {
365
- const centre = recordOf(recordOf(point).center);
366
- const x = asNumber(centre.x);
367
- const y = asNumber(centre.y);
368
- const diameter = asNumber(recordOf(point).diameter);
369
- return x === void 0 || y === void 0 || diameter === void 0 || diameter < 0 ? [] : [{ x, y, diameter: Math.max(diameter - slack, 0) }];
370
- });
371
- if (discs.length === 0) return null;
372
- return { discs, zMin, zMax, ...fit && !fit.resolved ? { unresolved: true } : {} };
373
- };
374
-
375
- // src/model/feature-sheet.ts
376
- var SHARP_MM = 0.1;
377
- var SHARP_RADIUS_MM = 0.01;
378
- var PINCH_TOOL_MM = 0.01;
379
- var asNumber2 = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
380
- var recordOf2 = (value) => typeof value === "object" && value !== null ? value : {};
381
- var definedOnly = (fields) => Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== void 0));
382
- var undercutOf = (facts) => {
383
- const unmeasured = facts.isInvalidGeometry === true || recordOf2(facts.cd).measurementFailed === true ? true : void 0;
384
- if (facts.kind === "Tslot")
385
- return definedOnly({
386
- undercutDepth: asNumber2(facts.undercutDepth),
387
- maxEntry: asNumber2(facts.maxEntryCd),
388
- isClosed: facts.isClosed === true ? true : void 0,
389
- unmeasured
390
- });
391
- if (facts.kind === "Dovetail")
392
- return definedOnly({
393
- taperDeg: asNumber2(facts.taperDeg),
394
- floorWidth: asNumber2(facts.floorWidth),
395
- topOpeningWidth: asNumber2(facts.topOpeningWidth),
396
- isExternal: facts.isExternal === true ? true : void 0,
397
- unmeasured
398
- });
399
- return void 0;
400
- };
401
- var threadingOf = (facts) => {
402
- const spec = recordOf2(recordOf2(facts.threading).spec);
403
- const basicDiameter = asNumber2(spec.basicDiameter);
404
- const threadPitch = asNumber2(spec.threadPitch);
405
- if (basicDiameter === void 0 || threadPitch === void 0 || threadPitch <= 0) return void 0;
406
- return { basicDiameter, threadPitch };
407
- };
408
- var noToolFits = (band) => {
409
- const { max } = band;
410
- if (typeof max === "string") return /^-inf/i.test(max.trim());
411
- return typeof max === "number" && (max === Number.NEGATIVE_INFINITY || Number.isFinite(max) && max < SHARP_MM);
412
- };
413
- var insideCornerRadius = (fit) => Math.max((fit.strict - fit.slack) / 2, 0);
414
- var pinchCentres = (points) => Array.isArray(points) ? points.flatMap((point) => {
415
- const centre = recordOf2(recordOf2(point).center);
416
- const x = asNumber2(centre.x);
417
- const y = asNumber2(centre.y);
418
- return x === void 0 || y === void 0 ? [] : [{ x, y }];
419
- }) : [];
420
- var ZERO_MM = 5e-5;
421
- var isCutterlessTslot = (datasheet) => {
422
- const facts = recordOf2(recordOf2(datasheet).facts);
423
- if (facts.kind !== "Tslot") return false;
424
- const leaves = (value) => typeof value === "object" && value !== null ? Object.values(value).flatMap(leaves) : [value];
425
- const band = leaves(facts.cd);
426
- return band.length > 0 && band.every((each) => {
427
- const value = typeof each === "string" && each.trim() !== "" ? Number(each) : each;
428
- return typeof value === "number" && Math.abs(value) < ZERO_MM;
429
- });
430
- };
431
- var isSharpCorneredFillet = (featureType, datasheet) => {
432
- if (typeof featureType !== "string" || !featureType.toLowerCase().split("_").includes("fillet"))
433
- return false;
434
- const facts = recordOf2(recordOf2(datasheet).facts);
435
- return facts.hasSharpCorner === true || recordOf2(facts.three).hasSharpCorner === true;
436
- };
437
- var isNoReading = (featureType, datasheet) => isCutterlessTslot(datasheet) || isSharpCorneredFillet(featureType, datasheet);
438
- var featureSheet = (datasheet) => {
439
- const sheet = recordOf2(datasheet);
440
- const facts = recordOf2(sheet.facts);
441
- const kind = typeof facts.kind === "string" ? facts.kind : void 0;
442
- const band = recordOf2(kind === "Chamfer" ? recordOf2(facts.three).cd : facts.cd);
443
- const ignoreBand = recordOf2(band.ignore);
444
- const fit = clearanceFit(datasheet);
445
- const fields = {
446
- kind,
447
- zMin: asNumber2(sheet.zMin),
448
- zMax: asNumber2(sheet.zMax),
449
- extendedZMax: asNumber2(sheet.extendedZMax),
450
- maxTool: asNumber2(ignoreBand.min),
451
- diameter: kind === "Hole" ? asNumber2(facts.diameter) : void 0,
452
- tipAngle: kind === "Hole" ? asNumber2(facts.fullConeDeg) : void 0,
453
- filletRadius: asNumber2(facts.filletRadius),
454
- // A bevel's angle wherever the facts carry one: a chamfer's, and any other kind that bevels.
455
- chamferAngle: asNumber2(recordOf2(facts.bevel).angleDeg)
456
- };
457
- const toolFitPath = facts.toolFit !== void 0 ? "facts.toolFit" : "facts.three.toolFit";
458
- const toolFit = recordOf2(facts.toolFit ?? recordOf2(facts.three).toolFit);
459
- fields.fitToolDiameter = asNumber2(toolFit.toolDiameter);
460
- fields.fitCornerRadius = asNumber2(toolFit.cornerRadius);
461
- const ballOnly = (facts.useOnlyBallToolsForFinish ?? recordOf2(facts.three).useOnlyBallToolsForFinish) === true;
462
- const measured = Object.fromEntries(
463
- Object.entries(fields).filter(([, value]) => value !== void 0)
464
- );
465
- const cramped = Object.keys(ignoreBand).length > 0 && noToolFits(ignoreBand);
466
- const walled = kind !== "Hole" && sheet.hasWall === true;
467
- const clearance = walled ? fit : void 0;
468
- const cornerRadius = clearance ? insideCornerRadius(clearance) : void 0;
469
- const sharp = cornerRadius !== void 0 && cornerRadius < SHARP_RADIUS_MM && !cramped;
470
- const threading = kind === "Hole" ? threadingOf(facts) : void 0;
471
- const undercut = undercutOf(facts);
472
- const pinched = (readPinch(datasheet)?.discs ?? []).filter(
473
- (disc) => disc.diameter >= PINCH_TOOL_MM
474
- );
475
- return {
476
- ...measured,
477
- ...pinched.length > 0 ? {
478
- pinchDiameter: Math.min(...pinched.map((disc) => disc.diameter)),
479
- pinchPlaces: pinched.length
480
- } : {},
481
- ...cornerRadius !== void 0 ? { cornerRadius } : {},
482
- ...clearance && !clearance.resolved ? { cornerRadiusUnresolved: true } : {},
483
- ...clearance ? { clearance } : {},
484
- ...Object.keys(toolFit).length > 0 ? { toolFitPath } : {},
485
- ...sharp ? { sharpCorners: pinchCentres(sheet.pinchPoints) } : {},
486
- ...cramped ? { noToolFits: true } : {},
487
- ...ballOnly ? { ballOnly: true } : {},
488
- ...threading ? { threading } : {},
489
- ...undercut ? { undercut } : {}
490
- };
491
- };
492
-
493
- // src/model/feature-details.ts
494
- import { MM_PER_INCH } from "@toolpath/tool-support";
495
- var mm = (value) => `${trim(value, 4)} mm`;
496
- var tol = (value) => `${trim(value, 6)} mm`;
497
- var clearanceDerivation = (fit, clearance) => {
498
- const { bandPath, strict, loose, atStrict, atLoose } = fit;
499
- const lines = [`\u2300\u2081 = ${bandPath}.ignore.min = ${mm(strict)}`];
500
- if (loose === void 0 || atStrict === void 0 || atLoose === void 0 || atLoose <= atStrict) {
501
- lines.push(
502
- `${bandPath}.deviate.min or a tolerance is missing, so the tolerance cannot be taken out:`,
503
- `clearance \u2264 \u2300\u2081 = ${mm(clearance)}`
504
- );
505
- return lines;
506
- }
507
- const growth = (loose - strict) / (atLoose - atStrict);
508
- lines.push(
509
- ` at t\u2081 = toleranceBand.atolIgnore = ${tol(atStrict)}`,
510
- `\u2300\u2082 = ${bandPath}.deviate.min = ${mm(loose)}`,
511
- ` at t\u2082 = toleranceBand.atolDeviate = ${tol(atLoose)}`
512
- );
513
- if (growth <= 0) {
514
- lines.push("The tool does not grow with tolerance (a gap, not a corner): clearance = \u2300\u2081");
515
- } else {
516
- lines.push(
517
- `k = (\u2300\u2082 \u2212 \u2300\u2081) / (t\u2082 \u2212 t\u2081) = ${trim(growth, 3)}`,
518
- `slack = k \xD7 t\u2081 = ${mm(growth * atStrict)}, what the tolerance adds to every tool`,
519
- `clearance = \u2300\u2081 \u2212 slack`
520
- );
521
- }
522
- lines.push(`clearance = ${mm(clearance)}`);
523
- return lines;
524
- };
525
- var trim = (value, places) => String(Number(value.toFixed(places)));
526
- var formatLength = (mm2, units, inchMark = false) => units === "inch" ? `${trim(mm2 / MM_PER_INCH, LENGTH_PLACES.inch)}${inchMark ? '"' : " in"}` : `${trim(mm2, LENGTH_PLACES.mm)} mm`;
527
- var SURFACE_TYPES = /* @__PURE__ */ new Set([
528
- "contour_surface",
529
- "inner_fillet",
530
- "outer_fillet",
531
- "fillet"
532
- ]);
533
- var isSurfaceType = (featureType) => SURFACE_TYPES.has(featureType);
534
- var maxBallDiameter = (sheet) => {
535
- const { fitToolDiameter: diameter, fitCornerRadius: corner } = sheet;
536
- if (corner === void 0 || corner <= 0) return void 0;
537
- return diameter !== void 0 && diameter > 0 ? Math.min(diameter, 2 * corner) : 2 * corner;
538
- };
539
- var ROW_ORDER = [
540
- "featureDepth",
541
- "undercutWidth",
542
- "floorWidth",
543
- "openingWidth",
544
- "undercutDepth",
545
- "taper",
546
- "diameter",
547
- "cornerRadius",
548
- "filletRadius",
549
- "floorFillet",
550
- "tipAngle",
551
- "thread",
552
- "bevelAngle",
553
- "finishTool",
554
- "undercutCutter",
555
- "maxShaft",
556
- "pinch",
557
- "fitCornerRadius",
558
- "maxBull",
559
- "maxBall",
560
- "depthBelowTop",
561
- "ld",
562
- "featureLd",
563
- "topLd"
564
- ];
565
- var featureMeasurements = ({
566
- features,
567
- feature,
568
- sheets,
569
- units,
570
- inchMark = false
571
- }) => {
572
- const other = units === "inch" ? "mm" : "inch";
573
- const length = (mm2) => ({
574
- value: formatLength(mm2, units, inchMark),
575
- alt: formatLength(mm2, other, inchMark)
576
- });
577
- const sheet = sheets[feature.tag.toLowerCase()];
578
- const rows = [];
579
- const undercut = sheet?.undercut;
580
- const top = sheet ? partTop(features, sheets, feature.machiningDirection) : null;
581
- const bottom = sheet?.zMin;
582
- const topFrom = top === null ? void 0 : features.find((each) => sheets[each.tag.toLowerCase()]?.extendedZMax === top);
583
- const topLine = top === null ? "" : `Top of part = the highest extendedZMax of the features machined from this direction = ${mm(top)}${topFrom ? ` (${featureTypeLabel(topFrom.featureType)} ${topFrom.tag})` : ""}`;
584
- if (top !== null && bottom !== void 0) {
585
- rows.push({
586
- key: "depthBelowTop",
587
- label: "Depth below top of part",
588
- milling: true,
589
- ...length(top - bottom),
590
- derivation: [topLine, `Top \u2212 zMin = ${mm(top)} \u2212 ${mm(bottom)} = ${mm(top - bottom)}`]
591
- });
592
- }
593
- if (sheet?.zMax !== void 0 && bottom !== void 0 && !(undercut && sheet?.kind === "Tslot")) {
594
- rows.push({
595
- key: "featureDepth",
596
- label: "Feature depth",
597
- ...length(sheet.zMax - bottom),
598
- derivation: [`zMax \u2212 zMin = ${mm(sheet.zMax)} \u2212 ${mm(bottom)} = ${mm(sheet.zMax - bottom)}`]
599
- });
600
- }
601
- if (sheet?.diameter !== void 0) {
602
- rows.push({
603
- key: "diameter",
604
- label: "Diameter",
605
- ...length(sheet.diameter),
606
- derivation: [`facts.diameter = ${mm(sheet.diameter)}`]
607
- });
608
- }
609
- if (sheet?.cornerRadius !== void 0 && !undercut) {
610
- const radius = length(sheet.cornerRadius);
611
- rows.push({
612
- key: "cornerRadius",
613
- label: sheet.sharpCorners ? "Minimum radius (sharp)" : "Minimum radius",
614
- // Measured at one tolerance only, it is the most the modelled radius can be, not the radius itself.
615
- ...sheet.cornerRadiusUnresolved ? { value: `\u2264 ${radius.value}`, alt: `\u2264 ${radius.alt}` } : radius,
616
- derivation: [
617
- "The tightest corner between walls: half the minimum clearance, the widest tool that reaches every point with the tolerance it was measured to taken out.",
618
- ...sheet.clearance ? clearanceDerivation(sheet.clearance, 2 * sheet.cornerRadius) : [],
619
- `R = clearance / 2 = ${mm(sheet.cornerRadius)}${sheet.sharpCorners ? " (under 0.01 mm: sharp)" : ""}`
620
- ]
621
- });
622
- }
623
- if (!sheet?.sharpCorners && !undercut) {
624
- const clearance = sheet?.pinchDiameter ?? (sheet?.cornerRadius !== void 0 ? 2 * sheet.cornerRadius : void 0);
625
- if (clearance !== void 0) {
626
- const width = length(clearance);
627
- const places = sheet?.pinchPlaces;
628
- const floor = !SURFACE_TYPES.has(feature.featureType) && sheet?.filletRadius !== void 0 && sheet.filletRadius > 0 ? length(sheet.filletRadius) : void 0;
629
- const atMost = sheet?.cornerRadiusUnresolved ? "\u2264 " : "";
630
- rows.push({
631
- key: "pinch",
632
- label: "Max tool diameter",
633
- milling: true,
634
- // Measured at one tolerance only, it is the most the clearance can be, not the clearance itself.
635
- value: `${atMost}\u2300 ${width.value}${floor ? ` \xB7 R ${floor.value}` : ""}`,
636
- alt: `${atMost}\u2300 ${width.alt}${floor ? ` \xB7 R ${floor.alt}` : ""}`,
637
- derivation: [
638
- "The widest circle that fits where the feature is tightest: twice an inside corner\u2019s radius, or the width of a gap between walls.",
639
- ...places !== void 0 ? [
640
- `pinchPoints: where the feature narrows to its tightest clearance, a disc each; ${places} ${places === 1 ? "place" : "places"} that tight, the tightest drawn.`,
641
- `min(pinchPoints[].diameter) is the cutter band\u2019s min, measured to a tolerance (t) the widest tool grows with: run back to none from two tolerances.`
642
- ] : [
643
- "No pinch points reported: the cutter band\u2019s min, measured to a tolerance (t) the widest tool grows with, run back to none from two tolerances."
644
- ],
645
- ...sheet?.clearance ? clearanceDerivation(sheet.clearance, clearance) : [],
646
- ...floor && sheet?.filletRadius !== void 0 ? [
647
- `A bull nose, its corner radius the floor fillet\u2019s: facts.filletRadius = ${mm(sheet.filletRadius)}`
648
- ] : []
649
- ]
650
- });
651
- }
652
- }
653
- if (sheet && undercut) rows.push(...undercutRows(sheet, undercut, top, length));
654
- const surface = SURFACE_TYPES.has(feature.featureType);
655
- if (surface && sheet) {
656
- const diameter = sheet.fitToolDiameter;
657
- const corner = sheet.fitCornerRadius;
658
- const fit = sheet.toolFitPath ?? "facts.toolFit";
659
- const ball = maxBallDiameter(sheet);
660
- rows.push({
661
- key: "finishTool",
662
- label: "Finishing tool",
663
- milling: true,
664
- value: sheet.ballOnly ? "Ball end mill" : "Ball or bull nose",
665
- derivation: [
666
- `facts.useOnlyBallToolsForFinish (or facts.three.\u2026) is ${sheet.ballOnly ? "true" : "not true"}`
667
- ]
668
- });
669
- if (corner !== void 0 && corner > 0) {
670
- rows.push({
671
- key: "fitCornerRadius",
672
- label: "Max corner radius",
673
- milling: true,
674
- ...length(corner),
675
- derivation: [
676
- "The tightest the surface turns inward: a tool with a larger corner radius cannot follow it.",
677
- `${fit}.cornerRadius = ${mm(corner)}`
678
- ]
679
- });
680
- }
681
- const sized = diameter !== void 0 && diameter > 0;
682
- if (!sheet.ballOnly && corner !== void 0 && corner > 0 && (!sized || ball === void 0 || ball < diameter)) {
683
- const size = sized ? length(diameter) : void 0;
684
- const radius = length(corner);
685
- rows.push({
686
- key: "maxBull",
687
- label: "Max bull nose",
688
- milling: true,
689
- // Drawable only at a diameter the fit gives: "any" is no size to draw.
690
- ...sized ? { tool: "bull" } : {},
691
- value: `${size ? `\u2300 ${size.value}` : "any \u2300"} \xB7 R ${radius.value}`,
692
- alt: `${size ? `\u2300 ${size.alt}` : "any \u2300"} \xB7 R ${radius.alt}`,
693
- derivation: [
694
- sized ? "The largest full-diameter tool the surface\u2019s shape admits, with the largest corner radius it admits." : "The surface limits only the tool\u2019s corner radius, not its diameter: a bull nose of any size with a corner no larger than this.",
695
- ...sized ? [`\u2300 = ${fit}.toolDiameter = ${mm(diameter)}`] : [`${fit}.toolDiameter is not reported`],
696
- `R = ${fit}.cornerRadius = ${mm(corner)}`
697
- ]
698
- });
699
- }
700
- if (ball !== void 0 && corner !== void 0) {
701
- const size = length(ball);
702
- rows.push({
703
- key: "maxBall",
704
- label: "Max ball nose",
705
- milling: true,
706
- tool: "ball",
707
- value: `\u2300 ${size.value}`,
708
- alt: `\u2300 ${size.alt}`,
709
- derivation: [
710
- "A ball\u2019s corner radius is half its diameter, so it must fit under the corner limit, and the diameter limit where there is one:",
711
- ...diameter !== void 0 && diameter > 0 ? [
712
- `min(${fit}.toolDiameter, 2 \xD7 ${fit}.cornerRadius)`,
713
- `= min(${mm(diameter)}, ${mm(2 * corner)}) = ${mm(ball)}`
714
- ] : [`2 \xD7 ${fit}.cornerRadius = ${mm(ball)} (${fit}.toolDiameter is not reported)`]
715
- ]
716
- });
717
- }
718
- }
719
- const ld = undercut ? null : featureLd(features, feature, sheets);
720
- if (ld && top !== null && bottom !== void 0) {
721
- const across = ld.basis === "bore" ? `D = facts.diameter = ${mm(ld.across)}` : ld.basis === "pinch" ? `D = widest tool (the tightest pinch disc, tolerance taken out) = ${mm(ld.across)}${ld.atLeast ? " (at most, so L/D is at least)" : ""}` : `D = widest tool = 2 \xD7 inside corner radius = ${mm(ld.across)}${ld.atLeast ? " (at most, so L/D is at least)" : ""} (no pinch points reported)`;
722
- const ratioOf = (depth) => {
723
- const ratio2 = (depth / ld.across).toFixed(3);
724
- return ld.atLeast ? `\u2265 ${ratio2}` : ratio2;
725
- };
726
- if (ld.drilling) {
727
- rows.push({
728
- key: "ld",
729
- label: "Drilling L/D",
730
- milling: true,
731
- value: ratioOf(top - bottom),
732
- derivation: [
733
- `L = depth below top of part = ${mm(top - bottom)}`,
734
- across,
735
- `L / D = ${mm(top - bottom)} / ${mm(ld.across)} = ${ld.ratio.toFixed(3)}`
736
- ]
737
- });
738
- } else {
739
- if (sheet?.zMax !== void 0) {
740
- rows.push({
741
- key: "featureLd",
742
- label: "Feature L/D",
743
- milling: true,
744
- value: ratioOf(sheet.zMax - bottom),
745
- derivation: [
746
- `L = feature depth = zMax \u2212 zMin = ${mm(sheet.zMax - bottom)}`,
747
- across,
748
- `L / D = ${mm(sheet.zMax - bottom)} / ${mm(ld.across)} = ${((sheet.zMax - bottom) / ld.across).toFixed(3)}`
749
- ]
750
- });
751
- }
752
- rows.push({
753
- key: "topLd",
754
- label: "L/D to top of part",
755
- milling: true,
756
- value: ratioOf(top - bottom),
757
- derivation: [
758
- `L = depth below top of part = ${mm(top - bottom)}`,
759
- across,
760
- `L / D = ${mm(top - bottom)} / ${mm(ld.across)} = ${ld.ratio.toFixed(3)}`
761
- ]
762
- });
763
- }
764
- }
765
- if (sheet?.tipAngle !== void 0) {
766
- const flat = Math.abs(sheet.tipAngle - 180) < 0.05;
767
- rows.push({
768
- key: "tipAngle",
769
- label: "Tip angle",
770
- value: `${trim(sheet.tipAngle, 3)}\xB0${flat ? " (flat)" : ""}`,
771
- derivation: [
772
- `facts.fullConeDeg = ${trim(sheet.tipAngle, 3)}\xB0${flat ? " (180\xB0: flat bottom)" : ""}`
773
- ]
774
- });
775
- }
776
- if (sheet?.threading) {
777
- rows.push({
778
- key: "thread",
779
- label: "Thread",
780
- value: `${formatLength(sheet.threading.basicDiameter, units, inchMark)} \xD7 ${formatLength(sheet.threading.threadPitch, units, inchMark)} pitch`,
781
- derivation: [
782
- `facts.threading.spec.basicDiameter = ${mm(sheet.threading.basicDiameter)}`,
783
- `facts.threading.spec.threadPitch = ${mm(sheet.threading.threadPitch)}`
784
- ]
785
- });
786
- }
787
- if (surface) {
788
- if (sheet?.filletRadius !== void 0 && sheet.filletRadius !== 0) {
789
- rows.push({
790
- key: "filletRadius",
791
- label: "Fillet radius",
792
- ...length(Math.abs(sheet.filletRadius)),
793
- derivation: [
794
- `|facts.filletRadius| = |${mm(sheet.filletRadius)}| (signed: + over an edge, \u2212 into a corner)`
795
- ]
796
- });
797
- }
798
- } else if (sheet?.filletRadius !== void 0 && sheet.filletRadius > 0) {
799
- rows.push({
800
- key: "floorFillet",
801
- label: "Floor fillet radius",
802
- ...length(sheet.filletRadius),
803
- derivation: [`facts.filletRadius = ${mm(sheet.filletRadius)}`]
804
- });
805
- }
806
- if (sheet?.chamferAngle !== void 0) {
807
- rows.push({
808
- key: "bevelAngle",
809
- label: "Chamfer angle",
810
- value: `${sheet.chamferAngle.toFixed(3)}\xB0`,
811
- derivation: [`facts.bevel.angleDeg = ${trim(sheet.chamferAngle, 3)}\xB0`]
812
- });
813
- }
814
- return rows.sort((a, b) => ROW_ORDER.indexOf(a.key) - ROW_ORDER.indexOf(b.key));
815
- };
816
- var undercutRows = (sheet, undercut, top, length) => {
817
- const rows = [];
818
- const tslot = sheet.kind === "Tslot";
819
- const { zMin, zMax } = sheet;
820
- const { floorWidth: floor, topOpeningWidth: opening } = undercut;
821
- const angle = undercut.taperDeg !== void 0 ? `${trim(undercut.taperDeg, 3)}\xB0` : void 0;
822
- if (tslot && zMin !== void 0 && zMax !== void 0) {
823
- rows.push({
824
- key: "undercutWidth",
825
- label: "Undercut width",
826
- ...length(zMax - zMin),
827
- derivation: [
828
- "The groove\u2019s height along the tool: the widest cutter it takes in one pass.",
829
- `zMax \u2212 zMin = ${mm(zMax)} \u2212 ${mm(zMin)} = ${mm(zMax - zMin)}`
830
- ]
831
- });
832
- }
833
- if (floor !== void 0) {
834
- rows.push({
835
- key: "floorWidth",
836
- label: "Floor width",
837
- ...length(floor),
838
- derivation: ["The widest clearance over the floor", `facts.floorWidth = ${mm(floor)}`]
839
- });
840
- }
841
- if (opening !== void 0) {
842
- rows.push({
843
- key: "openingWidth",
844
- label: "Opening width",
845
- ...length(opening),
846
- derivation: [
847
- "The clearance through the opening at the top of the groove",
848
- `facts.topOpeningWidth = ${mm(opening)}`
849
- ]
850
- });
851
- }
852
- let depth = undercut.undercutDepth;
853
- let depthLine = depth !== void 0 ? `facts.undercutDepth = ${mm(depth)}` : "";
854
- if (depth === void 0 && floor !== void 0 && opening !== void 0) {
855
- if (floor > opening && !undercut.isExternal) {
856
- depth = (floor - opening) / 2;
857
- depthLine = `(facts.floorWidth \u2212 facts.topOpeningWidth) / 2 = (${mm(floor)} \u2212 ${mm(opening)}) / 2 = ${mm(depth)}`;
858
- }
859
- }
860
- if (depth !== void 0) {
861
- rows.push({
862
- key: "undercutDepth",
863
- label: "Undercut depth",
864
- ...length(depth),
865
- derivation: [
866
- "How far the groove runs back from its opening: what the cutter\u2019s head reaches past its shaft.",
867
- depthLine
868
- ]
869
- });
870
- }
871
- if (angle) {
872
- rows.push({
873
- key: "taper",
874
- label: "Dovetail angle",
875
- value: `${angle} from the tool axis`,
876
- derivation: [`facts.taperDeg = ${angle}, between the overhanging wall and the tool axis`]
877
- });
878
- }
879
- const cutter = (value, derivation, alt) => ({
880
- key: "undercutCutter",
881
- label: "Max cutting diameter",
882
- milling: true,
883
- value,
884
- ...alt !== void 0 ? { alt } : {},
885
- derivation
886
- });
887
- if (undercut.unmeasured) {
888
- return [
889
- ...rows,
890
- cutter("Not measured", [
891
- "The Engine could not measure the groove (facts.isInvalidGeometry or facts.cd.measurementFailed), so its figures offer no cutter."
892
- ])
893
- ];
894
- }
895
- if (sheet.noToolFits) {
896
- return [
897
- ...rows,
898
- cutter("None fits", [
899
- "facts.cd.ignore.max is next to nothing: no cutter fits anywhere in the groove."
900
- ])
901
- ];
902
- }
903
- const band = sheet.maxTool !== void 0 && sheet.maxTool > 0 ? sheet.maxTool : void 0;
904
- const dropIn = undercut.isClosed ? undercut.maxEntry : void 0;
905
- const head = band === void 0 ? void 0 : Math.min(band, dropIn ?? Infinity);
906
- const opensTo = undercut.maxEntry ?? opening;
907
- const behind = head !== void 0 && depth !== void 0 ? head - 2 * depth : void 0;
908
- const limits = [opensTo, behind].filter((each) => each !== void 0);
909
- const shaft = limits.length > 0 ? Math.max(Math.min(...limits), 0) : void 0;
910
- const shaftLines = [
911
- "The most the cutter\u2019s shaft can be: what comes down through the opening above the groove, and leaves the head reaching the back of it.",
912
- ...opensTo !== void 0 ? [`Opening: ${tslot ? "facts.maxEntryCd" : "facts.topOpeningWidth"} = ${mm(opensTo)}`] : [],
913
- ...behind !== void 0 && head !== void 0 && depth !== void 0 ? [
914
- `Reach: max cutting diameter \u2212 2 \xD7 undercut depth = ${mm(head)} \u2212 2 \xD7 ${mm(depth)} = ${mm(behind)}`
915
- ] : [],
916
- ...shaft !== void 0 ? [`Max shaft = ${mm(shaft)}`] : []
917
- ];
918
- if (head !== void 0 && band !== void 0) {
919
- const headLines = [
920
- "The biggest head that reaches every point of the groove.",
921
- `facts.cd.ignore.min = ${mm(band)}`,
922
- ...dropIn !== void 0 ? [
923
- `A closed slot: the head comes down through the opening above it, facts.maxEntryCd = ${mm(dropIn)}`
924
- ] : [],
925
- `\u2300 = ${mm(head)}`
926
- ];
927
- if (head < SHARP_MM || shaft !== void 0 && shaft < SHARP_MM) {
928
- return [
929
- ...rows,
930
- cutter("None fits", [
931
- ...headLines,
932
- ...shaft !== void 0 ? shaftLines : [],
933
- "No head that fits the groove leaves room for a shaft to carry it."
934
- ])
935
- ];
936
- }
937
- const size = length(head);
938
- const filletRadius = sheet.filletRadius !== void 0 && sheet.filletRadius > 0 ? sheet.filletRadius : void 0;
939
- const fillet = filletRadius !== void 0 ? length(filletRadius) : void 0;
940
- const describe = (unit2) => [`\u2300 ${size[unit2]}`, ...angle ? [angle] : [], ...fillet ? [`R ${fillet[unit2]}`] : []].join(
941
- " \xB7 "
942
- );
943
- rows.push(
944
- cutter(
945
- describe("value"),
946
- [
947
- ...headLines,
948
- ...angle ? [`Angle = facts.taperDeg = ${angle}, from the tool axis`] : [],
949
- ...filletRadius !== void 0 ? [`R = facts.filletRadius = ${mm(filletRadius)}, the blend the head\u2019s corners cut`] : []
950
- ],
951
- describe("alt")
952
- )
953
- );
954
- if (top !== null && zMin !== void 0) {
955
- const reach = top - zMin;
956
- const ratio2 = (reach / head).toFixed(3);
957
- rows.push({
958
- key: "topLd",
959
- label: "L/D to top of part",
960
- milling: true,
961
- value: ratio2,
962
- derivation: [
963
- `L = depth below top of part = ${mm(reach)}`,
964
- `D = max cutting diameter = ${mm(head)}`,
965
- `L / D = ${mm(reach)} / ${mm(head)} = ${ratio2}`
966
- ]
967
- });
968
- }
969
- }
970
- if (shaft !== void 0 || tslot) {
971
- const size = shaft !== void 0 ? length(shaft) : void 0;
972
- rows.push({
973
- key: "maxShaft",
974
- label: "Max shaft diameter",
975
- milling: true,
976
- ...size ? { value: `\u2300 ${size.value}`, alt: `\u2300 ${size.alt}` } : { value: "No limit" },
977
- derivation: size ? shaftLines : [
978
- "facts.maxEntryCd is not reported and the head or undercut depth is not known: nothing limits the shaft."
979
- ]
980
- });
981
- }
982
- return rows;
983
- };
984
-
985
- // src/model/pinch-mark.ts
986
- import { MM_PER_INCH as MM_PER_INCH2 } from "@toolpath/tool-support";
987
- var MAX_DRAWN_TOOL_MM = 3 * MM_PER_INCH2;
988
- var pinchMark = (datasheet, sheet, featureType) => {
989
- const pinch = readPinch(datasheet);
990
- const discs = pinch?.discs.filter(
991
- (disc) => disc.diameter >= PINCH_TOOL_MM && disc.diameter <= MAX_DRAWN_TOOL_MM
992
- ) ?? [];
993
- if (!pinch || discs.length === 0) return null;
994
- const fillet = sheet?.filletRadius;
995
- const corner = !isSurfaceType(featureType) && fillet !== void 0 && fillet > 0 ? fillet : void 0;
996
- return { ...pinch, discs, ...corner !== void 0 ? { corner } : {} };
997
- };
998
- var pinchLabel = (mark, units) => {
999
- const length = (mm2) => `${lengthValue(mm2, units)} ${unitLabel(units)}`;
1000
- const tightest = Math.min(...mark.discs.map((disc) => disc.diameter));
1001
- const tool = mark.corner !== void 0 ? `bull nose R ${length(mark.corner)}` : "widest tool";
1002
- const places = mark.discs.length;
1003
- return {
1004
- label: `${mark.unresolved ? "\u2264 " : ""}\u2300 ${length(tightest)}`,
1005
- note: places > 1 ? `${tool} \xB7 ${places} places` : tool
1006
- };
1007
- };
1008
-
1009
- // src/model/tool-frame.ts
1010
- var extent = (values) => {
1011
- let low = Infinity;
1012
- let high = -Infinity;
1013
- for (const value of values) {
1014
- if (value < low) low = value;
1015
- if (value > high) high = value;
1016
- }
1017
- return { low, high };
1018
- };
1019
- var dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
1020
- var cross = (a, b) => [
1021
- a[1] * b[2] - a[2] * b[1],
1022
- a[2] * b[0] - a[0] * b[2],
1023
- a[0] * b[1] - a[1] * b[0]
1024
- ];
1025
- var scale = (a, by) => [a[0] * by, a[1] * by, a[2] * by];
1026
- var add = (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
1027
- var unit = (a) => scale(a, 1 / Math.hypot(a[0], a[1], a[2]));
1028
- var ON_DEPTH_MM = 0.05;
1029
- var ON_CORNER_MM = 0.02;
1030
- var POINT_DISC_MM = 0.01;
1031
- var ON_WALL_MM = 0.1;
1032
- var ON_WALL_SHARE = 0.02;
1033
- var WALL_NORMAL_ALONG = 0.7;
1034
- var SAME_PLACE_MM = 0.05;
1035
- var MIN_HEIGHT_MM = 0.05;
1036
- var readTriangles = ({ positions, normals }, origin) => {
1037
- const triangles = [];
1038
- for (let at2 = 0; at2 + 8 < positions.length; at2 += 9) {
1039
- const corner = (k) => [
1040
- (positions[at2 + k] ?? 0) - origin[0],
1041
- (positions[at2 + k + 1] ?? 0) - origin[1],
1042
- (positions[at2 + k + 2] ?? 0) - origin[2]
1043
- ];
1044
- const n = at2 / 9 * 3;
1045
- triangles.push({
1046
- a: corner(0),
1047
- b: corner(3),
1048
- c: corner(6),
1049
- normal: [normals[n] ?? 0, normals[n + 1] ?? 0, normals[n + 2] ?? 0]
1050
- });
1051
- }
1052
- return triangles;
1053
- };
1054
- var pointsOf = (triangles) => triangles.flatMap(({ a, b, c }) => [a, b, c]);
1055
- var flatten = (point, { u, v }) => ({ x: dot(point, u), y: dot(point, v) });
1056
- var wallSegments = (triangles, frame) => triangles.filter(({ normal }) => Math.abs(dot(normal, frame.w)) < WALL_NORMAL_ALONG).flatMap(({ a, b, c, normal }) => {
1057
- const [fa, fb, fc] = [flatten(a, frame), flatten(b, frame), flatten(c, frame)];
1058
- const air = flatten(normal, frame);
1059
- return [
1060
- { p: fa, q: fb, air },
1061
- { p: fb, q: fc, air },
1062
- { p: fc, q: fa, air }
1063
- ];
1064
- });
1065
- var nearestOn = ({ p, q }, at2) => {
1066
- const dx = q.x - p.x;
1067
- const dy = q.y - p.y;
1068
- const length = dx * dx + dy * dy;
1069
- const t = length === 0 ? 0 : Math.min(1, Math.max(0, ((at2.x - p.x) * dx + (at2.y - p.y) * dy) / length));
1070
- return { x: p.x + t * dx, y: p.y + t * dy };
1071
- };
1072
- var nearestWall = (segments, at2) => segments.reduce((best, segment) => {
1073
- const point = nearestOn(segment, at2);
1074
- const distance2 = Math.hypot(point.x - at2.x, point.y - at2.y);
1075
- if (best && distance2 >= best.distance) return best;
1076
- const open = (at2.x - point.x) * segment.air.x + (at2.y - point.y) * segment.air.y >= 0;
1077
- return { point, distance: distance2, open };
1078
- }, null);
1079
- var fitsDiscs = (triangles, frame, discs) => {
1080
- const points = discs.filter((disc) => disc.diameter < POINT_DISC_MM);
1081
- const wide = discs.filter((disc) => disc.diameter >= POINT_DISC_MM);
1082
- if (points.length > 0) {
1083
- const flat = pointsOf(triangles).map((point) => flatten(point, frame));
1084
- const onCorners = points.every(
1085
- (disc) => flat.some((point) => Math.hypot(point.x - disc.x, point.y - disc.y) <= ON_CORNER_MM)
1086
- );
1087
- if (!onCorners) return false;
1088
- }
1089
- if (wide.length === 0) return points.length > 0;
1090
- const segments = wallSegments(triangles, frame);
1091
- if (segments.length === 0) return false;
1092
- let touches = false;
1093
- for (const disc of wide) {
1094
- const nearest = nearestWall(segments, disc);
1095
- if (!nearest || !nearest.open) return false;
1096
- const slack = ON_WALL_MM + ON_WALL_SHARE * disc.diameter;
1097
- const radius = disc.diameter / 2;
1098
- if (nearest.distance < radius - slack) return false;
1099
- if (nearest.distance <= radius + slack) touches = true;
1100
- }
1101
- return touches;
1102
- };
1103
- var placeInFrame = ({ u, v, w }, x, y, z) => add(add(scale(u, x), scale(v, y)), scale(w, z));
1104
- var AXES = [
1105
- [1, 0, 0],
1106
- [0, 1, 0],
1107
- [0, 0, 1]
1108
- ];
1109
- var candidateFrames = (points, zMin, zMax, direction, strict = true) => {
1110
- const along = unit(direction);
1111
- const frames = [];
1112
- for (const sign of [1, -1]) {
1113
- const w = scale(along, sign);
1114
- const { low, high } = extent(points.map((point) => dot(point, w)));
1115
- if (strict && (Math.abs(low - zMin) > ON_DEPTH_MM || Math.abs(high - zMax) > ON_DEPTH_MM)) {
1116
- continue;
1117
- }
1118
- const across = AXES.reduce(
1119
- (best, axis) => Math.abs(dot(axis, w)) < Math.abs(dot(best, w)) ? axis : best
1120
- );
1121
- const u0 = unit(add(across, scale(w, -dot(across, w))));
1122
- const v0 = cross(w, u0);
1123
- for (let quarter = 0; quarter < 4; quarter++) {
1124
- const angle = quarter * Math.PI / 2;
1125
- const u = add(scale(u0, Math.cos(angle)), scale(v0, Math.sin(angle)));
1126
- for (const hand of [1, -1]) frames.push({ u, v: scale(cross(w, u), hand), w });
1127
- }
1128
- }
1129
- return frames;
1130
- };
1131
- var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
1132
- var exactFrame = (triangles, discs, zMin, zMax, direction) => {
1133
- const fits = candidateFrames(pointsOf(triangles), zMin, zMax, direction).filter(
1134
- (frame) => fitsDiscs(triangles, frame, discs)
1135
- );
1136
- const [first] = fits;
1137
- if (!first) return null;
1138
- const placed = (frame) => discs.map((disc) => placeInFrame(frame, disc.x, disc.y, zMin));
1139
- const firstPlaces = placed(first);
1140
- const agree = fits.every(
1141
- (frame) => placed(frame).every((at2, index) => distance(at2, firstPlaces[index] ?? at2) <= SAME_PLACE_MM)
1142
- );
1143
- return agree ? first : null;
1144
- };
1145
- var discMiss = (triangles, frame, discs) => {
1146
- let miss = 0;
1147
- const points = discs.filter((disc) => disc.diameter < POINT_DISC_MM);
1148
- if (points.length > 0) {
1149
- const flat = pointsOf(triangles).map((point) => flatten(point, frame));
1150
- for (const disc of points) {
1151
- miss += extent(flat.map((point) => Math.hypot(point.x - disc.x, point.y - disc.y))).low;
1152
- }
1153
- }
1154
- const wide = discs.filter((disc) => disc.diameter >= POINT_DISC_MM);
1155
- if (wide.length === 0) return miss;
1156
- const segments = wallSegments(triangles, frame);
1157
- let touch = Infinity;
1158
- for (const disc of wide) {
1159
- const radius = disc.diameter / 2;
1160
- const nearest = nearestWall(segments, disc);
1161
- if (!nearest) return Infinity;
1162
- if (!nearest.open) miss += disc.diameter * 4;
1163
- miss += Math.max(0, radius - nearest.distance);
1164
- touch = Math.min(touch, Math.abs(nearest.distance - radius));
1165
- }
1166
- return miss + touch;
1167
- };
1168
- var bestFrame = (triangles, discs, zMin, zMax, direction) => {
1169
- if (triangles.length === 0 || discs.length === 0) return null;
1170
- const exact = exactFrame(triangles, discs, zMin, zMax, direction);
1171
- if (exact) return { frame: exact, lift: 0 };
1172
- const points = pointsOf(triangles);
1173
- const fitting = candidateFrames(points, zMin, zMax, direction);
1174
- const frames = fitting.length > 0 ? fitting : candidateFrames(points, zMin, zMax, direction, false);
1175
- const best = frames.reduce((was, frame) => {
1176
- const miss = discMiss(triangles, frame, discs);
1177
- return !was || miss < was.miss ? { frame, miss } : was;
1178
- }, null);
1179
- if (!best) return null;
1180
- const { low } = extent(points.map((point) => dot(point, best.frame.w)));
1181
- return { frame: best.frame, lift: fitting.length > 0 ? 0 : low - zMin };
1182
- };
1183
- var asVec = ([x, y, z]) => ({ x, y, z });
1184
- var placePinchTool = (mark, triangles, direction, origin = { x: 0, y: 0, z: 0 }) => {
1185
- const shift = [origin.x, origin.y, origin.z];
1186
- const faces = readTriangles(triangles, shift);
1187
- const found = bestFrame(faces, mark.discs, mark.zMin, mark.zMax, [
1188
- direction.x,
1189
- direction.y,
1190
- direction.z
1191
- ]);
1192
- const disc = mark.discs.reduce(
1193
- (tightest, each) => !tightest || each.diameter < tightest.diameter ? each : tightest,
1194
- null
1195
- );
1196
- if (!found || !disc) return null;
1197
- const { frame, lift } = found;
1198
- const radius = disc.diameter / 2;
1199
- const base = add(placeInFrame(frame, disc.x, disc.y, mark.zMin + lift), shift);
1200
- const contact = nearestWall(wallSegments(faces, frame), disc)?.point;
1201
- const toward = contact ? { x: contact.x - disc.x, y: contact.y - disc.y } : { x: 1, y: 0 };
1202
- const length = Math.hypot(toward.x, toward.y);
1203
- const across = add(
1204
- scale(frame.u, length > 1e-9 ? toward.x / length : 1),
1205
- scale(frame.v, length > 1e-9 ? toward.y / length : 0)
1206
- );
1207
- return {
1208
- base: asVec(base),
1209
- axis: asVec(frame.w),
1210
- diameter: disc.diameter,
1211
- height: Math.max(mark.zMax - mark.zMin, MIN_HEIGHT_MM),
1212
- cornerRadius: Math.min(Math.max(mark.corner ?? 0, 0), radius),
1213
- across: asVec(across)
1214
- };
1215
- };
1216
-
1217
- // src/model/turned-check.ts
1218
- var regionsOf = (feature) => Array.isArray(feature.regionIdxs) ? feature.regionIdxs : [];
1219
- var stretchKey = (feature) => {
1220
- const regions = regionsOf(feature);
1221
- return regions.length === 0 ? `tag:${feature.featureTag}` : `${feature.featureType}:${[...regions].sort((a, b) => a - b).join(",")}`;
1222
- };
1223
- var isApproach = (value) => value === "PlusZ" || value === "MinusZ";
1224
- var turnedStretches = (features) => {
1225
- const groups = /* @__PURE__ */ new Map();
1226
- for (const feature of features) {
1227
- const key = stretchKey(feature);
1228
- groups.set(key, [...groups.get(key) ?? [], feature]);
1229
- }
1230
- const merged = [...groups.values()].flatMap((copies) => {
1231
- const [first] = copies;
1232
- if (!first) return [];
1233
- const approaches = [...new Set(copies.map((each) => each.approach).filter(isApproach))];
1234
- const only = approaches.length === 1 ? approaches[0] : void 0;
1235
- const z = only === "PlusZ" ? 1 : only === "MinusZ" ? -1 : 0;
1236
- return [{ first, copies, approaches, machiningDirection: { x: 0, y: 0, z } }];
1237
- });
1238
- const numbered = dfmFeatures(
1239
- merged.map(({ first, machiningDirection }) => ({
1240
- featureTag: first.featureTag,
1241
- featureType: first.featureType,
1242
- machiningDirection,
1243
- regionIdxs: regionsOf(first)
1244
- }))
1245
- );
1246
- return merged.flatMap(({ copies, approaches }, at2) => {
1247
- const feature = numbered[at2];
1248
- return feature ? [{ ...feature, copies, approaches }] : [];
1249
- });
1250
- };
1251
- var record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
1252
- var finite = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
1253
- var ratio = (top, bottom) => top !== null && bottom !== null && bottom > 0 ? top / bottom : null;
1254
- var narrowestStep = (facts) => {
1255
- const steps = Array.isArray(facts.steps) ? facts.steps : [];
1256
- const diameters = steps.map((step) => finite(record(step)?.diameter)).filter((each) => each !== null && each > 0);
1257
- return diameters.length > 0 ? Math.min(...diameters) : null;
1258
- };
1259
- var threadSpec = (facts, field) => finite(record(facts.threadSpec)?.[field]) ?? finite(record(record(facts.thread)?.threadSpec)?.[field]);
1260
- var partEnds = (stretches) => {
1261
- const zs = stretches.flatMap(
1262
- (stretch) => stretch.copies.flatMap((copy) => {
1263
- const sheet = record(copy.datasheet);
1264
- return [finite(sheet?.zMin), finite(sheet?.zMax)].filter(
1265
- (each) => each !== null
1266
- );
1267
- })
1268
- );
1269
- return zs.length > 0 ? { low: Math.min(...zs), high: Math.max(...zs) } : null;
1270
- };
1271
- var turnedLd = (sheet, facts, kind, approach, ends) => {
1272
- if (kind === "AxialHole") return ratio(finite(facts.depth), narrowestStep(facts));
1273
- const inside = ID_KINDS;
1274
- if (!kind || !inside.includes(kind) || !ends || !approach) return null;
1275
- const zMin = finite(sheet.zMin);
1276
- const zMax = finite(sheet.zMax);
1277
- const reach = approach === "PlusZ" ? zMin === null ? null : ends.high - zMin : zMax === null ? null : zMax - ends.low;
1278
- const rMin = finite(sheet.rMin);
1279
- const bore = finite(sheet.entryDiameter) ?? (rMin === null ? null : 2 * rMin);
1280
- return ratio(reach, bore);
1281
- };
1282
- var HAIR = 1e-3;
1283
- var FLAT_CONE = 179.5;
1284
- var copyMeasure = (metric, copy, ends) => {
1285
- const sheet = record(copy.datasheet);
1286
- if (!sheet) return null;
1287
- const facts = record(sheet.facts) ?? {};
1288
- const kind = typeof facts.kind === "string" ? facts.kind : kindOfType(copy.featureType);
1289
- const kinds = metric.kinds;
1290
- if (kinds && !(kind && kinds.includes(kind))) return null;
1291
- const doubled = (value) => {
1292
- const radius = finite(value);
1293
- return radius === null ? null : 2 * radius;
1294
- };
1295
- switch (metric.key) {
1296
- case "maxDiameter":
1297
- return doubled(sheet.rMax);
1298
- case "minDiameter":
1299
- return doubled(sheet.rMin);
1300
- case "length": {
1301
- const zMin = finite(sheet.zMin);
1302
- const zMax = finite(sheet.zMax);
1303
- return zMin === null || zMax === null || zMax - zMin < HAIR ? null : zMax - zMin;
1304
- }
1305
- case "ld":
1306
- return turnedLd(sheet, facts, kind, copy.approach ?? null, ends);
1307
- case "grooveWidth":
1308
- return finite(facts.width);
1309
- case "grooveDepth":
1310
- case "threadDepth":
1311
- case "holeDepth":
1312
- return finite(facts.depth);
1313
- case "grooveAspect":
1314
- return ratio(finite(facts.depth), finite(facts.width));
1315
- case "threadPitch":
1316
- return finite(facts.pitch) ?? threadSpec(facts, "threadPitch");
1317
- case "threadDiameter":
1318
- return threadSpec(facts, "basicDiameter");
1319
- case "holeDiameter":
1320
- return narrowestStep(facts);
1321
- case "holeSteps":
1322
- return Array.isArray(facts.steps) ? facts.steps.length : null;
1323
- case "flatBottom": {
1324
- if (facts.bottom === void 0) return 0;
1325
- const cone = finite(record(facts.bottom)?.coneDeg);
1326
- return cone === null ? null : cone >= FLAT_CONE ? 1 : 0;
1327
- }
1328
- // Zero is a figure here: a sharp corner, which a "radius ≤" rule is most of all about.
1329
- case "cornerRadius":
1330
- return finite(sheet.minConcaveRadius);
1331
- case "sharpCorner": {
1332
- const radius = finite(sheet.minConcaveRadius);
1333
- return radius === null ? 0 : radius <= HAIR ? 1 : 0;
1334
- }
1335
- // Absent where nothing stands between the feature and its end: nothing to pass, so clean.
1336
- case "entryDiameter":
1337
- return finite(sheet.entryDiameter);
1338
- case "axialTool":
1339
- return typeof sheet.mounting === "string" ? sheet.mounting === "Axial" ? 1 : 0 : null;
1340
- case "tolerance":
1341
- return finite(record(sheet.toleranceBand)?.atolMax);
1342
- default:
1343
- return null;
1344
- }
1345
- };
1346
- var kindOfType = (featureType) => featureType.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
1347
- var stretchFacts = (stretch) => stretch.copies.map((copy) => record(record(copy.datasheet)?.facts)).find((each) => each !== void 0);
1348
- var stretchIs = (subject, stretch) => {
1349
- const type = stretch.featureType.toLowerCase();
1350
- if (subject.startsWith(TYPE_SUBJECT)) return type === subject.slice(TYPE_SUBJECT.length);
1351
- const facts = stretchFacts(stretch);
1352
- const kind = typeof facts?.kind === "string" ? facts.kind : kindOfType(type);
1353
- const hole = kind === "AxialHole";
1354
- switch (subject) {
1355
- case "any":
1356
- return true;
1357
- case "thread":
1358
- return kind === "OdThread" || kind === "IdThread" || hole && record(facts?.thread) !== void 0;
1359
- case "throughHole":
1360
- return hole && facts?.through === true;
1361
- case "blindHole":
1362
- return hole && facts?.through === false;
1363
- case "threadedHole":
1364
- return hole && record(facts?.thread) !== void 0;
1365
- default: {
1366
- const kinds = subjectInfo(subject, TURNING_RULES)?.kinds;
1367
- return kinds !== void 0 && kinds.includes(kind);
1368
- }
1369
- }
1370
- };
1371
- var stretchHit = (stretch, rule, metric, ends) => {
1372
- if (metric.quantity === "presence") return { rule, metric, value: 1 };
1373
- const measured = stretch.copies.filter((copy) => record(copy.datasheet) !== void 0);
1374
- if (measured.length === 0) return null;
1375
- const values = [];
1376
- for (const copy of measured) {
1377
- const value2 = copyMeasure(metric, copy, ends);
1378
- if (value2 === null || !breaks(rule, metric.quantity, value2)) return null;
1379
- values.push(value2);
1380
- }
1381
- const value = worseUpward(rule, metric) ? Math.min(...values) : Math.max(...values);
1382
- return { rule, metric, value };
1383
- };
1384
- var checkTurnedPart = (stretches, rules) => {
1385
- const ends = partEnds(stretches);
1386
- const hitsByTag = new Map(
1387
- stretches.map((stretch) => [
1388
- stretch.tag.toLowerCase(),
1389
- rules.flatMap((rule) => {
1390
- const metric = metricInfo(rule.metric, TURNING_RULES);
1391
- if (!metric || !stretchIs(rule.subject, stretch)) return [];
1392
- const hit = stretchHit(stretch, rule, metric, ends);
1393
- return hit ? [hit] : [];
1394
- })
1395
- ])
1396
- );
1397
- const required = new Set(stretches.map((stretch) => stretch.tag.toLowerCase()));
1398
- const paintedFaces = /* @__PURE__ */ new Map();
1399
- for (const stretch of stretches) {
1400
- const color = worstColor(hitsByTag.get(stretch.tag.toLowerCase()));
1401
- if (!color) continue;
1402
- for (const region of stretch.regionIdxs) {
1403
- const painted = paintedFaces.get(region);
1404
- if (!painted || compareColors(color, painted.color) < 0)
1405
- paintedFaces.set(region, { tag: stretch.tag, color });
1406
- }
1407
- }
1408
- return {
1409
- hitsByTag,
1410
- required,
1411
- byRule: ruleResults(rules, stretches, hitsByTag, required),
1412
- paintedFaces,
1413
- paintedWhole: /* @__PURE__ */ new Map()
1414
- };
1415
- };
61
+ upperOf,
62
+ withMetric,
63
+ withOp,
64
+ withSubject,
65
+ withSurroundedFaces
66
+ } from "../chunk-XHYPKN4E.js";
1416
67
  export {
1417
68
  CRITICAL_COLOR,
1418
69
  FILE_KIND,
70
+ MAX_DATASHEET_FIELDS,
1419
71
  MILLING_RULES,
72
+ OPS,
1420
73
  PINCH_TOOL_MM,
74
+ PRESENCE_METRIC,
75
+ QUICK_SUBJECTS,
76
+ RANGE_HIGHS,
77
+ RANGE_LOWS,
1421
78
  RULE_COLORS,
1422
79
  TURNING_RULES,
1423
80
  WARNING_COLOR,
@@ -1425,32 +82,51 @@ export {
1425
82
  checkPart,
1426
83
  checkTurnedPart,
1427
84
  compareColors,
85
+ datasheetFields,
1428
86
  describeRule,
1429
87
  dfmFeatures,
88
+ directionLabel,
1430
89
  featureColor,
1431
90
  featureMeasurements,
1432
91
  featureProfile,
92
+ featureRows,
1433
93
  featureSheet,
1434
94
  featureTypeLabel,
95
+ formatMeasured,
96
+ fromField,
97
+ highOf,
1435
98
  hitFigure,
1436
99
  isNoReading,
1437
100
  isSurfaceType,
101
+ lengthValue,
1438
102
  llmRulePrompt,
103
+ lowOf,
1439
104
  makeRule,
1440
105
  maxBallDiameter,
106
+ metricInfo,
107
+ metricsForSubject,
108
+ opSymbol,
1441
109
  parseRuleSetFile,
1442
110
  parseRules,
1443
111
  peakHeight,
1444
112
  pinchLabel,
1445
113
  pinchMark,
1446
114
  placePinchTool,
115
+ quantityUnit,
1447
116
  readPinch,
1448
117
  readReachCurve,
1449
118
  runStart,
1450
119
  sameDepth,
1451
120
  serializeRuleSet,
121
+ subjectLabel,
122
+ toField,
1452
123
  trimmedCurve,
1453
124
  turnedStretches,
1454
125
  turnedTypeLabel,
126
+ unitLabel,
127
+ upperOf,
128
+ withMetric,
129
+ withOp,
130
+ withSubject,
1455
131
  withSurroundedFaces
1456
132
  };