Documentation
PPSCAD and OpenSCAD
What is the same, what differs, and how to move a model over.
What is the same
PPSCAD takes most of its shape from OpenSCAD. If you know one, you can read the other.
- Solids are built by union, difference and intersection.
- The same primitives: cube, cylinder, sphere, and the 2D circle, square and polygon.
- The same transforms: translate, rotate, scale, mirror.
- Extrude and revolve take a 2D shape into 3D; hull wraps a set of shapes.
- For loops and if and else.
What differs
| OpenSCAD | PPSCAD | |
|---|---|---|
| Parameters | Customizer annotations in comments | A param line with a type, a range and a label |
| Modules | module name() { … } | mod name() { … } |
| Functions | function name() = … | fn name() = … |
| Variables | name = value; | let name = value |
| Semicolons | Required | Not needed |
| Vectors | cube([x, y, z]) | cube(x, y, z) or cube(size: [x, y, z]) |
| Resolution | $fn, $fa, $fs | segments: on a primitive ($fn: works too) |
| Running | A desktop program, F5 and F6 | The browser, as you type |
| Sharing | An exported STL | A link with the sliders in it |
| Kernel | CGAL, native | Manifold, WebAssembly in the browser |
The same box in both
// OpenSCAD
$fn = 60;
width = 40; // [10:100]
height = 20; // [5:50]
wall = 2; // [1:5]
difference() {
cube([width, height, 20]);
translate([wall, wall, wall])
cube([width-wall*2, height-wall*2, 21]);
}// PPSCAD
param width: float = 40 [10:100] "Width (mm)"
param height: float = 20 [5:50] "Height (mm)"
param wall: float = 2 [1:5:0.5] "Wall (mm)"
difference {
cube(width, height, 20)
translate(wall, wall, wall)
cube(width - wall * 2, height - wall * 2, 21)
}Moving a model over
modulebecomesmod,functionbecomesfn, an assignment becomes alet.- Drop the semicolons and the parentheses after union, difference and intersection.
- A customizer comment becomes a
paramline with its range and a label. cube([x, y, z])becomescube(x, y, z); a vector argument is still accepted assize:.$fnbecomessegments:on the primitive that needs it.- Trigonometry is in degrees in both, so angles need no change.
- A polygon's points run counter-clockwise and the points of a hole clockwise; a list is walked with
forand has no index.
PPSCAD is open source. The specification says exactly what a program means, and its documentation has a longer page for people who come from OpenSCAD.