primlib primitives
Spreadsheet-driven parametric primitives for FreeCAD.
All the code in this repository was generated by Claude, an AI from Anthropic, and has not been checked by a person. It may have bugs or not do what it says. Read it before you rely on it, and use it at your own risk.
Simple Mathematical Models
| primitive | key | description | document signed off | drawing signed off |
|---|---|---|---|---|
| Box | box | A rectangular block: `length` along x, `width` along y, `height` along z. | changed since v0.1 RB 2026-11-25 | changed since v0.1 RB 2026-11-25 |
| Cylinder | cylinder | A round rod `diameter` across and `height` tall, or the part of one from `start_angle` round to `stop_angle` (a sector). | changed since v0.1 RB 2026-11-25 | changed since v0.1 RB 2026-11-25 |
| Cone | cone | A cone `diameter_bottom` across at its base and `diameter_top` across at its top, `height` tall: a frustum (its tip cut off), or with either diameter 0 (not both), a cone to a point. The top may be wider than the bottom. Or the part of one from `start_angle` round to `stop_angle` (a sector). | changed since v0.1 RB 2026-11-25 | changed since v0.1 RB 2026-11-25 |
| Sphere | sphere | A ball `diameter` across. | changed since v0.1 RB 2026-11-25 | changed since v0.1 RB 2026-11-25 |
| Obround | obround | A bar with half-round ends: `length` along x end to end, `width` along y, `height` along z. Each end is a half circle `width` across. | changed since v0.1 RB 2026-11-25 | changed since v0.1 RB 2026-11-25 |
Other primitives
| primitive | key | description | document signed off | drawing signed off |
|---|---|---|---|---|
| Box corner | box_corner | The corner where three panels of a box meet: three walls, each the `box_edge` section carried on, with a `skin` over each panel's outside, a web `panel_gap` wide where two panels' edges meet, and a `bevel` across each of the three outside edges, with a flat triangular facet where the bevels meet. `size` here is the corner's own outside width, usually more than the edges'. The panels drop into the three rebates and are screwed through the skin. | v0.1 RB 2026-11-26 | v0.1 RB 2026-11-26 |
| Box edge | box_edge | One length of the edge along which two panels of a box meet. The section is an L: a `skin` over each panel's outside, a web `panel_gap` wide between the panels' edges, and a `bevel` across the outside corner. The panels drop into the two rebates and are screwed through the skin. | v0.1 RB (all except the derived parameters' equations) 2026-11-26 v0.1 claude (the derived parameters' equations) 2026-11-26 | v0.1 RB 2026-11-26 |
| Hinge | hinge | The library's hinge: VerticalHinge3 (and 3b, the same hinge 13 long with 2 rings and 7.5 side plates), the hinge printed and confirmed for the hybrid case. Print in place, standing on end: two sides of interleaved rings on a pin, each side with a leaf to screw to a panel. | v0.1 RB 2026-11-26 | v0.1 RB 2026-11-26 |
| Screw hole | hole | These are parts typically used to cut screw holes from CSG objects: a hole `thickness` deep, plain, countersunk or counterbored, as `hole_type` says (0 none, 1 plain, 2 countersunk, 3 counterbored). Type 0 is the plain shape. | changed since v0.1.1 RB 2026-11-25 | changed since v0.1.1 RB 2026-11-25 |
| Panel | panel | A flat sheet cut to size: `length` along x, `width` along y, `thickness` along z. Sheet stock such as plywood, cut rather than printed. | changed since v0.1 RB 2026-11-25 | changed since v0.1 RB 2026-11-25 |
| Retained pin | pin | A retained pin: a straight shaft capped at each end by a conical flare. A sleeve snapped over the shaft is trapped between the flares. | v0.1 RB 2026-11-26 | v0.1 RB 2026-11-26 |
| Plate | plate | A flat plate with a grid of screw holes, to screw down as a mount or a base: `length` by `width`, `thickness` thick, with `screws_x` by `screws_y` holes. | v0.1 RB 2026-11-28 | v0.1 RB 2026-11-28 |
| 15 mm rail | rail15 | Four fixed parameters define its shape, and aren't for changing: `width` 15, `angle` 60, `tip_radius` 1 and `root_radius` 0.2. Its variable parameters are `length`, `depth`, `base_depth`, `base_width` and `printer_width_offset`. The rail has no tolerance. The full dimensioned specification, with the working, is `rail15_spec.html`. | not signed off | not signed off |
| 15 mm rail housing | rail15_housing | The receiver for a `rail15`: a block `block_width` (y) by `block_depth` (z) by `length` (x) with the slot cut along it, through both ends. It shares the rail's four fixed parameters, and its `depth` must match the rail's. The full dimensioned specification, with the working, is `rail15_spec.html`. | not signed off | not signed off |
| Rail catch | rail_catch | A catch for a fitting that must come off, such as a shoulder strap or a handle: `rail_count` dovetail rails `rail_width` wide and `length` long on one plate screwed to a panel, a housing with a slot for each that slides on until its end wall meets the rails' ends, and two leaf springs that hold it there. The fitting is fixed to the housing's back (`strap_anchor` is this catch with a plate for a strap's webbing there). Not yet printed. | not signed off | not signed off |
| Dovetail rail | rail_dovetail | A sliding dovetail rail: the `rail15` profile with its `width` free, `length` long and `depth` deep (15 by 20 by 4 at the defaults). Use `rail15` where the 15.00 rail is meant, and this one where a design needs another width, such as `rail_catch`'s narrower rails side by side. At `width` 15 it is `rail15`, solid for solid. Not yet printed on its own. | not signed off | not signed off |
| Dovetail rail housing | rail_dovetail_housing | The receiver for a `rail_dovetail`: a block `block_width` across, `block_depth` deep and `length` long with the slot the rail slides in, the rail grown by `clearance` (25 by 6 by 20 at the defaults). It is `rail15_housing` with the rail's `width` free, and at `width` 15 it is `rail15_housing`, solid for solid. Its `width` and `depth` must match the rail's. Not yet printed on its own. | not signed off | not signed off |
| Rail end | rail_end | The end of the hybrid case's Topeak rail: the bottom Y edge over the rail's width (a box_edge, notched by `notch` underneath to clear the rack, no screws through its lower wall) fused to a topeak_rail tongue that runs from the case's outside face in under the bottom panel, so the rail's end is one piece with the edge above it. | not signed off | — |
| Rail mount plate | rail_mount_plate | The mate to a `topeak_rail`, made to fix to a bike rack: a `topeak_rail_housing` block `block_width` wide on a plate `plate_width` wide and `length` long (140 by 150 at the defaults), screwed or tied to the rack. A box with the rail slides on along x. Not yet printed. | not signed off | not signed off |
| Rotary latch | rotary_latch | A rotary latch for a box lid: a hex knob on the body reaches over the lid joint and turns over an arc of 15 mm rail on the lid. Two plates `plate_w` wide screw to the case, one either side of the joint; the knob is `knob_af` across the flats and stands `knob_len` off the case. Five parts, each its own object in the result compound (`{name}_base`, `_knob`, `_cap`, `_lid`, `_bridge`). | not signed off | not signed off |
| Sleeve | sleeve | A hollow barrel that rides a retained pin with a uniform running clearance: the bore is the pin's clearance envelope, every pin face offset by `tolerance` along its own normal, so the gap measured normal to the faces is `tolerance` everywhere -- flanks and shaft alike. | changed since v0.1 RB 2026-11-26 | v0.1 RB 2026-11-26 |
| Sleeve clearance | sleeve_clearance | The clearance envelope of a sleeve, used as a cutting tool to make the pocket a sleeve turns in. Takes every sleeve parameter, so it stays in step with the sleeve it clears. | changed since v0.1 RB 2026-11-26 | v0.1 RB 2026-11-26 |
| Stencil | stencil | Two templates for putting text on a board: up to six lines, each with its own font, size, place and justification, cut through a plate that lies on the board's face, registered by fences that hook over the board's edges, each switched on or off. Trace the letters with a pencil, paint through them, or rout them with a bearing-guided bit. | not signed off | not signed off |
| Strap anchor | strap_anchor | A strap anchor: a shoulder strap's end, held on a case by a `rail_catch` so that it comes off. The catch's rails screw to the panel; its housing carries a plate on its back that the strap's webbing (`web_w` wide) loops round and pinches itself under, so it needs no sewing or buckle. The catch's size (`block_w` by `length`), deeper by the strap plate. Five parts, each its own object in the result compound (`{name}_rail`, `_housing`, `_leaf`, `_leaf_locked`, `_web_support`). Not yet printed. | not signed off | not signed off |
| Support | support | A print support under your own control: a wall `length` (x) by `width` (y) by `thickness` (z), its corner at the origin, pierced by a row of diamond holes. Put it between the bed (or a lower part) at z = 0 and the part it holds up at z = `thickness`; after printing, cut through the necks to separate them. | not signed off | — |
| Half-cylinder support | support_half | A print support under your own control for a round part: a half cylinder of `radius` on the +y side of the x axis, centred on the origin, from the face below at z = 0 to the face it holds up at z = `height`. | not signed off | — |
| Rectangle support | support_rect | A print support under your own control, filling a rectangle `length` (x) by `width` (y), its corner at the origin, from the face below at z = 0 to the face it holds up at z = `height`. | not signed off | — |
| Topeak rail | topeak_rail | The tongue that slides in a Topeak rack. Eight fixed parameters define its shape, and aren't for changing. Its variable parameters are `length`, `base_depth`, `base_width`, `end_taper` and `printer_width_offset`. The rail has no tolerance. The full dimensioned specification, with the working, is `topeak_rail_spec.html`. | not signed off | not signed off |
| Topeak rail housing | topeak_rail_housing | The receiver for a `topeak_rail`: a block `block_width` (y) by `block_depth` (z) by `length` (x) with the slot cut along it, through both ends, and the centre guide left standing in it. It shares the rail's eight fixed parameters. The full dimensioned specification, with the working, is `topeak_rail_spec.html`. A real Topeak rack is not made to this part's numbers: this is the printed mate, for testing and for parts of our own. | not signed off | not signed off |
In development
Not yet printed or proven: not ready for sign-off.
| primitive | key | description | document signed off | drawing signed off |
|---|---|---|---|---|
| Latch | latch | An over-centre bail latch, closed, made to print and kept plain: the library's `hinge` for its hinges, and boxes and cylinders for everything else. It holds a box's lid shut: `latch_width` from the lever tip to the far side of the bail bar, `height` along the hinge axes, standing `max_depth` proud of the box wall. Not yet printed on the library's hinge: print and test its hinges before relying on it. | in development: not ready for sign-off | in development: not ready for sign-off |
| Twist plug | twist_plug | **In development: not yet printed or proven.** Its geometry and defaults may change (docs/PLAN.md, 3.3). | in development: not ready for sign-off | — |
| Twist socket | twist_socket | **In development: not yet printed or proven.** Its geometry and defaults may change (docs/PLAN.md, 3.3). | in development: not ready for sign-off | — |
Paths
Outlines that more than one primitive draws, declared once.
| path | key | description |
|---|---|---|
| Dovetail | dovetail | The dovetail section of the rails and their housings: a tongue `depth` deep whose flanks lean out at `angle` to its tip face, so it is wider at the tip than at the root and can't pull out of its slot. It is `width` across where calipers read it (between vertical tangents to the tip radii), and everything else is worked from that. The tip corners are rounded `tip_radius`, the root corners `root_radius`. |