aboutsummaryrefslogtreecommitdiff
path: root/lib/dice.scad
blob: c3cab85c7bba547e5c006094087e72cc6b6be8d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module d6(side=false, size=false) {
    l = side ? side : size;
    if (l == false) {
        echo("ERROR: d6: one of side or size should be defined");
    }
    echo(l);
    difference() {
        intersection() {
            cube(l, center=true);
            sphere(l*0.79);
        }
        translate([0, 0, l/2]) child(0);
        rotate([90, 0, 0]) translate([0, 0, l/2]) child(1);
        rotate([0, 90, 0]) translate([0, 0, l/2]) child(2);
        rotate([-90, 0, 0]) translate([0, 0, l/2]) child(3);
        rotate([0, -90, 0]) translate([0, 0, l/2]) child(4);
        rotate([180, 0, 0]) translate([0, 0, l/2]) child(5);
    }
}