@faicad/sheetmetal 0.16.1 → 0.18.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 +53 -0
- package/dist/geometryOps.d.ts.map +1 -0
- package/dist/geometryOps.js +104 -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/tabFns.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ok, err, validationError, line, wireLoop, face, extrude, fuse, getSolids, isValid, isPlanarWire, vecAdd, vecScale
|
|
1
|
+
import { ok, err, kernelError, validationError, line, wireLoop, face, extrude, fuse, getSolids, isValid, isPlanarWire, vecAdd, vecScale } from '@faicad/faijs/api';
|
|
2
2
|
import { normalizeSolid } from './internal.js';
|
|
3
3
|
import { regionFrames, regionDevExtent, mapToFrame2, addSlot } from './cutoutFns.js';
|
|
4
4
|
const EPS = 1e-6;
|
|
@@ -16,7 +16,7 @@ const EPS = 1e-6;
|
|
|
16
16
|
* @param spec - the tab specification.
|
|
17
17
|
* @returns the updated part with the tab feature recorded, or an error.
|
|
18
18
|
*/
|
|
19
|
-
export function addTab(part, spec) {
|
|
19
|
+
export async function addTab(part, spec) {
|
|
20
20
|
if (part.solid === undefined) {
|
|
21
21
|
return err(validationError('NO_SOLID', 'addTab: part has no folded solid to fuse onto'));
|
|
22
22
|
}
|
|
@@ -41,13 +41,16 @@ export function addTab(part, spec) {
|
|
|
41
41
|
return err(validationError('TAB_OUT_OF_BOUNDS', `tab [${spec.offset}, ${spec.offset + spec.width}] on side '${spec.side}' exceeds edge length ${edgeLen}`));
|
|
42
42
|
}
|
|
43
43
|
const local = tabLocalRect(spec, ext);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
let solid;
|
|
45
|
+
try {
|
|
46
|
+
const tool = await buildTabSolid(local, world, part.thickness);
|
|
47
|
+
if (!tool.ok)
|
|
48
|
+
return tool;
|
|
49
|
+
solid = normalizeSolid((await fuse(part.solid, tool.value)));
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
return err(kernelError('FUSE_FAILED', `tab: ${e instanceof Error ? e.message : String(e)}`));
|
|
53
|
+
}
|
|
51
54
|
if (!isValid(solid) || getSolids(solid).length > 1) {
|
|
52
55
|
return err(validationError('TAB_INVALID_SOLID', `addTab: tab on region '${spec.region}' did not fuse into a single valid body`));
|
|
53
56
|
}
|
|
@@ -73,12 +76,12 @@ export function addTab(part, spec) {
|
|
|
73
76
|
* @param slot - the slot placement.
|
|
74
77
|
* @returns the updated part with the tab-and-slot feature recorded, or an error.
|
|
75
78
|
*/
|
|
76
|
-
export function tabAndSlot(part, tab, slot) {
|
|
79
|
+
export async function tabAndSlot(part, tab, slot) {
|
|
77
80
|
const clearance = slot.clearance ?? 0.1;
|
|
78
81
|
if (!Number.isFinite(clearance) || clearance < 0) {
|
|
79
82
|
return err(validationError('INVALID_CLEARANCE', `clearance must be non-negative, got ${clearance}`));
|
|
80
83
|
}
|
|
81
|
-
const withTab = addTab(part, tab);
|
|
84
|
+
const withTab = await addTab(part, tab);
|
|
82
85
|
if (!withTab.ok)
|
|
83
86
|
return withTab;
|
|
84
87
|
// The tab's inserted cross-section is `width` (along the edge) by `thickness`
|
|
@@ -135,7 +138,7 @@ function tabLocalRect(spec, ext) {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
/** Extrude the region-local tab rectangle through the sheet via the region world frame. */
|
|
138
|
-
function buildTabSolid(local, f, thickness) {
|
|
141
|
+
async function buildTabSolid(local, f, thickness) {
|
|
139
142
|
const worldPts = local.map(([x, y]) => vecAdd(vecAdd(f.origin, vecScale(f.u, x)), vecScale(f.v, y)));
|
|
140
143
|
const edges = [];
|
|
141
144
|
for (let i = 0; i < worldPts.length; i += 1) {
|
|
@@ -155,7 +158,12 @@ function buildTabSolid(local, f, thickness) {
|
|
|
155
158
|
const profile = face(wire.value);
|
|
156
159
|
if (!profile.ok)
|
|
157
160
|
return profile;
|
|
158
|
-
|
|
161
|
+
try {
|
|
162
|
+
return ok((await extrude(profile.value, [f.n[0] * thickness, f.n[1] * thickness, f.n[2] * thickness])));
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
return err(kernelError('TAB_TOOL_FAILED', `extrude tab: ${e instanceof Error ? e.message : String(e)}`));
|
|
166
|
+
}
|
|
159
167
|
}
|
|
160
168
|
/** Developed-plane axis-aligned rectangle `[x0,y0,x1,y1]` of the local tab rect. */
|
|
161
169
|
function devRect(local, dev) {
|
package/dist/tabFns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabFns.js","sourceRoot":"","sources":["../src/tabFns.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,EAAE,EACF,GAAG,EACH,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,MAAM,EACN,QAAQ,GACT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAErF,MAAM,GAAG,GAAG,IAAI,CAAC;AAIjB;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CAAC,IAAoB,EAAE,IAAa;IACxD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,CAAC,eAAe,CAAC,UAAU,EAAE,+CAA+C,CAAC,CAAC,CAAC;IAC3F,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAA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AC9F,CAAC;AAED,oFAAoF;AACpF,SAAS,OAAO,CAAC,KAAY,EAAE,GAAW;IACxC,IAAI,EAAE,GAAG,QAAQ,CAAC;IAClB,IAAI,EAAE,GAAG,QAAQ,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;IACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import {\n type Result,\n type Vec3,\n type Solid,\n ok,\n err,\n validationError,\n line,\n wireLoop,\n face,\n extrude,\n fuse,\n getSolids,\n isValid,\n isPlanarWire,\n vecAdd,\n vecScale,\n} from '@faicad/faijs/brepjs-compat';\nimport type { TabSpec, TabFeature, SheetMetalPart } from './types.js';\nimport { normalizeSolid } from './internal.js';\nimport type { FlatFrame } from './authorFns.js';\nimport type { Frame2 } from './unfoldFns.js';\nimport { regionFrames, regionDevExtent, mapToFrame2, addSlot } from './cutoutFns.js';\n\nconst EPS = 1e-6;\n\ntype Pt2 = [number, number];\n\n/**\n * Fuse a rectangular tab onto a named flat region's edge — additive material (the\n * counterpart of a cutout). The tab is built as a region-local rectangle just past\n * the chosen `side`, placed onto the correct folded face via the region's world\n * {@link FlatFrame}, extruded through the sheet thickness and fused to the solid. The\n * same local rectangle, mapped through the region's developed {@link Frame2}, is\n * recorded as a {@link TabFeature} so {@link unfold} extends the OUTER outline by the\n * protrusion (tabs add material, so the developed area grows). Guards a valid,\n * single-bodied solid.\n *\n * @param part - the sheet metal part to attach a tab to.\n * @param spec - the tab specification.\n * @returns the updated part with the tab feature recorded, or an error.\n */\nexport function addTab(part: SheetMetalPart, spec: TabSpec): Result<SheetMetalPart> {\n if (part.solid === undefined) {\n return err(validationError('NO_SOLID', 'addTab: part has no folded solid to fuse onto'));\n }\n if (!Number.isFinite(spec.width) || spec.width <= 0) {\n return err(validationError('INVALID_TAB', `tab width must be positive, got ${spec.width}`));\n }\n if (!Number.isFinite(spec.length) || spec.length <= 0) {\n return err(validationError('INVALID_TAB', `tab length must be positive, got ${spec.length}`));\n }\n if (!Number.isFinite(spec.offset) || spec.offset < -EPS) {\n return err(validationError('INVALID_TAB', `tab offset must be non-negative, got ${spec.offset}`));\n }\n\n const framesResult = regionFrames(part, spec.region);\n if (!framesResult.ok) return framesResult;\n const { regionId, world, dev } = framesResult.value;\n\n const ext = regionDevExtent(part, regionId, world);\n // The tab attaches to a region edge and runs `width` ALONG it; that span must lie\n // within the edge's length, or the protrusion overhangs the region.\n const edgeLen = spec.side === 'xmax' || spec.side === 'xmin' ? ext.vMax : ext.uMax;\n if (spec.offset + spec.width > edgeLen + EPS) {\n return err(\n validationError(\n 'TAB_OUT_OF_BOUNDS',\n `tab [${spec.offset}, ${spec.offset + spec.width}] on side '${spec.side}' exceeds edge length ${edgeLen}`\n )\n );\n }\n\n const local = tabLocalRect(spec, ext);\n\n const tool = buildTabSolid(local, world, part.thickness);\n if (!tool.ok) return tool;\n\n const fused = fuse(part.solid, tool.value);\n if (!fused.ok) return fused;\n const solid = normalizeSolid(fused.value);\n if (!isValid(solid) || getSolids(solid).length > 1) {\n return err(\n validationError(\n 'TAB_INVALID_SOLID',\n `addTab: tab on region '${spec.region}' did not fuse into a single valid body`\n )\n );\n }\n\n const rect = devRect(local, dev);\n const feature: TabFeature = {\n spec,\n region: regionId,\n rect,\n area: spec.width * spec.length,\n };\n\n return ok({ ...part, solid, tabs: [...(part.tabs ?? []), feature] });\n}\n\n/** The mating-slot placement for a {@link tabAndSlot} joint. */\nexport interface SlotPlacement {\n region: string;\n x: number;\n y: number;\n clearance?: number | undefined;\n /** In-plane rotation of the slot (deg, CCW) in the mating region's local frame.\n * Default 0 = slot length along the region's +x (bend-axis) direction; set this\n * when the tab meets the slot region at a non-default orientation. */\n angleDeg?: number | undefined;\n}\n\n/**\n * Self-fixturing tab-and-slot joint: fuse a tab on one region and punch a matching\n * SLOT CUTOUT on the mating region, sized so the tab's cross-section\n * (`width × thickness`) inserts into the slot. The slot is `tab.width + clearance`\n * long by `thickness + clearance` wide, centred at the mating region's local\n * `(x, y)`. The slot is always strictly larger than the tab cross-section, so the\n * joint mates (verified numerically by callers). Clearance defaults to `0.1` mm.\n *\n * @param part - the sheet metal part to process.\n * @param tab - the tab specification.\n * @param slot - the slot placement.\n * @returns the updated part with the tab-and-slot feature recorded, or an error.\n */\nexport function tabAndSlot(\n part: SheetMetalPart,\n tab: TabSpec,\n slot: SlotPlacement\n): Result<SheetMetalPart> {\n const clearance = slot.clearance ?? 0.1;\n if (!Number.isFinite(clearance) || clearance < 0) {\n return err(validationError('INVALID_CLEARANCE', `clearance must be non-negative, got ${clearance}`));\n }\n\n const withTab = addTab(part, tab);\n if (!withTab.ok) return withTab;\n\n // The tab's inserted cross-section is `width` (along the edge) by `thickness`\n // (through the sheet); the slot must clear both, so it's sized + clearance.\n const slotLength = tab.width + clearance;\n const slotWidth = part.thickness + clearance;\n\n return addSlot(withTab.value, slot.region, {\n x: slot.x,\n y: slot.y,\n length: slotLength,\n width: slotWidth,\n ...(slot.angleDeg !== undefined ? { angleDeg: slot.angleDeg } : {}),\n });\n}\n\n/**\n * Region-local rectangle of the tab as four corners (CCW), extending OUTWARD past\n * the chosen edge by `length`, spanning `[offset, offset+width]` along the edge.\n */\nfunction tabLocalRect(spec: TabSpec, ext: { uMax: number; vMax: number }): Pt2[] {\n const o = spec.offset;\n const w = o + spec.width;\n const l = spec.length;\n switch (spec.side) {\n case 'xmax':\n return [\n [ext.uMax, o],\n [ext.uMax + l, o],\n [ext.uMax + l, w],\n [ext.uMax, w],\n ];\n case 'xmin':\n return [\n [-l, o],\n [0, o],\n [0, w],\n [-l, w],\n ];\n case 'ymax':\n return [\n [o, ext.vMax],\n [w, ext.vMax],\n [w, ext.vMax + l],\n [o, ext.vMax + l],\n ];\n case 'ymin':\n return [\n [o, -l],\n [w, -l],\n [w, 0],\n [o, 0],\n ];\n default:\n return spec.side satisfies never;\n }\n}\n\n/** Extrude the region-local tab rectangle through the sheet via the region world frame. */\nfunction buildTabSolid(local: Pt2[], f: FlatFrame, thickness: number): Result<Solid> {\n const worldPts: Vec3[] = local.map(([x, y]) =>\n vecAdd(vecAdd(f.origin, vecScale(f.u, x)), vecScale(f.v, y))\n );\n const edges = [];\n for (let i = 0; i < worldPts.length; i += 1) {\n const a = worldPts[i];\n const b = worldPts[(i + 1) % worldPts.length];\n if (a === undefined || b === undefined) {\n return err(validationError('TAB_TOOL_FAILED', 'failed to index tab rectangle points'));\n }\n edges.push(line(a, b));\n }\n const wire = wireLoop(edges);\n if (!wire.ok) return wire;\n if (!isPlanarWire(wire.value)) {\n return err(validationError('TAB_TOOL_FAILED', 'tab profile wire is not planar'));\n }\n const profile = face(wire.value);\n if (!profile.ok) return profile;\n return extrude(profile.value, [f.n[0] * thickness, f.n[1] * thickness, f.n[2] * thickness]);\n}\n\n/** Developed-plane axis-aligned rectangle `[x0,y0,x1,y1]` of the local tab rect. */\nfunction devRect(local: Pt2[], dev: Frame2): [number, number, number, number] {\n let x0 = Infinity;\n let y0 = Infinity;\n let x1 = -Infinity;\n let y1 = -Infinity;\n for (const p of local) {\n const [x, y] = mapToFrame2(p, dev);\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n return [x0, y0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AC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3G,CAAC;AACH,CAAC;AAED,oFAAoF;AACpF,SAAS,OAAO,CAAC,KAAY,EAAE,GAAW;IACxC,IAAI,EAAE,GAAG,QAAQ,CAAC;IAClB,IAAI,EAAE,GAAG,QAAQ,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;IACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,EAAE;YAAE,EAAE,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import type { Solid } from './types.js';\nimport {type Result, type Vec3, ok, err, kernelError, validationError, line, wireLoop, face, extrude, fuse, getSolids, isValid, isPlanarWire, vecAdd, vecScale} from '@faicad/faijs/api';\nimport type { TabSpec, TabFeature, SheetMetalPart } from './types.js';\nimport { normalizeSolid } from './internal.js';\nimport type { FlatFrame } from './authorFns.js';\nimport type { Frame2 } from './unfoldFns.js';\nimport { regionFrames, regionDevExtent, mapToFrame2, addSlot } from './cutoutFns.js';\n\nconst EPS = 1e-6;\n\ntype Pt2 = [number, number];\n\n/**\n * Fuse a rectangular tab onto a named flat region's edge — additive material (the\n * counterpart of a cutout). The tab is built as a region-local rectangle just past\n * the chosen `side`, placed onto the correct folded face via the region's world\n * {@link FlatFrame}, extruded through the sheet thickness and fused to the solid. The\n * same local rectangle, mapped through the region's developed {@link Frame2}, is\n * recorded as a {@link TabFeature} so {@link unfold} extends the OUTER outline by the\n * protrusion (tabs add material, so the developed area grows). Guards a valid,\n * single-bodied solid.\n *\n * @param part - the sheet metal part to attach a tab to.\n * @param spec - the tab specification.\n * @returns the updated part with the tab feature recorded, or an error.\n */\nexport async function addTab(part: SheetMetalPart, spec: TabSpec): Promise<Result<SheetMetalPart>> {\n if (part.solid === undefined) {\n return err(validationError('NO_SOLID', 'addTab: part has no folded solid to fuse onto'));\n }\n if (!Number.isFinite(spec.width) || spec.width <= 0) {\n return err(validationError('INVALID_TAB', `tab width must be positive, got ${spec.width}`));\n }\n if (!Number.isFinite(spec.length) || spec.length <= 0) {\n return err(validationError('INVALID_TAB', `tab length must be positive, got ${spec.length}`));\n }\n if (!Number.isFinite(spec.offset) || spec.offset < -EPS) {\n return err(validationError('INVALID_TAB', `tab offset must be non-negative, got ${spec.offset}`));\n }\n\n const framesResult = regionFrames(part, spec.region);\n if (!framesResult.ok) return framesResult;\n const { regionId, world, dev } = framesResult.value;\n\n const ext = regionDevExtent(part, regionId, world);\n // The tab attaches to a region edge and runs `width` ALONG it; that span must lie\n // within the edge's length, or the protrusion overhangs the region.\n const edgeLen = spec.side === 'xmax' || spec.side === 'xmin' ? ext.vMax : ext.uMax;\n if (spec.offset + spec.width > edgeLen + EPS) {\n return err(\n validationError(\n 'TAB_OUT_OF_BOUNDS',\n `tab [${spec.offset}, ${spec.offset + spec.width}] on side '${spec.side}' exceeds edge length ${edgeLen}`\n )\n );\n }\n\n const local = tabLocalRect(spec, ext);\n\n let solid: Solid;\n try {\n const tool = await buildTabSolid(local, world, part.thickness);\n if (!tool.ok) return tool;\n solid = normalizeSolid((await fuse(part.solid, tool.value)) as Solid);\n } catch (e) {\n return err(kernelError('FUSE_FAILED', `tab: ${e instanceof Error ? e.message : String(e)}`));\n }\n if (!isValid(solid) || getSolids(solid).length > 1) {\n return err(\n validationError(\n 'TAB_INVALID_SOLID',\n `addTab: tab on region '${spec.region}' did not fuse into a single valid body`\n )\n );\n }\n\n const rect = devRect(local, dev);\n const feature: TabFeature = {\n spec,\n region: regionId,\n rect,\n area: spec.width * spec.length,\n };\n\n return ok({ ...part, solid, tabs: [...(part.tabs ?? []), feature] });\n}\n\n/** The mating-slot placement for a {@link tabAndSlot} joint. */\nexport interface SlotPlacement {\n region: string;\n x: number;\n y: number;\n clearance?: number | undefined;\n /** In-plane rotation of the slot (deg, CCW) in the mating region's local frame.\n * Default 0 = slot length along the region's +x (bend-axis) direction; set this\n * when the tab meets the slot region at a non-default orientation. */\n angleDeg?: number | undefined;\n}\n\n/**\n * Self-fixturing tab-and-slot joint: fuse a tab on one region and punch a matching\n * SLOT CUTOUT on the mating region, sized so the tab's cross-section\n * (`width × thickness`) inserts into the slot. The slot is `tab.width + clearance`\n * long by `thickness + clearance` wide, centred at the mating region's local\n * `(x, y)`. The slot is always strictly larger than the tab cross-section, so the\n * joint mates (verified numerically by callers). Clearance defaults to `0.1` mm.\n *\n * @param part - the sheet metal part to process.\n * @param tab - the tab specification.\n * @param slot - the slot placement.\n * @returns the updated part with the tab-and-slot feature recorded, or an error.\n */\nexport async function tabAndSlot(\n part: SheetMetalPart,\n tab: TabSpec,\n slot: SlotPlacement\n): Promise<Result<SheetMetalPart>> {\n const clearance = slot.clearance ?? 0.1;\n if (!Number.isFinite(clearance) || clearance < 0) {\n return err(validationError('INVALID_CLEARANCE', `clearance must be non-negative, got ${clearance}`));\n }\n\n const withTab = await addTab(part, tab);\n if (!withTab.ok) return withTab;\n\n // The tab's inserted cross-section is `width` (along the edge) by `thickness`\n // (through the sheet); the slot must clear both, so it's sized + clearance.\n const slotLength = tab.width + clearance;\n const slotWidth = part.thickness + clearance;\n\n return addSlot(withTab.value, slot.region, {\n x: slot.x,\n y: slot.y,\n length: slotLength,\n width: slotWidth,\n ...(slot.angleDeg !== undefined ? { angleDeg: slot.angleDeg } : {}),\n });\n}\n\n/**\n * Region-local rectangle of the tab as four corners (CCW), extending OUTWARD past\n * the chosen edge by `length`, spanning `[offset, offset+width]` along the edge.\n */\nfunction tabLocalRect(spec: TabSpec, ext: { uMax: number; vMax: number }): Pt2[] {\n const o = spec.offset;\n const w = o + spec.width;\n const l = spec.length;\n switch (spec.side) {\n case 'xmax':\n return [\n [ext.uMax, o],\n [ext.uMax + l, o],\n [ext.uMax + l, w],\n [ext.uMax, w],\n ];\n case 'xmin':\n return [\n [-l, o],\n [0, o],\n [0, w],\n [-l, w],\n ];\n case 'ymax':\n return [\n [o, ext.vMax],\n [w, ext.vMax],\n [w, ext.vMax + l],\n [o, ext.vMax + l],\n ];\n case 'ymin':\n return [\n [o, -l],\n [w, -l],\n [w, 0],\n [o, 0],\n ];\n default:\n return spec.side satisfies never;\n }\n}\n\n/** Extrude the region-local tab rectangle through the sheet via the region world frame. */\nasync function buildTabSolid(local: Pt2[], f: FlatFrame, thickness: number): Promise<Result<Solid>> {\n const worldPts: Vec3[] = local.map(([x, y]) =>\n vecAdd(vecAdd(f.origin, vecScale(f.u, x)), vecScale(f.v, y))\n );\n const edges = [];\n for (let i = 0; i < worldPts.length; i += 1) {\n const a = worldPts[i];\n const b = worldPts[(i + 1) % worldPts.length];\n if (a === undefined || b === undefined) {\n return err(validationError('TAB_TOOL_FAILED', 'failed to index tab rectangle points'));\n }\n edges.push(line(a, b));\n }\n const wire = wireLoop(edges);\n if (!wire.ok) return wire;\n if (!isPlanarWire(wire.value)) {\n return err(validationError('TAB_TOOL_FAILED', 'tab profile wire is not planar'));\n }\n const profile = face(wire.value);\n if (!profile.ok) return profile;\n try {\n return ok((await extrude(profile.value, [f.n[0] * thickness, f.n[1] * thickness, f.n[2] * thickness])) as Solid);\n } catch (e) {\n return err(kernelError('TAB_TOOL_FAILED', `extrude tab: ${e instanceof Error ? e.message : String(e)}`));\n }\n}\n\n/** Developed-plane axis-aligned rectangle `[x0,y0,x1,y1]` of the local tab rect. */\nfunction devRect(local: Pt2[], dev: Frame2): [number, number, number, number] {\n let x0 = Infinity;\n let y0 = Infinity;\n let x1 = -Infinity;\n let y1 = -Infinity;\n for (const p of local) {\n const [x, y] = mapToFrame2(p, dev);\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n return [x0, y0, x1, y1];\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SolidShape, CurveShape } from '@faicad/faijs/api';
|
|
2
|
+
/** faijs 建模链产物(core-decouple wrapup §2.2):brepjs `Solid` 的 faijs 等价。
|
|
3
|
+
* 建模 op 均为 faijs 异步 op,产物统一为 `SolidShape`。 */
|
|
4
|
+
export type Solid = SolidShape;
|
|
5
|
+
/** 有效实体别名(断言实体性的调用点保留,等价 `SolidShape`)。 */
|
|
6
|
+
export type ValidSolid = SolidShape;
|
|
7
|
+
/** faijs 曲线形状(edge / wire)——brepjs `Wire` 的 faijs 等价。 */
|
|
8
|
+
export type Wire = CurveShape;
|
|
9
|
+
/** faijs 曲线形状(edge)——brepjs `Edge` 的 faijs 等价。 */
|
|
10
|
+
export type Edge = CurveShape;
|
|
11
|
+
/** faijs 面(携带面句柄的 solid shape)——brepjs `Face` 的 faijs 等价。 */
|
|
12
|
+
export type Face = SolidShape;
|
|
13
|
+
/** 轴对齐包围盒(大写字段形态;由 faijs `bounds3D`(brep 引擎包围盒)组合,见 geometryOps.getBounds)。 */
|
|
14
|
+
export interface Bounds3D {
|
|
15
|
+
xMin: number;
|
|
16
|
+
xMax: number;
|
|
17
|
+
yMin: number;
|
|
18
|
+
yMax: number;
|
|
19
|
+
zMin: number;
|
|
20
|
+
zMax: number;
|
|
21
|
+
}
|
|
2
22
|
/** Which edge of a flat a child flange folds off. */
|
|
3
23
|
export type FlatSide = 'xmin' | 'xmax' | 'ymin' | 'ymax';
|
|
4
24
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Solid, Wire, Edge, Bounds3D } from '@faicad/faijs/brepjs-compat';\n\n/** Which edge of a flat a child flange folds off. */\nexport type FlatSide = 'xmin' | 'xmax' | 'ymin' | 'ymax';\n\n/**\n * Reference to the parent edge a flange folds from. `faceIndex` keeps the legacy\n * construction-order scheme (`face-0` = base flat). `parentId` names the parent\n * flat directly (a flange id for chained flanges, or undefined for the base) and\n * `side`/`offset`/`extent` locate the flange along that parent edge — the data\n * the recursive unfold walk and the feature tree consume.\n */\nexport type EdgeRef = {\n kind: 'index';\n faceIndex: number;\n edgeIndex: number;\n parentId?: string | undefined;\n side?: FlatSide | undefined;\n offset?: number | undefined;\n extent?: number | undefined;\n};\n\n/** Bend-deduction rule: a bend's inner radius plus its K-factor, with an optional\n * allowance, deduction, or bend-table reference as the length-compensation basis. */\nexport interface BendRule {\n innerRadius: number;\n kFactor: number;\n allowance?: number | undefined;\n deduction?: number | undefined;\n bendTableRef?: string | undefined;\n}\n\n/** A stock material: a name and thickness, plus the default {@link BendRule} applied\n * to bends made from it. */\nexport interface MaterialSpec {\n name: string;\n thickness: number;\n defaultRule: BendRule;\n}\n\n/** Miter between two adjacent flange ends: a cut gap, with `style` currently always\n * `'auto'` (the corner geometry is derived automatically). */\nexport interface MiterSpec {\n gap: number;\n style: 'auto';\n}\n\n/** A single bend in the folded part: a 3D fold axis (origin + direction), the bend\n * angle and direction, and the {@link BendRule} used to develop it. */\nexport interface BendFeature {\n id: string;\n axisOrigin: [number, number, number];\n axisDir: [number, number, number];\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n}\n\n/** A flange folded up from an edge of a parent flat (the base or another flange):\n * length, span, angle, optional miter, and the {@link BendRule} it folds with. */\nexport interface FlangeFeature {\n id: string;\n baseEdge: EdgeRef;\n length: number;\n /** Extent along the bend axis — the flange's cross-width in the developed strip. */\n span: number;\n /** Start position of the flange measured along the parent edge (0 = edge start). */\n offset?: number | undefined;\n angleDeg: number;\n direction?: 'up' | 'down' | undefined;\n rule: BendRule;\n /** World-space AABB of the folded flange, recorded by {@link authorPart} from the\n * real placed geometry. The collision check prefers this over an analytic re-fold,\n * which is only correct for root flanges (chained flanges fold off an off-plane edge). */\n foldedBounds?: Bounds3D | undefined;\n miter?: MiterSpec | undefined;\n}\n\n/** A recorded corner miter between two perpendicular flanges. */\nexport interface CornerMiter {\n flangeA: string;\n flangeB: string;\n gap: number;\n}\n\n/**\n * A relief cut to make a multi-bend part manufacturable. `shape` records the intent:\n * `rectangular` is a plain slot, `obround` the rounded-slot (semicircular-ended,\n * lower-stress) standard relief. In this version both produce rectangular geometry —\n * `obround` only carries the rounded-end intent onto the recorded feature; the\n * developed notch and 3D cut are rectangular for both. `width` runs along the parent\n * edge (the slot's narrow extent, default ≈ material thickness); `depth` cuts\n * perpendicular into the parent flat (default ≈ the bend's developed length plus a\n * small clearance). For a corner relief, `width` sets the square notch side (default\n * ≈ depth).\n */\nexport interface ReliefSpec {\n shape: 'rectangular' | 'obround';\n width?: number | undefined;\n depth?: number | undefined;\n}\n\n/**\n * A recorded relief, mirroring {@link CornerMiter}: enough information for the\n * unfold to replay the 2D notch without reparsing geometry. `kind` distinguishes a\n * bend relief (a slot at each end of a partial bend line, into the parent flat)\n * from a corner relief (a notch at the shared corner of two flanges). `notches`\n * are the developed-plane (flat-pattern) rectangles to subtract from the outline;\n * each is also cut from the 3D solid. `shape` carries the rounded-end option onto\n * the developed outline.\n */\nexport interface ReliefFeature {\n kind: 'bend' | 'corner';\n shape: 'rectangular' | 'obround';\n /** The flange the relief was applied to (bend relief) or the first flange (corner relief). */\n flangeA: string;\n /** The second flange of a corner relief; undefined for a bend relief. */\n flangeB?: string | undefined;\n width: number;\n depth: number;\n /** Developed-plane notch rectangles `[x0, y0, x1, y1]` subtracted from the outline. */\n notches: [number, number, number, number][];\n}\n\n/**\n * A 2D feature punched through a named flat region's thickness, in that region's\n * LOCAL frame: the origin is the region frame origin, `+x` runs along the region's\n * `u` axis and `+y` along its `v` axis (so `(0,0)` is the region's near corner).\n * `region` is a flange id, or `'root'`/`'base'` for the base flat.\n *\n * - `hole` — a circular hole centred at `(x, y)`.\n * - `slot` — a slot centred at `(x, y)`, `length` along the slot axis by `width`\n * across; `angleDeg` rotates the slot in-plane (CCW about its centre);\n * `round` makes the ends semicircular (obround) rather than square.\n * - `polygon`— an arbitrary closed polygon given by its local `points` (≥ 3).\n *\n * `region` names the flat the cutout sits on: a flange id, or `'root'`/`'base'`/\n * `'face-0'` for the base flat (the three base aliases the rest of the package\n * accepts). Coordinates are region-local: `+x` along the bend axis, `+y` along the\n * run, origin at the region's frame origin.\n */\nexport type CutoutSpec =\n | { kind: 'hole'; region: string; x: number; y: number; diameter: number }\n | {\n kind: 'slot';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n angleDeg?: number | undefined;\n round?: boolean | undefined;\n }\n | { kind: 'polygon'; region: string; points: [number, number][] };\n\n/**\n * A recorded cutout, mirroring {@link ReliefFeature}: enough to replay the 2D loop\n * in the developed pattern without re-deriving geometry. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold); `loop`\n * is the closed cutout boundary already mapped into developed-plane coordinates via\n * the region's unfold frame; `area` is the loop's enclosed area, subtracted from the\n * developed area.\n */\nexport interface CutoutFeature {\n spec: CutoutSpec;\n /** The region (flange id, or `'root'`) the cutout was applied to. */\n region: string;\n /** Closed cutout boundary `[x, y]` in the developed (flat-pattern) plane. */\n loop: [number, number][];\n /** Enclosed area of the loop. */\n area: number;\n}\n\n/**\n * A rectangular tab: additive material extending OUTWARD from a flat region's edge\n * (the additive counterpart of a cutout). `region` names the flat (a flange id, or\n * `'base'`/`'root'` for the base); `side` is the region-local edge it protrudes\n * from; `offset` is its start position along that edge and `width` its extent along\n * it; `length` is how far it sticks out past the edge. The tab is full thickness.\n */\nexport interface TabSpec {\n region: string;\n side: FlatSide;\n offset: number;\n width: number;\n length: number;\n}\n\n/**\n * A recorded tab, mirroring {@link CutoutFeature}: enough to replay the developed\n * protrusion and re-fuse the 3D material on a re-fold. `rect` is the developed-plane\n * rectangle `[x0, y0, x1, y1]` added to the outer outline; `area` is its area, added\n * to the developed area.\n */\nexport interface TabFeature {\n spec: TabSpec;\n /** The region (flange id, or `'root'`) the tab protrudes from. */\n region: string;\n /** Developed-plane protrusion rectangle `[x0, y0, x1, y1]`. */\n rect: [number, number, number, number];\n /** Area of the protrusion rectangle (`width · length`). */\n area: number;\n}\n\n/**\n * A form feature: a louver (vent flap) or an emboss/dimple (round bump), formed\n * locally on a flat region's face. Forms do not remove or add net material, so the\n * developed outline is unchanged; the flat pattern carries the fabrication markers\n * (the louver U-cut + hinge line, the emboss footprint circle) on a FORM layer.\n *\n * - `louver` — a vent cut on three sides with the flap formed up along the hinge.\n * `length` runs along the hinge, `width` is the flap depth (perpendicular), and\n * `height` is how far the flap rises. `direction` picks the formed face (`up` =\n * +n, the default).\n * - `emboss` / `dimple` — a round local form of `diameter` rising (`emboss`) or\n * recessed (`dimple`) by `height`.\n *\n * Coordinates are region-local: `(x, y)` is the form centre, `+x` along the region\n * `u` axis, `+y` along `v`.\n */\nexport type FormSpec =\n | {\n kind: 'louver';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down' | undefined;\n }\n | {\n kind: 'emboss';\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n form: 'dimple' | 'emboss';\n };\n\n/**\n * A recorded form feature, mirroring {@link CutoutFeature}. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold). `cuts`\n * are OPEN developed-plane cut paths: the louver's three cut sides — all but the\n * {@link FormFeature.hinge} side — as an open polyline the fabricator cuts to free\n * the flap; empty for an emboss/dimple, which removes no material. `markers` are\n * closed developed-plane marker loops (the emboss/dimple footprint circle; empty for\n * a louver). `hinge` is the developed-plane fold segment of a louver — the one\n * footprint side NOT cut — and is `undefined` for an emboss/dimple.\n */\nexport interface FormFeature {\n spec: FormSpec;\n /** The region (flange id, or `'root'`) the form sits on. */\n region: string;\n /** Developed-plane cut paths (open) a fabricator cuts; empty for embosses. */\n cuts: [number, number][][];\n /** Developed-plane marker loops (closed) for the FORM layer. */\n markers: [number, number][][];\n /** Developed-plane hinge segment `[a, b]` for a louver; undefined otherwise. */\n hinge?: [[number, number], [number, number]] | undefined;\n}\n\n/**\n * One segment of a contour-flange profile: an open 2D polyline of straight `line`\n * runs joined by circular-`arc` bends, swept along a straight base edge. A `line`\n * is a flat leg of `length`; an `arc` is a bend of `radius` turning `angleDeg`\n * either `up` (toward the parent normal) or `down`. Each arc becomes a recorded\n * {@link BendFeature}; each line a flat leg of the developed strip.\n */\nexport type ProfileSegment =\n | { kind: 'line'; length: number }\n | { kind: 'arc'; radius: number; angleDeg: number; direction: 'up' | 'down' };\n\n/**\n * A contour flange: an OPEN 2D profile (alternating line/arc {@link ProfileSegment}s)\n * swept along a straight edge of the base flat (`side`). Unlike a plain flange (one\n * bend + one flat) this chains an arbitrary multi-bend cross-section — a return, a\n * hat/top-hat, a J — in one feature. The development is EXACT: the developed strip\n * length is the sum of each segment's developed length (lines: `length`; arcs: the\n * canonical {@link bendAllowance}).\n */\nexport interface ContourFlangeSpec {\n id: string;\n side: FlatSide;\n profile: ProfileSegment[];\n rule?: BendRule | undefined;\n /** Extent along the base edge (the bend-axis width). Default = full edge length. */\n width?: number | undefined;\n /** Start position along the base edge. Default `0`. */\n offset?: number | undefined;\n}\n\n/**\n * A recorded contour flange, mirroring {@link FlangeFeature}: enough for the unfold\n * to lay the developed strip out straight along the base edge without re-deriving\n * the 3D geometry. `segments` carries each developed segment in order (a flat leg or\n * a developed bend arc); `developedLength` is their exact sum (the strip length out\n * from the base edge); `span`/`offset` locate the strip along the base edge.\n */\nexport interface ContourFlangeFeature {\n id: string;\n side: FlatSide;\n /** Start position along the base edge. */\n offset: number;\n /** Extent along the base edge (the developed strip width). */\n span: number;\n /** Exact developed length out from the base edge (Σ segment developed lengths). */\n developedLength: number;\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A lofted / ruled transition flange: a ruled surface lofted between two parallel\n * OPEN profiles (`profileA`, `profileB`) separated by `height` along +Z, thickened\n * to a valid solid. The development is by TRIANGULATION — the standard sheet-metal\n * transition development pairing profile vertices into triangles laid flat\n * preserving edge lengths. Exact to tolerance for a genuinely developable (single-\n * curvature, straight-generator) transition; an approximation otherwise, in which\n * case the unfold emits a {@link SheetMetalWarning} `DEVELOPMENT_APPROXIMATE`.\n */\nexport interface LoftedFlangeSpec {\n id: string;\n /** Open polyline of the near profile, in the base plane (z = 0). */\n profileA: [number, number][];\n /** Open polyline of the far profile (its z is `height`). */\n profileB: [number, number][];\n height: number;\n thickness?: number | undefined;\n}\n\n/**\n * A recorded lofted flange, mirroring {@link ContourFlangeFeature}. `developedLoop`\n * is the triangulated flat boundary (a closed developed-plane polygon); `developedArea`\n * the summed triangle areas; `approximate` flags a non-developable transition the\n * triangulated development only approximates (the unfold emits the warning).\n */\nexport interface LoftedFlangeFeature {\n id: string;\n /** Triangulated developed boundary `[x, y]` (closed) in the developed plane. */\n developedLoop: [number, number][];\n /** Summed area of the triangulated development. */\n developedArea: number;\n /** True when the transition is not developable; the development is an approximation. */\n approximate: boolean;\n}\n\n/**\n * A hem: an edge folded back ~180°+ onto its parent flat, then running a short\n * return leg. `region` names the flat the hem folds off (a flange id, or\n * `'base'`/`'root'` for the base flat); `side` is that region's local edge. The\n * four `type`s set the curl angle and the gap between the return and the parent:\n *\n * - `closed` — a tight ~180° fold, the return runs flat against the parent\n * (`gap ≈ 0`; a HAIR clearance keeps the fused solid valid). `length` is the\n * return-leg length out along the parent.\n * - `open` — a ~180° fold with a `gap` (defaults to `radius`) between the\n * return and the parent, the return running parallel offset by the gap.\n * - `teardrop` — a >180° curl leaving a small teardrop opening, then a short\n * return tangent to the curl.\n * - `rolled` — a full ~270° circular roll (a curled edge / safe edge), no return.\n *\n * `radius` is the inner bend radius (defaults to one material thickness). `gap`\n * applies to `open` only. `rule` overrides the part's per-bend allowance rule.\n */\nexport interface HemSpec {\n region: string;\n side: FlatSide;\n type: 'closed' | 'open' | 'teardrop' | 'rolled';\n /** Optional unique id; defaults to `hem-<region>-<side>-<type>`. Set this to\n * place more than one hem of the same type on the same region edge (e.g. at\n * different offsets). Must not contain `::`. */\n id?: string | undefined;\n /** Return-leg length out along the parent. Required for closed/open/teardrop. */\n length?: number | undefined;\n /** Inner bend radius. Default = one thickness (closed defaults to ≈0, just the\n * HAIR clearance, so it folds flat). */\n radius?: number | undefined;\n /** Open-hem physical clear distance between the return and the parent (the inner\n * radius is set to gap/2). Default = one thickness. */\n gap?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded hem, mirroring {@link ContourFlangeFeature}: enough for the unfold to\n * lay its developed strip out straight along the parent edge. `subBends` are the\n * `hem::<id>::<n>` curl bends (one per ≤180° sub-arc); `returnLength` is the flat\n * return leg past the curl. `developedLength` is the EXACT strip length out from\n * the edge: Σ curl bend allowances + `returnLength`. `segments` mirrors the\n * contour-flange developed segment list (a flat leg or a developed bend arc), so\n * the unfold lays bend lines at their exact cumulative developed offsets.\n */\nexport interface HemFeature {\n id: string;\n type: HemSpec['type'];\n /** The flat region the hem folds off (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n /** Start position along the parent edge. */\n offset: number;\n /** Extent along the parent edge (the developed strip width). */\n span: number;\n /** Flat return-leg length past the curl (0 for a rolled hem). */\n returnLength: number;\n /** Exact developed length out from the parent edge (Σ curl allowances + return). */\n developedLength: number;\n subBends: string[];\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A jog (joggle): two opposite bends (`+θ` then `−θ`) that step a flat by\n * `offsetHeight` perpendicular to its plane, then continue parallel past the step.\n * `region` names the flat the jog runs across (a flange id, or `'base'`/`'root'`);\n * `side` is the region edge the jog develops out from; `position` is how far out\n * along the run the jog sits; `offsetHeight` is the Z-step the two bends produce.\n * `angle` (default 45°) is the magnitude of each bend — a shallower angle gives a\n * longer, gentler step; the connecting step run is `offsetHeight / sin(angle)`.\n * `runOut` is the flat leg continuing past the second bend. `rule` overrides the\n * per-bend allowance rule.\n */\nexport interface JogSpec {\n region: string;\n side: FlatSide;\n /** Optional unique id; defaults to `jog-<region>-<side>`. Set this to place more\n * than one jog on the same region edge (e.g. at different positions). Must not\n * contain `::`. */\n id?: string | undefined;\n /** Distance out along the run from the region edge to the first bend. */\n position: number;\n /** The perpendicular step the two opposite bends produce. Must be > 0. */\n offsetHeight: number;\n /** Magnitude of each opposite bend, in degrees (0, 90). Default `45`. */\n angle?: number | undefined;\n /** Flat leg continuing past the second bend. Default = `position`. */\n runOut?: number | undefined;\n /** Inner bend radius. Default = one material thickness. */\n radius?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded jog, mirroring {@link HemFeature}. `bends` are the two opposite curl\n * bends (`jog::<id>::0` up, `jog::<id>::1` down); `offsetHeight` is the requested\n * perpendicular step; `segments` is the developed leg/arc list (position leg →\n * up bend → step run → down bend → runOut leg). `developedLength` is the exact\n * strip length out from the edge (Σ legs + Σ bend allowances).\n */\nexport interface JogFeature {\n id: string;\n /** The flat region the jog runs across (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n offset: number;\n span: number;\n offsetHeight: number;\n angleDeg: number;\n developedLength: number;\n bends: string[];\n segments: {\n kind: 'line' | 'arc';\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n bendId?: string | undefined;\n }[];\n}\n\n/** A fully-defined sheet-metal part: thickness, base-flat extents, material, and the\n * feature lists (flanges, bends, reliefs, cutouts, tabs, forms, …) that build it. */\nexport interface SheetMetalPart {\n thickness: number;\n /** Base flat extent along +X (x∈[0, baseLength]); the east-run length. */\n baseLength: number;\n /** Base flat cross-width (extent perpendicular to the run); the developed-strip width. */\n width: number;\n material?: MaterialSpec | undefined;\n flanges: FlangeFeature[];\n bends: BendFeature[];\n solid?: Solid | undefined;\n miters?: CornerMiter[] | undefined;\n reliefs?: ReliefFeature[] | undefined;\n cutouts?: CutoutFeature[] | undefined;\n tabs?: TabFeature[] | undefined;\n forms?: FormFeature[] | undefined;\n contourFlanges?: ContourFlangeFeature[] | undefined;\n loftedFlanges?: LoftedFlangeFeature[] | undefined;\n hems?: HemFeature[] | undefined;\n jogs?: JogFeature[] | undefined;\n}\n\n/** The developed 2D flat of a part: the outer outline, fold bend-lines, interior\n * cutouts, form cut/marker/hinge annotations, lofted developments, and area. */\nexport interface FlatPattern {\n outline: Wire;\n bendLines: {\n id: string;\n line: Edge;\n angleDeg: number;\n direction: 'up' | 'down';\n /** Unit direction in the developed plane pointing into the parent flat (the\n * side a bend relief notches), opposite the develop-out direction. */\n inward: [number, number];\n }[];\n /** Interior cutout loops (holes/slots/polygons) as closed wires in the developed plane. */\n holes: Wire[];\n /** Form cut paths (louver U-cuts) a fabricator cuts before forming, as open wires\n * (the three non-hinge sides; the hinge rides in {@link FlatPattern.formHinges}). */\n formCuts: Wire[];\n /** Form marker loops (emboss/dimple footprints) for annotation, as closed wires. */\n formMarkers: Wire[];\n /** Form hinge lines (louver fold lines) for annotation, as edges. */\n formHinges: Edge[];\n /**\n * Lofted/ruled transition developed boundaries, as closed wires in the developed\n * plane (one per recorded {@link LoftedFlangeFeature}). The outline laid out by the\n * rectilinear union covers the base + straight flanges; a ruled transition's\n * triangulated development is non-rectilinear and rides here instead.\n */\n loftedDevelopments: Wire[];\n developedArea: number;\n}\n\n/** Per-bend summary of a development: each bend's radius, allowance and flat length,\n * plus the overall flat-pattern size. */\nexport interface BendReport {\n bends: {\n id: string;\n angleDeg: number;\n radius: number;\n allowance: number;\n flatLength: number;\n direction: 'up' | 'down';\n }[];\n totalFlatSize: [number, number];\n}\n\n/** A non-fatal problem encountered while unfolding or nesting a part: a\n * machine-readable code, a human message, and an optional offending feature id. */\nexport type SheetMetalWarning = {\n code:\n | 'COLLISION'\n | 'SEAM_CUT'\n | 'MIN_RADIUS'\n | 'INVALID_SOLID'\n | 'MITER_NOT_DEVELOPED'\n | 'DEVELOPMENT_APPROXIMATE'\n /** Foreign unfold: a face is outside the supported planar/cylindrical class\n * (unknown surface type, or a cylinder that didn't fit) and was ignored. */\n | 'UNSUPPORTED_FACE'\n /** Foreign unfold: the part is a valid solid but its detected structure is\n * incomplete (non-uniform thickness, a dropped panel, or a bend not joining\n * exactly two flats), so the flat pattern may be partial. */\n | 'DETECTION_INCOMPLETE'\n /** A bend-table query fell outside the tabulated (thickness, radius, angle)\n * range and was clamped to the nearest entry (no extrapolation). Distinct from\n * MIN_RADIUS, which means a bend's inner radius is below one thickness. */\n | 'TABLE_CLAMP'\n /** Nesting: a flat pattern's outline bounding box does not fit the usable stock\n * sheet (sheet minus margin) even rotated 90°, so it was left unplaced. */\n | 'PART_TOO_LARGE';\n message: string;\n featureId?: string | undefined;\n};\n\n/** The outcome of unfolding a part: the {@link FlatPattern}, its {@link BendReport},\n * and any {@link SheetMetalWarning}s raised along the way. */\nexport interface UnfoldResult {\n pattern: FlatPattern;\n report: BendReport;\n warnings: SheetMetalWarning[];\n}\n\n/**\n * One fold-up region in a {@link FlatInput}: a rectangle in the flat pattern that\n * folds about a fold line off its parent region (the base by default, or another\n * region via `parent`). The region-tree is the inverse of the unfold layout, and is\n * recovered purely from the 2D flat-pattern geometry by `patternToFlatInput` — so\n * folding it up just re-runs the forward author geometry. `side`/`offset`/`width`\n * locate the fold line along the parent edge exactly as the authoring `FlangeSpec`\n * does (`side` is expressed in the parent region's local frame).\n */\nexport interface FoldRegion {\n id: string;\n /** Flat extent of the region away from the fold line (becomes the flange length). */\n length: number;\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n /** Which edge of the parent region this region folds off. Default `'xmax'`. */\n side?: FlatSide | undefined;\n /** Id of another fold region this one chains off. Default = base region. */\n parent?: string | undefined;\n /** Start position along the parent edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the parent edge. Default = full parent-edge length. */\n width?: number | undefined;\n miter?: MiterSpec | undefined;\n /** Bend relief to add at this region's partial-span fold-line ends after folding. */\n bendRelief?: ReliefSpec | undefined;\n /** Cutouts to punch into this region (in region-local coords) after folding. */\n cutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto this region's edges (in region-local coords) after folding. */\n tabs?: TabSpec[] | undefined;\n /** Form features (louvers / embosses) on this region (region-local) after folding. */\n forms?: FormSpec[] | undefined;\n}\n\n/**\n * A flat pattern to fold up into a 3D part: the base region (a rectangle) plus a\n * tree of {@link FoldRegion}s, each folding off its parent about a fold line. This\n * is the inverse of {@link unfold}: a region-tree rather than a 2D outline, which\n * avoids fragile auto-partitioning of an arbitrary developed polygon and maps\n * one-to-one onto the authored feature tree.\n */\nexport interface FlatInput {\n thickness: number;\n /** Base region extent along +X (the run). */\n baseLength: number;\n /** Base region extent along +Y (the developed-strip width). */\n width: number;\n material?: MaterialSpec | undefined;\n regions: FoldRegion[];\n /** Cutouts to punch into the base region (in base-local coords) after folding. */\n baseCutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto the base region's edges (in base-local coords) after folding. */\n baseTabs?: TabSpec[] | undefined;\n /** Form features on the base region (base-local coords) after folding. */\n baseForms?: FormSpec[] | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {SolidShape, CurveShape} from '@faicad/faijs/api';\n\n/** faijs 建模链产物(core-decouple wrapup §2.2):brepjs `Solid` 的 faijs 等价。\n * 建模 op 均为 faijs 异步 op,产物统一为 `SolidShape`。 */\nexport type Solid = SolidShape;\n\n/** 有效实体别名(断言实体性的调用点保留,等价 `SolidShape`)。 */\nexport type ValidSolid = SolidShape;\n\n/** faijs 曲线形状(edge / wire)——brepjs `Wire` 的 faijs 等价。 */\nexport type Wire = CurveShape;\n\n/** faijs 曲线形状(edge)——brepjs `Edge` 的 faijs 等价。 */\nexport type Edge = CurveShape;\n\n/** faijs 面(携带面句柄的 solid shape)——brepjs `Face` 的 faijs 等价。 */\nexport type Face = SolidShape;\n\n/** 轴对齐包围盒(大写字段形态;由 faijs `bounds3D`(brep 引擎包围盒)组合,见 geometryOps.getBounds)。 */\nexport interface Bounds3D {\n xMin: number;\n xMax: number;\n yMin: number;\n yMax: number;\n zMin: number;\n zMax: number;\n}\n\n/** Which edge of a flat a child flange folds off. */\nexport type FlatSide = 'xmin' | 'xmax' | 'ymin' | 'ymax';\n\n/**\n * Reference to the parent edge a flange folds from. `faceIndex` keeps the legacy\n * construction-order scheme (`face-0` = base flat). `parentId` names the parent\n * flat directly (a flange id for chained flanges, or undefined for the base) and\n * `side`/`offset`/`extent` locate the flange along that parent edge — the data\n * the recursive unfold walk and the feature tree consume.\n */\nexport type EdgeRef = {\n kind: 'index';\n faceIndex: number;\n edgeIndex: number;\n parentId?: string | undefined;\n side?: FlatSide | undefined;\n offset?: number | undefined;\n extent?: number | undefined;\n};\n\n/** Bend-deduction rule: a bend's inner radius plus its K-factor, with an optional\n * allowance, deduction, or bend-table reference as the length-compensation basis. */\nexport interface BendRule {\n innerRadius: number;\n kFactor: number;\n allowance?: number | undefined;\n deduction?: number | undefined;\n bendTableRef?: string | undefined;\n}\n\n/** A stock material: a name and thickness, plus the default {@link BendRule} applied\n * to bends made from it. */\nexport interface MaterialSpec {\n name: string;\n thickness: number;\n defaultRule: BendRule;\n}\n\n/** Miter between two adjacent flange ends: a cut gap, with `style` currently always\n * `'auto'` (the corner geometry is derived automatically). */\nexport interface MiterSpec {\n gap: number;\n style: 'auto';\n}\n\n/** A single bend in the folded part: a 3D fold axis (origin + direction), the bend\n * angle and direction, and the {@link BendRule} used to develop it. */\nexport interface BendFeature {\n id: string;\n axisOrigin: [number, number, number];\n axisDir: [number, number, number];\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n}\n\n/** A flange folded up from an edge of a parent flat (the base or another flange):\n * length, span, angle, optional miter, and the {@link BendRule} it folds with. */\nexport interface FlangeFeature {\n id: string;\n baseEdge: EdgeRef;\n length: number;\n /** Extent along the bend axis — the flange's cross-width in the developed strip. */\n span: number;\n /** Start position of the flange measured along the parent edge (0 = edge start). */\n offset?: number | undefined;\n angleDeg: number;\n direction?: 'up' | 'down' | undefined;\n rule: BendRule;\n /** World-space AABB of the folded flange, recorded by {@link authorPart} from the\n * real placed geometry. The collision check prefers this over an analytic re-fold,\n * which is only correct for root flanges (chained flanges fold off an off-plane edge). */\n foldedBounds?: Bounds3D | undefined;\n miter?: MiterSpec | undefined;\n}\n\n/** A recorded corner miter between two perpendicular flanges. */\nexport interface CornerMiter {\n flangeA: string;\n flangeB: string;\n gap: number;\n}\n\n/**\n * A relief cut to make a multi-bend part manufacturable. `shape` records the intent:\n * `rectangular` is a plain slot, `obround` the rounded-slot (semicircular-ended,\n * lower-stress) standard relief. In this version both produce rectangular geometry —\n * `obround` only carries the rounded-end intent onto the recorded feature; the\n * developed notch and 3D cut are rectangular for both. `width` runs along the parent\n * edge (the slot's narrow extent, default ≈ material thickness); `depth` cuts\n * perpendicular into the parent flat (default ≈ the bend's developed length plus a\n * small clearance). For a corner relief, `width` sets the square notch side (default\n * ≈ depth).\n */\nexport interface ReliefSpec {\n shape: 'rectangular' | 'obround';\n width?: number | undefined;\n depth?: number | undefined;\n}\n\n/**\n * A recorded relief, mirroring {@link CornerMiter}: enough information for the\n * unfold to replay the 2D notch without reparsing geometry. `kind` distinguishes a\n * bend relief (a slot at each end of a partial bend line, into the parent flat)\n * from a corner relief (a notch at the shared corner of two flanges). `notches`\n * are the developed-plane (flat-pattern) rectangles to subtract from the outline;\n * each is also cut from the 3D solid. `shape` carries the rounded-end option onto\n * the developed outline.\n */\nexport interface ReliefFeature {\n kind: 'bend' | 'corner';\n shape: 'rectangular' | 'obround';\n /** The flange the relief was applied to (bend relief) or the first flange (corner relief). */\n flangeA: string;\n /** The second flange of a corner relief; undefined for a bend relief. */\n flangeB?: string | undefined;\n width: number;\n depth: number;\n /** Developed-plane notch rectangles `[x0, y0, x1, y1]` subtracted from the outline. */\n notches: [number, number, number, number][];\n}\n\n/**\n * A 2D feature punched through a named flat region's thickness, in that region's\n * LOCAL frame: the origin is the region frame origin, `+x` runs along the region's\n * `u` axis and `+y` along its `v` axis (so `(0,0)` is the region's near corner).\n * `region` is a flange id, or `'root'`/`'base'` for the base flat.\n *\n * - `hole` — a circular hole centred at `(x, y)`.\n * - `slot` — a slot centred at `(x, y)`, `length` along the slot axis by `width`\n * across; `angleDeg` rotates the slot in-plane (CCW about its centre);\n * `round` makes the ends semicircular (obround) rather than square.\n * - `polygon`— an arbitrary closed polygon given by its local `points` (≥ 3).\n *\n * `region` names the flat the cutout sits on: a flange id, or `'root'`/`'base'`/\n * `'face-0'` for the base flat (the three base aliases the rest of the package\n * accepts). Coordinates are region-local: `+x` along the bend axis, `+y` along the\n * run, origin at the region's frame origin.\n */\nexport type CutoutSpec =\n | { kind: 'hole'; region: string; x: number; y: number; diameter: number }\n | {\n kind: 'slot';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n angleDeg?: number | undefined;\n round?: boolean | undefined;\n }\n | { kind: 'polygon'; region: string; points: [number, number][] };\n\n/**\n * A recorded cutout, mirroring {@link ReliefFeature}: enough to replay the 2D loop\n * in the developed pattern without re-deriving geometry. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold); `loop`\n * is the closed cutout boundary already mapped into developed-plane coordinates via\n * the region's unfold frame; `area` is the loop's enclosed area, subtracted from the\n * developed area.\n */\nexport interface CutoutFeature {\n spec: CutoutSpec;\n /** The region (flange id, or `'root'`) the cutout was applied to. */\n region: string;\n /** Closed cutout boundary `[x, y]` in the developed (flat-pattern) plane. */\n loop: [number, number][];\n /** Enclosed area of the loop. */\n area: number;\n}\n\n/**\n * A rectangular tab: additive material extending OUTWARD from a flat region's edge\n * (the additive counterpart of a cutout). `region` names the flat (a flange id, or\n * `'base'`/`'root'` for the base); `side` is the region-local edge it protrudes\n * from; `offset` is its start position along that edge and `width` its extent along\n * it; `length` is how far it sticks out past the edge. The tab is full thickness.\n */\nexport interface TabSpec {\n region: string;\n side: FlatSide;\n offset: number;\n width: number;\n length: number;\n}\n\n/**\n * A recorded tab, mirroring {@link CutoutFeature}: enough to replay the developed\n * protrusion and re-fuse the 3D material on a re-fold. `rect` is the developed-plane\n * rectangle `[x0, y0, x1, y1]` added to the outer outline; `area` is its area, added\n * to the developed area.\n */\nexport interface TabFeature {\n spec: TabSpec;\n /** The region (flange id, or `'root'`) the tab protrudes from. */\n region: string;\n /** Developed-plane protrusion rectangle `[x0, y0, x1, y1]`. */\n rect: [number, number, number, number];\n /** Area of the protrusion rectangle (`width · length`). */\n area: number;\n}\n\n/**\n * A form feature: a louver (vent flap) or an emboss/dimple (round bump), formed\n * locally on a flat region's face. Forms do not remove or add net material, so the\n * developed outline is unchanged; the flat pattern carries the fabrication markers\n * (the louver U-cut + hinge line, the emboss footprint circle) on a FORM layer.\n *\n * - `louver` — a vent cut on three sides with the flap formed up along the hinge.\n * `length` runs along the hinge, `width` is the flap depth (perpendicular), and\n * `height` is how far the flap rises. `direction` picks the formed face (`up` =\n * +n, the default).\n * - `emboss` / `dimple` — a round local form of `diameter` rising (`emboss`) or\n * recessed (`dimple`) by `height`.\n *\n * Coordinates are region-local: `(x, y)` is the form centre, `+x` along the region\n * `u` axis, `+y` along `v`.\n */\nexport type FormSpec =\n | {\n kind: 'louver';\n region: string;\n x: number;\n y: number;\n length: number;\n width: number;\n height: number;\n direction?: 'up' | 'down' | undefined;\n }\n | {\n kind: 'emboss';\n region: string;\n x: number;\n y: number;\n diameter: number;\n height: number;\n form: 'dimple' | 'emboss';\n };\n\n/**\n * A recorded form feature, mirroring {@link CutoutFeature}. `spec` is the original\n * region-local feature (so {@link FoldRegion} can re-apply it on a re-fold). `cuts`\n * are OPEN developed-plane cut paths: the louver's three cut sides — all but the\n * {@link FormFeature.hinge} side — as an open polyline the fabricator cuts to free\n * the flap; empty for an emboss/dimple, which removes no material. `markers` are\n * closed developed-plane marker loops (the emboss/dimple footprint circle; empty for\n * a louver). `hinge` is the developed-plane fold segment of a louver — the one\n * footprint side NOT cut — and is `undefined` for an emboss/dimple.\n */\nexport interface FormFeature {\n spec: FormSpec;\n /** The region (flange id, or `'root'`) the form sits on. */\n region: string;\n /** Developed-plane cut paths (open) a fabricator cuts; empty for embosses. */\n cuts: [number, number][][];\n /** Developed-plane marker loops (closed) for the FORM layer. */\n markers: [number, number][][];\n /** Developed-plane hinge segment `[a, b]` for a louver; undefined otherwise. */\n hinge?: [[number, number], [number, number]] | undefined;\n}\n\n/**\n * One segment of a contour-flange profile: an open 2D polyline of straight `line`\n * runs joined by circular-`arc` bends, swept along a straight base edge. A `line`\n * is a flat leg of `length`; an `arc` is a bend of `radius` turning `angleDeg`\n * either `up` (toward the parent normal) or `down`. Each arc becomes a recorded\n * {@link BendFeature}; each line a flat leg of the developed strip.\n */\nexport type ProfileSegment =\n | { kind: 'line'; length: number }\n | { kind: 'arc'; radius: number; angleDeg: number; direction: 'up' | 'down' };\n\n/**\n * A contour flange: an OPEN 2D profile (alternating line/arc {@link ProfileSegment}s)\n * swept along a straight edge of the base flat (`side`). Unlike a plain flange (one\n * bend + one flat) this chains an arbitrary multi-bend cross-section — a return, a\n * hat/top-hat, a J — in one feature. The development is EXACT: the developed strip\n * length is the sum of each segment's developed length (lines: `length`; arcs: the\n * canonical {@link bendAllowance}).\n */\nexport interface ContourFlangeSpec {\n id: string;\n side: FlatSide;\n profile: ProfileSegment[];\n rule?: BendRule | undefined;\n /** Extent along the base edge (the bend-axis width). Default = full edge length. */\n width?: number | undefined;\n /** Start position along the base edge. Default `0`. */\n offset?: number | undefined;\n}\n\n/**\n * A recorded contour flange, mirroring {@link FlangeFeature}: enough for the unfold\n * to lay the developed strip out straight along the base edge without re-deriving\n * the 3D geometry. `segments` carries each developed segment in order (a flat leg or\n * a developed bend arc); `developedLength` is their exact sum (the strip length out\n * from the base edge); `span`/`offset` locate the strip along the base edge.\n */\nexport interface ContourFlangeFeature {\n id: string;\n side: FlatSide;\n /** Start position along the base edge. */\n offset: number;\n /** Extent along the base edge (the developed strip width). */\n span: number;\n /** Exact developed length out from the base edge (Σ segment developed lengths). */\n developedLength: number;\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A lofted / ruled transition flange: a ruled surface lofted between two parallel\n * OPEN profiles (`profileA`, `profileB`) separated by `height` along +Z, thickened\n * to a valid solid. The development is by TRIANGULATION — the standard sheet-metal\n * transition development pairing profile vertices into triangles laid flat\n * preserving edge lengths. Exact to tolerance for a genuinely developable (single-\n * curvature, straight-generator) transition; an approximation otherwise, in which\n * case the unfold emits a {@link SheetMetalWarning} `DEVELOPMENT_APPROXIMATE`.\n */\nexport interface LoftedFlangeSpec {\n id: string;\n /** Open polyline of the near profile, in the base plane (z = 0). */\n profileA: [number, number][];\n /** Open polyline of the far profile (its z is `height`). */\n profileB: [number, number][];\n height: number;\n thickness?: number | undefined;\n}\n\n/**\n * A recorded lofted flange, mirroring {@link ContourFlangeFeature}. `developedLoop`\n * is the triangulated flat boundary (a closed developed-plane polygon); `developedArea`\n * the summed triangle areas; `approximate` flags a non-developable transition the\n * triangulated development only approximates (the unfold emits the warning).\n */\nexport interface LoftedFlangeFeature {\n id: string;\n /** Triangulated developed boundary `[x, y]` (closed) in the developed plane. */\n developedLoop: [number, number][];\n /** Summed area of the triangulated development. */\n developedArea: number;\n /** True when the transition is not developable; the development is an approximation. */\n approximate: boolean;\n}\n\n/**\n * A hem: an edge folded back ~180°+ onto its parent flat, then running a short\n * return leg. `region` names the flat the hem folds off (a flange id, or\n * `'base'`/`'root'` for the base flat); `side` is that region's local edge. The\n * four `type`s set the curl angle and the gap between the return and the parent:\n *\n * - `closed` — a tight ~180° fold, the return runs flat against the parent\n * (`gap ≈ 0`; a HAIR clearance keeps the fused solid valid). `length` is the\n * return-leg length out along the parent.\n * - `open` — a ~180° fold with a `gap` (defaults to `radius`) between the\n * return and the parent, the return running parallel offset by the gap.\n * - `teardrop` — a >180° curl leaving a small teardrop opening, then a short\n * return tangent to the curl.\n * - `rolled` — a full ~270° circular roll (a curled edge / safe edge), no return.\n *\n * `radius` is the inner bend radius (defaults to one material thickness). `gap`\n * applies to `open` only. `rule` overrides the part's per-bend allowance rule.\n */\nexport interface HemSpec {\n region: string;\n side: FlatSide;\n type: 'closed' | 'open' | 'teardrop' | 'rolled';\n /** Optional unique id; defaults to `hem-<region>-<side>-<type>`. Set this to\n * place more than one hem of the same type on the same region edge (e.g. at\n * different offsets). Must not contain `::`. */\n id?: string | undefined;\n /** Return-leg length out along the parent. Required for closed/open/teardrop. */\n length?: number | undefined;\n /** Inner bend radius. Default = one thickness (closed defaults to ≈0, just the\n * HAIR clearance, so it folds flat). */\n radius?: number | undefined;\n /** Open-hem physical clear distance between the return and the parent (the inner\n * radius is set to gap/2). Default = one thickness. */\n gap?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded hem, mirroring {@link ContourFlangeFeature}: enough for the unfold to\n * lay its developed strip out straight along the parent edge. `subBends` are the\n * `hem::<id>::<n>` curl bends (one per ≤180° sub-arc); `returnLength` is the flat\n * return leg past the curl. `developedLength` is the EXACT strip length out from\n * the edge: Σ curl bend allowances + `returnLength`. `segments` mirrors the\n * contour-flange developed segment list (a flat leg or a developed bend arc), so\n * the unfold lays bend lines at their exact cumulative developed offsets.\n */\nexport interface HemFeature {\n id: string;\n type: HemSpec['type'];\n /** The flat region the hem folds off (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n /** Start position along the parent edge. */\n offset: number;\n /** Extent along the parent edge (the developed strip width). */\n span: number;\n /** Flat return-leg length past the curl (0 for a rolled hem). */\n returnLength: number;\n /** Exact developed length out from the parent edge (Σ curl allowances + return). */\n developedLength: number;\n subBends: string[];\n segments: {\n kind: 'line' | 'arc';\n /** Developed length of this segment along the strip. */\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n /** Id of the recorded {@link BendFeature} for an arc segment. */\n bendId?: string | undefined;\n }[];\n}\n\n/**\n * A jog (joggle): two opposite bends (`+θ` then `−θ`) that step a flat by\n * `offsetHeight` perpendicular to its plane, then continue parallel past the step.\n * `region` names the flat the jog runs across (a flange id, or `'base'`/`'root'`);\n * `side` is the region edge the jog develops out from; `position` is how far out\n * along the run the jog sits; `offsetHeight` is the Z-step the two bends produce.\n * `angle` (default 45°) is the magnitude of each bend — a shallower angle gives a\n * longer, gentler step; the connecting step run is `offsetHeight / sin(angle)`.\n * `runOut` is the flat leg continuing past the second bend. `rule` overrides the\n * per-bend allowance rule.\n */\nexport interface JogSpec {\n region: string;\n side: FlatSide;\n /** Optional unique id; defaults to `jog-<region>-<side>`. Set this to place more\n * than one jog on the same region edge (e.g. at different positions). Must not\n * contain `::`. */\n id?: string | undefined;\n /** Distance out along the run from the region edge to the first bend. */\n position: number;\n /** The perpendicular step the two opposite bends produce. Must be > 0. */\n offsetHeight: number;\n /** Magnitude of each opposite bend, in degrees (0, 90). Default `45`. */\n angle?: number | undefined;\n /** Flat leg continuing past the second bend. Default = `position`. */\n runOut?: number | undefined;\n /** Inner bend radius. Default = one material thickness. */\n radius?: number | undefined;\n /** Start position along the region edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the region edge. Default = full edge length. */\n width?: number | undefined;\n rule?: BendRule | undefined;\n}\n\n/**\n * A recorded jog, mirroring {@link HemFeature}. `bends` are the two opposite curl\n * bends (`jog::<id>::0` up, `jog::<id>::1` down); `offsetHeight` is the requested\n * perpendicular step; `segments` is the developed leg/arc list (position leg →\n * up bend → step run → down bend → runOut leg). `developedLength` is the exact\n * strip length out from the edge (Σ legs + Σ bend allowances).\n */\nexport interface JogFeature {\n id: string;\n /** The flat region the jog runs across (a flange id, or `'root'` for the base). */\n region: string;\n side: FlatSide;\n offset: number;\n span: number;\n offsetHeight: number;\n angleDeg: number;\n developedLength: number;\n bends: string[];\n segments: {\n kind: 'line' | 'arc';\n dev: number;\n angleDeg?: number | undefined;\n direction?: 'up' | 'down' | undefined;\n bendId?: string | undefined;\n }[];\n}\n\n/** A fully-defined sheet-metal part: thickness, base-flat extents, material, and the\n * feature lists (flanges, bends, reliefs, cutouts, tabs, forms, …) that build it. */\nexport interface SheetMetalPart {\n thickness: number;\n /** Base flat extent along +X (x∈[0, baseLength]); the east-run length. */\n baseLength: number;\n /** Base flat cross-width (extent perpendicular to the run); the developed-strip width. */\n width: number;\n material?: MaterialSpec | undefined;\n flanges: FlangeFeature[];\n bends: BendFeature[];\n solid?: Solid | undefined;\n miters?: CornerMiter[] | undefined;\n reliefs?: ReliefFeature[] | undefined;\n cutouts?: CutoutFeature[] | undefined;\n tabs?: TabFeature[] | undefined;\n forms?: FormFeature[] | undefined;\n contourFlanges?: ContourFlangeFeature[] | undefined;\n loftedFlanges?: LoftedFlangeFeature[] | undefined;\n hems?: HemFeature[] | undefined;\n jogs?: JogFeature[] | undefined;\n}\n\n/** The developed 2D flat of a part: the outer outline, fold bend-lines, interior\n * cutouts, form cut/marker/hinge annotations, lofted developments, and area. */\nexport interface FlatPattern {\n outline: Wire;\n bendLines: {\n id: string;\n line: Edge;\n angleDeg: number;\n direction: 'up' | 'down';\n /** Unit direction in the developed plane pointing into the parent flat (the\n * side a bend relief notches), opposite the develop-out direction. */\n inward: [number, number];\n }[];\n /** Interior cutout loops (holes/slots/polygons) as closed wires in the developed plane. */\n holes: Wire[];\n /** Form cut paths (louver U-cuts) a fabricator cuts before forming, as open wires\n * (the three non-hinge sides; the hinge rides in {@link FlatPattern.formHinges}). */\n formCuts: Wire[];\n /** Form marker loops (emboss/dimple footprints) for annotation, as closed wires. */\n formMarkers: Wire[];\n /** Form hinge lines (louver fold lines) for annotation, as edges. */\n formHinges: Edge[];\n /**\n * Lofted/ruled transition developed boundaries, as closed wires in the developed\n * plane (one per recorded {@link LoftedFlangeFeature}). The outline laid out by the\n * rectilinear union covers the base + straight flanges; a ruled transition's\n * triangulated development is non-rectilinear and rides here instead.\n */\n loftedDevelopments: Wire[];\n developedArea: number;\n}\n\n/** Per-bend summary of a development: each bend's radius, allowance and flat length,\n * plus the overall flat-pattern size. */\nexport interface BendReport {\n bends: {\n id: string;\n angleDeg: number;\n radius: number;\n allowance: number;\n flatLength: number;\n direction: 'up' | 'down';\n }[];\n totalFlatSize: [number, number];\n}\n\n/** A non-fatal problem encountered while unfolding or nesting a part: a\n * machine-readable code, a human message, and an optional offending feature id. */\nexport type SheetMetalWarning = {\n code:\n | 'COLLISION'\n | 'SEAM_CUT'\n | 'MIN_RADIUS'\n | 'INVALID_SOLID'\n | 'MITER_NOT_DEVELOPED'\n | 'DEVELOPMENT_APPROXIMATE'\n /** Foreign unfold: a face is outside the supported planar/cylindrical class\n * (unknown surface type, or a cylinder that didn't fit) and was ignored. */\n | 'UNSUPPORTED_FACE'\n /** Foreign unfold: the part is a valid solid but its detected structure is\n * incomplete (non-uniform thickness, a dropped panel, or a bend not joining\n * exactly two flats), so the flat pattern may be partial. */\n | 'DETECTION_INCOMPLETE'\n /** A bend-table query fell outside the tabulated (thickness, radius, angle)\n * range and was clamped to the nearest entry (no extrapolation). Distinct from\n * MIN_RADIUS, which means a bend's inner radius is below one thickness. */\n | 'TABLE_CLAMP'\n /** Nesting: a flat pattern's outline bounding box does not fit the usable stock\n * sheet (sheet minus margin) even rotated 90°, so it was left unplaced. */\n | 'PART_TOO_LARGE';\n message: string;\n featureId?: string | undefined;\n};\n\n/** The outcome of unfolding a part: the {@link FlatPattern}, its {@link BendReport},\n * and any {@link SheetMetalWarning}s raised along the way. */\nexport interface UnfoldResult {\n pattern: FlatPattern;\n report: BendReport;\n warnings: SheetMetalWarning[];\n}\n\n/**\n * One fold-up region in a {@link FlatInput}: a rectangle in the flat pattern that\n * folds about a fold line off its parent region (the base by default, or another\n * region via `parent`). The region-tree is the inverse of the unfold layout, and is\n * recovered purely from the 2D flat-pattern geometry by `patternToFlatInput` — so\n * folding it up just re-runs the forward author geometry. `side`/`offset`/`width`\n * locate the fold line along the parent edge exactly as the authoring `FlangeSpec`\n * does (`side` is expressed in the parent region's local frame).\n */\nexport interface FoldRegion {\n id: string;\n /** Flat extent of the region away from the fold line (becomes the flange length). */\n length: number;\n angleDeg: number;\n direction: 'up' | 'down';\n rule: BendRule;\n /** Which edge of the parent region this region folds off. Default `'xmax'`. */\n side?: FlatSide | undefined;\n /** Id of another fold region this one chains off. Default = base region. */\n parent?: string | undefined;\n /** Start position along the parent edge. Default `0`. */\n offset?: number | undefined;\n /** Extent along the parent edge. Default = full parent-edge length. */\n width?: number | undefined;\n miter?: MiterSpec | undefined;\n /** Bend relief to add at this region's partial-span fold-line ends after folding. */\n bendRelief?: ReliefSpec | undefined;\n /** Cutouts to punch into this region (in region-local coords) after folding. */\n cutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto this region's edges (in region-local coords) after folding. */\n tabs?: TabSpec[] | undefined;\n /** Form features (louvers / embosses) on this region (region-local) after folding. */\n forms?: FormSpec[] | undefined;\n}\n\n/**\n * A flat pattern to fold up into a 3D part: the base region (a rectangle) plus a\n * tree of {@link FoldRegion}s, each folding off its parent about a fold line. This\n * is the inverse of {@link unfold}: a region-tree rather than a 2D outline, which\n * avoids fragile auto-partitioning of an arbitrary developed polygon and maps\n * one-to-one onto the authored feature tree.\n */\nexport interface FlatInput {\n thickness: number;\n /** Base region extent along +X (the run). */\n baseLength: number;\n /** Base region extent along +Y (the developed-strip width). */\n width: number;\n material?: MaterialSpec | undefined;\n regions: FoldRegion[];\n /** Cutouts to punch into the base region (in base-local coords) after folding. */\n baseCutouts?: CutoutSpec[] | undefined;\n /** Tabs to fuse onto the base region's edges (in base-local coords) after folding. */\n baseTabs?: TabSpec[] | undefined;\n /** Form features on the base region (base-local coords) after folding. */\n baseForms?: FormSpec[] | undefined;\n}\n"]}
|
package/dist/unfoldFns.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 { SheetMetalPart, UnfoldResult, BendReport, SheetMetalWarning, FlatSide } from './types.js';
|
|
3
3
|
import { type FeatureTree } from './featureTreeFns.js';
|
|
4
4
|
type Pt2 = [number, number];
|
package/dist/unfoldFns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unfoldFns.d.ts","sourceRoot":"","sources":["../src/unfoldFns.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unfoldFns.d.ts","sourceRoot":"","sources":["../src/unfoldFns.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,MAAM,EAAyD,MAAM,mBAAmB,CAAC;AACtG,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAEZ,UAAU,EACV,iBAAiB,EAEjB,QAAQ,EACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AAIlF,KAAK,GAAG,G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AAC;IAC/E,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,yEAAyE;AACzE,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;AAE/C,wFAAwF;AACxF,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,IAAI,EAAE,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAC/C,MAAM,CAAC,UAAU,CAAC,CA6DpB;AAkED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,GAAG,CAAA;CAAE,CAe/F;AAqfD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAyB/D"}
|
package/dist/unfoldFns.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ok, err, validationError, line,
|
|
1
|
+
import { ok, err, validationError, line, wireLoop, assembleWire } from '@faicad/faijs/api';
|
|
2
2
|
import { featureTree, ROOT_FLAT_ID } from './featureTreeFns.js';
|
|
3
3
|
import { developedLength } from './allowanceFns.js';
|
|
4
4
|
import { sideFromAxisDir } from './internal.js';
|
|
@@ -492,7 +492,7 @@ function openPathWire(path) {
|
|
|
492
492
|
}
|
|
493
493
|
edges.push(line([a[0], a[1], 0], [b[0], b[1], 0]));
|
|
494
494
|
}
|
|
495
|
-
return
|
|
495
|
+
return assembleWire(edges);
|
|
496
496
|
}
|
|
497
497
|
function rectOf(f) {
|
|
498
498
|
const c0 = f.origin;
|