@toolpath/dfm 0.0.0-stage → 0.1.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.
@@ -0,0 +1,109 @@
1
+ import { d as DfmHit, U as Units, b as DfmFeature, F as FeatureSheets, e as FeatureSheet, D as DfmRule } from '../reach-CfmYU_yQ.js';
2
+ export { C as CRITICAL_COLOR, f as ClearanceFit, a as DfmCheck, g as DfmMetric, h as DfmOp, i as DfmQuantity, j as DfmSources, k as FactsKind, l as FeatureAcross, m as FeaturePinch, c as FeatureProfile, n as FeatureThreading, P as PINCH_TOOL_MM, o as PinchDisc, p as RULE_COLORS, q as RangeHigh, r as RangeLow, R as ReachCurve, s as ReportFeature, t as RuleResult, W as WARNING_COLOR, u as checkPart, v as compareColors, w as describeRule, x as dfmFeatures, y as featureProfile, z as featureSheet, A as featureTypeLabel, B as isNoReading, E as makeRule, G as parseRules, H as peakHeight, I as readPinch, J as readReachCurve, K as runStart, L as trimmedCurve, M as withSurroundedFaces } from '../reach-CfmYU_yQ.js';
3
+
4
+ /** The figure that broke a rule, bare: `7.5`, `0.05"`. Empty for a yes/no or "any size". */
5
+ declare const hitFigure: (hit: DfmHit, units: Units) => string;
6
+
7
+ /** One row of a feature's details. */
8
+ interface Measurement {
9
+ /** Stable, so a list can key its rows. */
10
+ readonly key: string;
11
+ readonly label: string;
12
+ readonly value: string;
13
+ /** The same number in the other unit. Absent on a ratio or a count. */
14
+ readonly alt?: string;
15
+ /**
16
+ * How it was worked out from the datasheet, a line at a time: the fields it
17
+ * reads, by their path in the raw record, and the arithmetic, in the
18
+ * Engine's millimetres.
19
+ */
20
+ readonly derivation: readonly string[];
21
+ /**
22
+ * A machining consideration rather than a measurement of the feature's own
23
+ * shape: the tool that cuts it, and how far it has to reach. The panel lists
24
+ * these under their own heading, for every kind of feature.
25
+ */
26
+ readonly milling?: true;
27
+ /** A row that stands for a tool the viewer can draw on the part, by its kind. */
28
+ readonly tool?: SurfaceToolKind;
29
+ }
30
+ /** Which of a surface's finishing tools: a ball nose, or a bull nose with a flat between its corners. */
31
+ type SurfaceToolKind = 'ball' | 'bull';
32
+ /** Whether a feature type is read as a surface: see `SURFACE_TYPES`. */
33
+ declare const isSurfaceType: (featureType: string) => boolean;
34
+ /**
35
+ * The biggest ball nose a surface admits, mm: a ball's corner radius is half
36
+ * its diameter, so it is held under the tool fit's diameter and corner radius
37
+ * at once. None where the surface reports no fit, or admits no corner at all.
38
+ */
39
+ declare const maxBallDiameter: (sheet: Pick<FeatureSheet, "fitToolDiameter" | "fitCornerRadius">) => number | undefined;
40
+ /**
41
+ * The rows a feature gets, in {@link ROW_ORDER}: its own geometry first, then
42
+ * where it sits in the part and the reach that makes, then the tools a
43
+ * surface admits. A row is left out rather than shown empty: "—" against a
44
+ * field this kind never reports reads as a measurement that failed.
45
+ */
46
+ declare const featureMeasurements: ({ features, feature, sheets, units, }: {
47
+ features: readonly DfmFeature[];
48
+ feature: DfmFeature;
49
+ sheets: FeatureSheets;
50
+ units: Units;
51
+ }) => Measurement[];
52
+
53
+ /** Whether two depths are one depth, as the quoting app counts them: within a twentieth, or a hundredth of a mm. */
54
+ declare const sameDepth: (a: number, b: number) => boolean;
55
+
56
+ /**
57
+ * A set of DFM rules as a file: what Export writes, Import reads, and what
58
+ * an LLM is asked to produce. One JSON object, so a shop can keep a set per
59
+ * customer or material, send one to a colleague, or have one written for
60
+ * them from a conversation.
61
+ *
62
+ * Values are canonical, as the rules are stored: millimetres, square
63
+ * millimetres, degrees, plain ratios. A file says so in `units`, so a reader
64
+ * is never left guessing, and so a later version can accept inches.
65
+ */
66
+ interface RuleSetFile {
67
+ /** What this file is. Always `toolpath-dfm-rules`. */
68
+ kind: typeof FILE_KIND;
69
+ /** The file format's version, for a later reader. */
70
+ version: 1;
71
+ /** What the set is for: "Aluminium prototypes", "Acme Corp sheet work". */
72
+ name?: string;
73
+ description?: string;
74
+ /** The unit every length in `rules` is in. Only millimetres are written or read today. */
75
+ units: 'mm';
76
+ rules: DfmRule[];
77
+ }
78
+ declare const FILE_KIND = "toolpath-dfm-rules";
79
+ /** The rules as a file, pretty-printed. */
80
+ declare const serializeRuleSet: (rules: readonly DfmRule[], meta?: {
81
+ name?: string;
82
+ description?: string;
83
+ }) => string;
84
+ /**
85
+ * The rules in a file, or the reason it cannot be read. Lenient about the
86
+ * wrapper — a bare array of rules is accepted, and so is an object with a
87
+ * `rules` list and nothing else, since an LLM may well hand back either —
88
+ * strict about every rule, which `parseRules` checks field by field. Rules
89
+ * without an id, or whose ids collide, are given fresh ones. A file that says
90
+ * its lengths are in anything but millimetres is refused rather than read as
91
+ * millimetres; one that does not say is read as millimetres.
92
+ */
93
+ declare const parseRuleSetFile: (text: string) => {
94
+ rules: DfmRule[];
95
+ skipped: number;
96
+ name?: string;
97
+ } | {
98
+ error: string;
99
+ };
100
+ /**
101
+ * A prompt that lets any LLM interview a user and write a rule set this
102
+ * viewer reads. Built from the metric and subject tables themselves, so it
103
+ * never drifts from what the parser accepts: every subject value, every
104
+ * metric key with its unit and meaning and the kinds of feature that report
105
+ * it, every comparison, and the palette.
106
+ */
107
+ declare const llmRulePrompt: (current?: readonly DfmRule[]) => string;
108
+
109
+ export { DfmFeature, DfmHit, DfmRule, FILE_KIND, FeatureSheet, FeatureSheets, type Measurement, type RuleSetFile, type SurfaceToolKind, Units, featureMeasurements, hitFigure, isSurfaceType, llmRulePrompt, maxBallDiameter, parseRuleSetFile, sameDepth, serializeRuleSet };