bd_warehouse: The Standard Library for Mechanical Parts

Built for build123d, it generates fasteners, bearings, gears, and threads from standards tables, so a CAD script can call up exact hardware on demand.

8 min read · gumyr/bd_warehouse

An editorial illustration of a warehouse aisle with labeled drawers for standard hardware, while screws, bearings, and gears flow out toward a drafting table and a Python script sheet. It explains the core idea that mechanical parts can be generated from code instead of hunted down as files.
Standard parts stop behaving like assets and start behaving like inventory the script can call up.

By incorporating bd_warehouse into Build123d, you gain access to on-demand generation of parametric parts and extensions that expand the core capabilities of Build123d.

gumyr, Project Creator/Maintainer · bd_warehouse README
Key Takeaways

Most CAD workflows still treat hardware like a scavenger hunt. bd_warehouse changes the job. In a build123d script, a bolt, bearing, or gear is not a downloaded mesh. It is a standard part requested by name and size, then generated from data.

The parts warehouse changes the job

That sounds small until you look at the workflow. Once hardware is data, it can be reviewed in git, regenerated on demand, and kept consistent across assemblies. The part stops being a file you happened to find and becomes something the design can instantiate, place, and test.

WSJ-style hedcut portrait of gumyr based on a verified GitHub avatar. It presents the project maintainer as the person behind the parts warehouse idea, grounding the library in an actual maintainer rather than an abstract package.

With just a few lines of code, you can create parametric parts that are easily reviewable and version controlled using tools like git and GitHub.

gumyr, Project Creator/Maintainer · bd_warehouse README

A CSV turns into a part

The real trick is not geometry first. It is standards first. Files in src/bd_warehouse/data/ hold the dimensions for hardware families, while the Python layer reads, decodes, and normalizes those values before any solid is built. That separation lets one code path support many sizes without hardcoding every variant.

A standard part is not a mesh that gets imported. It is a pipeline that turns a human request into normalized parameters, geometry, and assembly-ready output.

That design choice is the foundation of the repo. The dimension tables are the source of truth, and the modeling code stays focused on turning those tables into solids. For imperial sizes, the library even decodes the odd naming conventions instead of forcing the user to translate them by hand.

The hard geometry is the point

This is where the library stops being a convenience wrapper and starts looking like real CAD infrastructure. Threads are generated as true helices, bearings use abstract base classes to keep their sections consistent, and gears rely on involute math so the teeth mesh cleanly instead of stuttering.

from bd_warehouse.fastener import SocketHeadCapScrew

screw = SocketHeadCapScrew(size="M5-0.8", length=20, simple=True)
A close-up editorial illustration of a helical thread forming from a flat sketch line into a three-dimensional spiral. A narrow bypass path sits beside it, showing the simpler iteration mode that skips the expensive full geometry until final export.
The expensive part is geometry, so bd_warehouse lets you choose between full fidelity and a faster iteration path.

That `simple=True` path matters because the best CAD library is not always the one that draws the most detail. It is the one that lets you move fast during layout, then bake in the expensive precision only when you need it. Fidelity becomes a choice, not a tax.

What it beats, and what it does not

A split editorial illustration with a cluttered stack of downloaded STL files and loose hardware on the left, and a clean Python function call producing a standard fastener or bearing on the right. It contrasts scavenging files with generating exact parts from data.
The library is not trying to replace CAD. It removes the friction around standard parts.
ApproachBest atTrade-offWhere bd_warehouse fits
Downloading STL filesFast visual placeholdersFit, naming, and tolerances are opaqueGenerates exact parts from standards data inside the script
Modeling hardware by handOne-off custom detailsSlow, repetitive work and duplicated effortReuses one parametric definition across many sizes
General code-CAD toolsBuilding whole assemblies and custom shapesStandard hardware still needs to be sourced or modeledAdds a ready-made hardware catalog for build123d workflows
bd_warehouseStandard parts in version-controlled assembliesNot a full CAD suite and not for bespoke shapesLets the assembly call up bolts, bearings, gears, and threads on demand

That is the niche. If the part is custom, you still need a modeling tool. If the part is standard and the assembly is code-driven, bd_warehouse removes a huge amount of repetitive work. It is closer to a hardware standard library than a general modeling app.

The bigger shift: hardware as reproducible code

The lasting value here is not that the repo saves a few clicks. It is that it makes mechanical design behave more like software. Hardware can be versioned, regenerated, tested, and reviewed with the same discipline as the rest of the codebase. That is a better contract for teams that want precision without file chaos.