5 spot_gap = spot_dia / 3.0;
9 multicolour_gap = 0.15; // each side
10 initial_layer_thick = 0.400;
11 initial_layer_width = 0.750;
12 final_layer_thick = 0.250;
16 $spots_absent = false;
17 $spots_plusgap = false;
22 module Spots_Extrude_Lower(){
23 d = $spots_plusgap ? 1 : 0;
25 linear_extrude(height= initial_layer_thick + d)
29 module Spots_Extrude_Upper(){
30 d = $spots_plusgap ? 1 : 0;
31 translate([0,0, thick + d])
33 linear_extrude(height= final_layer_thick + d)
37 module SpotAt(condition, xy) {
38 if (condition == !$spots_absent) {
39 translate(xy * (spot_gap + spot_dia) * sqrt(0.5))
40 circle(r= spot_dia/2 +
41 ($spots_plusgap ? multicolour_gap : 0));
46 SpotAt(($nspots % 2) > 0, [0,0]);
47 SpotAt($nspots >= 2, [ 1, 1]);
48 SpotAt($nspots >= 2, [-1,-1]);
49 SpotAt($nspots >= 4, [ 1,-1]);
50 SpotAt($nspots >= 4, [-1, 1]);
53 module Token_Spots_All(){
70 $spots_plusgap = true;
72 linear_extrude(height=thick)
73 circle(r=token_dia/2);
74 Spots_Extrude_Lower() Token_Spots_All();
75 Spots_Extrude_Upper() Token_Spots_All();
90 module Demo(){ ////toplevel
91 color("red") { Token_L3(); }
92 color("white") { Token_L1(); Token_L5(); }
93 color("black") { Token_L2(); Token_L4(); }
97 zs = [ initial_layer_thick,
103 base_sz = token_dia * [ 6, 1.5 ];
104 sz = base_sz + phase * initial_layer_width * 2 * [1,1];
105 linear_extrude(height= initial_layer_thick) {
107 square(center=true, sz + initial_layer_width * 2 * [1,1]);
108 square(center=true, sz);
112 translate([-base_sz[0]/2, (3-phase)*(multicolour_post + multicolour_gap)])
113 linear_extrude(height= zs[phase-1])
114 square(multicolour_post);
118 for ($nspots = [1,2,3,4]) {
119 translate(($nspots - 2) * (token_dia + 3) * [1,0])
124 module Test_L1(){ ////toplevel
125 Frame(1); Tests() Token_L1();
127 module Test_L2(){ ////toplevel
128 Frame(2); Tests() Token_L2();
130 module Test_L3(){ ////toplevel
131 Frame(3); Tests() Token_L3();
133 module Test_L4(){ ////toplevel
134 Frame(4); Tests() Token_L4();
136 module Test_L5(){ ////toplevel
137 Frame(5); Tests() Token_L5();