@toolpath/dfm 0.4.0 → 0.5.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,99 +1,3 @@
1
- /** The unit a length is shown in. The Engine's meshes are always millimetres. */
2
- type Units = 'mm' | 'inch';
3
-
4
- /**
5
- * At or above, above, at or below, below, equal, not equal, or between —
6
- * equal meaning within half a percent, since figures are measured, and not
7
- * equal anything further off; between from a low end up to, not including, a
8
- * high one.
9
- */
10
- type DfmOp = 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'ne' | 'between';
11
- /**
12
- * How a figure is read and typed: a length (mm), an area (mm²), an angle
13
- * (degrees), a plain ratio, a count, a percentage, yes/no, or — for "any
14
- * size" — nothing at all.
15
- */
16
- type DfmQuantity = 'length' | 'area' | 'angle' | 'ratio' | 'count' | 'percent' | 'flag' | 'presence';
17
- /** A datasheet's `facts.kind`: which family of measurements the Engine took. */
18
- type FactsKind = 'Hole' | 'Pocket' | 'Boss' | 'Wall' | 'Face' | 'Three' | 'Chamfer' | 'Profile' | 'Dovetail' | 'Tslot';
19
- interface DfmMetric {
20
- key: string;
21
- /** As the rule sentence reads it: "L/D", "depth below top". */
22
- label: string;
23
- /** The heading it is listed under when choosing. */
24
- group: string;
25
- quantity: DfmQuantity;
26
- /** Which way is worse, for a new rule: deep is bad (≥), a tiny corner is bad (≤). */
27
- op: DfmOp;
28
- /** What a new rule starts at: millimetres and inches kept apart, so both read as round numbers. */
29
- start: Record<Units, number>;
30
- /** What it means, in a few plain words. */
31
- hint: string;
32
- /** The kinds of datasheet that report it; every kind when left out. */
33
- kinds?: readonly FactsKind[];
34
- /**
35
- * Where it sits in the datasheet, first found wins: a chamfer keeps its
36
- * cutter band under its surface reading (`facts.three.cd`). Left out for a
37
- * measure worked out rather than read (see `dfm-flags.ts`).
38
- */
39
- path?: readonly string[];
40
- /** Whether a rule may name a value below zero: a height, or a signed radius. */
41
- signed?: true;
42
- }
43
-
44
- /** How a range holds its low end: at or above it, or above it. */
45
- type RangeLow = 'gte' | 'gt';
46
- /** How a range holds its high end: below it, or at or below it. */
47
- type RangeHigh = 'lt' | 'lte';
48
- interface DfmRule {
49
- /** Stable, so a list can key its rows and a feature can name the rule it broke. */
50
- id: string;
51
- /** Which features: a value from {@link FEATURE_SUBJECTS}. */
52
- subject: string;
53
- /** What is measured: a key from {@link FEATURE_METRICS}. */
54
- metric: string;
55
- op: DfmOp;
56
- /** Canonical — mm or a ratio. Ignored by a yes/no metric. The low end of a range. */
57
- value: number;
58
- /** A range's high end. Only a `between` rule has one. */
59
- max?: number;
60
- /** How a range holds its low end; ≥ where unsaid. Only a `between` rule has one. */
61
- lowOp?: RangeLow;
62
- /** How a range holds its high end; < where unsaid. Only a `between` rule has one. */
63
- highOp?: RangeHigh;
64
- /** `#rrggbb`: what the features that break it are painted. */
65
- color: string;
66
- }
67
- /**
68
- * The colours a rule can wear: vivid, and far enough apart in hue and
69
- * lightness to tell apart on the part at a glance (no two closer than ΔE 37,
70
- * and none within 50 of the selection's blue). Warm first, since most
71
- * rules call out trouble; then cool ones for a rule that marks something
72
- * good.
73
- */
74
- declare const RULE_COLORS: readonly {
75
- name: string;
76
- value: string;
77
- }[];
78
- /**
79
- * Which colour shows where a feature breaks rules of two: the one earliest in
80
- * the palette, so red over yellow. Colours from outside it come after, in an
81
- * order of their own, so a tie never falls back on the list.
82
- */
83
- declare const compareColors: (a: string, b: string) => number;
84
- /** The quoting app's two severities, as the colours a rule starts in. */
85
- declare const CRITICAL_COLOR = "#e5484d";
86
- declare const WARNING_COLOR = "#ffd60a";
87
- /**
88
- * A rule as one plain line: "Holes with L/D ≥ 8", "Holes with 4 ≤ L/D < 8",
89
- * "Any feature with a sharp inside corner", "Undercut T-slots, any size".
90
- */
91
- declare const describeRule: (rule: DfmRule, units: Units) => string;
92
- /** A new rule for a subject and metric, at the metric's own starting value in the reader's units. */
93
- declare const makeRule: (subject: string, metricKey: string, units: Units, color?: string) => DfmRule;
94
- /** Stored rules, the ones that read; null when what is stored is not a list at all. */
95
- declare const parseRules: (raw: unknown) => DfmRule[] | null;
96
-
97
1
  /**
98
2
  * Where a feature is at its tightest (the datasheet's `pinchPoints`, API
99
3
  * 1.12.1): one disc per stretch of the feature that reaches its minimum
@@ -313,6 +217,163 @@ declare const dfmFeatures: (features: readonly ReportFeature[]) => DfmFeature[];
313
217
  /** `through_hole` as `Through hole`. The Engine's feature types are open-ended snake case. */
314
218
  declare const featureTypeLabel: (featureType: string) => string;
315
219
 
220
+ /** A turning datasheet's `facts.kind`, and `Unknown` for a stretch the Engine could not name. */
221
+ type TurnedFactsKind = 'AxialHole' | 'Face' | 'FaceGroove' | 'FaceProfile' | 'IdGroove' | 'IdProfile' | 'IdThread' | 'OdGroove' | 'OdProfile' | 'OdThread' | 'Unknown';
222
+ /**
223
+ * `od_groove` as `OD groove`, `axial_hole` as `Axial hole`. The Engine's
224
+ * turned feature types are open-ended snake case, so a type it adds later
225
+ * reads as its words.
226
+ */
227
+ declare const turnedTypeLabel: (featureType: string) => string;
228
+ /** Turning rules: the measures and subjects of the Engine's turned features. */
229
+ declare const TURNING_RULES: RuleVocabulary;
230
+
231
+ /** The unit a length is shown in. The Engine's meshes are always millimetres. */
232
+ type Units = 'mm' | 'inch';
233
+
234
+ /**
235
+ * At or above, above, at or below, below, equal, not equal, or between —
236
+ * equal meaning within half a percent, since figures are measured, and not
237
+ * equal anything further off; between from a low end up to, not including, a
238
+ * high one.
239
+ */
240
+ type DfmOp = 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'ne' | 'between';
241
+ /**
242
+ * How a figure is read and typed: a length (mm), an area (mm²), an angle
243
+ * (degrees), a plain ratio, a count, a percentage, yes/no, or — for "any
244
+ * size" — nothing at all.
245
+ */
246
+ type DfmQuantity = 'length' | 'area' | 'angle' | 'ratio' | 'count' | 'percent' | 'flag' | 'presence';
247
+ /** A datasheet's `facts.kind`: which family of measurements the Engine took. */
248
+ type FactsKind = 'Hole' | 'Pocket' | 'Boss' | 'Wall' | 'Face' | 'Three' | 'Chamfer' | 'Profile' | 'Dovetail' | 'Tslot';
249
+ /** A datasheet's `facts.kind`, milled or turned. */
250
+ type AnyFactsKind = FactsKind | TurnedFactsKind;
251
+ interface DfmMetric {
252
+ key: string;
253
+ /** As the rule sentence reads it: "L/D", "depth below top". */
254
+ label: string;
255
+ /** The heading it is listed under when choosing. */
256
+ group: string;
257
+ quantity: DfmQuantity;
258
+ /** Which way is worse, for a new rule: deep is bad (≥), a tiny corner is bad (≤). */
259
+ op: DfmOp;
260
+ /** What a new rule starts at: millimetres and inches kept apart, so both read as round numbers. */
261
+ start: Record<Units, number>;
262
+ /** What it means, in a few plain words. */
263
+ hint: string;
264
+ /** The kinds of datasheet that report it; every kind when left out. */
265
+ kinds?: readonly AnyFactsKind[];
266
+ /**
267
+ * Where it sits in the datasheet, first found wins: a chamfer keeps its
268
+ * cutter band under its surface reading (`facts.three.cd`). Left out for a
269
+ * measure worked out rather than read (see `dfm-flags.ts`).
270
+ */
271
+ path?: readonly string[];
272
+ /** Whether a rule may name a value below zero: a height, or a signed radius. */
273
+ signed?: true;
274
+ }
275
+ interface DfmSubject {
276
+ value: string;
277
+ /** Plural, as the rule sentence starts: "Holes", "Undercut T-slots". */
278
+ label: string;
279
+ /** "Groups" or "Feature types", for choosing. */
280
+ group: string;
281
+ /** The datasheet kinds its features report; every kind when left out. */
282
+ kinds?: readonly AnyFactsKind[];
283
+ }
284
+ /** Which kind of machining a set of rules is about: a milled part's features, or a turned part's. */
285
+ type RuleProcess = 'milling' | 'turning';
286
+ /**
287
+ * Everything a set of rules can say, for one process: its measures, its
288
+ * subjects, the short lists offered first, and how a feature that breaks a
289
+ * rule is named in a list. Pure data, so the editor, the checker and the
290
+ * rule-set file read milling and turning rules the same way.
291
+ */
292
+ interface RuleVocabulary {
293
+ process: RuleProcess;
294
+ metrics: readonly DfmMetric[];
295
+ subjects: readonly DfmSubject[];
296
+ quickSubjects: readonly string[];
297
+ quickMetrics: readonly string[];
298
+ /** What a new or moved rule falls back on when its own measure is unknown: L/D for milling, "any size" for turning. */
299
+ fallbackMetric: DfmMetric;
300
+ /**
301
+ * A feature as a list or the feature panel names it: `{ name: 'Blind hole',
302
+ * detail: 'from +Z' }`, or for a turned one `{ name: 'OD groove', detail:
303
+ * 'from both ends' }`. The detail follows "Machined" in the feature panel.
304
+ */
305
+ featureLabel: (feature: Pick<DfmFeature, 'featureType' | 'machiningDirection'>) => {
306
+ name: string;
307
+ detail: string;
308
+ };
309
+ /** The feature panel's heading over what a feature asks of the machining: `Milling considerations`. */
310
+ considerationsTitle: string;
311
+ /** What an exported set is saved as. */
312
+ fileName: string;
313
+ }
314
+ /** Milling rules: the measures and subjects above, which the Engine's milled features report. */
315
+ declare const MILLING_RULES: RuleVocabulary;
316
+
317
+ /** How a range holds its low end: at or above it, or above it. */
318
+ type RangeLow = 'gte' | 'gt';
319
+ /** How a range holds its high end: below it, or at or below it. */
320
+ type RangeHigh = 'lt' | 'lte';
321
+ interface DfmRule {
322
+ /** Stable, so a list can key its rows and a feature can name the rule it broke. */
323
+ id: string;
324
+ /** Which features: a value from its vocabulary's subjects — `FEATURE_SUBJECTS` for milling. */
325
+ subject: string;
326
+ /** What is measured: a key from its vocabulary's metrics — `FEATURE_METRICS` for milling. */
327
+ metric: string;
328
+ op: DfmOp;
329
+ /** Canonical — mm or a ratio. Ignored by a yes/no metric. The low end of a range. */
330
+ value: number;
331
+ /** A range's high end. Only a `between` rule has one. */
332
+ max?: number;
333
+ /** How a range holds its low end; ≥ where unsaid. Only a `between` rule has one. */
334
+ lowOp?: RangeLow;
335
+ /** How a range holds its high end; < where unsaid. Only a `between` rule has one. */
336
+ highOp?: RangeHigh;
337
+ /** `#rrggbb`: what the features that break it are painted. */
338
+ color: string;
339
+ }
340
+ /**
341
+ * The colours a rule can wear: vivid, and far enough apart in hue and
342
+ * lightness to tell apart on the part at a glance (no two closer than ΔE 37,
343
+ * and none within 50 of the selection's blue). Warm first, since most
344
+ * rules call out trouble; then cool ones for a rule that marks something
345
+ * good.
346
+ */
347
+ declare const RULE_COLORS: readonly {
348
+ name: string;
349
+ value: string;
350
+ }[];
351
+ /**
352
+ * Which colour shows where a feature breaks rules of two: the one earliest in
353
+ * the palette, so red over yellow. Colours from outside it come after, in an
354
+ * order of their own, so a tie never falls back on the list.
355
+ */
356
+ declare const compareColors: (a: string, b: string) => number;
357
+ /** The quoting app's two severities, as the colours a rule starts in. */
358
+ declare const CRITICAL_COLOR = "#e5484d";
359
+ declare const WARNING_COLOR = "#ffd60a";
360
+ /**
361
+ * A rule as one plain line: "Holes with L/D ≥ 8", "Holes with 4 ≤ L/D < 8",
362
+ * "Any feature with a sharp inside corner", "Undercut T-slots, any size".
363
+ */
364
+ declare const describeRule: (rule: DfmRule, units: Units, vocabulary?: RuleVocabulary) => string;
365
+ /**
366
+ * A new rule for a subject and metric, at the metric's own starting value in
367
+ * the reader's units. A metric the vocabulary does not know is its fallback.
368
+ */
369
+ declare const makeRule: (subject: string, metricKey: string, units: Units, color?: string, vocabulary?: RuleVocabulary) => DfmRule;
370
+ /**
371
+ * Stored rules, the ones that read in this vocabulary — a turning rule is
372
+ * dropped as milling reads it, and the other way round; null when what is
373
+ * stored is not a list at all.
374
+ */
375
+ declare const parseRules: (raw: unknown, vocabulary?: RuleVocabulary) => DfmRule[] | null;
376
+
316
377
  /** What the checks read of the part, beyond its features. */
317
378
  interface DfmSources {
318
379
  /** Each feature's measurements, cut down (`feature-sheet.ts`), by lower-cased tag. */
@@ -464,8 +525,11 @@ interface BrokenRule {
464
525
  /** On hover: the rule written out, and why it matters. */
465
526
  readonly note?: string;
466
527
  }
467
- /** The rules a feature breaks, as its details list them: one a measure, the worst, palette first. */
468
- declare const brokenRules: (check: DfmCheck, tag: string, units: Units) => BrokenRule[];
528
+ /**
529
+ * The rules a feature breaks, as its details list them: one a measure, the
530
+ * worst, palette first, each written in the vocabulary its rules are in.
531
+ */
532
+ declare const brokenRules: (check: DfmCheck, tag: string, units: Units, vocabulary?: RuleVocabulary) => BrokenRule[];
469
533
  /**
470
534
  * The colour a feature is painted on the part: the one earliest in the
471
535
  * palette of the rules it breaks, for a required feature. Read from a face
@@ -532,4 +596,4 @@ interface FeatureRecord {
532
596
  readonly datasheet: unknown;
533
597
  }
534
598
 
535
- export { dfmFeatures as A, type BrokenRule as B, CRITICAL_COLOR as C, type DfmRule as D, featureColor as E, type FeatureSheets as F, featureMeasurements as G, featureProfile as H, featureSheet as I, featureTypeLabel as J, isNoReading as K, isSurfaceType as L, type Measurement as M, makeRule as N, maxBallDiameter as O, PINCH_TOOL_MM as P, parseRules as Q, type ReachCurve as R, type SurfaceToolKind as S, peakHeight as T, type Units as U, readPinch as V, WARNING_COLOR as W, readReachCurve as X, runStart as Y, trimmedCurve as Z, withSurroundedFaces as _, type DfmCheck as a, type DfmFeature as b, type FeatureProfile as c, type FeatureRecord as d, type DfmHit as e, type FeaturePinch as f, type FeatureSheet as g, type ClearanceFit as h, type DfmMetric as i, type DfmOp as j, type DfmQuantity as k, type DfmSources as l, type FactsKind as m, type FeatureAcross as n, type FeatureThreading as o, type FeatureUndercut as p, type PinchDisc as q, RULE_COLORS as r, type RangeHigh as s, type RangeLow as t, type ReportFeature as u, type RuleResult as v, brokenRules as w, checkPart as x, compareColors as y, describeRule as z };
599
+ export { peakHeight as $, type TurnedFactsKind as A, type BrokenRule as B, CRITICAL_COLOR as C, type DfmRule as D, brokenRules as E, type FeatureSheets as F, checkPart as G, compareColors as H, describeRule as I, dfmFeatures as J, featureColor as K, featureMeasurements as L, type Measurement as M, featureProfile as N, featureSheet as O, PINCH_TOOL_MM as P, featureTypeLabel as Q, type RuleVocabulary as R, type SurfaceToolKind as S, TURNING_RULES as T, type Units as U, isNoReading as V, WARNING_COLOR as W, isSurfaceType as X, makeRule as Y, maxBallDiameter as Z, parseRules as _, type DfmCheck as a, readPinch as a0, readReachCurve as a1, runStart as a2, trimmedCurve as a3, turnedTypeLabel as a4, withSurroundedFaces as a5, type DfmFeature as b, type ReachCurve as c, type FeatureProfile as d, type FeatureRecord as e, MILLING_RULES as f, type RuleProcess as g, type DfmHit as h, type FeaturePinch as i, type FeatureSheet as j, type ClearanceFit as k, type DfmMetric as l, type DfmOp as m, type DfmQuantity as n, type DfmSources as o, type DfmSubject as p, type FactsKind as q, type FeatureAcross as r, type FeatureThreading as s, type FeatureUndercut as t, type PinchDisc as u, RULE_COLORS as v, type RangeHigh as w, type RangeLow as x, type ReportFeature as y, type RuleResult as z };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, FC, KeyboardEvent, Ref, ComponentType, ReactElement, HTMLAttributes } from 'react';
3
- import { D as DfmRule, a as DfmCheck, b as DfmFeature, F as FeatureSheets, U as Units, R as ReachCurve, c as FeatureProfile, B as BrokenRule, M as Measurement, d as FeatureRecord } from './feature-record-DHbkVpx0.js';
3
+ import { D as DfmRule, a as DfmCheck, b as DfmFeature, F as FeatureSheets, U as Units, R as RuleVocabulary, c as ReachCurve, d as FeatureProfile, B as BrokenRule, M as Measurement, e as FeatureRecord } from './feature-record-CfjgDCJU.js';
4
+ export { f as MILLING_RULES, g as RuleProcess, T as TURNING_RULES } from './feature-record-CfjgDCJU.js';
4
5
 
5
6
  /**
6
7
  * The rules the list shows, and how to change them. The app owns them —
@@ -32,6 +33,12 @@ interface RuleListProps {
32
33
  selectedGroup: readonly string[] | null;
33
34
  onInspect: (tag: string, group?: readonly string[]) => void;
34
35
  onHover: (hovered: Hovered) => void;
36
+ /**
37
+ * What the rules can say, and how a broken feature is named: `MILLING_RULES`
38
+ * where left out, `TURNING_RULES` for a turned part — whose `features` are
39
+ * its stretches (`turnedStretches`) and whose `sheets` are `{}`.
40
+ */
41
+ vocabulary?: RuleVocabulary;
35
42
  /**
36
43
  * At the end of the footer's row, after Copy LLM prompt: the app's own
37
44
  * buttons — a way back to its default rules, say.
@@ -234,6 +241,11 @@ interface FeatureDetailsProps {
234
241
  PopOut?: PopOutWindow;
235
242
  look?: FeaturePanelLook;
236
243
  folds?: FoldStore;
244
+ /**
245
+ * Which process the feature is read for: how it is named, the way it is cut
246
+ * from, and the heading over its considerations. Milling where left out.
247
+ */
248
+ vocabulary?: RuleVocabulary;
237
249
  }
238
250
  /**
239
251
  * One feature, as the Engine read it: its name and the way it is machined
@@ -289,6 +301,8 @@ interface CandidateListProps {
289
301
  face?: ComparedFaceList;
290
302
  look?: FeaturePanelLook;
291
303
  folds?: FoldStore;
304
+ /** How the rows' features are named: milling where left out. */
305
+ vocabulary?: RuleVocabulary;
292
306
  }
293
307
  /**
294
308
  * Every feature a clicked face belongs to, as rows to choose between: its
@@ -355,6 +369,8 @@ interface FeaturePanelProps {
355
369
  className?: string;
356
370
  look?: FeaturePanelLook;
357
371
  folds?: FoldStore;
372
+ /** How the candidates are named: milling where left out (see `FeatureDetails`). */
373
+ vocabulary?: RuleVocabulary;
358
374
  /** The active face's feature: its `<FeatureDetails>`. */
359
375
  children?: ReactNode;
360
376
  }
@@ -370,4 +386,4 @@ interface FeaturePanelProps {
370
386
  */
371
387
  declare const FeaturePanel: FC<FeaturePanelProps>;
372
388
 
373
- export { CandidateList, type CandidateListProps, type CandidateRow, type ComparedFace, type ComparedFaceList, ComparisonTable, type ComparisonTableProps, type DfmRules, FeatureDetails, type FeatureDetailsProps, type FeatureIdentity, FeaturePanel, type FeaturePanelLook, type FeaturePanelProps, type FoldStore, type Hovered, type InspectedFace, type Loadable, type PopOutId, type PopOutWindow, type PopOutWindowProps, ReachChart, type ReachChartProps, ReachDrawing, RuleList, type RuleListProps, Swatch, type SwatchProps, candidateListKeys, isField, listKeys, ruleListKeys, storageFolds };
389
+ export { CandidateList, type CandidateListProps, type CandidateRow, type ComparedFace, type ComparedFaceList, ComparisonTable, type ComparisonTableProps, type DfmRules, FeatureDetails, type FeatureDetailsProps, type FeatureIdentity, FeaturePanel, type FeaturePanelLook, type FeaturePanelProps, type FoldStore, type Hovered, type InspectedFace, type Loadable, type PopOutId, type PopOutWindow, type PopOutWindowProps, ReachChart, type ReachChartProps, ReachDrawing, RuleList, type RuleListProps, RuleVocabulary, Swatch, type SwatchProps, candidateListKeys, isField, listKeys, ruleListKeys, storageFolds };