CADbuildr BOM
Summary
Bills of materials for cadbuildr-foundation
assemblies. One common BOM contract every CADbuildr library feeds
(part number, standard, material, stock + cut length, mass, vendors, cost),
one builder, and what procurement and fabrication need from the result:
costing (unit price, quantity breaks, material and process estimates,
roll-ups per sub-assembly), vendor data and a procurement view (orders per
vendor rounded to pack sizes), cut-list optimisation (1-D bars, 2-D sheets,
waste report), checks, and exports (CSV, XLSX, Markdown, HTML, JSON with a
schema, PDF).
Quickstart
pip install cadbuildr-bom # core: no third-party dependency
pip install "cadbuildr-bom[xlsx,pdf]" # styled XLSX (openpyxl), PDF (fpdf2)
pip install "cadbuildr-bom[stdlib]" # stdlib parts + material prices
from cadbuildr.bom import build_bom, PriceBook, VendorRef, set_bom
bom = build_bom(MyMachine()) # cadbuildr-bom@2
print(bom.to_markdown()) # also to_csv(), to_json(), to_xlsx(), to_html(), to_pdf()
bom.totals() # {"mass_kg", "cost": {"EUR": ...}, "unknown_mass": [...], ...}
bom.rollup_tree() # totals per sub-assembly, nested like the model
# costing: declared prices, then estimates for what you make
bom = bom.priced(PriceBook.from_csv(open("prices.csv").read()))
bom = bom.costed(rates={"laser": 90, "saw": 35}, currency="EUR", fx={"USD": 0.92})
# procurement: order per vendor, rounded up to packs, price breaks applied
print(bom.procurement(builds=10).to_markdown())
bom.issues() # unpriced lines, missing SKUs, missing materials...
# cut lists
print(bom.nest({"2020 aluminium extrusion": [1000, 2000]}, kerf=3).to_text()) # 1-D bars
print(bom.nest_sheets({"Birch plywood 18 mm": (2500, 1250)}, kerf=3).to_text()) # 2-D sheets
bom.to_html("bom.html", sheets=bom.nest_sheets({"Birch plywood 18 mm": (2500, 1250)}))
Catalogue
| Feature | API | Notes |
|---|---|---|
| BOM contract | BomInfo, set_bom, register_producer, @part(bom=...), __bom__ |
merged in order with provenance (sources) |
| Build | build_bom(obj) → Bom |
groups by part number, vendor SKU, stock + cut size, or geometry |
| Unit price + breaks | VendorRef(unit_cost, currency, pack_size, price_breaks, lead_time_days), PriceBook |
breaks are (min_packs, pack_price) |
| Material cost | Bom.costed(material_prices=...), material_price() |
mass × price/kg: custom → cadbuildr-stdlib → cited local table |
| Process time | BomInfo(process, process_time_h, setup_time_h) + costed(rates=...) |
optional estimates; rates passed in |
| Currency | Bom.converted(currency, fx) |
rates passed in, never fetched |
| Roll-ups | totals(), rollup(by), rollup_tree() |
per category / procurement / sub-assembly |
| Vendor links | VendorRef(vendor, sku, url, lead_time_days), with_links(...) |
identical items merge across the tree |
| Procurement view | Bom.procurement(builds) → Procurement |
per vendor, pack rounding, lead time, cart CSV |
| 1-D nesting | nest_cuts, nest_plan, Bom.nest |
FFD + exact branch and bound (≤ 16 pieces), kerf, trim, several stock lengths |
| 2-D nesting | nest_panels, Bom.nest_sheets, Sheet |
guillotine shelf heuristic, kerf, margin, grain |
| Waste report | NestingPlan.waste_report(), SheetPlan.waste_report() |
waste %, FFD gap |
| Checks | bom_issues, BomChecks (__checks__), attach_bom_checks |
foundation check issues |
| Exports | export(fmt): csv, md, json, xlsx, html, pdf |
Bom.from_json round-trips; load_schema(2) |
Two schemas
| Function | Schema | What it is |
|---|---|---|
extract_bom(obj) / bom_to_csv |
cadbuildr-bom@1 |
grouped parts by (name, material, geometry hash) with stable ids. Output of the bom@1 cloud task; unchanged. |
build_bom(obj) → Bom |
cadbuildr-bom@2 |
the @1 grouping plus the contract fields; purchased parts group by part number, stock pieces by (stock, cut length). |
JSON schemas ship in the package: cadbuildr.bom.load_schema(1) / load_schema(2)
(cadbuildr/bom/schemas/cadbuildr-bom-{1,2}.schema.json).
The contract: where BOM data comes from
BomInfo is the one record. build_bom merges, in order (later wins, None
never erases):
- geometry: part name, paint material, placement-free geometry hash;
- library: the
LibraryRefstamp of@part/@assemblyinstances (item id, category, standard, configuration, inputs); - decorator:
@part(..., bom={"part_number": "ISO4762-{size}x{length:g}"}), templates over the inputs; - producer:
register_producer("stdlib:HexNut", fn)adapters. The stdlib fasteners, bearings, rods, extrusions, motors and pulleys ship here (cadbuildr.bom.producers.stdlib); - method: the component's own
__bom__(); - explicit:
set_bom(part, stock="45x45 beech", cut_length=720)in project code.
Structure: set_bom(asm, part_number=..., explode=False) makes a bought
sub-assembly one line; exclude=True drops reference geometry;
add_bom_line(asm, "Wood glue", quantity=30, unit="ml") adds non-geometric
lines; ref="R1" collects reference designators.
Library items (viewer tab "BOM")
| Item | Kind | What |
|---|---|---|
bom:PurchasedPart |
part | box / cylinder envelope of a bought component carrying part number, vendor, SKU, price, mass. Anchors bottom, top, center (PlaneFace). |
bom:SheetPanel |
part | panel of birch plywood (6.5 / 12 / 18 mm, 2500 × 1250 sheets, 680 kg/m³ per the WISA specification) with cut size and grain; feeds the panel list and sheet nesting. Anchors bottom, top, center, edge_a, edge_b. |
bom:add_bom_line |
operation | non-geometric line on an assembly (consumables, labour, kits). |
bom:Bookshelf |
assembly | worked example: stock boards with cut lengths, a hardware line, glue; anchors + connect, no transforms; check() includes the BOM checks. |
python -m cadbuildr.foundation.library manifest cadbuildr.bom
Cloud task
On CADbuildr cloud, extract_bom powers the bom@1 task: run it against
any project version and bom.json + bom.csv land in the project's
artifact repository (create_task_run(task_type="bom")).
Tags
cad, python, library, bom, bill-of-materials, cut-list, nesting, purchasing, open-source
Status
yellow
Guidelines
cadbuildr-bom@1is a load-bearing contract (fan-out enumerator for per-part tasks): never change its fields or ids. New fields go in@2.- Row ids must be stable across re-runs and commits: nothing that depends on the environment (library source sha, paint counters, placement) may reach an id or a geometry hash.
- Fail loudly: bad BOM data raises
BomContractErrornaming the component and the field; impossible nesting raisesCutTooLongError/PanelTooLargeErrornaming the piece; a missing optional package raisesOptionalDependencyErrornaming it. - No third-party runtime dependency in the core: openpyxl (XLSX styling), fpdf2 (PDF) and cadbuildr-stdlib (material prices) are optional extras.
- Never invent prices, SKUs or exchange rates: they come from the model, a
price book or the caller. Estimates are marked (
cost_source="estimate",mass_source="estimate") and every default price table cites its source. - Checks live in a
__checks__hook (BomChecks); never overridecheck(). - Producers for another library are keyed by library item id and never
import that library. When the library carries the data itself (decorator
bom=or__bom__), delete its producer here. - Units: mm, kg, ISO 4217 currency codes.
Dependencies
Upstream
cadbuildr-foundation>=0.3.0,<0.4.0(component tree, library registry and stamps, interfaces,__checks__)- optional:
cadbuildr-stdlib>=0.5.0,<0.6.0(stdlib producers, material prices),openpyxl,fpdf2
Downstream
- CADbuildr cloud: the
bom@1task and the curated library registry - Libraries adopting the contract:
cadbuildr-stdlib(via producers today),cadbuildr-frames,cadbuildr-tslot,cadbuildr-electronics,cadbuildr-woodworking
Metadata
Release files for cadbuildr-bom 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cadbuildr_bom-0.2.0.tar.gz | 82.1 kB | Without provenance | Details for cadbuildr_bom-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cadbuildr_bom-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cadbuildr_bom-0.2.0-py3-none-any.whl |
Total release size: 155.6 kB
Release files / cadbuildr_bom-0.2.0.tar.gz
| Download URL | cadbuildr_bom-0.2.0.tar.gz |
|---|---|
| Size | 82.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4aec9f4283da1198834c8ae331c8c372c72f4aafd0a6aa3cf953997702d45841
|
|
BLAKE2b-256 checksum How to use checksums |
9dca9f8255922cd6daf4c9a1664b6d626aae852d1143cde35860aaf4358343da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.19
|
Release files / cadbuildr_bom-0.2.0-py3-none-any.whl
| Download URL | cadbuildr_bom-0.2.0-py3-none-any.whl |
|---|---|
| Size | 73.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0acd9f53cb469515fdd8a630a877d977f013ab6dcd472e8afa40aef61e086ff
|
|
BLAKE2b-256 checksum How to use checksums |
ea332afc8595607991fd4196b58a3c36625cc9061a5bb1a349ecf6171b1c5291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.19
|
Security for cadbuildr-bom 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.