Categories
3D modeling 3d printing FLOSS open source

Truchet tiles in OpenSCAD

I’ve created an OpenSCAD script that generates Truchet tiles. Truchet tiles are square tiles decorated with patterns that are not rotationally symmetric. When placed in a square tiling of the plane, they can form varied patterns. The original Truchet tiles stem from a paper published in 1704 written by a french monk Sebastian Truchet. The Truchet tiles were popularized by Cyril Smith in a scientific publication in 1987.

The basic Truchet tile that I use here are two quarter-circles connecting the midpoints of adjacent sides. This tile can be rotated 90 degrees to result in a different tile.

Find below a bit of explanation about the OpenSCAD script but if you want a link to the OpenSCAD files and 3d printable files go straight to the bottom.

Single tile used in this script.

The script randomly generates a square of the tiles and produces interesting patterns. The center of the script is the tile module that (together with the tori module) creates a square cube and two tori. The tori are positioned in such a way that, when subtracted from the square, result in the tiles above.

module torus(r1,r2) {
    rotate_extrude(convexity=10,$fn=100)
    translate([r1,0,0])
    circle(r2,$fn=30);
}

module tile(size) {
//create a single tile
    difference() {
        h = 5; //height of a tile
        cube([size,size,h],center=true);
        translate([size/2,size/2,h/2]) torus(r1,r2);
        translate([-size/2,-size/2,h/2]) torus(r1,r2);
    }
}

The function rnd(n) ensures that the tiles are randomly rotated either 0 or 90 degree. The parameters size and mx are the size of the tile and the size of the square respectively.

function rnd(n) = (n>0.5) ? 90 : 0;

The rest of the script just loops in two dimensions to create a two-dimensional array of tiles. The size of the array is determined by the variable mx. See below an example of mx=60.

The resulting randomly created Truchet tiles in a 60 by 60 square.

The end result can be used in something simple as a coaster or to decorate a vase. I expanded the original truchet script a little bit to create these 3d printer coasters.

Six 3d printed coasters with Sunlu filament Silk Rainbow.

I uploaded the end result to Printables and besides the .stl and .3mf files for the 3d printer I made the source code available both for the truchet tiles and the complete coaster: https://www.printables.com/model/1102980-truchet-tiled-surface-and-coaster.

Thanks for reading!

Leave a Reply