Skip to main content

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.toml file. 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"
# buy = 1                                         # optional: how many listings to buy, when qty doesn't say
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. A quantity with a unit ("375 g", "2 m") counts as one listing; set buy = n on the part to say otherwise. 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cad-to-bom 0.1.1
File Size Uploaded Provenance Actions
cad_to_bom-0.1.1.tar.gz 31.0 kB With provenance Details for cad_to_bom-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cad-to-bom 0.1.1
File Interpreter ABI Platform Actions
cad_to_bom-0.1.1-py3-none-any.whl Python 3 none any Details for cad_to_bom-0.1.1-py3-none-any.whl

Total release size: 61.7 kB

Release files / cad_to_bom-0.1.1.tar.gz

Download URL cad_to_bom-0.1.1.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
726fd210c808cd03dfcf56ebfe651455d1fd85151c0d6617f34daa8121ced0dd
BLAKE2b-256 checksum
How to use checksums
bb1576a9e581bf741e208d50b75a637197fdaa9f8052f1ebb7dcc834113ce243
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 log

Release files / cad_to_bom-0.1.1-py3-none-any.whl

Download URL cad_to_bom-0.1.1-py3-none-any.whl
Size 30.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4391776fb9c2a70a26b33a9314b61242c71ba90b16c55bc9257733a30f3c323
BLAKE2b-256 checksum
How to use checksums
9dc149a0fbd26b219aee827d989d76106015b8532327b3fcafa62d3f08a6436d
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 log

Security for cad-to-bom 0.1.1

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.

Select from 2 files

Attestation for cad_to_bom-0.1.1.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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page