Skip to content
Sign in

Documentation

How to write printable parts as code, make them adjustable, and get them onto a printer. Start with the first guide; keep the reference open while you write.

  • Every statement, primitive, transform, operation, function and operator of the language.
  • What runs where, the time budget, what the browser cannot promise, and what PPSCAD is not.

PPSCAD, the language of these docs, is open source. Its specification defines every statement, and the repository on GitHub holds the grammar, more documentation, examples, a conformance test suite and the interpreter this site runs. Read the announcement.

PPSCAD
// A box with a cylindrical hole through it
param width: float = 30 [10:100] "Width (mm)"
param height: float = 20 [5:50] "Height (mm)"
param depth: float = 10 [2:30] "Depth (mm)"
param hole_radius: float = 4 [1:15] "Hole radius (mm)"

difference {
  cube(width, height, depth)
  translate(width / 2, height / 2, -1)
    cylinder(h: depth + 2, r: hole_radius)
}

The four param lines become sliders beside the viewer; the model follows a slider as it moves. Every length is in millimetres, and the STL you download is too.

A parameter is declared in the code, so the controls come from the code and a shared link can carry the values:

PPSCAD
param name: type = default [min:max:step] "Label" "Description"
PPSCAD
// A whole number with a slider
param teeth: int = 20 [6:200] "Number of teeth"

// A decimal with its own step
param module: float = 2.0 [0.5:10:0.01] "Module (mm)"

// A switch
param chamfer: bool = true "Add a chamfer"

// A choice from a list
param style: choice = round ["round", "square", "hex"] "Head style"

Save a design and it gets a short address. Anyone with the link opens the model, moves the sliders and downloads an STL, without an account. The values travel in the query of the link, as in ?width=50&height=30.