@toolpath/dfm 0.0.0-stage → 0.2.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 +213 -2
- package/dfm.css +10 -0
- package/dist/chunk-5MPHT7BC.js +1599 -0
- package/dist/feature-record-BUoFFjN6.d.ts +503 -0
- package/dist/index.d.ts +368 -0
- package/dist/index.js +2486 -0
- package/dist/model/index.d.ts +128 -0
- package/dist/model/index.js +1047 -0
- package/package.json +72 -3
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { e as DfmHit, U as Units, f as FeaturePinch, g as FeatureSheet, D as DfmRule } from '../feature-record-BUoFFjN6.js';
|
|
2
|
+
export { B as BrokenRule, C as CRITICAL_COLOR, h as ClearanceFit, a as DfmCheck, b as DfmFeature, i as DfmMetric, j as DfmOp, k as DfmQuantity, l as DfmSources, m as FactsKind, n as FeatureAcross, c as FeatureProfile, d as FeatureRecord, F as FeatureSheets, o as FeatureThreading, M as Measurement, P as PINCH_TOOL_MM, p as PinchDisc, q as RULE_COLORS, r as RangeHigh, s as RangeLow, R as ReachCurve, t as ReportFeature, u as RuleResult, S as SurfaceToolKind, W as WARNING_COLOR, v as brokenRules, w as checkPart, x as compareColors, y as describeRule, z as dfmFeatures, A as featureColor, E as featureMeasurements, G as featureProfile, H as featureSheet, I as featureTypeLabel, J as isNoReading, K as isSurfaceType, L as makeRule, N as maxBallDiameter, O as parseRules, Q as peakHeight, T as readPinch, V as readReachCurve, X as runStart, Y as trimmedCurve, Z as withSurroundedFaces } from '../feature-record-BUoFFjN6.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
|
+
/** Whether two depths are one depth, as the quoting app counts them: within a twentieth, or a hundredth of a mm. */
|
|
8
|
+
declare const sameDepth: (a: number, b: number) => boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A feature's pinch discs as the widest tool that fits stands in them: the
|
|
12
|
+
* datasheet's discs a tool can stand in, in its tool frame, mm, with how deep
|
|
13
|
+
* the feature runs and the corner the tool has.
|
|
14
|
+
*/
|
|
15
|
+
interface PinchMark extends FeaturePinch {
|
|
16
|
+
/**
|
|
17
|
+
* The radius on the tool's corner, mm: a filleted pocket's floor fillet,
|
|
18
|
+
* which a bull nose of that radius cuts. Absent for a flat-bottomed tool.
|
|
19
|
+
*/
|
|
20
|
+
readonly corner?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The pinch discs worth drawing a tool in: none for a feature with no discs,
|
|
24
|
+
* only a sharp corner's (no tool at all), or tools wider than
|
|
25
|
+
* {@link MAX_DRAWN_TOOL_MM}. A walled feature's floor fillet rounds the tool's
|
|
26
|
+
* corner; a surface's fillet radius is its own shape, and does not.
|
|
27
|
+
*/
|
|
28
|
+
declare const pinchMark: (datasheet: unknown, sheet: FeatureSheet | undefined, featureType: string) => PinchMark | null;
|
|
29
|
+
/**
|
|
30
|
+
* What a pinch mark's tool is labelled: its diameter at the tightest disc —
|
|
31
|
+
* "≤" where the clearance was measured at one tolerance only — and, quieter,
|
|
32
|
+
* the kind of tool and how many places are that tight.
|
|
33
|
+
*/
|
|
34
|
+
declare const pinchLabel: (mark: PinchMark, units: Units) => {
|
|
35
|
+
label: string;
|
|
36
|
+
note: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** A direction or a point. */
|
|
40
|
+
interface Vec3 {
|
|
41
|
+
readonly x: number;
|
|
42
|
+
readonly y: number;
|
|
43
|
+
readonly z: number;
|
|
44
|
+
}
|
|
45
|
+
/** A feature's faces as triangles: nine numbers each for the corners, three for the outward normal. */
|
|
46
|
+
interface FaceTriangles {
|
|
47
|
+
readonly positions: ArrayLike<number>;
|
|
48
|
+
readonly normals: ArrayLike<number>;
|
|
49
|
+
}
|
|
50
|
+
/** The widest tool a feature admits, placed on the part: what to draw, in the drawn coordinates. */
|
|
51
|
+
interface PlacedTool {
|
|
52
|
+
/** The centre of the tool's bottom, on the feature's floor. */
|
|
53
|
+
readonly base: Vec3;
|
|
54
|
+
/** Up the tool. */
|
|
55
|
+
readonly axis: Vec3;
|
|
56
|
+
readonly diameter: number;
|
|
57
|
+
readonly height: number;
|
|
58
|
+
/** The radius on its corner: a filleted floor's, no more than the tool's own radius. */
|
|
59
|
+
readonly cornerRadius: number;
|
|
60
|
+
/** Across the tool, toward where it touches the wall. */
|
|
61
|
+
readonly across: Vec3;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The widest tool a feature admits, standing on its tightest pinch disc, ready
|
|
65
|
+
* to draw: the datasheet's frame found against the feature's faces, the disc
|
|
66
|
+
* placed in it, and the tool turned toward the wall that pinches it.
|
|
67
|
+
*
|
|
68
|
+
* `origin` is where the CAD file's own zero sits in the coordinates the part
|
|
69
|
+
* is drawn in — moved by whatever centred it — since a datasheet is in the
|
|
70
|
+
* file's coordinates and the triangles and the answer are in the drawn ones.
|
|
71
|
+
* Null for a feature with no faces or no discs.
|
|
72
|
+
*/
|
|
73
|
+
declare const placePinchTool: (mark: PinchMark, triangles: FaceTriangles, direction: Vec3, origin?: Vec3) => PlacedTool | null;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A set of DFM rules as a file: what Export writes, Import reads, and what
|
|
77
|
+
* an LLM is asked to produce. One JSON object, so a shop can keep a set per
|
|
78
|
+
* customer or material, send one to a colleague, or have one written for
|
|
79
|
+
* them from a conversation.
|
|
80
|
+
*
|
|
81
|
+
* Values are canonical, as the rules are stored: millimetres, square
|
|
82
|
+
* millimetres, degrees, plain ratios. A file says so in `units`, so a reader
|
|
83
|
+
* is never left guessing, and so a later version can accept inches.
|
|
84
|
+
*/
|
|
85
|
+
interface RuleSetFile {
|
|
86
|
+
/** What this file is. Always `toolpath-dfm-rules`. */
|
|
87
|
+
kind: typeof FILE_KIND;
|
|
88
|
+
/** The file format's version, for a later reader. */
|
|
89
|
+
version: 1;
|
|
90
|
+
/** What the set is for: "Aluminium prototypes", "Acme Corp sheet work". */
|
|
91
|
+
name?: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
/** The unit every length in `rules` is in. Only millimetres are written or read today. */
|
|
94
|
+
units: 'mm';
|
|
95
|
+
rules: DfmRule[];
|
|
96
|
+
}
|
|
97
|
+
declare const FILE_KIND = "toolpath-dfm-rules";
|
|
98
|
+
/** The rules as a file, pretty-printed. */
|
|
99
|
+
declare const serializeRuleSet: (rules: readonly DfmRule[], meta?: {
|
|
100
|
+
name?: string;
|
|
101
|
+
description?: string;
|
|
102
|
+
}) => string;
|
|
103
|
+
/**
|
|
104
|
+
* The rules in a file, or the reason it cannot be read. Lenient about the
|
|
105
|
+
* wrapper — a bare array of rules is accepted, and so is an object with a
|
|
106
|
+
* `rules` list and nothing else, since an LLM may well hand back either —
|
|
107
|
+
* strict about every rule, which `parseRules` checks field by field. Rules
|
|
108
|
+
* without an id, or whose ids collide, are given fresh ones. A file that says
|
|
109
|
+
* its lengths are in anything but millimetres is refused rather than read as
|
|
110
|
+
* millimetres; one that does not say is read as millimetres.
|
|
111
|
+
*/
|
|
112
|
+
declare const parseRuleSetFile: (text: string) => {
|
|
113
|
+
rules: DfmRule[];
|
|
114
|
+
skipped: number;
|
|
115
|
+
name?: string;
|
|
116
|
+
} | {
|
|
117
|
+
error: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* A prompt that lets any LLM interview a user and write a rule set this
|
|
121
|
+
* viewer reads. Built from the metric and subject tables themselves, so it
|
|
122
|
+
* never drifts from what the parser accepts: every subject value, every
|
|
123
|
+
* metric key with its unit and meaning and the kinds of feature that report
|
|
124
|
+
* it, every comparison, and the palette.
|
|
125
|
+
*/
|
|
126
|
+
declare const llmRulePrompt: (current?: readonly DfmRule[]) => string;
|
|
127
|
+
|
|
128
|
+
export { DfmHit, DfmRule, FILE_KIND, type FaceTriangles, FeaturePinch, FeatureSheet, type PinchMark, type PlacedTool, type RuleSetFile, Units, type Vec3, hitFigure, llmRulePrompt, parseRuleSetFile, pinchLabel, pinchMark, placePinchTool, sameDepth, serializeRuleSet };
|