Metadata-Version: 2.4
Name: cadbuildr-bom
Version: 0.1.0
Summary: Bill-of-materials extraction for cadbuildr assemblies: traverse a foundation component tree into a typed, stable-id parts list (bom.json + CSV)
Author: Cadbuildr Team
License-File: LICENSE
Requires-Python: <4.0.0,>=3.10.0
Requires-Dist: cadbuildr-foundation<0.3.0,>=0.2.12
Description-Content-Type: text/markdown

# CADbuildr BOM

Bill-of-materials extraction for [`cadbuildr-foundation`](https://pypi.org/project/cadbuildr-foundation/)
assemblies: traverse a component tree into a typed, stable-id parts list.

## Installation

```bash
pip install cadbuildr-bom
```

## Quick usage

```python
from cadbuildr.bom import extract_bom, bom_to_csv
from my_project.chair import Chair

bom = extract_bom(Chair())
# {"schema": "cadbuildr-bom@1", "root": "chair", "total_part_count": 7,
#  "unique_part_count": 3, "items": [{"id": "leg@beech", "name": "leg",
#  "material": "beech", "quantity": 4, "example_path": "chair/leg_1"}, ...]}

print(bom_to_csv(bom))
```

## What it does

- Walks `Part` / `Assembly` trees (or already-converted `PartRoot` /
  `AssemblyRoot`) recursively through nested assemblies.
- Groups identical leaf parts by **(base name, material)** — foundation's
  auto-dedup suffixes (`table_leg_1`, `table_leg_2`) collapse back into one
  line item with `quantity`.
- Emits **stable item ids** (`table_leg`, `leg@beech`). These ids are the
  enumerator contract for per-part fan-out workflows (supplier sourcing,
  per-part quoting/CAM/drawings) in the CADbuildr task infrastructure.

Output schema is versioned (`cadbuildr-bom@1`); breaking changes bump it.

## Cloud task

On CADbuildr cloud this library powers the `bom@1` task: run it against any
project version and the `bom.json` + `bom.csv` land in the project's artifact
repository. See the platform docs for `create_task_run(task_type="bom")`.
