Skip to content
Skills Library
Programming · Building & coding

kernelcad-sheet-metal

/kernelcad-sheet-metal

Folded sheet-metal parts — sheetMetal(profile, opts), .bend(edge, angle, radius), .flattenPattern(). Use when building L-brackets, U-channels, service panels, or any part fabricated from a flat blank + folds.

Author
w1ne ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Folded sheet-metal parts — sheetMetal(profile, opts), .bend(edge, angle, radius), .flattenPattern(). Use when building L-brackets, U-channels, service panels, or any part fabricated from a flat blank + folds.

Original author description

Folded sheet-metal parts — sheetMetal(profile, opts), .bend(edge, angle, radius), .flattenPattern(). Use when building L-brackets, U-channels, service panels, or any part fabricated from a flat blank + folds.

How it works

  1. API
  2. Bend-allowance math (K-factor approximation)
  3. How a bend folds
  4. Slice-1 limits
  5. MCP introspection
  6. Sheet-metal diagnostic codes
  7. Verification gates
  8. Mounting sheet on a frame
  9. Related skills
Original SKILL.md headings · 109 lines, 1,082 words
SKILL.md preview
---
name: kernelcad-sheet-metal
description: Folded sheet-metal parts — sheetMetal(profile, opts), .bend(edge, angle, radius), .flattenPattern(). Use when building L-brackets, U-channels, service panels, or any part fabricated from a flat blank + folds.
---

# kernelCAD — sheet metal

Build folded sheet-metal parts (L-brackets, U-channels, service panels) from a closed Sketch + thickness + K-factor. Bend along a linear axis line; recover the flat blank as a `Region` for laser / CNC consumption.

```typescript
// L-bracket: 100 x 60 x 2 mm, one 90 degree fold along x=50.
const s = path().moveTo(0, 0).lineTo(100, 0).lineTo(100, 60).lineTo(0, 60).close();
const blank = sheetMetal(s, { thickness: 2, kFactor: 0.38 });
const bracket = blank.bend({ atX: 50 }, 90, 3);
return bracket;

// Recover the flat blank as a Region.
const flat = bracket.flattenPattern();
console.log(flat.outer);     // [[0,0], [100,0], [100,60], [0,60]]
console.log(flat.bendLines); // [{ start: [50,0], end: [50,60], angle: 90, radius: 3, ordinal: 0 }]
```

## API

```typescript
// Top-level constructor — captures kind:sheetMetal record.
sheetMetal(profile: Sketch, opts: {
  thickness: Editable<number>;   // mm, > 0
  kFactor: Editable<number>;     // unitless, in [0, 1]
  faceLabels?: FaceLabelsMap;
}): Shape;

// Shape methods — chain on a sheetMetal-rooted Shape.
shape.bend(
  edgeRef: EdgeSelector | string,  // slice-1: { atX: n } | { atY: n } | { face: 'top' }
  angle: Editable<number>,         // degrees, signed (positive = fold +normal)
  radius: Editable<number>,        // mm, inner bend radius
): Shape;

shape.flattenPattern(): Region;    // derived view — no FeatureRecord
```

## Bend-allowance math (K-factor approximation)

```
BA = (pi * |angle_deg| / 180) * (kFactor * thickness + radius)
```

- `BA` = developed length of the neutral axis through the bend arc.
- `kFactor` = neutral-axis offset ratio. Typical values: 0.33-0.45 (mild steel / aluminum).
- Slice 1 supports the K-factor formula only.

## How a bend folds

- The bend line is in FLAT-BLANK coordinates for every bend of a chain:
  `.bend({ atX: 25 }, 90, 2).bend({ atX: 75 }, 90, 2)` is a U-channel, even
  though the second line has moved by the time it folds.
- The strip of width `BA` centred on the line becomes the arc (inner radius =
  `radius`); the flange beyond it keeps its flat length, so the flat pattern
  is exactly the blank (flange lengths + bend allowances).
- The SHORTER side of the blank across the line folds (a tie folds the +X /
  +Y side). A web with a bend near each end stays on the bench.
- Holes and cutouts drilled in the flat blank before `.bend()` ride along
  with their flange: `sheetMetal(...).holes({ byNormal: 'Z' }, ...).bend(...)`.
- Parallel bend lines whose zones overlap fail with `feature.invalid-args`.

## Slice-1 limits

- Bend axis derived from `{ atX }` / `{ atY }` EdgeQuery or `{ face: 'top' }`. Other selectors emit `feature.bend.edge-not-linear`.
- `radius >= 0.5 * thickness` recommended; tighter bends emit `feature.kernel-failed`.
- `flattenPattern()` flattens any number of bends (a C-channel with lips is 4). A fold that collides with another flange or loses material fails with `feature.sheetMetal.fold-invalid` instead of producing a broken solid.
- Sketch profiles must be polylines (`path().moveTo / lineTo / close`). Arcs in the profile are not supported by `flattenPattern()` in slice 1.
- A hole that crosses the bend zone loses the part of it inside the zone (the arc is the sheet section at the zone start, revolved). Keep holes `>= BA/2 + radius` from the line.
- Bend lines span the whole blank, so an `atX` and an `atY` bend always cross. That folds only when the blank outline has corner relief there — notch the corner at least one bend allowance past each line (e.g. `path().moveTo(0,0).lineTo(82,0).lineTo(82,18).lineTo(100,18)...` for bends at x = 85 and y = 15). Without relief: `feature.sheetMetal.crossing-bends`.

## MCP introspection

- `flatten_pattern` — returns the unfolded `Region` as JSON (outer ring + bend lines + holes).
- `inspect({ of: 'bend-table' })` — lists every bend with its K-factor bend allowance, axis line, and parent `sheetMetal` opts.

## Sheet-metal diagnostic codes

- `feature.sheetMetal.kfactor-invalid` (error) — `kFactor` not in `[0, 1]` or non-finite. Hint: pass a value in `[0, 1]`; typical 0.33-0.45.
- `feature.bend.edge-not-linear` (error) — resolved bend axis cannot be derived from the selector. Hint: pick a straight perimeter edge; slice-1 supports `{ atX: <n> }`, `{ atY: <n> }`, or `{ face: 'top' }`.
- `feature.sheetMetal.crossing-bends` (error) — an `atX` and an `atY` bend cross where the blank still has material. Hint: add corner relief to the outline.
- `feature.sheetMetal.fold-invalid` (error) — the fold produced several solids, an invalid solid, or lost / overlapped material (flanges folding into each other). Hint: reorder or respace the bends.

## Verification gates

After authoring a sheet-metal part, run before reporting done:

| Gate | Pass criterion |
|------|----------------|
| G-eval | `kernelcad evaluate` exits 0 — no `feature.sheetMetal.*` / `feature.bend.*` / `feature.flattenPattern.*` diagnostics |
| G-kfactor-valid | `kFactor` is a finite number in `[0, 1]`; pick 0.33-0.45 for mild steel / aluminum unless you have a measured value |
| G-radius-vs-thickness | Inner bend radius `>= 0.5 * thickness`; tighter bends fail and emit `feature.kernel-failed` |
| G-bend-edge-linear | Every `.bend(...)` selector resolves to a straight edge (slice 1: `{ atX }`, `{ atY }`, or `{ face: 'top' }`) |
| G-bend-table-exists | `inspect({ of: 'bend-table' })` returns one entry per `.bend(...)` call with non-negative bend allowance and a finite axis line |
| G-flatten-roundtrip | `shape.flattenPattern()` produces a `Region` whose `outer` polyline area equals the source profile area within `1e-6` |
| G-fold-valid | No `feature.sheetMetal.fold-invalid` / `feature.sheetMetal.crossing-bends`: every fold is one closed solid with conserved volume |
| G-profile-polyline | Sketch profile uses only `moveTo` / `lineTo` / `close` — no arcs (slice 1) |

## Mounting sheet on a frame

A sheet (flat panel or bent part) that sits on tubes or a frame touches them: put its underside at the frame top (`z = tubeHeight` for tubes on `z = 0`), not a few mm above. If sheet and frame are fused with `union()`, `evaluate_script` fails with `union.disconnected` when the sheet floats (the message gives the gap) and `union.member-overlap` when members finished with the same material share more than 1 mm³. Prefer `assembly().part('sheet', ...)` + one part per frame member when they are separate BOM lines; recipe: `welded-tube-frame-tray`.

## Related skills

- `kernelcad-authoring` — `path()` + `Sketch` shape this skill operates on; rotate / translate the bracket after folding.
- `kernelcad-features` — fillet / chamfer / hole apply to the folded result, or drill the flat blank before `.bend()`.
- `kernelcad-params` — `thickness`, `kFactor`, `angle`, `radius` all accept `Editable<number>`; wire to params for fab-iteration.
- `kernelcad-mcp` — `flatten_pattern` and `inspect({ of: 'bend-table' })` are the inspection surface for downstream CAM / nesting tools.

Versions

The database has no other skills named kernelcad-sheet-metal.

Database snapshot: 13.11.2026 · package version 633b0f30ce11 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100solidcraft-sheet-metal
    Use when modelling sheet-metal or bent-plate parts in SolidCraft (flanges, bends, hem, fold, path flange, convert, flat pattern, DXF, bend table), especially when a drawing or an expected flat pattern is given.
  • 100solidcraft-sheet-metal-flatpack
    Use when modelling flat-pack sheet-metal enclosures in SolidCraft (laser-cut plates with ear tabs, bend slits, perforation, side plates), from real flat patterns, videos or photos, for example a CD-ROM player enclosure.
  • 100kernelcad-tubes
    Model bent tubes and fluid lines between ports with tube(name, opts), tubeSpec(rules) and part.port(name), checked for bend radius, straight lengths and clearance, with a bend table per tube. A tube can branch off another tube at a 90 degree tee. Use when routing a rigid tube or…
  • 90kernelcad-design-loop
    Build or revise a CAD model with the hosted kernelCAD MCP — write .kcad.ts source, evaluate, review with design_loop until green. Use for any "design / model / make a part" request when the kernelcad MCP server is connected.
  • 95smlibpy
    Model exact 3D CAD parts in Python with smlibpy, the Python library on SMLib (NVIDIA's open-source NURBS solid modeling kernel). Solids, sketches, text (engraved or embossed lettering), holes, fillets (also G2), shells, lofts, sweeps, freeform surfaces (also fitted to point…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.