@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.
- package/LICENSE +21 -0
- package/README.md +97 -2
- package/dfm.css +9 -0
- package/dist/chunk-5MPHT7BC.js +1599 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +1628 -0
- package/dist/model/index.d.ts +109 -0
- package/dist/model/index.js +775 -0
- package/dist/reach-CfmYU_yQ.d.ts +415 -0
- package/package.json +72 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Toolpath
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Toolpath DFM
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@toolpath/dfm` is the DFM (design for manufacturing) rule list: each rule
|
|
4
|
+
written as the sentence it is — "Holes with L/D to top of part ≥ 8" — whose
|
|
5
|
+
words are its fields, beside its colour and how many of a part's features
|
|
6
|
+
break it. Under the list, Import, Export and Copy LLM prompt share a rule set
|
|
7
|
+
as one JSON file.
|
|
8
|
+
|
|
9
|
+
It also draws a feature's reach chart: the walls beside the feature, how high
|
|
10
|
+
they stand and how far out.
|
|
11
|
+
|
|
12
|
+
The rules and the checker that counts them ship too, with no React, under
|
|
13
|
+
`@toolpath/dfm/model`.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @toolpath/dfm @toolpath/ui react react-dom
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add the styles after Tailwind and the `@toolpath/ui` theme:
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
@import 'tailwindcss';
|
|
25
|
+
@import '@toolpath/ui/theme.css';
|
|
26
|
+
@import '@toolpath/dfm/dfm.css';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Exports
|
|
30
|
+
|
|
31
|
+
| Entry point | What it is |
|
|
32
|
+
| ----------------------- | -------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `@toolpath/dfm` | `RuleList`, `Swatch`, the list's keyboard helpers, `ReachChart`, `ReachDrawing`, their types |
|
|
34
|
+
| `@toolpath/dfm/model` | The rules, `checkPart`, the rule-set file — no React, no DOM |
|
|
35
|
+
| `@toolpath/dfm/dfm.css` | Lets the app's Tailwind see the list's and chart's classes |
|
|
36
|
+
|
|
37
|
+
## The rules are an input
|
|
38
|
+
|
|
39
|
+
The package ships no default rules and stores nothing. The app keeps the rules
|
|
40
|
+
— in memory, `localStorage`, a server — and passes them in with the functions
|
|
41
|
+
that change them:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { RuleList, type DfmRules } from '@toolpath/dfm'
|
|
45
|
+
import { checkPart, dfmFeatures } from '@toolpath/dfm/model'
|
|
46
|
+
|
|
47
|
+
const rules: DfmRules = { rules, add, update, remove, replace }
|
|
48
|
+
|
|
49
|
+
// From a part analysis: the Engine's report, and each feature's datasheet.
|
|
50
|
+
const features = dfmFeatures(report.features)
|
|
51
|
+
const check = checkPart(features, { sheets, datasheets, regionAreas }, rules.rules)
|
|
52
|
+
|
|
53
|
+
<RuleList
|
|
54
|
+
rules={rules}
|
|
55
|
+
check={check} // null while the part is still being analysed
|
|
56
|
+
features={features}
|
|
57
|
+
sheets={sheets}
|
|
58
|
+
units="mm"
|
|
59
|
+
selected={selectedTag}
|
|
60
|
+
selectedGroup={selectedGroup}
|
|
61
|
+
onInspect={(tag, group) => inspect(tag, group)}
|
|
62
|
+
onHover={(hovered) => highlight(hovered)}
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`sheets` is each feature's measurements, built with `featureSheet` from its
|
|
67
|
+
datasheet; `datasheets` is the datasheets as the API sent them, both by
|
|
68
|
+
lower-cased feature tag; `regionAreas` is each face's area by region index.
|
|
69
|
+
|
|
70
|
+
Put `ruleListKeys` on the panel that holds the list, so the arrow keys walk the
|
|
71
|
+
rules from anywhere in it.
|
|
72
|
+
|
|
73
|
+
## Reach chart
|
|
74
|
+
|
|
75
|
+
`ReachChart` draws a feature's reach curve: the section through the part at the
|
|
76
|
+
feature's wall, to scale. The feature is on the left, in blue; the walls step up
|
|
77
|
+
on the right, with their heights and their distances from the feature written
|
|
78
|
+
on. Pointing at the walls reads the curve at that distance.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { ReachChart, ReachDrawing } from '@toolpath/dfm'
|
|
82
|
+
import { featureProfile, readReachCurve } from '@toolpath/dfm/model'
|
|
83
|
+
|
|
84
|
+
const curve = readReachCurve(datasheet) // null where the feature has none
|
|
85
|
+
const feature = featureProfile(sheets[tag], featureType)
|
|
86
|
+
|
|
87
|
+
export const Reach = () =>
|
|
88
|
+
curve ? <ReachChart curve={curve} units="mm" feature={feature} /> : null
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`ReachChart` is as wide as its container. `ReachDrawing` is the same section
|
|
92
|
+
with a caption and a note on how to read it, for a larger window of its own.
|
|
93
|
+
Both stop drawing the curve half an inch past where the walls reach full
|
|
94
|
+
height; `ReachDrawing` says so in its note.
|
|
95
|
+
|
|
96
|
+
This is not the clearance overlay in `@toolpath/tool-drawing/clearance`: that
|
|
97
|
+
draws the walls beside a cutting tool, to show whether the tool fits. This
|
|
98
|
+
draws the walls alone.
|
package/dfm.css
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Lets the app's Tailwind see the classes the rule list uses. Import it after
|
|
3
|
+
* Tailwind and `@toolpath/ui/theme.css`, whose colours the list is drawn in:
|
|
4
|
+
*
|
|
5
|
+
* @import 'tailwindcss';
|
|
6
|
+
* @import '@toolpath/ui/theme.css';
|
|
7
|
+
* @import '@toolpath/dfm/dfm.css';
|
|
8
|
+
*/
|
|
9
|
+
@source './dist';
|