@faicad/sheetmetal 0.16.1 → 0.17.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/dist/allowanceFns.d.ts +1 -1
- package/dist/allowanceFns.d.ts.map +1 -1
- package/dist/allowanceFns.js +1 -1
- package/dist/allowanceFns.js.map +1 -1
- package/dist/api.d.ts +21 -20
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +20 -20
- package/dist/api.js.map +1 -1
- package/dist/authorFns.d.ts +2 -2
- package/dist/authorFns.d.ts.map +1 -1
- package/dist/authorFns.js +61 -51
- package/dist/authorFns.js.map +1 -1
- package/dist/bendTableFns.d.ts +1 -1
- package/dist/bendTableFns.d.ts.map +1 -1
- package/dist/bendTableFns.js +1 -1
- package/dist/bendTableFns.js.map +1 -1
- package/dist/contourFlangeFns.d.ts +5 -4
- package/dist/contourFlangeFns.d.ts.map +1 -1
- package/dist/contourFlangeFns.js +59 -44
- package/dist/contourFlangeFns.js.map +1 -1
- package/dist/cutoutFns.d.ts +5 -5
- package/dist/cutoutFns.d.ts.map +1 -1
- package/dist/cutoutFns.js +22 -14
- package/dist/cutoutFns.js.map +1 -1
- package/dist/dxfFns.d.ts +1 -1
- package/dist/dxfFns.d.ts.map +1 -1
- package/dist/dxfFns.js +1 -1
- package/dist/dxfFns.js.map +1 -1
- package/dist/facade.d.ts +43 -42
- package/dist/facade.d.ts.map +1 -1
- package/dist/facade.js +83 -83
- package/dist/facade.js.map +1 -1
- package/dist/featureTreeFns.d.ts +1 -1
- package/dist/featureTreeFns.d.ts.map +1 -1
- package/dist/featureTreeFns.js +1 -1
- package/dist/featureTreeFns.js.map +1 -1
- package/dist/foldFns.d.ts +3 -3
- package/dist/foldFns.d.ts.map +1 -1
- package/dist/foldFns.js +12 -12
- package/dist/foldFns.js.map +1 -1
- package/dist/foreignUnfoldFns.d.ts +2 -1
- package/dist/foreignUnfoldFns.d.ts.map +1 -1
- package/dist/foreignUnfoldFns.js +21 -10
- package/dist/foreignUnfoldFns.js.map +1 -1
- package/dist/formFns.d.ts +4 -4
- package/dist/formFns.d.ts.map +1 -1
- package/dist/formFns.js +91 -76
- package/dist/formFns.js.map +1 -1
- package/dist/geometryOps.d.ts +32 -0
- package/dist/geometryOps.d.ts.map +1 -0
- package/dist/geometryOps.js +83 -0
- package/dist/geometryOps.js.map +1 -0
- package/dist/hemFns.d.ts +2 -2
- package/dist/hemFns.d.ts.map +1 -1
- package/dist/hemFns.js +4 -4
- package/dist/hemFns.js.map +1 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/jogFns.d.ts +2 -2
- package/dist/jogFns.d.ts.map +1 -1
- package/dist/jogFns.js +6 -6
- package/dist/jogFns.js.map +1 -1
- package/dist/loftedFlangeFns.d.ts +2 -2
- package/dist/loftedFlangeFns.d.ts.map +1 -1
- package/dist/loftedFlangeFns.js +35 -25
- package/dist/loftedFlangeFns.js.map +1 -1
- package/dist/miterFns.d.ts +3 -3
- package/dist/miterFns.d.ts.map +1 -1
- package/dist/miterFns.js +30 -19
- package/dist/miterFns.js.map +1 -1
- package/dist/nestFns.d.ts +1 -1
- package/dist/nestFns.d.ts.map +1 -1
- package/dist/nestFns.js +1 -1
- package/dist/nestFns.js.map +1 -1
- package/dist/polygonFns.d.ts +2 -2
- package/dist/polygonFns.d.ts.map +1 -1
- package/dist/polygonFns.js +1 -1
- package/dist/polygonFns.js.map +1 -1
- package/dist/reliefFns.d.ts +4 -4
- package/dist/reliefFns.d.ts.map +1 -1
- package/dist/reliefFns.js +39 -31
- package/dist/reliefFns.js.map +1 -1
- package/dist/reportFns.d.ts +1 -1
- package/dist/reportFns.d.ts.map +1 -1
- package/dist/reportFns.js +1 -1
- package/dist/reportFns.js.map +1 -1
- package/dist/tabFns.d.ts +3 -3
- package/dist/tabFns.d.ts.map +1 -1
- package/dist/tabFns.js +21 -13
- package/dist/tabFns.js.map +1 -1
- package/dist/types.d.ts +21 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/unfoldFns.d.ts +1 -1
- package/dist/unfoldFns.d.ts.map +1 -1
- package/dist/unfoldFns.js +2 -2
- package/dist/unfoldFns.js.map +1 -1
- package/dist/validateFns.d.ts.map +1 -1
- package/dist/validateFns.js +4 -6
- package/dist/validateFns.js.map +1 -1
- package/package.json +2 -2
package/dist/facade.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* chain stays terminal-free. Use the `Result`-returning functions in `./api.js`
|
|
10
10
|
* directly when explicit error handling is preferred over throwing.
|
|
11
11
|
*/
|
|
12
|
-
import { isErr } from '@faicad/faijs/
|
|
12
|
+
import { isErr } from '@faicad/faijs/api';
|
|
13
13
|
import { author, unfold, unfoldSolid, fold, miter, miterCorner, bendRelief, autoReliefs, relieveCorner, addCutout, addHole, addSlot, addPolygonCutout, addTab, tabAndSlot, louver, emboss, contourFlange, loftedFlange, hem, jog, toDXF, report, validate, } from './api.js';
|
|
14
14
|
/** Thrown by the fluent facade when an underlying `Result<T>` is an `Err`. */
|
|
15
15
|
export class SheetMetalError extends Error {
|
|
@@ -43,8 +43,8 @@ class SheetMetalPartHandle {
|
|
|
43
43
|
* @param plane - the oriented cutting plane; material on the plane's `+normal` side is removed.
|
|
44
44
|
* @returns a new `SheetMetalPartHandle` carrying the mitered part.
|
|
45
45
|
*/
|
|
46
|
-
miter(plane) {
|
|
47
|
-
return new SheetMetalPartHandle(unwrapOrThrow(miter(this.part, plane)));
|
|
46
|
+
async miter(plane) {
|
|
47
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await miter(this.part, plane)));
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Auto-miter the shared corner of two flanges with an optional gap.
|
|
@@ -53,8 +53,8 @@ class SheetMetalPartHandle {
|
|
|
53
53
|
* @param gap - optional gap (in millimetres) left between the two mitered edges; defaults to 0.
|
|
54
54
|
* @returns a new `SheetMetalPartHandle` carrying the part with the corner mitered.
|
|
55
55
|
*/
|
|
56
|
-
miterCorner(flangeIdA, flangeIdB, gap = 0) {
|
|
57
|
-
return new SheetMetalPartHandle(unwrapOrThrow(miterCorner(this.part, flangeIdA, flangeIdB, gap)));
|
|
56
|
+
async miterCorner(flangeIdA, flangeIdB, gap = 0) {
|
|
57
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await miterCorner(this.part, flangeIdA, flangeIdB, gap)));
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Add a bend relief at each mid-edge end of a partial flange's bend line.
|
|
@@ -62,16 +62,16 @@ class SheetMetalPartHandle {
|
|
|
62
62
|
* @param spec - optional relief specification overriding the defaults.
|
|
63
63
|
* @returns a new `SheetMetalPartHandle` carrying the part with the relief added.
|
|
64
64
|
*/
|
|
65
|
-
bendRelief(flangeId, spec) {
|
|
66
|
-
return new SheetMetalPartHandle(unwrapOrThrow(bendRelief(this.part, flangeId, spec)));
|
|
65
|
+
async bendRelief(flangeId, spec) {
|
|
66
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await bendRelief(this.part, flangeId, spec)));
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Add a bend relief to every partial-span bend in the part.
|
|
70
70
|
* @param spec - optional relief specification applied to every partial bend.
|
|
71
71
|
* @returns a new `SheetMetalPartHandle` carrying the part with all reliefs added.
|
|
72
72
|
*/
|
|
73
|
-
autoReliefs(spec) {
|
|
74
|
-
return new SheetMetalPartHandle(unwrapOrThrow(autoReliefs(this.part, spec)));
|
|
73
|
+
async autoReliefs(spec) {
|
|
74
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await autoReliefs(this.part, spec)));
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Cut a corner relief notch at the shared corner of two adjacent flanges.
|
|
@@ -80,16 +80,16 @@ class SheetMetalPartHandle {
|
|
|
80
80
|
* @param spec - optional relief specification overriding the defaults.
|
|
81
81
|
* @returns a new `SheetMetalPartHandle` carrying the part with the corner relief added.
|
|
82
82
|
*/
|
|
83
|
-
cornerRelief(flangeIdA, flangeIdB, spec) {
|
|
84
|
-
return new SheetMetalPartHandle(unwrapOrThrow(relieveCorner(this.part, flangeIdA, flangeIdB, spec)));
|
|
83
|
+
async cornerRelief(flangeIdA, flangeIdB, spec) {
|
|
84
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await relieveCorner(this.part, flangeIdA, flangeIdB, spec)));
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* Punch a cutout (hole / slot / polygon) through a named flat region.
|
|
88
88
|
* @param spec - the cutout definition (kind, geometry, and target region).
|
|
89
89
|
* @returns a new `SheetMetalPartHandle` carrying the part with the cutout punched.
|
|
90
90
|
*/
|
|
91
|
-
cutout(spec) {
|
|
92
|
-
return new SheetMetalPartHandle(unwrapOrThrow(addCutout(this.part, spec)));
|
|
91
|
+
async cutout(spec) {
|
|
92
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await addCutout(this.part, spec)));
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Punch a circular hole of `diameter` centred at region-local `(x, y)`.
|
|
@@ -99,8 +99,8 @@ class SheetMetalPartHandle {
|
|
|
99
99
|
* @param diameter - hole diameter.
|
|
100
100
|
* @returns a new `SheetMetalPartHandle` carrying the part with the hole punched.
|
|
101
101
|
*/
|
|
102
|
-
hole(region, x, y, diameter) {
|
|
103
|
-
return new SheetMetalPartHandle(unwrapOrThrow(addHole(this.part, region, x, y, diameter)));
|
|
102
|
+
async hole(region, x, y, diameter) {
|
|
103
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await addHole(this.part, region, x, y, diameter)));
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Punch a slot (rectangular or obround) centred at region-local `(x, y)`.
|
|
@@ -108,8 +108,8 @@ class SheetMetalPartHandle {
|
|
|
108
108
|
* @param opts - slot geometry: centre `(x, y)`, `length`, `width`, optional `angleDeg` rotation, and `round` ends flag.
|
|
109
109
|
* @returns a new `SheetMetalPartHandle` carrying the part with the slot punched.
|
|
110
110
|
*/
|
|
111
|
-
slot(region, opts) {
|
|
112
|
-
return new SheetMetalPartHandle(unwrapOrThrow(addSlot(this.part, region, opts)));
|
|
111
|
+
async slot(region, opts) {
|
|
112
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await addSlot(this.part, region, opts)));
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Punch an arbitrary polygon cutout from its region-local `points`.
|
|
@@ -117,16 +117,16 @@ class SheetMetalPartHandle {
|
|
|
117
117
|
* @param points - region-local polygon vertices as `[x, y]` pairs.
|
|
118
118
|
* @returns a new `SheetMetalPartHandle` carrying the part with the polygon cutout.
|
|
119
119
|
*/
|
|
120
|
-
polygonCutout(region, points) {
|
|
121
|
-
return new SheetMetalPartHandle(unwrapOrThrow(addPolygonCutout(this.part, region, points)));
|
|
120
|
+
async polygonCutout(region, points) {
|
|
121
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await addPolygonCutout(this.part, region, points)));
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Fuse a rectangular tab (additive protrusion) onto a region's edge.
|
|
125
125
|
* @param spec - tab definition: edge, width, and length.
|
|
126
126
|
* @returns a new `SheetMetalPartHandle` carrying the part with the tab added.
|
|
127
127
|
*/
|
|
128
|
-
tab(spec) {
|
|
129
|
-
return new SheetMetalPartHandle(unwrapOrThrow(addTab(this.part, spec)));
|
|
128
|
+
async tab(spec) {
|
|
129
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await addTab(this.part, spec)));
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Self-fixturing tab-and-slot joint: a tab on one region + a matching slot on another.
|
|
@@ -134,56 +134,56 @@ class SheetMetalPartHandle {
|
|
|
134
134
|
* @param slot - placement of the matching slot on the second region.
|
|
135
135
|
* @returns a new `SheetMetalPartHandle` carrying the part with the joint added.
|
|
136
136
|
*/
|
|
137
|
-
tabAndSlot(tab, slot) {
|
|
138
|
-
return new SheetMetalPartHandle(unwrapOrThrow(tabAndSlot(this.part, tab, slot)));
|
|
137
|
+
async tabAndSlot(tab, slot) {
|
|
138
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await tabAndSlot(this.part, tab, slot)));
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Form a louver (vent flap) on a region.
|
|
142
142
|
* @param opts - louver geometry: target `region`, centre `(x, y)`, `length`, `width`, `height`, and optional `direction`.
|
|
143
143
|
* @returns a new `SheetMetalPartHandle` carrying the part with the louver formed.
|
|
144
144
|
*/
|
|
145
|
-
louver(opts) {
|
|
146
|
-
return new SheetMetalPartHandle(unwrapOrThrow(louver(this.part, opts)));
|
|
145
|
+
async louver(opts) {
|
|
146
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await louver(this.part, opts)));
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* Form a round emboss (raised) or dimple (recessed) on a region.
|
|
150
150
|
* @param opts - emboss geometry: target `region`, centre `(x, y)`, `diameter`, `height`, and `kind` (`dimple` or `emboss`).
|
|
151
151
|
* @returns a new `SheetMetalPartHandle` carrying the part with the form added.
|
|
152
152
|
*/
|
|
153
|
-
emboss(opts) {
|
|
154
|
-
return new SheetMetalPartHandle(unwrapOrThrow(emboss(this.part, opts)));
|
|
153
|
+
async emboss(opts) {
|
|
154
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await emboss(this.part, opts)));
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* Author a contour flange (open line/arc profile swept along a base edge).
|
|
158
158
|
* @param spec - contour flange definition: profile, base edge, and bend parameters.
|
|
159
159
|
* @returns a new `SheetMetalPartHandle` carrying the part with the contour flange added.
|
|
160
160
|
*/
|
|
161
|
-
contourFlange(spec) {
|
|
162
|
-
return new SheetMetalPartHandle(unwrapOrThrow(contourFlange(this.part, spec)));
|
|
161
|
+
async contourFlange(spec) {
|
|
162
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await contourFlange(this.part, spec)));
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* Author a lofted / ruled transition flange between two parallel open profiles.
|
|
166
166
|
* @param spec - lofted flange definition: the two open profiles and their alignment.
|
|
167
167
|
* @returns a new `SheetMetalPartHandle` carrying the part with the lofted flange added.
|
|
168
168
|
*/
|
|
169
|
-
loftedFlange(spec) {
|
|
170
|
-
return new SheetMetalPartHandle(unwrapOrThrow(loftedFlange(this.part, spec)));
|
|
169
|
+
async loftedFlange(spec) {
|
|
170
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await loftedFlange(this.part, spec)));
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Fold a region edge back ~180°+ onto its parent as a hem (closed/open/teardrop/rolled).
|
|
174
174
|
* @param spec - hem definition: edge, curl radius, and return leg length.
|
|
175
175
|
* @returns a new `SheetMetalPartHandle` carrying the part with the hem added.
|
|
176
176
|
*/
|
|
177
|
-
hem(spec) {
|
|
178
|
-
return new SheetMetalPartHandle(unwrapOrThrow(hem(this.part, spec)));
|
|
177
|
+
async hem(spec) {
|
|
178
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await hem(this.part, spec)));
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Step a region's flat by `offsetHeight` with two opposite bends (a jog/joggle).
|
|
182
182
|
* @param spec - jog definition: bend line, offset height, and radii.
|
|
183
183
|
* @returns a new `SheetMetalPartHandle` carrying the part with the jog added.
|
|
184
184
|
*/
|
|
185
|
-
jog(spec) {
|
|
186
|
-
return new SheetMetalPartHandle(unwrapOrThrow(jog(this.part, spec)));
|
|
185
|
+
async jog(spec) {
|
|
186
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await jog(this.part, spec)));
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Flatten into a developed flat pattern + bend report + warnings.
|
|
@@ -308,8 +308,8 @@ class SheetMetalBuilder {
|
|
|
308
308
|
* `report()`) authors the solid only once.
|
|
309
309
|
* @returns a `SheetMetalPartHandle` for the folded part, memoized across calls.
|
|
310
310
|
*/
|
|
311
|
-
build() {
|
|
312
|
-
this.built ??= new SheetMetalPartHandle(unwrapOrThrow(author(this.spec)));
|
|
311
|
+
async build() {
|
|
312
|
+
this.built ??= new SheetMetalPartHandle(unwrapOrThrow(await author(this.spec)));
|
|
313
313
|
return this.built;
|
|
314
314
|
}
|
|
315
315
|
// ----- part-consuming shortcuts (build then delegate) -----
|
|
@@ -318,8 +318,8 @@ class SheetMetalBuilder {
|
|
|
318
318
|
* @param plane - the oriented cutting plane; material on the plane's `+normal` side is removed.
|
|
319
319
|
* @returns a `SheetMetalPartHandle` carrying the mitered part.
|
|
320
320
|
*/
|
|
321
|
-
miter(plane) {
|
|
322
|
-
return this.build().miter(plane);
|
|
321
|
+
async miter(plane) {
|
|
322
|
+
return (await this.build()).miter(plane);
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
325
|
* Build the part and auto-miter the shared corner of two flanges with an optional gap.
|
|
@@ -328,8 +328,8 @@ class SheetMetalBuilder {
|
|
|
328
328
|
* @param gap - optional gap (in millimetres) left between the two mitered edges; defaults to 0.
|
|
329
329
|
* @returns a `SheetMetalPartHandle` carrying the part with the corner mitered.
|
|
330
330
|
*/
|
|
331
|
-
miterCorner(flangeIdA, flangeIdB, gap = 0) {
|
|
332
|
-
return this.build().miterCorner(flangeIdA, flangeIdB, gap);
|
|
331
|
+
async miterCorner(flangeIdA, flangeIdB, gap = 0) {
|
|
332
|
+
return (await this.build()).miterCorner(flangeIdA, flangeIdB, gap);
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
335
|
* Build the part and add a bend relief at each mid-edge end of a partial flange's bend line.
|
|
@@ -337,16 +337,16 @@ class SheetMetalBuilder {
|
|
|
337
337
|
* @param spec - optional relief specification overriding the defaults.
|
|
338
338
|
* @returns a `SheetMetalPartHandle` carrying the part with the relief added.
|
|
339
339
|
*/
|
|
340
|
-
bendRelief(flangeId, spec) {
|
|
341
|
-
return this.build().bendRelief(flangeId, spec);
|
|
340
|
+
async bendRelief(flangeId, spec) {
|
|
341
|
+
return (await this.build()).bendRelief(flangeId, spec);
|
|
342
342
|
}
|
|
343
343
|
/**
|
|
344
344
|
* Build the part and add a bend relief to every partial-span bend.
|
|
345
345
|
* @param spec - optional relief specification applied to every partial bend.
|
|
346
346
|
* @returns a `SheetMetalPartHandle` carrying the part with all reliefs added.
|
|
347
347
|
*/
|
|
348
|
-
autoReliefs(spec) {
|
|
349
|
-
return this.build().autoReliefs(spec);
|
|
348
|
+
async autoReliefs(spec) {
|
|
349
|
+
return (await this.build()).autoReliefs(spec);
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
352
|
* Build the part and cut a corner relief notch at the shared corner of two adjacent flanges.
|
|
@@ -355,16 +355,16 @@ class SheetMetalBuilder {
|
|
|
355
355
|
* @param spec - optional relief specification overriding the defaults.
|
|
356
356
|
* @returns a `SheetMetalPartHandle` carrying the part with the corner relief added.
|
|
357
357
|
*/
|
|
358
|
-
cornerRelief(flangeIdA, flangeIdB, spec) {
|
|
359
|
-
return this.build().cornerRelief(flangeIdA, flangeIdB, spec);
|
|
358
|
+
async cornerRelief(flangeIdA, flangeIdB, spec) {
|
|
359
|
+
return (await this.build()).cornerRelief(flangeIdA, flangeIdB, spec);
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
362
362
|
* Build the part and punch a cutout (hole / slot / polygon) through a named flat region.
|
|
363
363
|
* @param spec - the cutout definition (kind, geometry, and target region).
|
|
364
364
|
* @returns a `SheetMetalPartHandle` carrying the part with the cutout punched.
|
|
365
365
|
*/
|
|
366
|
-
cutout(spec) {
|
|
367
|
-
return this.build().cutout(spec);
|
|
366
|
+
async cutout(spec) {
|
|
367
|
+
return (await this.build()).cutout(spec);
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
370
|
* Build the part and punch a circular hole of `diameter` centred at region-local `(x, y)`.
|
|
@@ -374,8 +374,8 @@ class SheetMetalBuilder {
|
|
|
374
374
|
* @param diameter - hole diameter.
|
|
375
375
|
* @returns a `SheetMetalPartHandle` carrying the part with the hole punched.
|
|
376
376
|
*/
|
|
377
|
-
hole(region, x, y, diameter) {
|
|
378
|
-
return this.build().hole(region, x, y, diameter);
|
|
377
|
+
async hole(region, x, y, diameter) {
|
|
378
|
+
return (await this.build()).hole(region, x, y, diameter);
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* Build the part and punch a slot (rectangular or obround) centred at region-local `(x, y)`.
|
|
@@ -383,8 +383,8 @@ class SheetMetalBuilder {
|
|
|
383
383
|
* @param opts - slot geometry: centre `(x, y)`, `length`, `width`, optional `angleDeg` rotation, and `round` ends flag.
|
|
384
384
|
* @returns a `SheetMetalPartHandle` carrying the part with the slot punched.
|
|
385
385
|
*/
|
|
386
|
-
slot(region, opts) {
|
|
387
|
-
return this.build().slot(region, opts);
|
|
386
|
+
async slot(region, opts) {
|
|
387
|
+
return (await this.build()).slot(region, opts);
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
390
390
|
* Build the part and punch an arbitrary polygon cutout from its region-local `points`.
|
|
@@ -392,16 +392,16 @@ class SheetMetalBuilder {
|
|
|
392
392
|
* @param points - region-local polygon vertices as `[x, y]` pairs.
|
|
393
393
|
* @returns a `SheetMetalPartHandle` carrying the part with the polygon cutout.
|
|
394
394
|
*/
|
|
395
|
-
polygonCutout(region, points) {
|
|
396
|
-
return this.build().polygonCutout(region, points);
|
|
395
|
+
async polygonCutout(region, points) {
|
|
396
|
+
return (await this.build()).polygonCutout(region, points);
|
|
397
397
|
}
|
|
398
398
|
/**
|
|
399
399
|
* Build the part and fuse a rectangular tab (additive protrusion) onto a region's edge.
|
|
400
400
|
* @param spec - tab definition: edge, width, and length.
|
|
401
401
|
* @returns a `SheetMetalPartHandle` carrying the part with the tab added.
|
|
402
402
|
*/
|
|
403
|
-
tab(spec) {
|
|
404
|
-
return this.build().tab(spec);
|
|
403
|
+
async tab(spec) {
|
|
404
|
+
return (await this.build()).tab(spec);
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
407
407
|
* Build the part and add a self-fixturing tab-and-slot joint across two regions.
|
|
@@ -409,92 +409,92 @@ class SheetMetalBuilder {
|
|
|
409
409
|
* @param slot - placement of the matching slot on the second region.
|
|
410
410
|
* @returns a `SheetMetalPartHandle` carrying the part with the joint added.
|
|
411
411
|
*/
|
|
412
|
-
tabAndSlot(tab, slot) {
|
|
413
|
-
return this.build().tabAndSlot(tab, slot);
|
|
412
|
+
async tabAndSlot(tab, slot) {
|
|
413
|
+
return (await this.build()).tabAndSlot(tab, slot);
|
|
414
414
|
}
|
|
415
415
|
/**
|
|
416
416
|
* Build the part and form a louver (vent flap) on a region.
|
|
417
417
|
* @param opts - louver geometry: target `region`, centre `(x, y)`, `length`, `width`, `height`, and optional `direction`.
|
|
418
418
|
* @returns a `SheetMetalPartHandle` carrying the part with the louver formed.
|
|
419
419
|
*/
|
|
420
|
-
louver(opts) {
|
|
421
|
-
return this.build().louver(opts);
|
|
420
|
+
async louver(opts) {
|
|
421
|
+
return (await this.build()).louver(opts);
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
424
424
|
* Build the part and form a round emboss (raised) or dimple (recessed) on a region.
|
|
425
425
|
* @param opts - emboss geometry: target `region`, centre `(x, y)`, `diameter`, `height`, and `kind` (`dimple` or `emboss`).
|
|
426
426
|
* @returns a `SheetMetalPartHandle` carrying the part with the form added.
|
|
427
427
|
*/
|
|
428
|
-
emboss(opts) {
|
|
429
|
-
return this.build().emboss(opts);
|
|
428
|
+
async emboss(opts) {
|
|
429
|
+
return (await this.build()).emboss(opts);
|
|
430
430
|
}
|
|
431
431
|
/**
|
|
432
432
|
* Build the part and author a contour flange (open line/arc profile swept along a base edge).
|
|
433
433
|
* @param spec - contour flange definition: profile, base edge, and bend parameters.
|
|
434
434
|
* @returns a `SheetMetalPartHandle` carrying the part with the contour flange added.
|
|
435
435
|
*/
|
|
436
|
-
contourFlange(spec) {
|
|
437
|
-
return this.build().contourFlange(spec);
|
|
436
|
+
async contourFlange(spec) {
|
|
437
|
+
return (await this.build()).contourFlange(spec);
|
|
438
438
|
}
|
|
439
439
|
/**
|
|
440
440
|
* Build the part and author a lofted / ruled transition flange between two parallel open profiles.
|
|
441
441
|
* @param spec - lofted flange definition: the two open profiles and their alignment.
|
|
442
442
|
* @returns a `SheetMetalPartHandle` carrying the part with the lofted flange added.
|
|
443
443
|
*/
|
|
444
|
-
loftedFlange(spec) {
|
|
445
|
-
return this.build().loftedFlange(spec);
|
|
444
|
+
async loftedFlange(spec) {
|
|
445
|
+
return (await this.build()).loftedFlange(spec);
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
448
|
* Build the part and fold a region edge back ~180°+ onto its parent as a hem.
|
|
449
449
|
* @param spec - hem definition: edge, curl radius, and return leg length.
|
|
450
450
|
* @returns a `SheetMetalPartHandle` carrying the part with the hem added.
|
|
451
451
|
*/
|
|
452
|
-
hem(spec) {
|
|
453
|
-
return this.build().hem(spec);
|
|
452
|
+
async hem(spec) {
|
|
453
|
+
return (await this.build()).hem(spec);
|
|
454
454
|
}
|
|
455
455
|
/**
|
|
456
456
|
* Build the part and step a region's flat by `offsetHeight` with two opposite bends (a jog/joggle).
|
|
457
457
|
* @param spec - jog definition: bend line, offset height, and radii.
|
|
458
458
|
* @returns a `SheetMetalPartHandle` carrying the part with the jog added.
|
|
459
459
|
*/
|
|
460
|
-
jog(spec) {
|
|
461
|
-
return this.build().jog(spec);
|
|
460
|
+
async jog(spec) {
|
|
461
|
+
return (await this.build()).jog(spec);
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
464
|
* Build the part and flatten it into a developed flat pattern + bend report + warnings.
|
|
465
465
|
* @returns the `UnfoldResult` with the flat pattern, bend report, and any warnings.
|
|
466
466
|
*/
|
|
467
|
-
unfold() {
|
|
468
|
-
return this.build().unfold();
|
|
467
|
+
async unfold() {
|
|
468
|
+
return (await this.build()).unfold();
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
* Build the part and produce the bend report from its feature tree.
|
|
472
472
|
* @returns the `BendReport` describing every bend in the part.
|
|
473
473
|
*/
|
|
474
|
-
report() {
|
|
475
|
-
return this.build().report();
|
|
474
|
+
async report() {
|
|
475
|
+
return (await this.build()).report();
|
|
476
476
|
}
|
|
477
477
|
/**
|
|
478
478
|
* Build the part and emit an annotated multi-layer DXF of its developed flat pattern.
|
|
479
479
|
* @param options - optional DXF output options (layers, precision, units).
|
|
480
480
|
* @returns the DXF text of the developed flat pattern.
|
|
481
481
|
*/
|
|
482
|
-
dxf(options) {
|
|
483
|
-
return this.build().dxf(options);
|
|
482
|
+
async dxf(options) {
|
|
483
|
+
return (await this.build()).dxf(options);
|
|
484
484
|
}
|
|
485
485
|
/**
|
|
486
486
|
* Build the part and run manufacturability checks (advisory, never throws).
|
|
487
487
|
* @returns the list of `SheetMetalWarning`s (empty when the part is manufacturable).
|
|
488
488
|
*/
|
|
489
|
-
validate() {
|
|
490
|
-
return this.build().validate();
|
|
489
|
+
async validate() {
|
|
490
|
+
return (await this.build()).validate();
|
|
491
491
|
}
|
|
492
492
|
/**
|
|
493
493
|
* Build the part and return it (escape hatch back to the functional API).
|
|
494
494
|
* @returns the underlying `SheetMetalPart`.
|
|
495
495
|
*/
|
|
496
|
-
get() {
|
|
497
|
-
return this.build().get();
|
|
496
|
+
async get() {
|
|
497
|
+
return (await this.build()).get();
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
/**
|
|
@@ -519,8 +519,8 @@ export function fromPart(part) {
|
|
|
519
519
|
* @param input - the flat pattern (region tree) to fold up.
|
|
520
520
|
* @returns a `SheetMetalPartHandle` carrying the folded part.
|
|
521
521
|
*/
|
|
522
|
-
export function foldFlat(input) {
|
|
523
|
-
return new SheetMetalPartHandle(unwrapOrThrow(fold(input)));
|
|
522
|
+
export async function foldFlat(input) {
|
|
523
|
+
return new SheetMetalPartHandle(unwrapOrThrow(await fold(input)));
|
|
524
524
|
}
|
|
525
525
|
/**
|
|
526
526
|
* Detect and unfold an imported foreign sheet-metal solid (no feature tree).
|
package/dist/facade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGpD,OAAO,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,EACT,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,aAAa,EACb,YAAY,EACZ,GAAG,EACH,GAAG,EACH,KAAK,EACL,MAAM,EACN,QAAQ,GACT,MAAM,UAAU,CAAC;AAkBlB,8EAA8E;AAC9E,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,uEAAuE;IAC9D,IAAI,CAAS;IACtB,+DAA+D;IACtD,IAAI,CAAS;IAEtB,YAAY,SAAoB;QAC9B,KAAK,CACH,SAAS,CAAC,UAAU;YAClB,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,iBAAiB,SAAS,CAAC,UAAU,EAAE;YAC7D,CAAC,CAAC,SAAS,CAAC,OAAO,CACtB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;CACF;AAED,SAAS,aAAa,CAAI,MAAiB;IACzC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAA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AAU,QAAQ,CAAC,KAAgB;IACvC,OAAO,IAAI,oBAAoB,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAY,EAAE,IAA2B;IACjE,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["/**\n * Fluent facade — `sheetMetal(base).flange(...).miter(...).unfold()`.\n *\n * A lightweight immutable builder over the {@link ./api.js} wrappers. Authoring\n * steps (`flange`, `material`) accumulate into a spec; part-consuming steps\n * (`miter`, `miterCorner`, `unfold`, `report`, `dxf`, `validate`, `part`)\n * materialize the folded part once and thread it through, auto-unwrapping the\n * underlying `Result<T>` and throwing {@link SheetMetalError} on failure so the\n * chain stays terminal-free. Use the `Result`-returning functions in `./api.js`\n * directly when explicit error handling is preferred over throwing.\n */\n\nimport type { BrepError, Result, Solid } from '@faicad/faijs/brepjs-compat';\nimport { isErr } from '@faicad/faijs/brepjs-compat';\nimport type { AuthorSpec, BaseFlatSpec, FlangeSpec, SeamSpec } from './authorFns.js';\nimport type { MiterPlane, DxfOptions, SlotPlacement } from './api.js';\nimport {\n author,\n unfold,\n unfoldSolid,\n fold,\n miter,\n miterCorner,\n bendRelief,\n autoReliefs,\n relieveCorner,\n addCutout,\n addHole,\n addSlot,\n addPolygonCutout,\n addTab,\n tabAndSlot,\n louver,\n emboss,\n contourFlange,\n loftedFlange,\n hem,\n jog,\n toDXF,\n report,\n validate,\n} from './api.js';\nimport type {\n SheetMetalPart,\n FlatPattern,\n FlatInput,\n BendReport,\n MaterialSpec,\n ReliefSpec,\n CutoutSpec,\n TabSpec,\n ContourFlangeSpec,\n LoftedFlangeSpec,\n HemSpec,\n JogSpec,\n SheetMetalWarning,\n UnfoldResult,\n} from './types.js';\n\n/** Thrown by the fluent facade when an underlying `Result<T>` is an `Err`. */\nexport class SheetMetalError extends Error {\n /** The machine-readable error code from the underlying `BrepError`. */\n readonly code: string;\n /** The error kind/category from the underlying `BrepError`. */\n readonly kind: string;\n\n constructor(brepError: BrepError) {\n super(\n brepError.suggestion\n ? `${brepError.message}\\nSuggestion: ${brepError.suggestion}`\n : brepError.message\n );\n this.name = 'SheetMetalError';\n this.code = brepError.code;\n this.kind = brepError.kind;\n }\n}\n\nfunction unwrapOrThrow<T>(result: Result<T>): T {\n if (isErr(result)) {\n throw new SheetMetalError(result.error);\n }\n return result.value;\n}\n\n/** A built part already mitered/operated on, re-entering the fluent chain. */\nclass SheetMetalPartHandle {\n constructor(readonly part: SheetMetalPart) {}\n\n /**\n * Cut by an oriented plane, removing material on the `+normal` side.\n * @param plane - the oriented cutting plane; material on the plane's `+normal` side is removed.\n * @returns a new `SheetMetalPartHandle` carrying the mitered part.\n */\n miter(plane: MiterPlane): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(miter(this.part, plane)));\n }\n\n /**\n * Auto-miter the shared corner of two flanges with an optional gap.\n * @param flangeIdA - id of the first flange meeting at the corner.\n * @param flangeIdB - id of the second flange meeting at the corner.\n * @param gap - optional gap (in millimetres) left between the two mitered edges; defaults to 0.\n * @returns a new `SheetMetalPartHandle` carrying the part with the corner mitered.\n */\n miterCorner(flangeIdA: string, flangeIdB: string, gap = 0): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(miterCorner(this.part, flangeIdA, flangeIdB, gap)));\n }\n\n /**\n * Add a bend relief at each mid-edge end of a partial flange's bend line.\n * @param flangeId - id of the partial flange whose bend-line ends get the relief.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a new `SheetMetalPartHandle` carrying the part with the relief added.\n */\n bendRelief(flangeId: string, spec?: ReliefSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(bendRelief(this.part, flangeId, spec)));\n }\n\n /**\n * Add a bend relief to every partial-span bend in the part.\n * @param spec - optional relief specification applied to every partial bend.\n * @returns a new `SheetMetalPartHandle` carrying the part with all reliefs added.\n */\n autoReliefs(spec?: ReliefSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(autoReliefs(this.part, spec)));\n }\n\n /**\n * Cut a corner relief notch at the shared corner of two adjacent flanges.\n * @param flangeIdA - id of the first flange forming the corner.\n * @param flangeIdB - id of the second flange forming the corner.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a new `SheetMetalPartHandle` carrying the part with the corner relief added.\n */\n cornerRelief(flangeIdA: string, flangeIdB: string, spec?: ReliefSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(relieveCorner(this.part, flangeIdA, flangeIdB, spec)));\n }\n\n /**\n * Punch a cutout (hole / slot / polygon) through a named flat region.\n * @param spec - the cutout definition (kind, geometry, and target region).\n * @returns a new `SheetMetalPartHandle` carrying the part with the cutout punched.\n */\n cutout(spec: CutoutSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(addCutout(this.part, spec)));\n }\n\n /**\n * Punch a circular hole of `diameter` centred at region-local `(x, y)`.\n * @param region - name of the flat region the hole is punched through.\n * @param x - region-local X of the hole centre.\n * @param y - region-local Y of the hole centre.\n * @param diameter - hole diameter.\n * @returns a new `SheetMetalPartHandle` carrying the part with the hole punched.\n */\n hole(region: string, x: number, y: number, diameter: number): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(addHole(this.part, region, x, y, diameter)));\n }\n\n /**\n * Punch a slot (rectangular or obround) centred at region-local `(x, y)`.\n * @param region - name of the flat region the slot is punched through.\n * @param opts - slot geometry: centre `(x, y)`, `length`, `width`, optional `angleDeg` rotation, and `round` ends flag.\n * @returns a new `SheetMetalPartHandle` carrying the part with the slot punched.\n */\n slot(\n region: string,\n opts: { x: number; y: number; length: number; width: number; angleDeg?: number; round?: boolean }\n ): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(addSlot(this.part, region, opts)));\n }\n\n /**\n * Punch an arbitrary polygon cutout from its region-local `points`.\n * @param region - name of the flat region the polygon is punched through.\n * @param points - region-local polygon vertices as `[x, y]` pairs.\n * @returns a new `SheetMetalPartHandle` carrying the part with the polygon cutout.\n */\n polygonCutout(region: string, points: [number, number][]): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(addPolygonCutout(this.part, region, points)));\n }\n\n /**\n * Fuse a rectangular tab (additive protrusion) onto a region's edge.\n * @param spec - tab definition: edge, width, and length.\n * @returns a new `SheetMetalPartHandle` carrying the part with the tab added.\n */\n tab(spec: TabSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(addTab(this.part, spec)));\n }\n\n /**\n * Self-fixturing tab-and-slot joint: a tab on one region + a matching slot on another.\n * @param tab - the tab to add to the first region.\n * @param slot - placement of the matching slot on the second region.\n * @returns a new `SheetMetalPartHandle` carrying the part with the joint added.\n */\n tabAndSlot(tab: TabSpec, slot: SlotPlacement): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(tabAndSlot(this.part, tab, slot)));\n }\n\n /**\n * Form a louver (vent flap) on a region.\n * @param opts - louver geometry: target `region`, centre `(x, y)`, `length`, `width`, `height`, and optional `direction`.\n * @returns a new `SheetMetalPartHandle` carrying the part with the louver formed.\n */\n louver(opts: {\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down';\n }): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(louver(this.part, opts)));\n }\n\n /**\n * Form a round emboss (raised) or dimple (recessed) on a region.\n * @param opts - emboss geometry: target `region`, centre `(x, y)`, `diameter`, `height`, and `kind` (`dimple` or `emboss`).\n * @returns a new `SheetMetalPartHandle` carrying the part with the form added.\n */\n emboss(opts: {\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n kind: 'dimple' | 'emboss';\n }): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(emboss(this.part, opts)));\n }\n\n /**\n * Author a contour flange (open line/arc profile swept along a base edge).\n * @param spec - contour flange definition: profile, base edge, and bend parameters.\n * @returns a new `SheetMetalPartHandle` carrying the part with the contour flange added.\n */\n contourFlange(spec: ContourFlangeSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(contourFlange(this.part, spec)));\n }\n\n /**\n * Author a lofted / ruled transition flange between two parallel open profiles.\n * @param spec - lofted flange definition: the two open profiles and their alignment.\n * @returns a new `SheetMetalPartHandle` carrying the part with the lofted flange added.\n */\n loftedFlange(spec: LoftedFlangeSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(loftedFlange(this.part, spec)));\n }\n\n /**\n * Fold a region edge back ~180°+ onto its parent as a hem (closed/open/teardrop/rolled).\n * @param spec - hem definition: edge, curl radius, and return leg length.\n * @returns a new `SheetMetalPartHandle` carrying the part with the hem added.\n */\n hem(spec: HemSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(hem(this.part, spec)));\n }\n\n /**\n * Step a region's flat by `offsetHeight` with two opposite bends (a jog/joggle).\n * @param spec - jog definition: bend line, offset height, and radii.\n * @returns a new `SheetMetalPartHandle` carrying the part with the jog added.\n */\n jog(spec: JogSpec): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(jog(this.part, spec)));\n }\n\n /**\n * Flatten into a developed flat pattern + bend report + warnings.\n * @returns the `UnfoldResult` with the flat pattern, bend report, and any warnings.\n */\n unfold(): UnfoldResult {\n return unwrapOrThrow(unfold(this.part));\n }\n\n /**\n * Just the flat pattern from the unfold.\n * @returns the developed `FlatPattern`.\n */\n flatPattern(): FlatPattern {\n return this.unfold().pattern;\n }\n\n /**\n * Bend report built from the feature tree.\n * @returns the `BendReport` describing every bend in the part.\n */\n report(): BendReport {\n return unwrapOrThrow(report(this.part));\n }\n\n /**\n * Annotated multi-layer DXF of the developed flat pattern.\n * @param options - optional DXF output options (layers, precision, units).\n * @returns the DXF text of the developed flat pattern.\n */\n dxf(options?: DxfOptions): string {\n return unwrapOrThrow(toDXF(this.flatPattern(), options));\n }\n\n /**\n * Manufacturability warnings (advisory, never throws).\n * @returns the list of `SheetMetalWarning`s (empty when the part is manufacturable).\n */\n validate(): SheetMetalWarning[] {\n return validate(this.part);\n }\n\n /**\n * The materialized part (escape hatch back to the functional API).\n * @returns the underlying `SheetMetalPart`.\n */\n get(): SheetMetalPart {\n return this.part;\n }\n}\n\n/**\n * An imported foreign solid (no feature tree) re-entering the fluent chain: detect\n * its geometry and unfold it. `kFactor` defaults to the mid-surface neutral axis.\n */\nclass ForeignSolidHandle {\n constructor(\n private readonly solid: Solid,\n private readonly opts?: { kFactor?: number }\n ) {}\n\n /**\n * Override the neutral-axis K-factor (default 0.5, the mid-surface).\n * @param kFactor - the K-factor to use for the bend allowance.\n * @returns a new `ForeignSolidHandle` with the K-factor applied.\n */\n kFactor(kFactor: number): ForeignSolidHandle {\n return new ForeignSolidHandle(this.solid, { ...this.opts, kFactor });\n }\n\n /**\n * Detect geometry and flatten into a developed flat pattern + report + warnings.\n * @returns the `UnfoldResult` with the detected flat pattern, report, and any warnings.\n */\n unfold(): UnfoldResult {\n return unwrapOrThrow(unfoldSolid(this.solid, this.opts));\n }\n\n /**\n * Just the flat pattern from the detected unfold.\n * @returns the developed `FlatPattern`.\n */\n flatPattern(): FlatPattern {\n return this.unfold().pattern;\n }\n\n /**\n * Annotated multi-layer DXF of the developed flat pattern.\n * @param options - optional DXF output options (layers, precision, units).\n * @returns the DXF text of the developed flat pattern.\n */\n dxf(options?: DxfOptions): string {\n return unwrapOrThrow(toDXF(this.flatPattern(), options));\n }\n}\n\n/** Authoring builder — accumulates the base/flanges/material spec, then folds. */\nclass SheetMetalBuilder {\n private built?: SheetMetalPartHandle;\n\n constructor(private readonly spec: AuthorSpec) {}\n\n /**\n * Add a flange folded off its parent edge (the base by default).\n * @param flange - the flange definition to add.\n * @returns a new `SheetMetalBuilder` with the flange appended to the spec.\n */\n flange(flange: FlangeSpec): SheetMetalBuilder {\n return new SheetMetalBuilder({ ...this.spec, flanges: [...this.spec.flanges, flange] });\n }\n\n /**\n * Add a seam closing a profile into a tube/box (left unfolded).\n * @param seam - the seam definition to add.\n * @returns a new `SheetMetalBuilder` with the seam appended to the spec.\n */\n seam(seam: SeamSpec): SheetMetalBuilder {\n return new SheetMetalBuilder({ ...this.spec, seams: [...(this.spec.seams ?? []), seam] });\n }\n\n /**\n * Set the part material (its thickness/default rule).\n * @param material - the material definition (thickness / default rule).\n * @returns a new `SheetMetalBuilder` with the material set.\n */\n material(material: MaterialSpec): SheetMetalBuilder {\n return new SheetMetalBuilder({ ...this.spec, material });\n }\n\n /**\n * Fold the accumulated spec into a 3D part, re-entering the fluent chain.\n * Memoized so chaining multiple terminal shortcuts (e.g. `unfold()` then\n * `report()`) authors the solid only once.\n * @returns a `SheetMetalPartHandle` for the folded part, memoized across calls.\n */\n build(): SheetMetalPartHandle {\n this.built ??= new SheetMetalPartHandle(unwrapOrThrow(author(this.spec)));\n return this.built;\n }\n\n // ----- part-consuming shortcuts (build then delegate) -----\n\n /**\n * Build the part and cut it by an oriented plane, removing material on the `+normal` side.\n * @param plane - the oriented cutting plane; material on the plane's `+normal` side is removed.\n * @returns a `SheetMetalPartHandle` carrying the mitered part.\n */\n miter(plane: MiterPlane): SheetMetalPartHandle {\n return this.build().miter(plane);\n }\n\n /**\n * Build the part and auto-miter the shared corner of two flanges with an optional gap.\n * @param flangeIdA - id of the first flange meeting at the corner.\n * @param flangeIdB - id of the second flange meeting at the corner.\n * @param gap - optional gap (in millimetres) left between the two mitered edges; defaults to 0.\n * @returns a `SheetMetalPartHandle` carrying the part with the corner mitered.\n */\n miterCorner(flangeIdA: string, flangeIdB: string, gap = 0): SheetMetalPartHandle {\n return this.build().miterCorner(flangeIdA, flangeIdB, gap);\n }\n\n /**\n * Build the part and add a bend relief at each mid-edge end of a partial flange's bend line.\n * @param flangeId - id of the partial flange whose bend-line ends get the relief.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a `SheetMetalPartHandle` carrying the part with the relief added.\n */\n bendRelief(flangeId: string, spec?: ReliefSpec): SheetMetalPartHandle {\n return this.build().bendRelief(flangeId, spec);\n }\n\n /**\n * Build the part and add a bend relief to every partial-span bend.\n * @param spec - optional relief specification applied to every partial bend.\n * @returns a `SheetMetalPartHandle` carrying the part with all reliefs added.\n */\n autoReliefs(spec?: ReliefSpec): SheetMetalPartHandle {\n return this.build().autoReliefs(spec);\n }\n\n /**\n * Build the part and cut a corner relief notch at the shared corner of two adjacent flanges.\n * @param flangeIdA - id of the first flange forming the corner.\n * @param flangeIdB - id of the second flange forming the corner.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a `SheetMetalPartHandle` carrying the part with the corner relief added.\n */\n cornerRelief(flangeIdA: string, flangeIdB: string, spec?: ReliefSpec): SheetMetalPartHandle {\n return this.build().cornerRelief(flangeIdA, flangeIdB, spec);\n }\n\n /**\n * Build the part and punch a cutout (hole / slot / polygon) through a named flat region.\n * @param spec - the cutout definition (kind, geometry, and target region).\n * @returns a `SheetMetalPartHandle` carrying the part with the cutout punched.\n */\n cutout(spec: CutoutSpec): SheetMetalPartHandle {\n return this.build().cutout(spec);\n }\n\n /**\n * Build the part and punch a circular hole of `diameter` centred at region-local `(x, y)`.\n * @param region - name of the flat region the hole is punched through.\n * @param x - region-local X of the hole centre.\n * @param y - region-local Y of the hole centre.\n * @param diameter - hole diameter.\n * @returns a `SheetMetalPartHandle` carrying the part with the hole punched.\n */\n hole(region: string, x: number, y: number, diameter: number): SheetMetalPartHandle {\n return this.build().hole(region, x, y, diameter);\n }\n\n /**\n * Build the part and punch a slot (rectangular or obround) centred at region-local `(x, y)`.\n * @param region - name of the flat region the slot is punched through.\n * @param opts - slot geometry: centre `(x, y)`, `length`, `width`, optional `angleDeg` rotation, and `round` ends flag.\n * @returns a `SheetMetalPartHandle` carrying the part with the slot punched.\n */\n slot(\n region: string,\n opts: { x: number; y: number; length: number; width: number; angleDeg?: number; round?: boolean }\n ): SheetMetalPartHandle {\n return this.build().slot(region, opts);\n }\n\n /**\n * Build the part and punch an arbitrary polygon cutout from its region-local `points`.\n * @param region - name of the flat region the polygon is punched through.\n * @param points - region-local polygon vertices as `[x, y]` pairs.\n * @returns a `SheetMetalPartHandle` carrying the part with the polygon cutout.\n */\n polygonCutout(region: string, points: [number, number][]): SheetMetalPartHandle {\n return this.build().polygonCutout(region, points);\n }\n\n /**\n * Build the part and fuse a rectangular tab (additive protrusion) onto a region's edge.\n * @param spec - tab definition: edge, width, and length.\n * @returns a `SheetMetalPartHandle` carrying the part with the tab added.\n */\n tab(spec: TabSpec): SheetMetalPartHandle {\n return this.build().tab(spec);\n }\n\n /**\n * Build the part and add a self-fixturing tab-and-slot joint across two regions.\n * @param tab - the tab to add to the first region.\n * @param slot - placement of the matching slot on the second region.\n * @returns a `SheetMetalPartHandle` carrying the part with the joint added.\n */\n tabAndSlot(tab: TabSpec, slot: SlotPlacement): SheetMetalPartHandle {\n return this.build().tabAndSlot(tab, slot);\n }\n\n /**\n * Build the part and form a louver (vent flap) on a region.\n * @param opts - louver geometry: target `region`, centre `(x, y)`, `length`, `width`, `height`, and optional `direction`.\n * @returns a `SheetMetalPartHandle` carrying the part with the louver formed.\n */\n louver(opts: {\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down';\n }): SheetMetalPartHandle {\n return this.build().louver(opts);\n }\n\n /**\n * Build the part and form a round emboss (raised) or dimple (recessed) on a region.\n * @param opts - emboss geometry: target `region`, centre `(x, y)`, `diameter`, `height`, and `kind` (`dimple` or `emboss`).\n * @returns a `SheetMetalPartHandle` carrying the part with the form added.\n */\n emboss(opts: {\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n kind: 'dimple' | 'emboss';\n }): SheetMetalPartHandle {\n return this.build().emboss(opts);\n }\n\n /**\n * Build the part and author a contour flange (open line/arc profile swept along a base edge).\n * @param spec - contour flange definition: profile, base edge, and bend parameters.\n * @returns a `SheetMetalPartHandle` carrying the part with the contour flange added.\n */\n contourFlange(spec: ContourFlangeSpec): SheetMetalPartHandle {\n return this.build().contourFlange(spec);\n }\n\n /**\n * Build the part and author a lofted / ruled transition flange between two parallel open profiles.\n * @param spec - lofted flange definition: the two open profiles and their alignment.\n * @returns a `SheetMetalPartHandle` carrying the part with the lofted flange added.\n */\n loftedFlange(spec: LoftedFlangeSpec): SheetMetalPartHandle {\n return this.build().loftedFlange(spec);\n }\n\n /**\n * Build the part and fold a region edge back ~180°+ onto its parent as a hem.\n * @param spec - hem definition: edge, curl radius, and return leg length.\n * @returns a `SheetMetalPartHandle` carrying the part with the hem added.\n */\n hem(spec: HemSpec): SheetMetalPartHandle {\n return this.build().hem(spec);\n }\n\n /**\n * Build the part and step a region's flat by `offsetHeight` with two opposite bends (a jog/joggle).\n * @param spec - jog definition: bend line, offset height, and radii.\n * @returns a `SheetMetalPartHandle` carrying the part with the jog added.\n */\n jog(spec: JogSpec): SheetMetalPartHandle {\n return this.build().jog(spec);\n }\n\n /**\n * Build the part and flatten it into a developed flat pattern + bend report + warnings.\n * @returns the `UnfoldResult` with the flat pattern, bend report, and any warnings.\n */\n unfold(): UnfoldResult {\n return this.build().unfold();\n }\n\n /**\n * Build the part and produce the bend report from its feature tree.\n * @returns the `BendReport` describing every bend in the part.\n */\n report(): BendReport {\n return this.build().report();\n }\n\n /**\n * Build the part and emit an annotated multi-layer DXF of its developed flat pattern.\n * @param options - optional DXF output options (layers, precision, units).\n * @returns the DXF text of the developed flat pattern.\n */\n dxf(options?: DxfOptions): string {\n return this.build().dxf(options);\n }\n\n /**\n * Build the part and run manufacturability checks (advisory, never throws).\n * @returns the list of `SheetMetalWarning`s (empty when the part is manufacturable).\n */\n validate(): SheetMetalWarning[] {\n return this.build().validate();\n }\n\n /**\n * Build the part and return it (escape hatch back to the functional API).\n * @returns the underlying `SheetMetalPart`.\n */\n get(): SheetMetalPart {\n return this.build().get();\n }\n}\n\n/**\n * Start a fluent sheet-metal chain from a base flat (`length × width`).\n * @param base - the base flat definition (length × width).\n * @param thickness - the sheet material thickness in millimetres.\n * @returns a `SheetMetalBuilder` ready for authoring steps like `flange`/`seam`/`material`.\n */\nexport function sheetMetal(base: BaseFlatSpec, thickness: number): SheetMetalBuilder {\n return new SheetMetalBuilder({ thickness, base, flanges: [] });\n}\n\n/**\n * Re-enter the fluent chain from an already-authored part.\n * @param part - an authored sheet-metal part to operate on.\n * @returns a `SheetMetalPartHandle` wrapping the part.\n */\nexport function fromPart(part: SheetMetalPart): SheetMetalPartHandle {\n return new SheetMetalPartHandle(part);\n}\n\n/**\n * Fold a flat pattern up into a part and re-enter the fluent chain.\n * @param input - the flat pattern (region tree) to fold up.\n * @returns a `SheetMetalPartHandle` carrying the folded part.\n */\nexport function foldFlat(input: FlatInput): SheetMetalPartHandle {\n return new SheetMetalPartHandle(unwrapOrThrow(fold(input)));\n}\n\n/**\n * Detect and unfold an imported foreign sheet-metal solid (no feature tree).\n * @param solid - the imported solid (B-rep) to unfold.\n * @param opts - optional overrides; `opts.kFactor` sets the K-factor used for the bend allowance.\n * @returns a `ForeignSolidHandle` for detecting and unfolding the solid.\n */\nexport function fromSolid(solid: Solid, opts?: { kFactor?: number }): ForeignSolidHandle {\n return new ForeignSolidHandle(solid, opts);\n}\n\nexport { SheetMetalBuilder, SheetMetalPartHandle, ForeignSolidHandle };\n"]}
|
|
1
|
+
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAGxC,OAAO,EACL,MAAM,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,EACT,OAAO,EACP,OAAO,EACP,gBAAgB,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H,KAAK,CAAC,QAAQ;QACZ,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG;QACP,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAkB,EAAE,SAAiB;IAC9D,OAAO,IAAI,iBAAiB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAoB;IAC3C,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAgB;IAC7C,OAAO,IAAI,oBAAoB,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAY,EAAE,IAA2B;IACjE,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["/**\n * Fluent facade — `sheetMetal(base).flange(...).miter(...).unfold()`.\n *\n * A lightweight immutable builder over the {@link ./api.js} wrappers. Authoring\n * steps (`flange`, `material`) accumulate into a spec; part-consuming steps\n * (`miter`, `miterCorner`, `unfold`, `report`, `dxf`, `validate`, `part`)\n * materialize the folded part once and thread it through, auto-unwrapping the\n * underlying `Result<T>` and throwing {@link SheetMetalError} on failure so the\n * chain stays terminal-free. Use the `Result`-returning functions in `./api.js`\n * directly when explicit error handling is preferred over throwing.\n */\n\nimport type { Solid } from './types.js';\nimport type {BrepError, Result} from '@faicad/faijs/api';\nimport {isErr} from '@faicad/faijs/api';\nimport type { AuthorSpec, BaseFlatSpec, FlangeSpec, SeamSpec } from './authorFns.js';\nimport type { MiterPlane, DxfOptions, SlotPlacement } from './api.js';\nimport {\n author,\n unfold,\n unfoldSolid,\n fold,\n miter,\n miterCorner,\n bendRelief,\n autoReliefs,\n relieveCorner,\n addCutout,\n addHole,\n addSlot,\n addPolygonCutout,\n addTab,\n tabAndSlot,\n louver,\n emboss,\n contourFlange,\n loftedFlange,\n hem,\n jog,\n toDXF,\n report,\n validate,\n} from './api.js';\nimport type {\n SheetMetalPart,\n FlatPattern,\n FlatInput,\n BendReport,\n MaterialSpec,\n ReliefSpec,\n CutoutSpec,\n TabSpec,\n ContourFlangeSpec,\n LoftedFlangeSpec,\n HemSpec,\n JogSpec,\n SheetMetalWarning,\n UnfoldResult,\n} from './types.js';\n\n/** Thrown by the fluent facade when an underlying `Result<T>` is an `Err`. */\nexport class SheetMetalError extends Error {\n /** The machine-readable error code from the underlying `BrepError`. */\n readonly code: string;\n /** The error kind/category from the underlying `BrepError`. */\n readonly kind: string;\n\n constructor(brepError: BrepError) {\n super(\n brepError.suggestion\n ? `${brepError.message}\\nSuggestion: ${brepError.suggestion}`\n : brepError.message\n );\n this.name = 'SheetMetalError';\n this.code = brepError.code;\n this.kind = brepError.kind;\n }\n}\n\nfunction unwrapOrThrow<T>(result: Result<T>): T {\n if (isErr(result)) {\n throw new SheetMetalError(result.error);\n }\n return result.value;\n}\n\n/** A built part already mitered/operated on, re-entering the fluent chain. */\nclass SheetMetalPartHandle {\n constructor(readonly part: SheetMetalPart) {}\n\n /**\n * Cut by an oriented plane, removing material on the `+normal` side.\n * @param plane - the oriented cutting plane; material on the plane's `+normal` side is removed.\n * @returns a new `SheetMetalPartHandle` carrying the mitered part.\n */\n async miter(plane: MiterPlane): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await miter(this.part, plane)));\n }\n\n /**\n * Auto-miter the shared corner of two flanges with an optional gap.\n * @param flangeIdA - id of the first flange meeting at the corner.\n * @param flangeIdB - id of the second flange meeting at the corner.\n * @param gap - optional gap (in millimetres) left between the two mitered edges; defaults to 0.\n * @returns a new `SheetMetalPartHandle` carrying the part with the corner mitered.\n */\n async miterCorner(flangeIdA: string, flangeIdB: string, gap = 0): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await miterCorner(this.part, flangeIdA, flangeIdB, gap)));\n }\n\n /**\n * Add a bend relief at each mid-edge end of a partial flange's bend line.\n * @param flangeId - id of the partial flange whose bend-line ends get the relief.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a new `SheetMetalPartHandle` carrying the part with the relief added.\n */\n async bendRelief(flangeId: string, spec?: ReliefSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await bendRelief(this.part, flangeId, spec)));\n }\n\n /**\n * Add a bend relief to every partial-span bend in the part.\n * @param spec - optional relief specification applied to every partial bend.\n * @returns a new `SheetMetalPartHandle` carrying the part with all reliefs added.\n */\n async autoReliefs(spec?: ReliefSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await autoReliefs(this.part, spec)));\n }\n\n /**\n * Cut a corner relief notch at the shared corner of two adjacent flanges.\n * @param flangeIdA - id of the first flange forming the corner.\n * @param flangeIdB - id of the second flange forming the corner.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a new `SheetMetalPartHandle` carrying the part with the corner relief added.\n */\n async cornerRelief(flangeIdA: string, flangeIdB: string, spec?: ReliefSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await relieveCorner(this.part, flangeIdA, flangeIdB, spec)));\n }\n\n /**\n * Punch a cutout (hole / slot / polygon) through a named flat region.\n * @param spec - the cutout definition (kind, geometry, and target region).\n * @returns a new `SheetMetalPartHandle` carrying the part with the cutout punched.\n */\n async cutout(spec: CutoutSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await addCutout(this.part, spec)));\n }\n\n /**\n * Punch a circular hole of `diameter` centred at region-local `(x, y)`.\n * @param region - name of the flat region the hole is punched through.\n * @param x - region-local X of the hole centre.\n * @param y - region-local Y of the hole centre.\n * @param diameter - hole diameter.\n * @returns a new `SheetMetalPartHandle` carrying the part with the hole punched.\n */\n async hole(region: string, x: number, y: number, diameter: number): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await addHole(this.part, region, x, y, diameter)));\n }\n\n /**\n * Punch a slot (rectangular or obround) centred at region-local `(x, y)`.\n * @param region - name of the flat region the slot is punched through.\n * @param opts - slot geometry: centre `(x, y)`, `length`, `width`, optional `angleDeg` rotation, and `round` ends flag.\n * @returns a new `SheetMetalPartHandle` carrying the part with the slot punched.\n */\n async slot(\n region: string,\n opts: { x: number; y: number; length: number; width: number; angleDeg?: number; round?: boolean }\n ): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await addSlot(this.part, region, opts)));\n }\n\n /**\n * Punch an arbitrary polygon cutout from its region-local `points`.\n * @param region - name of the flat region the polygon is punched through.\n * @param points - region-local polygon vertices as `[x, y]` pairs.\n * @returns a new `SheetMetalPartHandle` carrying the part with the polygon cutout.\n */\n async polygonCutout(region: string, points: [number, number][]): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await addPolygonCutout(this.part, region, points)));\n }\n\n /**\n * Fuse a rectangular tab (additive protrusion) onto a region's edge.\n * @param spec - tab definition: edge, width, and length.\n * @returns a new `SheetMetalPartHandle` carrying the part with the tab added.\n */\n async tab(spec: TabSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await addTab(this.part, spec)));\n }\n\n /**\n * Self-fixturing tab-and-slot joint: a tab on one region + a matching slot on another.\n * @param tab - the tab to add to the first region.\n * @param slot - placement of the matching slot on the second region.\n * @returns a new `SheetMetalPartHandle` carrying the part with the joint added.\n */\n async tabAndSlot(tab: TabSpec, slot: SlotPlacement): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await tabAndSlot(this.part, tab, slot)));\n }\n\n /**\n * Form a louver (vent flap) on a region.\n * @param opts - louver geometry: target `region`, centre `(x, y)`, `length`, `width`, `height`, and optional `direction`.\n * @returns a new `SheetMetalPartHandle` carrying the part with the louver formed.\n */\n async louver(opts: {\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down';\n }): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await louver(this.part, opts)));\n }\n\n /**\n * Form a round emboss (raised) or dimple (recessed) on a region.\n * @param opts - emboss geometry: target `region`, centre `(x, y)`, `diameter`, `height`, and `kind` (`dimple` or `emboss`).\n * @returns a new `SheetMetalPartHandle` carrying the part with the form added.\n */\n async emboss(opts: {\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n kind: 'dimple' | 'emboss';\n }): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await emboss(this.part, opts)));\n }\n\n /**\n * Author a contour flange (open line/arc profile swept along a base edge).\n * @param spec - contour flange definition: profile, base edge, and bend parameters.\n * @returns a new `SheetMetalPartHandle` carrying the part with the contour flange added.\n */\n async contourFlange(spec: ContourFlangeSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await contourFlange(this.part, spec)));\n }\n\n /**\n * Author a lofted / ruled transition flange between two parallel open profiles.\n * @param spec - lofted flange definition: the two open profiles and their alignment.\n * @returns a new `SheetMetalPartHandle` carrying the part with the lofted flange added.\n */\n async loftedFlange(spec: LoftedFlangeSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await loftedFlange(this.part, spec)));\n }\n\n /**\n * Fold a region edge back ~180°+ onto its parent as a hem (closed/open/teardrop/rolled).\n * @param spec - hem definition: edge, curl radius, and return leg length.\n * @returns a new `SheetMetalPartHandle` carrying the part with the hem added.\n */\n async hem(spec: HemSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await hem(this.part, spec)));\n }\n\n /**\n * Step a region's flat by `offsetHeight` with two opposite bends (a jog/joggle).\n * @param spec - jog definition: bend line, offset height, and radii.\n * @returns a new `SheetMetalPartHandle` carrying the part with the jog added.\n */\n async jog(spec: JogSpec): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await jog(this.part, spec)));\n }\n\n /**\n * Flatten into a developed flat pattern + bend report + warnings.\n * @returns the `UnfoldResult` with the flat pattern, bend report, and any warnings.\n */\n unfold(): UnfoldResult {\n return unwrapOrThrow(unfold(this.part));\n }\n\n /**\n * Just the flat pattern from the unfold.\n * @returns the developed `FlatPattern`.\n */\n flatPattern(): FlatPattern {\n return this.unfold().pattern;\n }\n\n /**\n * Bend report built from the feature tree.\n * @returns the `BendReport` describing every bend in the part.\n */\n report(): BendReport {\n return unwrapOrThrow(report(this.part));\n }\n\n /**\n * Annotated multi-layer DXF of the developed flat pattern.\n * @param options - optional DXF output options (layers, precision, units).\n * @returns the DXF text of the developed flat pattern.\n */\n dxf(options?: DxfOptions): string {\n return unwrapOrThrow(toDXF(this.flatPattern(), options));\n }\n\n /**\n * Manufacturability warnings (advisory, never throws).\n * @returns the list of `SheetMetalWarning`s (empty when the part is manufacturable).\n */\n validate(): SheetMetalWarning[] {\n return validate(this.part);\n }\n\n /**\n * The materialized part (escape hatch back to the functional API).\n * @returns the underlying `SheetMetalPart`.\n */\n get(): SheetMetalPart {\n return this.part;\n }\n}\n\n/**\n * An imported foreign solid (no feature tree) re-entering the fluent chain: detect\n * its geometry and unfold it. `kFactor` defaults to the mid-surface neutral axis.\n */\nclass ForeignSolidHandle {\n constructor(\n private readonly solid: Solid,\n private readonly opts?: { kFactor?: number }\n ) {}\n\n /**\n * Override the neutral-axis K-factor (default 0.5, the mid-surface).\n * @param kFactor - the K-factor to use for the bend allowance.\n * @returns a new `ForeignSolidHandle` with the K-factor applied.\n */\n kFactor(kFactor: number): ForeignSolidHandle {\n return new ForeignSolidHandle(this.solid, { ...this.opts, kFactor });\n }\n\n /**\n * Detect geometry and flatten into a developed flat pattern + report + warnings.\n * @returns the `UnfoldResult` with the detected flat pattern, report, and any warnings.\n */\n unfold(): UnfoldResult {\n return unwrapOrThrow(unfoldSolid(this.solid, this.opts));\n }\n\n /**\n * Just the flat pattern from the detected unfold.\n * @returns the developed `FlatPattern`.\n */\n flatPattern(): FlatPattern {\n return this.unfold().pattern;\n }\n\n /**\n * Annotated multi-layer DXF of the developed flat pattern.\n * @param options - optional DXF output options (layers, precision, units).\n * @returns the DXF text of the developed flat pattern.\n */\n dxf(options?: DxfOptions): string {\n return unwrapOrThrow(toDXF(this.flatPattern(), options));\n }\n}\n\n/** Authoring builder — accumulates the base/flanges/material spec, then folds. */\nclass SheetMetalBuilder {\n private built?: SheetMetalPartHandle;\n\n constructor(private readonly spec: AuthorSpec) {}\n\n /**\n * Add a flange folded off its parent edge (the base by default).\n * @param flange - the flange definition to add.\n * @returns a new `SheetMetalBuilder` with the flange appended to the spec.\n */\n flange(flange: FlangeSpec): SheetMetalBuilder {\n return new SheetMetalBuilder({ ...this.spec, flanges: [...this.spec.flanges, flange] });\n }\n\n /**\n * Add a seam closing a profile into a tube/box (left unfolded).\n * @param seam - the seam definition to add.\n * @returns a new `SheetMetalBuilder` with the seam appended to the spec.\n */\n seam(seam: SeamSpec): SheetMetalBuilder {\n return new SheetMetalBuilder({ ...this.spec, seams: [...(this.spec.seams ?? []), seam] });\n }\n\n /**\n * Set the part material (its thickness/default rule).\n * @param material - the material definition (thickness / default rule).\n * @returns a new `SheetMetalBuilder` with the material set.\n */\n material(material: MaterialSpec): SheetMetalBuilder {\n return new SheetMetalBuilder({ ...this.spec, material });\n }\n\n /**\n * Fold the accumulated spec into a 3D part, re-entering the fluent chain.\n * Memoized so chaining multiple terminal shortcuts (e.g. `unfold()` then\n * `report()`) authors the solid only once.\n * @returns a `SheetMetalPartHandle` for the folded part, memoized across calls.\n */\n async build(): Promise<SheetMetalPartHandle> {\n this.built ??= new SheetMetalPartHandle(unwrapOrThrow(await author(this.spec)));\n return this.built;\n }\n\n // ----- part-consuming shortcuts (build then delegate) -----\n\n /**\n * Build the part and cut it by an oriented plane, removing material on the `+normal` side.\n * @param plane - the oriented cutting plane; material on the plane's `+normal` side is removed.\n * @returns a `SheetMetalPartHandle` carrying the mitered part.\n */\n async miter(plane: MiterPlane): Promise<SheetMetalPartHandle> {\n return (await this.build()).miter(plane);\n }\n\n /**\n * Build the part and auto-miter the shared corner of two flanges with an optional gap.\n * @param flangeIdA - id of the first flange meeting at the corner.\n * @param flangeIdB - id of the second flange meeting at the corner.\n * @param gap - optional gap (in millimetres) left between the two mitered edges; defaults to 0.\n * @returns a `SheetMetalPartHandle` carrying the part with the corner mitered.\n */\n async miterCorner(flangeIdA: string, flangeIdB: string, gap = 0): Promise<SheetMetalPartHandle> {\n return (await this.build()).miterCorner(flangeIdA, flangeIdB, gap);\n }\n\n /**\n * Build the part and add a bend relief at each mid-edge end of a partial flange's bend line.\n * @param flangeId - id of the partial flange whose bend-line ends get the relief.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a `SheetMetalPartHandle` carrying the part with the relief added.\n */\n async bendRelief(flangeId: string, spec?: ReliefSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).bendRelief(flangeId, spec);\n }\n\n /**\n * Build the part and add a bend relief to every partial-span bend.\n * @param spec - optional relief specification applied to every partial bend.\n * @returns a `SheetMetalPartHandle` carrying the part with all reliefs added.\n */\n async autoReliefs(spec?: ReliefSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).autoReliefs(spec);\n }\n\n /**\n * Build the part and cut a corner relief notch at the shared corner of two adjacent flanges.\n * @param flangeIdA - id of the first flange forming the corner.\n * @param flangeIdB - id of the second flange forming the corner.\n * @param spec - optional relief specification overriding the defaults.\n * @returns a `SheetMetalPartHandle` carrying the part with the corner relief added.\n */\n async cornerRelief(flangeIdA: string, flangeIdB: string, spec?: ReliefSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).cornerRelief(flangeIdA, flangeIdB, spec);\n }\n\n /**\n * Build the part and punch a cutout (hole / slot / polygon) through a named flat region.\n * @param spec - the cutout definition (kind, geometry, and target region).\n * @returns a `SheetMetalPartHandle` carrying the part with the cutout punched.\n */\n async cutout(spec: CutoutSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).cutout(spec);\n }\n\n /**\n * Build the part and punch a circular hole of `diameter` centred at region-local `(x, y)`.\n * @param region - name of the flat region the hole is punched through.\n * @param x - region-local X of the hole centre.\n * @param y - region-local Y of the hole centre.\n * @param diameter - hole diameter.\n * @returns a `SheetMetalPartHandle` carrying the part with the hole punched.\n */\n async hole(region: string, x: number, y: number, diameter: number): Promise<SheetMetalPartHandle> {\n return (await this.build()).hole(region, x, y, diameter);\n }\n\n /**\n * Build the part and punch a slot (rectangular or obround) centred at region-local `(x, y)`.\n * @param region - name of the flat region the slot is punched through.\n * @param opts - slot geometry: centre `(x, y)`, `length`, `width`, optional `angleDeg` rotation, and `round` ends flag.\n * @returns a `SheetMetalPartHandle` carrying the part with the slot punched.\n */\n async slot(\n region: string,\n opts: { x: number; y: number; length: number; width: number; angleDeg?: number; round?: boolean }\n ): Promise<SheetMetalPartHandle> {\n return (await this.build()).slot(region, opts);\n }\n\n /**\n * Build the part and punch an arbitrary polygon cutout from its region-local `points`.\n * @param region - name of the flat region the polygon is punched through.\n * @param points - region-local polygon vertices as `[x, y]` pairs.\n * @returns a `SheetMetalPartHandle` carrying the part with the polygon cutout.\n */\n async polygonCutout(region: string, points: [number, number][]): Promise<SheetMetalPartHandle> {\n return (await this.build()).polygonCutout(region, points);\n }\n\n /**\n * Build the part and fuse a rectangular tab (additive protrusion) onto a region's edge.\n * @param spec - tab definition: edge, width, and length.\n * @returns a `SheetMetalPartHandle` carrying the part with the tab added.\n */\n async tab(spec: TabSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).tab(spec);\n }\n\n /**\n * Build the part and add a self-fixturing tab-and-slot joint across two regions.\n * @param tab - the tab to add to the first region.\n * @param slot - placement of the matching slot on the second region.\n * @returns a `SheetMetalPartHandle` carrying the part with the joint added.\n */\n async tabAndSlot(tab: TabSpec, slot: SlotPlacement): Promise<SheetMetalPartHandle> {\n return (await this.build()).tabAndSlot(tab, slot);\n }\n\n /**\n * Build the part and form a louver (vent flap) on a region.\n * @param opts - louver geometry: target `region`, centre `(x, y)`, `length`, `width`, `height`, and optional `direction`.\n * @returns a `SheetMetalPartHandle` carrying the part with the louver formed.\n */\n async louver(opts: {\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down';\n }): Promise<SheetMetalPartHandle> {\n return (await this.build()).louver(opts);\n }\n\n /**\n * Build the part and form a round emboss (raised) or dimple (recessed) on a region.\n * @param opts - emboss geometry: target `region`, centre `(x, y)`, `diameter`, `height`, and `kind` (`dimple` or `emboss`).\n * @returns a `SheetMetalPartHandle` carrying the part with the form added.\n */\n async emboss(opts: {\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n kind: 'dimple' | 'emboss';\n }): Promise<SheetMetalPartHandle> {\n return (await this.build()).emboss(opts);\n }\n\n /**\n * Build the part and author a contour flange (open line/arc profile swept along a base edge).\n * @param spec - contour flange definition: profile, base edge, and bend parameters.\n * @returns a `SheetMetalPartHandle` carrying the part with the contour flange added.\n */\n async contourFlange(spec: ContourFlangeSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).contourFlange(spec);\n }\n\n /**\n * Build the part and author a lofted / ruled transition flange between two parallel open profiles.\n * @param spec - lofted flange definition: the two open profiles and their alignment.\n * @returns a `SheetMetalPartHandle` carrying the part with the lofted flange added.\n */\n async loftedFlange(spec: LoftedFlangeSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).loftedFlange(spec);\n }\n\n /**\n * Build the part and fold a region edge back ~180°+ onto its parent as a hem.\n * @param spec - hem definition: edge, curl radius, and return leg length.\n * @returns a `SheetMetalPartHandle` carrying the part with the hem added.\n */\n async hem(spec: HemSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).hem(spec);\n }\n\n /**\n * Build the part and step a region's flat by `offsetHeight` with two opposite bends (a jog/joggle).\n * @param spec - jog definition: bend line, offset height, and radii.\n * @returns a `SheetMetalPartHandle` carrying the part with the jog added.\n */\n async jog(spec: JogSpec): Promise<SheetMetalPartHandle> {\n return (await this.build()).jog(spec);\n }\n\n /**\n * Build the part and flatten it into a developed flat pattern + bend report + warnings.\n * @returns the `UnfoldResult` with the flat pattern, bend report, and any warnings.\n */\n async unfold(): Promise<UnfoldResult> {\n return (await this.build()).unfold();\n }\n\n /**\n * Build the part and produce the bend report from its feature tree.\n * @returns the `BendReport` describing every bend in the part.\n */\n async report(): Promise<BendReport> {\n return (await this.build()).report();\n }\n\n /**\n * Build the part and emit an annotated multi-layer DXF of its developed flat pattern.\n * @param options - optional DXF output options (layers, precision, units).\n * @returns the DXF text of the developed flat pattern.\n */\n async dxf(options?: DxfOptions): Promise<string> {\n return (await this.build()).dxf(options);\n }\n\n /**\n * Build the part and run manufacturability checks (advisory, never throws).\n * @returns the list of `SheetMetalWarning`s (empty when the part is manufacturable).\n */\n async validate(): Promise<SheetMetalWarning[]> {\n return (await this.build()).validate();\n }\n\n /**\n * Build the part and return it (escape hatch back to the functional API).\n * @returns the underlying `SheetMetalPart`.\n */\n async get(): Promise<SheetMetalPart> {\n return (await this.build()).get();\n }\n}\n\n/**\n * Start a fluent sheet-metal chain from a base flat (`length × width`).\n * @param base - the base flat definition (length × width).\n * @param thickness - the sheet material thickness in millimetres.\n * @returns a `SheetMetalBuilder` ready for authoring steps like `flange`/`seam`/`material`.\n */\nexport function sheetMetal(base: BaseFlatSpec, thickness: number): SheetMetalBuilder {\n return new SheetMetalBuilder({ thickness, base, flanges: [] });\n}\n\n/**\n * Re-enter the fluent chain from an already-authored part.\n * @param part - an authored sheet-metal part to operate on.\n * @returns a `SheetMetalPartHandle` wrapping the part.\n */\nexport function fromPart(part: SheetMetalPart): SheetMetalPartHandle {\n return new SheetMetalPartHandle(part);\n}\n\n/**\n * Fold a flat pattern up into a part and re-enter the fluent chain.\n * @param input - the flat pattern (region tree) to fold up.\n * @returns a `SheetMetalPartHandle` carrying the folded part.\n */\nexport async function foldFlat(input: FlatInput): Promise<SheetMetalPartHandle> {\n return new SheetMetalPartHandle(unwrapOrThrow(await fold(input)));\n}\n\n/**\n * Detect and unfold an imported foreign sheet-metal solid (no feature tree).\n * @param solid - the imported solid (B-rep) to unfold.\n * @param opts - optional overrides; `opts.kFactor` sets the K-factor used for the bend allowance.\n * @returns a `ForeignSolidHandle` for detecting and unfolding the solid.\n */\nexport function fromSolid(solid: Solid, opts?: { kFactor?: number }): ForeignSolidHandle {\n return new ForeignSolidHandle(solid, opts);\n}\n\nexport { SheetMetalBuilder, SheetMetalPartHandle, ForeignSolidHandle };\n"]}
|
package/dist/featureTreeFns.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Result } from '@faicad/faijs/
|
|
1
|
+
import { type Result } from '@faicad/faijs/api';
|
|
2
2
|
import type { BendFeature, FlangeFeature, SheetMetalPart, SheetMetalWarning } from './types.js';
|
|
3
3
|
/** Id of the root flat — the part's base flat, present as the root of every graph. */
|
|
4
4
|
export declare const ROOT_FLAT_ID = "root";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureTreeFns.d.ts","sourceRoot":"","sources":["../src/featureTreeFns.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"featureTreeFns.d.ts","sourceRoot":"","sources":["../src/featureTreeFns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,MAAM,EAA2B,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,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