TypeScript CAD library · v0.2.0

Mechanisms you can print and trust.

Latches, hinge mounts and port slots for 3D-printed enclosures. Pick sizes and download a part here, or call the same functions from TypeScript. Every part says whether it has actually been printed and fitted.

git clone https://github.com/kmartinezmedia/partkit && cd partkit && npm install

How it works

A printed mechanism is not finished when the model looks right. Each component comes with the steps that get it to a working part.

Call a function

Each mechanism is one function or small class with sizes you can change.

Get parts and cut-outs

It returns the pieces to print and the shapes to add to or cut from your own case.

Run the checks

Overlap, the full motion, whether it can be assembled, and whether a screwdriver can reach.

Print the coupon

A small test piece cut from your real model, before a ten-hour print depends on it.

Components

4 of 8 are proven on a printer with real hardware. The rest say exactly how far they have got.

Proven

Printed and fitted with the real hardware.

Printed

Printed, but the mechanism has not been exercised yet.

Designed

Passes the model's fit checks only. Not printed.

Method

A practice or a tool, not a printed part.

Five lines to a working latch

Components are written in their own local frame and return plain solids, so they drop into any model. It runs on the same geometry kernel as desktop CAD, in Node and in the browser. The defaults are the sizes that were printed; change them and the library tells you to test again.

typescript
import { ready, SlideLatch } from "partkit";
await ready();

const L = new SlideLatch();              // the sizes that were printed
lid  = lid.fuse(L.lidAdd()).cut(L.lidCut());
deck = deck.cut(L.deckSlot());

const [slider, pad] = L.parts();         // the two pieces you print
console.log(L.selfCheck().toString());   // ends with ALL CLEAR

Coming next

Mechanisms that exist in a real build and move into the library once they are proven.

Lid barrel, hinge bay and base trough round a torque hingeProven on a hinge test, still tied to one laptop's shape
Hinge cover with a tongue and nut pocketsDesigned; first version printed and revised
Speaker pad with inserts and a slot grille (2 in, 4 ohm)Printing
Microphone pocket and pinhole (6 mm electret)Designed
LED holder and lock ring (5 mm LED)Designed
Thumb-wheel volume control on a rotary encoderDesigned
Rocker switch cut-out (13 x 19.4 mm)Designed
TPU feet in 20 mm recessesDesigned
Zip-tie arches and a cable trunkDesigned
Gasket-mount keyboard plate clampsDesigned
Magnet pockets for a drop-in bezel (6 x 2 mm)Printing