Metadata-Version: 2.5
Name: cadbuildr-woodworking
Version: 0.4.0
Summary: Wood joinery one-liners (mortise & tenon, laps...) built on CADbuildr foundation anchors + joints
Author: CADbuildr Team
Requires-Python: <4.0.0,>=3.10.0
Requires-Dist: cadbuildr-foundation<0.4.0,>=0.3.0
Description-Content-Type: text/markdown

# cadbuildr.woodworking

## Summary

Wood joinery and cabinetry on CADbuildr foundation: stock, joints that cut and place the wood, 32 mm-system carcasses with real hardware, doors, drawers, furniture, cut lists and sheet nesting.

## Tags

cad, python, wood, joinery, joints, furniture, cabinetry, 32mm-system, cut-list, library

## Status

yellow — joints and cabinetry complete; joints not yet on foundation typed interfaces

## Guidelines

- Joints consume explicit sites (`beam.end("b")`, `face.at(d, from_="a")`); never guess ends.
- Separate WHERE (sites) from WHAT (spec dataclasses with documented defaults).
- Validate interfaces as a set (`Joinery.build`): end reuse, collisions, loop closure.
- Library code places parts with joints and anchors only: no `translate` / `tf=`.
- Every dimension is cited (`standards.py`) or listed under `Estimated:`.
- Checks go in `__checks__`; errors name the joint, the part and the fix.

## Dependencies

### Upstream

- cadbuildr-foundation

### Downstream

- (none)

## Quickstart

```bash
pip install cadbuildr-woodworking
```

```python
from cadbuildr.foundation import show
from cadbuildr.woodworking import BaseCabinet, cut_list, edge_banding_bom, hardware_bom, nest_sheets

cab = BaseCabinet(width=600, height=870, depth=560, toe_kick="eu", front="drawers", drawers=3)
rows = cut_list(cab)
print(len(nest_sheets(rows, sheet=(2440, 1220))), "sheets")   # grain kept along 2440
print(edge_banding_bom(rows), hardware_bom(cab))
show(cab)
```

## Catalogue

| Group | Items | Standard / datasheet |
|---|---|---|
| Stock | `Beam`, `Board`, `Lumber`, `Panel` (3–25 mm, 16/18/19 mm, US ply actuals; ply, MDF, melamine), `Dowel` | ALSC PS 20, EN 336 |
| Joinery | `Joinery` with mortise & tenon, dado, box corner, miter, **dovetail**, **butt** (confirmat / Minifix / pocket) | — |
| Carcasses | `Carcass`, `BaseCabinet`, `WallCabinet`, `TallCabinet`, `Bookcase`: line boring Ø5 × 12 on 32 mm, 37 mm setback; back in groove / rabbet; toe kick; shelves on pins | 32 mm system; US base 34-1/2" × 24", kick 4" × 3" |
| Hinges | `CupHinge` (full / half / inset), `HingePlate` (0/3/6/9): cup Ø35 × 13, boring 45/9.5, overlay `C + k − P` | Blum CLIP top 110° tables (compatible) |
| Slides | `BallBearingSlide` (45.7 high, 12.7 per side, 250–700), `UndermountSlide` (opening − 42, 13 mm recess) | Accuride 3832E, Blum TANDEM 563H (compatible) |
| Connectors | `ConfirmatScrew` 7×50, `MinifixHousing` Ø15 × 12.5 at B = 24, `MinifixBolt`, `ShelfPin` 5 mm | Häfele (compatible) |
| Doors & drawers | `SlabDoor`, `ShakerDoor`, `DrawerFront`, `DrawerBox` (dovetail / dado), `FaceFrame` (pocket / mortise), `door_size` | — |
| Furniture | `Desk` (740 mm), `DiningTable` (600 mm per seat), `DiningChair` (450 seat), `BedFrame` (twin…king, EU 90–180 × 200) | EN 527-1, Neufert, mattress sizes |
| Projects | `TableFrame`, `Bookshelf`, `PictureFrame`, `FingerJointBox` | — |
| Cut list | `cut_list`, `optimize_lengths`, `nest_sheets` (2440 × 1220, grain), `edge_banding_bom`, `hardware_bom` | — |

Every source is listed in `cadbuildr/woodworking/standards.py`.

## Requirements

`cadbuildr-foundation` 0.3 (PyPI). `cadbuildr-stdlib` is a dev / optional
dependency: its `WoodScrew` is what `screwed_overlap` and `pocket_screw`
usually drive. The JOINERY demo site in `github-io/` runs every snippet of
`github-io/src/examples.json` (tested by `tests/test_demo_examples.py`).
Used by the `joinery-chair` and `playground` projects (PyPI dependency).

## Usage

```python
from cadbuildr.foundation import show
from cadbuildr.woodworking import Beam, FingerSpec, Joinery, TenonSpec

# A four-corner finger-jointed box — the last corner closes the loop and is
# checked by foundation's loop closure (ClosureError if the lengths don't add up).
a, c = Beam(120, 18, 300), Beam(120, 18, 300)
b, d = Beam(120, 18, 200), Beam(120, 18, 200)
j = Joinery()
spec = FingerSpec(count=6)
j.box_corner(a.end("b").inside("ny"), b.end("a").inside("ny"), spec)
j.box_corner(b.end("b").inside("ny"), c.end("a").inside("ny"), spec)
j.box_corner(c.end("b").inside("ny"), d.end("a").inside("ny"), spec)
j.box_corner(d.end("b").inside("ny"), a.end("a").inside("ny"), spec)
show(j.build(ground=a))  # validate -> one Connection per joint (cut + place / close)
```

Whole projects are configurable assemblies:

```python
from cadbuildr.foundation import show
from cadbuildr.woodworking import Bookshelf, TableFrame, cut_list, format_cut_list

table = TableFrame(length=1200, width=700, height=740)   # or a named configuration
print(format_cut_list(cut_list(table)))
show(Bookshelf(height=1800, width=800, depth=280, shelves=5))
```

## Library manifest

`python -m cadbuildr.foundation.library manifest cadbuildr.woodworking` lists
every item, grouped on the Woodworking ribbon:

| Section | Items |
|---|---|
| Stock | `Beam`, `Board`, `Lumber` (`"2x4"`, `"45x95"`…), `Panel` (plywood/MDF/…, edge banding), `Dowel` |
| Joinery | site operations `joinery_mortise_and_tenon`, `joinery_dado`, `joinery_box_corner`, `joinery_miter` (sites are picked, specs are object forms) |
| Quick joints | the one-liners: `mortise_and_tenon`, `dado_joint`, `rabbet_joint`, `cross_lap`, `end_lap`, `butt_joint`, `doweled_butt`, `mitered_butt`, `box_joint`, `through_dovetail`, `sliding_dovetail`, `edge_joint`, `tongue_and_groove` |
| Fastening | `screwed_overlap` (slat construction), `pocket_screw` (pocket-hole joinery) |
| Projects | `TableFrame` (dining / coffee / side table, stool), `Bookshelf`, `PictureFrame`, `FingerJointBox` |
| Cabinetry | `Carcass`, `BaseCabinet`, `WallCabinet`, `TallCabinet`, `Bookcase` |
| Doors & drawers | `SlabDoor`, `ShakerDoor`, `DrawerFront`, `DrawerBox`, `FaceFrame` |
| Hardware | `CupHinge`, `HingePlate`, `BallBearingSlide`, `UndermountSlide`, `ConfirmatScrew`, `MinifixHousing`, `MinifixBolt`, `ShelfPin` |
| Furniture | `Desk`, `DiningTable`, `DiningChair`, `BedFrame` |

## Two API levels

- **`Joinery` (preferred)** — explicit sites and specs (`TenonSpec`,
  `DadoSpec`, `FingerSpec`, `MiterSpec`); `build(ground=...)` checks site
  reuse, collisions inside shared wood and loop closure.
- **One-liners** (`mortise_and_tenon(assembly, rail, leg, face="px", at=280)`)
  — a single illustrative joint; they guess ends and cannot close loops.

## Cut lists

`cut_list(assembly)` groups every `Beam`/`Board`/`Lumber`/`Panel` into rows
(section × length × material, edge banding for panels);
`optimize_lengths(rows, stock_length=2400, kerf=3, section=(38, 89))` packs
the pieces onto stock boards.

## Cabinetry

All carcass hardware is drilled where the datasheet puts it: shelf-pin rows
37 mm in on the 32 mm grid, hinge plates on the 37 mm line, cup bores
22.5 mm from the door edge at C = 5. Each hinge arm closes a kinematic
loop on its mounting plate, so a wrong overlay, crank or setback raises
instead of leaving a floating hinge.

```python
from cadbuildr.woodworking import Carcass, DrawerBox, ShakerDoor
Carcass(kind="wall", width=800, height=720, depth=320, doors=2, door_style="shaker", overlay="inset")
DrawerBox(500, 450, 150, joinery="dovetail")
```

## Planned

Half-blind and sliding dovetails on `Joinery`, bridle, haunched / wedged /
drawbored tenons, biscuits and dominos, scarf joints, hinge opening
kinematics, face-frame cabinets.
