@toolpath/dfm 0.3.1 → 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.
package/README.md CHANGED
@@ -34,11 +34,11 @@ Add the styles after Tailwind and the `@toolpath/ui` theme:
34
34
 
35
35
  ## Exports
36
36
 
37
- | Entry point | What it is |
38
- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
39
- | `@toolpath/dfm` | `RuleList`, `Swatch`, the list's keyboard helpers, `ReachChart`, `ReachDrawing`, the feature panel (`FeaturePanel`, `FeatureDetails`, `CandidateList`, `ComparisonTable`, `storageFolds`), their types |
40
- | `@toolpath/dfm/model` | The rules, `checkPart`, the rule-set file, the feature panel's rows, pinch points — no React, no DOM |
41
- | `@toolpath/dfm/dfm.css` | Lets the app's Tailwind see the list's and chart's classes |
37
+ | Entry point | What it is |
38
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
39
+ | `@toolpath/dfm` | `RuleList`, `Swatch`, the list's keyboard helpers, `ReachChart`, `ReachDrawing`, the feature panel (`FeaturePanel`, `FeatureDetails`, `CandidateList`, `ComparisonTable`, `storageFolds`), their types, and the two rule vocabularies (`MILLING_RULES`, `TURNING_RULES`) |
40
+ | `@toolpath/dfm/model` | The rules, `checkPart` and `checkTurnedPart`, the rule-set file, the feature panel's rows, pinch points — no React, no DOM |
41
+ | `@toolpath/dfm/dfm.css` | Lets the app's Tailwind see the list's and chart's classes |
42
42
 
43
43
  ## The rules are an input
44
44
 
@@ -81,6 +81,42 @@ rules from anywhere in it.
81
81
  Import…, Export and Copy LLM prompt — a way back to the app's default rules,
82
82
  say, since the package has none of its own.
83
83
 
84
+ ## Turning rules
85
+
86
+ The same list edits turning rules: pass `vocabulary={TURNING_RULES}`, and it
87
+ offers turned subjects (grooves, threads, axial holes, OD and ID features) and
88
+ their measures, saves its set as `dfm-turning-rules.json`, and writes its LLM
89
+ prompt for a lathe. Each vocabulary keeps its own rules: an import refuses the
90
+ other process's file, and `parseRules(raw, TURNING_RULES)` drops milling ones.
91
+ Every helper that reads a rule takes the vocabulary last, and reads milling
92
+ where it is left out.
93
+
94
+ ```tsx
95
+ import { RuleList, TURNING_RULES } from '@toolpath/dfm'
96
+ import { checkTurnedPart, turnedStretches } from '@toolpath/dfm/model'
97
+
98
+ // From a part analysis's `turning.features`.
99
+ const stretches = turnedStretches(report.turning.features)
100
+ const check = checkTurnedPart(stretches, rules.rules)
101
+
102
+ <RuleList
103
+ rules={rules}
104
+ vocabulary={TURNING_RULES}
105
+ check={check}
106
+ features={stretches}
107
+ sheets={{}}
108
+ units="mm"
109
+ {...rest}
110
+ />
111
+ ```
112
+
113
+ The Engine reports a stretch both ends of the part reach as two features, one
114
+ per end; `turnedStretches` makes them one again, under the first one's tag. A
115
+ stretch breaks a rule only if it breaks it from every end it is cut from, and
116
+ every stretch counts — a turned face has one reading — so nothing is left in
117
+ `otherTags`. Turning is experimental in the API, so a datasheet field that is
118
+ missing or malformed is no figure, never an error.
119
+
84
120
  ## Reach chart
85
121
 
86
122
  `ReachChart` draws a feature's reach curve: the section through the part at the
@@ -157,6 +193,12 @@ The parts work alone too. An app with an inspect panel of its own puts
157
193
  controls — a folder in a row's `detail`, a Pin button in its `action`, Zoom to
158
194
  in the details' `actions`, a folder badge in `status`.
159
195
 
196
+ A turned feature reads the same way: give `FeaturePanel`, `CandidateList` and
197
+ `FeatureDetails` `vocabulary={TURNING_RULES}` and a stretch from
198
+ `turnedStretches`, and the feature is named as a turned one — "OD groove from
199
+ both ends", "Machined from both ends" — with its considerations under
200
+ "Turning considerations". Milling is the default.
201
+
160
202
  - **Rules broken** are `BrokenRule` rows: a colour, the rule's text, the figure
161
203
  that broke it, and optionally the limit and a note on hover. `brokenRules`
162
204
  builds them from this package's check; an app with a checker of its own