-
Notifications
You must be signed in to change notification settings - Fork 1
/
tile.scad
101 lines (90 loc) · 2.81 KB
/
tile.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//variables
// dimensions
size=60;
thickness=3;
inlay_depth=0.4;
font="Liberation Sans:style=Bold";
//symbols
ace="svg/moon_large.svg";
corner="svg/moon_small.svg";
corner_size=size/4;
/*
ace="svg/sun_large.svg";
corner="svg/sun_small.svg";
corner_size=size/4;
*/
/*
ace="svg/crown_large.svg";
corner="svg/crown_small.svg";
corner_size=size/4;
*/
/*
ace="svg/arms_large.svg";
corner="svg/arms_small.svg";
corner_size=size/4;
*/
module inlay(rank="", rank_file, corner_file=corner, size=size, depth=inlay_depth, font=font, corner_size=corner_size) {
translate([0, 0, -(thickness/2)+(depth/2)]) mirror([1,0,0]) {
union() {
//Center
if(rank_file==undef) {
//0.001 added to remove the surface. makes it hard to align stuff on the build plate.
linear_extrude(height=depth+0.001, center=true) text(rank, size=size/2, font=font, halign="center", valign="center");
}
else {
linear_extrude(height=depth+0.001, center=true) resize([size/2, size/2, 0]) import(rank_file, center=true);
}
//corner
translate([-size/3, size/3, 0]) resize([corner_size, corner_size, 0]) linear_extrude(height=depth+0.001, center=true) import(corner_file, center=true);
}
}
}
module tile_body(size=size, thickness=thickness) {
cube([size,size,thickness], center=true);
}
module top_cross(size=size, tile_thickness=thickness, cross_thickness=inlay_depth) {
translate([0,0,tile_thickness/2+cross_thickness/2]) {
union() {
cube([size/2, 2, cross_thickness], center=true);
cube([2, size/2, cross_thickness], center=true);
}
}
}
module top_corners(size=size, tile_thickness=thickness, top_thickness=inlay_depth) {
translate([0,0,tile_thickness/2+top_thickness/2]) difference() {
//TODO
cube([size, size, top_thickness], center=true);
cube([size-4, size-4, top_thickness], center=true);
cube([size/2, size, top_thickness], center=true);
cube([size, size/2, top_thickness], center=true);
}
}
module tile(rank="", rank_file, thickness=thickness, size=size) {
union() {
difference() {
tile_body();
if (rank_file==undef) {
inlay(rank=rank, corner_size=corner_size);
}
else {
inlay(rank_file=rank_file, corner_size=corner_size);
}
}
top_cross();
top_corners();
}
}
translate([-(size+5), 0, 0]) tile();
tile(rank_file=ace);
translate([0, size+5, 0])tile(rank="2");
translate([size+5, 0, 0])tile(rank="3");
translate([size+5, size+5, 0])tile(rank="4");
translate([-(size+5), (size+5), 0 ])tile(rank="5");
/*
translate([-(size+5), 0, 0]) inlay();
inlay(rank_file=ace);
translate([0, size+5, 0])inlay(rank="2");
translate([size+5, 0, 0])inlay(rank="3");
translate([size+5, size+5, 0])inlay(rank="4");
translate([-(size+5), (size+5), 0 ])inlay(rank="5");
*/