Windows
Download the 64-bit EXE installer, or install from Windows Terminal.
winget install --id=OpenSCAD.OpenSCAD -e
Mathematics Department quick guide
Install OpenSCAD, add optional geometry libraries, and turn a recursive definition into a connected tetrahedral model ready for slicing.
Install the modeller
Use the official download page. Development snapshots are useful later, but the stable build is the simpler classroom default.
Download the 64-bit EXE installer, or install from Windows Terminal.
winget install --id=OpenSCAD.OpenSCAD -e
Choose the macOS installer listed for your Mac on the official downloads page. Open the DMG, then drag OpenSCAD into Applications.
If macOS blocks the first launch, control-click the app and choose Open.
On Debian or Ubuntu, install the repository package. Other distributions can use the official AppImage.
sudo apt-get install openscad
Optional libraries
The Sierpiński example below uses only native OpenSCAD. Libraries become useful when you add rounded parts, paths, labels, fixtures, or more complicated polyhedra.
In OpenSCAD, choose File → Show Library Folder.
Place its top-level folder inside libraries; for example, libraries/BOSL2/std.scad.
Open Help → Library Info and confirm the folder appears in the search path.
Broad geometry toolkit with transforms, attachable shapes, paths, sweeps, polyhedral data structures, and math helpers.
include <BOSL2/std.scad>
Download BOSL2
Smaller collection with regular shapes, curves, constants, transformations, gears, and common mechanical components.
use <MCAD/regular_shapes.scad>
Download MCAD
Default user library folders: Documents\OpenSCAD\libraries on Windows, ~/Documents/OpenSCAD/libraries on macOS, and ~/.local/share/OpenSCAD/libraries on Linux.
Build the fractal
At depth d, the model contains 4d tetrahedra. Its similarity dimension is log(4) / log(2) = 2.
// Printable Sierpinski tetrahedron
edge = 64; // outer edge length, mm
depth = 3; // 4^3 = 64 small tetrahedra
weld = 1.03; // slight overlap for a connected print
corners = [
[ 1, 1, 1], [ 1, -1, -1],
[-1, 1, -1], [-1, -1, 1]
];
module tetrahedron(side) {
scale(side / (2 * sqrt(2)))
polyhedron(
points = corners,
faces = [[0,2,1], [0,1,3],
[0,3,2], [1,2,3]]
);
}
module sierpinski(side, level) {
if (level == 0) {
scale([weld, weld, weld]) tetrahedron(side);
} else {
for (p = corners)
translate(p * (side / (4 * sqrt(2))))
sierpinski(side / 2, level - 1);
}
}
color("#f26b38") sierpinski(edge, depth);
Render and export
Open the SCAD file and press F5. Rotate the view and confirm all four branches appear at each level.
Press F6. Read the console. If the model is disconnected or non-manifold, increase weld slightly.
Choose File → Export → Export as STL, then inspect the sliced preview before printing.
edge, depth, weld, layer height, and material with the print.