cad-to-bom
A bill of materials, build checklist and cost tracker for hardware projects designed in code-CAD.
- Off-the-shelf parts come from a
bom.tomlfile. Each part links to listings on Amazon (any country store), AliExpress or any shop you add. - 3D printed parts come from the STL or 3MF files your CAD exports. Each gets a 3D preview, its size, and an estimate of filament weight and cost.
- Alternative listings sit next to the original. Each one is checked against the part's specs and flagged until you approve it.
- Costs are shown in any currency, using daily exchange rates. Pack sizes are handled: 4 screws from a 100-pack costs the whole pack.
- Tracking: each part is to buy, ordered or have, and can carry notes. Filter, sort and search the list.
- Local and plain: it runs on your computer and has no dependencies. Your progress is a JSON file you can commit next to your design.
It pairs well with text-to-cad (build123d models built with cadgen): export your printed parts and point bom.toml at the folder. Any CAD that writes STL or 3MF works the same way.
Install
pip install cad-to-bom # or: pipx install cad-to-bom / uv tool install cad-to-bom
This needs Python 3.11 or newer. The 3D preview loads three.js from a CDN, so it needs internet access; everything else works offline.
Quick start
cad-to-bom init my-robot # writes my-robot/bom.toml
cad-to-bom serve -c my-robot --open
To try the example project:
cad-to-bom serve -c examples/desk-lamp --open
bom.toml
title = "My robot"
currency = "USD" # default display currency
markets = ["amazon.com", "amazon.ca", "aliexpress"]
[[sections]]
id = "drive"
title = "Drive"
[[parts]]
section = "drive"
qty = 2 # a number, or text such as "1 m", "~60" or "4 + 2"
name = "608-2RS bearing"
search = "608 2RS bearing" # optional; the default is name
notes = "lead screw ends"
specs = { bore_mm = 8, od_mm = 22, width_mm = 7, seal = "2RS" }
[[parts.links]] # optional: listings can also be added on the page
market = "amazon.com"
url = "https://..."
price = 9.99 # in the market's currency unless currency = "..." is set
pack = 10
specs = { bore_mm = 8, od_mm = 22, width_mm = 7, seal = "2RS" }
[[printed]]
section = "drive"
paths = ["STL/*.stl", "3MF/*.3mf"] # globs, relative to bom.toml
material = "PETG"
qty = { motor_mount = 2 } # or name a file part_x2.stl
[printing]
price_per_kg = { PLA = 20, PETG = 22 } # or a single number
currency = "USD" # defaults to the project currency
fill = 0.6 # printed mass as a fraction of a solid part; a rough estimate
density = { PETG = 1.27 } # g/cm³; common materials are built in
Each part gets a stable id made from its section and name, such as drive-bought-608-2rs-bearing. Your progress is stored under that id. If you rename a part, set id = "..." on it to keep its history.
Marketplaces
The built-in marketplaces are:
- Amazon:
amazon.com,amazon.ca,amazon.co.uk,amazon.de,amazon.fr,amazon.it,amazon.es,amazon.nl,amazon.se,amazon.pl,amazon.co.jp,amazon.com.au,amazon.in,amazon.com.mx,amazon.com.br,amazon.sg,amazon.ae aliexpress
You can add any other shop, or override a built-in one:
markets = [
"amazon.co.uk",
{ id = "aliexpress", currency = "EUR" }, # the currency your AliExpress account shows
{ id = "mcmaster", name = "McMaster-Carr", currency = "USD", search = "https://www.mcmaster.com/{q}" },
]
Finding parts
cad-to-bom does not scrape shops. Each part shows a Find link for every marketplace, which opens that shop's search for the part. When you choose a listing, paste its URL, price and pack size into the side panel, or use the CLI (cad-to-bom link ...). Because the CLI and the JSON API are plain, a browser agent can fill in listings for you.
Alternatives, spec checks and approval
Each marketplace can hold one original listing (the part as specified) and any number of alternatives.
- Give the part
specs, and give each listing the specs it states. A listing's specs that don't match the part's, or that the listing doesn't state, show as a diff. - A listing needs review if it is an alternative, or if its specs differ from the part's. Until you approve it:
- the part is flagged (filter: Review);
- the listing is left out of the cost.
- Approve fit marks it checked. Reject keeps it on record with a reason, so you don't evaluate it again.
- If you change a listing's URL or specs, its verdict goes back to unverified.
From the CLI:
cad-to-bom link drive-bought-608-2rs-bearing aliexpress https://... --alt --price 3.20 --pack 10 \
--spec bore_mm=8 --spec od_mm=22 --spec width_mm=7 --spec seal=ZZ
cad-to-bom list --listings # shows verdicts and diffs
cad-to-bom verify drive-bought-608-2rs-bearing l2 rejected --reason "ZZ shields, need 2RS seals"
Currencies
Prices are stored in the currency they were listed in, and converted when shown; converted prices are marked ≈. Rates are the European Central Bank's daily reference rates, fetched from frankfurter.app and cached for 12 hours in .cad-to-bom/. To work offline, or to pin rates, set them per USD:
[fx]
rates = { CAD = 1.40, GBP = 0.79 }
Costs
- A bought part's cost is the number of packs needed times the pack price. It uses the listing you mark "use for cost"; otherwise it uses the cheapest usable listing.
- A printed part's cost is mesh volume × density × fill × price per kg. Treat it as an estimate.
- The top bar shows the total, what you have spent so far (ordered plus have), what is still to buy, and how many parts have no price yet.
Using it with text-to-cad
Export your printed parts from the models. You can do this one at a time:
cadgen export <model id> STL/bracket.stl
Or let the project's exports.py write them all. Then list the folders in [[printed]]. The page rescans on every load, so a fresh export appears when you reload.
To print more than one copy of a part, add _x<n> to its file name (clip_x4.stl) or set a qty table.
Command line
| Command | What it does |
|---|---|
cad-to-bom init [dir] |
Writes a starter bom.toml. |
cad-to-bom serve [-c bom.toml] [--host] [--port] [--open] |
Serves the page. |
cad-to-bom list [--missing] [--listings] [--currency EUR] [--json] |
Lists items, their listings and diffs. |
cad-to-bom summary [--currency EUR] |
Shows cost totals per section. |
cad-to-bom search [ids...] [--market amazon.de] [--open] |
Prints search links for parts that have no listing. |
cad-to-bom link <id> <market> <url> [--price] [--pack] [--currency] [--alt] [--spec k=v] |
Records a listing. |
cad-to-bom verify <id> <listing> approved|rejected|unverified [--reason] |
Records whether a listing fits. |
cad-to-bom status todo|ordered|have <ids...> |
Sets the status of one or more parts. |
cad-to-bom import-md BOM.md |
Turns markdown BOM tables (with Qty and Part columns) into [[parts]]. |
Files
| File | Contents | Commit it? |
|---|---|---|
bom.toml |
What the design needs. | Yes. |
bom-state.json |
Status, notes, listings and verdicts, written by the page and the CLI. | Yes, to share progress; ignore it to keep progress private. |
.cad-to-bom/ |
Cached exchange rates and mesh measurements. | No. |
Security
serve listens on 127.0.0.1 and has no authentication. Anyone who can reach the port can read and edit your BOM. To use it from other devices, put it behind something that does authenticate, such as an SSH tunnel, a VPN, or tailscale serve, rather than binding to 0.0.0.0 on an untrusted network.
Development
python -m venv .venv && .venv/bin/pip install -e '.[test]' && .venv/bin/pytest
License
MIT
Metadata
Release files for cad-to-bom 0.1.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 |
|---|---|---|---|---|
| cad_to_bom-0.1.0.tar.gz | 30.4 kB | With provenance | Details for cad_to_bom-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cad_to_bom-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cad_to_bom-0.1.0-py3-none-any.whl |
Total release size: 60.9 kB
Release files / cad_to_bom-0.1.0.tar.gz
| Download URL | cad_to_bom-0.1.0.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be852599a9e56503fd32ecf4d57156e65e7643057456f6092d97a62705c2d932
|
|
BLAKE2b-256 checksum How to use checksums |
7a32854b50b89575cc7b68d0765e9aba68e3adec61a12b57ade365b2d8e3ce4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / cad_to_bom-0.1.0-py3-none-any.whl
| Download URL | cad_to_bom-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89e2d230b4ec5ce84c8aba44595a6345bb2996b2f0efb6ab51394d90571e3503
|
|
BLAKE2b-256 checksum How to use checksums |
c6b56d96ebd4dcb43752c7484de2f64f5ab5b4eed119c179201474f1b8c8e9a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for cad-to-bom 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cad_to_bom-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA 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.