rulecad
Design physical things as code, where every measurement says which rule it comes from: a printer's line width, a screw's clearance, a switch's stem. Check that they print and fit, version them by what fits what, draw their circuit boards from the same rules, and share them as links.
npm create rulecad@latest my-project
cd my-project && npx cad check home/soap-tray
Each library below has a page: what it is for, how to use it, and a demonstration. The ones marked live run their own code in this page.
Guides
Walked from start to finish, in commands.
Frames: from a spec sheet to a checked box
guideMachines: from a task to a drawing
guideChoosing a pilot, an insert or a nut
Design
Describe a part by its rules and check it.
cad
The command line at the centre: every measurement a variable with its rule, checks for printing and fit, previews, print files and links.
create-rulecadcreate-rulecad
Start a project: a workspace with a printer's rules, a starter design and the notes an AI agent needs.
@rulecad/variables · livevariables
Variables that say where each number comes from: expressions over rule sets, resolved, and a lint that keeps numbers out of code.
@rulecad/rules · liverules
Published facts: printers, screws, switches, fabs and parts, each value with its source and the date it was checked.
@rulecad/shapes · liveshapes
Shape helpers for printed parts: text that prints, anchors on a face, clean cuts, and an enclosure kit.
@rulecad/fixings · livefixings
Screws, nuts and inserts by name: holes sized by what they are for, seats that print, threads cut for printing, and the sums on a joint. cad, motors and pcb take every screw size from it.
@rulecad/frames · liveframes
Structures from beams: profiles of any maker as rule sets, beams and the joins between them, slot nuts, printed and bought fittings, guides for motion, printed beams, frames generated from a size, the cut list, sheets and jigs, and building square.
@rulecad/flexures · liveflexures
Parts that move by bending: leaf springs, guides, serpentine springs and notch hinges, each with its stiffness, its strain, and how it prints.
@rulecad/topopt · livetopopt
Topology optimisation for flat and solid parts: the stiffest layout of the material you give, or the lightest under a stress limit, printable without supports if asked.
@rulecad/versions · liveversions
Semver for physical parts: a major release means an earlier print may no longer fit.
Check
Will it print? Does it fit?
printcheck
Is this mesh printable? Bed size, overhangs, bridges, floating undersides and closed solids, in plain words.
@rulecad/fit · livefit
Do these parts fit? The smallest gap between two meshes, and whether a point is inside one.
Boards
Circuit boards from the same rules.
Share
A model in a link, and the page that opens it.
model-link
A model in a link: compressed into the URL fragment, never uploaded; STL and Bambu-ready 3MF made in the browser.
@rulecad/viewerviewer
The model page: opens model links, checks dropped STL files, writes print files. Plain static files you can host anywhere.
Keyboards
One layout file for plate, keycaps, case and board.
Machines
Arms and axes as plain data: where they reach and how they draw.
How they fit together
cad is the command line. It reads designs whose variables come from variables and rule sets such as rules, builds shapes with JSCAD and shapes, sizes holes and seats for screws with fixings, builds frames from aluminium beams with frames, checks them with printcheck and fit, releases them with versions, lays out keyboards with keyboard-layout, draws boards with pcb, and shares them with model-link, which the viewer opens. create-rulecad starts a project with all of it in place.